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,7 +661,22 @@ class GroupchatControl(ChatControlBase):
|
|||
for word in text_splitted: # get each word of the text
|
||||
for special_word in special_words:
|
||||
if word.startswith(special_word):
|
||||
return True
|
||||
# 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 False
|
||||
|
||||
def set_subject(self, subject):
|
||||
|
|
Loading…
Reference in New Issue