Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs24-19fa
git_rec_nano
Commits
20058a1b
Commit
20058a1b
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
spelling: don't consider digits as word parts, because GNU spell doesn't
This fixes
https://savannah.gnu.org/bugs/?48660
.
parent
f6dd0ad1
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/chars.c
+20
-0
src/chars.c
src/proto.h
+1
-0
src/proto.h
src/utils.c
+5
-6
src/utils.c
with
26 additions
and
6 deletions
+26
-6
src/chars.c
View file @
20058a1b
...
...
@@ -93,6 +93,26 @@ void wctomb_reset(void)
IGNORE_CALL_RESULT
(
wctomb
(
NULL
,
0
));
}
/* This function is equivalent to isalpha() for multibyte characters. */
bool
is_alpha_mbchar
(
const
char
*
c
)
{
assert
(
c
!=
NULL
);
#ifdef ENABLE_UTF8
if
(
use_utf8
)
{
wchar_t
wc
;
if
(
mbtowc
(
&
wc
,
c
,
MB_CUR_MAX
)
<
0
)
{
mbtowc_reset
();
return
0
;
}
return
iswalpha
(
wc
);
}
else
#endif
return
isalpha
((
unsigned
char
)
*
c
);
}
/* This function is equivalent to isalnum() for multibyte characters. */
bool
is_alnum_mbchar
(
const
char
*
c
)
{
...
...
This diff is collapsed.
Click to expand it.
src/proto.h
View file @
20058a1b
...
...
@@ -183,6 +183,7 @@ bool nisblank(int c);
bool
niswblank
(
wchar_t
wc
);
#endif
bool
is_byte
(
int
c
);
bool
is_alpha_mbchar
(
const
char
*
c
);
bool
is_alnum_mbchar
(
const
char
*
c
);
bool
is_blank_mbchar
(
const
char
*
c
);
bool
is_ascii_cntrl_char
(
int
c
);
...
...
This diff is collapsed.
Click to expand it.
src/utils.c
View file @
20058a1b
...
...
@@ -290,12 +290,11 @@ bool is_separate_word(size_t position, size_t length, const char *buf)
parse_mbchar
(
buf
+
move_mbleft
(
buf
,
position
),
before
,
NULL
);
parse_mbchar
(
buf
+
word_end
,
after
,
NULL
);
/* If we're at the beginning of the line or the character before the
* word isn't a non-punctuation "word" character, and if we're at
* the end of the line or the character after the word isn't a
* non-punctuation "word" character, we have a whole word. */
retval
=
(
position
==
0
||
!
is_alnum_mbchar
(
before
))
&&
(
word_end
==
strlen
(
buf
)
||
!
is_alnum_mbchar
(
after
));
/* If the word starts at the beginning of the line OR the character before
* the word isn't a letter, and if the word ends at the end of the line OR
* the character after the word isn't a letter, we have a whole word. */
retval
=
(
position
==
0
||
!
is_alpha_mbchar
(
before
))
&&
(
word_end
==
strlen
(
buf
)
||
!
is_alpha_mbchar
(
after
));
free
(
before
);
free
(
after
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help