Skip to content

Commit 49f5efa

Browse files
committed
Make regex better for name patterns
1 parent c7ce8a0 commit 49f5efa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

util_classes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def __init__(self, tag_dict, *args):
262262
def text_changed(self, text):
263263
all_text = str(text)
264264
text = all_text[:self.cursorPosition()]
265-
prefix = re.split('[^%a-zA-Z)(_-]', text)[-1].strip()
265+
prefix = re.split(r'(?<=\))(.*)(?=%\()', text)[-1].strip()
266266
self.pref = prefix
267267
if prefix.strip() != prefix:
268268
self.pref = ''
@@ -271,7 +271,7 @@ def complete_text(self, text):
271271
cursor_pos = self.cursorPosition()
272272
before_text = str(self.text())[:cursor_pos]
273273
after_text = str(self.text())[cursor_pos:]
274-
prefix_len = len(re.split('[^%a-zA-Z)(_-]', before_text)[-1].strip())
274+
prefix_len = len(re.split(r'(?<=\))(.*)(?=%\()', before_text)[-1].strip())
275275
tag_text = self.tag_dict.get(text)
276276

277277
if tag_text is None:

0 commit comments

Comments
 (0)