Bug in get_word in main.c
Bohdan R. Rau
ethanak at polip.com
Wed Jun 20 04:22:23 EDT 2012
Hi all
I just found annoying bug in get_word function.
The ch variable is declared as signed char, and all calls to get_char,
where result is treated as character, are casted do signed char.
In this case comparison like 'ch > SPACE' has no sense, because for
example all accented letters in Latin scripts or all letters in Cyrillic
will be treated as non-word.
In effect, function get_word will find beginning of word only if first
word characters is 7-bit ascii.
Dirty and fast solution:
1) change declaration of ch variable from char to u_char
2) replace all (char) get_char calls into (u_char) get_char.
Works for me.
I could provide "dirty and fast" patch, but I think the 'ch > SPACE'
comparison would be changed into some more realistic function -
something like:
is_word_boundary(int ch1, int ch2)
{
return is_printable(ch1) != is_printable(ch2);
}
By the way - would you give me definition of "word" in speakup's scope?
Is it "longest string containing only printable characters"?
ethanak
--
http://milena.polip.com/ - Pa pa, Ivonko!
More information about the Speakup
mailing list