diff --git a/ChangeLog b/ChangeLog index d768e3f58..30dca121f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -37,6 +37,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] string_eval_expression and command /eval * api: add support for C++ plugins * api: fix read of arrays in hdata functions hdata_ (bug #40354) +* aspell: fix detection of nicks with non-alphanumeric chars * guile: disable guile gmp allocator (fix crash on unload of relay plugin) (bug #40628) * irc: fix memory leak when checking the value of ssl_priorities option in diff --git a/src/plugins/aspell/weechat-aspell.c b/src/plugins/aspell/weechat-aspell.c index fc7dfdd69..5b5dfbfd2 100644 --- a/src/plugins/aspell/weechat-aspell.c +++ b/src/plugins/aspell/weechat-aspell.c @@ -342,6 +342,32 @@ weechat_aspell_string_is_url (const char *word) return 0; } +/* + * Checks if a word is a nick of nicklist. + * + * Returns: + * 1: word is a nick of nicklist + * 0: word is not a nick of nicklist + */ + +int +weechat_aspell_string_is_nick (struct t_gui_buffer *buffer, const char *word) +{ + char *pos; + int rc; + + pos = strchr (word, ' '); + if (pos) + pos[0] = '\0'; + + rc = (weechat_nicklist_search_nick (buffer, NULL, word)) ? 1 : 0; + + if (pos) + pos[0] = ' '; + + return rc; +} + /* * Checks if a word is made of digits and punctuation. * @@ -395,10 +421,6 @@ weechat_aspell_check_word (struct t_gui_buffer *buffer, if (weechat_aspell_string_is_simili_number (word)) return 1; - /* word is a nick of nicklist on this buffer? then do not check word */ - if (weechat_nicklist_search_nick (buffer, NULL, word)) - return 1; - /* for "private" buffers, ignore self and remote nicks */ buffer_type = weechat_buffer_get_string (buffer, "localvar_type"); if (buffer_type && (strcmp (buffer_type, "private") == 0)) @@ -718,11 +740,12 @@ weechat_aspell_modifier_cb (void *data, const char *modifier, ptr_end = weechat_utf8_next_char (ptr_end_valid); word_end_pos = word_end_pos_valid; word_ok = 0; - if (weechat_aspell_string_is_url (ptr_string)) + if (weechat_aspell_string_is_url (ptr_string) + || weechat_aspell_string_is_nick (buffer, ptr_string)) { /* - * word is an URL, then it is OK, and search for next space - * (will be end of word) + * word is an URL or a nick, then it is OK: search for next + * space (will be end of word) */ word_ok = 1; if (ptr_end[0])