Cleaner version to check if char after a highlight is an alphanum or not
This commit is contained in:
parent
39d18c893d
commit
d10e203255
1 changed files with 6 additions and 11 deletions
|
@ -814,19 +814,14 @@ class GroupchatControl(ChatControlBase):
|
||||||
char_position = len(special_word)
|
char_position = len(special_word)
|
||||||
refer_to_nick_char = \
|
refer_to_nick_char = \
|
||||||
word[char_position:char_position+1]
|
word[char_position:char_position+1]
|
||||||
|
refer_to_nick_char = str(refer_to_nick_char)
|
||||||
if (refer_to_nick_char != ''):
|
if (refer_to_nick_char != ''):
|
||||||
refer_to_nick_char_code = ord(refer_to_nick_char)
|
if refer_to_nick_char.isalpha():
|
||||||
if ((refer_to_nick_char_code < 65 or \
|
# This is A->Z, a->z or 0-9, we can be sure our nick is the
|
||||||
refer_to_nick_char_code > 122) or \
|
# beginning of a real word, do not highlight.
|
||||||
(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
|
return False
|
||||||
|
else:
|
||||||
|
return True
|
||||||
else: # Special word == word, no char after in word
|
else: # Special word == word, no char after in word
|
||||||
return True
|
return True
|
||||||
for special_word in special_words:
|
for special_word in special_words:
|
||||||
|
|
Loading…
Add table
Reference in a new issue