FIX: Completion in editor doesn't work with subwords ended with '_'

Signed-off-by: Mikhail S. Pobolovets <styx.mp@gmail.com>
This commit is contained in:
Mikhail S. Pobolovets 2009-06-29 14:14:25 +03:00
parent bbbb4d6daf
commit 9e92f803cc

View File

@ -2222,6 +2222,10 @@ void edit_mail_dialog (WEdit * edit)
/* Word Completion */ /* Word Completion */
/*******************/ /*******************/
static gboolean is_break_char(char c)
{
return (isspace(c) || strchr("{}[]()<>=|/\\!?~'\",.;:#$%^&*", c));
}
/* find first character of current word */ /* find first character of current word */
static int edit_find_word_start (WEdit *edit, long *word_start, int *word_len) static int edit_find_word_start (WEdit *edit, long *word_start, int *word_len)
@ -2234,7 +2238,7 @@ static int edit_find_word_start (WEdit *edit, long *word_start, int *word_len)
c = (unsigned char) edit_get_byte (edit, edit->curs1 - 1); c = (unsigned char) edit_get_byte (edit, edit->curs1 - 1);
/* return if not at end or in word */ /* return if not at end or in word */
if (isspace (c) || c == '_') if (is_break_char(c))
return 0; return 0;
/* search start of word to be completed */ /* search start of word to be completed */
@ -2246,7 +2250,7 @@ static int edit_find_word_start (WEdit *edit, long *word_start, int *word_len)
last = c; last = c;
c = (unsigned char) edit_get_byte (edit, edit->curs1 - i); c = (unsigned char) edit_get_byte (edit, edit->curs1 - i);
if (isspace (c) || strchr("{}[]()<>=|/\\!?~'\",.;:#$%^&*", c)) { if (is_break_char(c)) {
/* return if word starts with digit */ /* return if word starts with digit */
if (isdigit (last)) if (isdigit (last))
return 0; return 0;