Show new autosuggestions on typing space

This commit is contained in:
Glutanimate 2017-08-30 14:19:15 +02:00
parent a7cdff6d96
commit e237324873

View File

@ -91,12 +91,14 @@ class TagCompleter(QCompleter):
self.cursor = None self.cursor = None
def splitPath(self, tags): def splitPath(self, tags):
tags = tags.strip() stripped_tags = tags.strip()
tags = re.sub(" +", " ", tags) stripped_tags = re.sub(" +", " ", stripped_tags)
self.tags = self.edit.col.tags.split(tags) self.tags = self.edit.col.tags.split(stripped_tags)
self.tags.append("") self.tags.append("")
p = self.edit.cursorPosition() p = self.edit.cursorPosition()
self.cursor = tags.count(" ", 0, p) self.cursor = stripped_tags.count(" ", 0, p)
if tags.endswith(" "):
self.cursor += 1
return [self.tags[self.cursor]] return [self.tags[self.cursor]]
def pathFromIndex(self, idx): def pathFromIndex(self, idx):