Do not highlight in gc in case we are sure our nick is beginning of a real word (nick after = A->Z or a->z)
This commit is contained in:
parent
e96724224d
commit
d440bdddab
|
@ -661,6 +661,21 @@ class GroupchatControl(ChatControlBase):
|
||||||
for word in text_splitted: # get each word of the text
|
for word in text_splitted: # get each word of the text
|
||||||
for special_word in special_words:
|
for special_word in special_words:
|
||||||
if word.startswith(special_word):
|
if word.startswith(special_word):
|
||||||
|
# get char after the word that highlight us
|
||||||
|
char_position = len(special_word)
|
||||||
|
refer_to_nick_char = \
|
||||||
|
word[char_position:char_position+1]
|
||||||
|
if (refer_to_nick_char != ''):
|
||||||
|
refer_to_nick_char_code = ord(refer_to_nick_char)
|
||||||
|
if ((refer_to_nick_char_code < 65 or refer_to_nick_char_code > 123)\
|
||||||
|
or (refer_to_nick_char_code < 97 and refer_to_nick_char_code > 90)):
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
# This is A->Z or a->z, we can be sure our nick is the beginning
|
||||||
|
# of a real word, do not highlight. Note that we can probably
|
||||||
|
# do a better detection of non-punctuation characters
|
||||||
|
return False
|
||||||
|
else: # Special word == word, no char after in word
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue