src/eric7/QScintilla/Editor.py

branch
eric7
changeset 10344
2f2e3294186d
parent 10343
d7d52b0b4448
child 10345
175e6f023126
--- a/src/eric7/QScintilla/Editor.py	Mon Nov 27 09:57:04 2023 +0100
+++ b/src/eric7/QScintilla/Editor.py	Mon Nov 27 10:24:47 2023 +0100
@@ -3874,10 +3874,10 @@
         """
         wc = self.wordCharacters()
         if wc is None or not useWordChars:
-            pattern = r"\b[\w_]+\b"
+            pattern = r"\b[\w_]+\b=?"
         else:
             wc = re.sub(r"\w", "", wc)
-            pattern = r"\b[\w{0}]+\b".format(re.escape(wc))
+            pattern = r"\b[\w{0}]+\b=?".format(re.escape(wc))
         rx = (
             re.compile(pattern)
             if self.caseSensitive()
@@ -5579,33 +5579,26 @@
             if len(lst) > 1:
                 txt = lst[0]
 
+            self.beginUndoAction()
             if Preferences.getEditor("AutoCompletionReplaceWord"):
-                self.beginUndoAction()
                 self.selectCurrentWord()
                 self.removeSelectedText()
                 line, col = self.getCursorPosition()
-                self.insert(txt)
-                self.endUndoAction()
             else:
                 line, col = self.getCursorPosition()
                 wLeft = self.getWordLeft(line, col)
-                if wLeft:
-                    self.beginUndoAction()
-                    if txt.startswith(wLeft):
-                        txt = txt[len(wLeft) :]
-                    else:
-                        self.selectCurrentWord()
-                        self.removeSelectedText()
-                        line, col = self.getCursorPosition()
-
-                    if txt and txt[0] in "'\"":
-                        # New in jedi 0.16: AC of dict keys
-                        txt = txt[1:]
-                    self.insert(txt)
-                    self.endUndoAction()
-                else:
-                    return
-
+                if not txt.startswith(wLeft):
+                    self.selectCurrentWord()
+                    self.removeSelectedText()
+                    line, col = self.getCursorPosition()
+                elif wLeft:
+                    txt = txt[len(wLeft) :]
+
+                if txt and txt[0] in "'\"":
+                    # New in jedi 0.16: AC of dict keys
+                    txt = txt[1:]
+            self.insert(txt)
+            self.endUndoAction()
             self.setCursorPosition(line, col + len(txt))
 
         # template completions

eric ide

mercurial