Don't block auto-replace on keyword lines, and only show completer on single keypresses
This commit is contained in:
@@ -1008,7 +1008,9 @@ class GuiDocEditor(QPlainTextEdit):
|
|||||||
return
|
return
|
||||||
|
|
||||||
text = block.text()
|
text = block.text()
|
||||||
if text.startswith("@"):
|
if text.startswith("@") and added + removed == 1:
|
||||||
|
# Only run on single keypresses, otherwise it will trigger
|
||||||
|
# at unwanted times when other changes are made to the document
|
||||||
cursor = self.textCursor()
|
cursor = self.textCursor()
|
||||||
bPos = cursor.positionInBlock()
|
bPos = cursor.positionInBlock()
|
||||||
if bPos > 0:
|
if bPos > 0:
|
||||||
@@ -1016,8 +1018,10 @@ class GuiDocEditor(QPlainTextEdit):
|
|||||||
point = self.cursorRect().bottomRight()
|
point = self.cursorRect().bottomRight()
|
||||||
self._completer.move(self.viewport().mapToGlobal(point))
|
self._completer.move(self.viewport().mapToGlobal(point))
|
||||||
self._completer.setVisible(show)
|
self._completer.setVisible(show)
|
||||||
|
else:
|
||||||
|
self._completer.setVisible(False)
|
||||||
|
|
||||||
elif self._doReplace and added == 1:
|
if self._doReplace and added == 1:
|
||||||
self._docAutoReplace(text)
|
self._docAutoReplace(text)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user