eric7/JediInterface/JediServer.py

branch
unittest
changeset 9069
938039ea15ca
parent 9056
af7c8c7b7c62
parent 9067
abad8563ee7d
child 9192
a763d57e23bc
diff -r a219ade50f7c -r 938039ea15ca eric7/JediInterface/JediServer.py
--- a/eric7/JediInterface/JediServer.py	Mon May 16 19:46:51 2022 +0200
+++ b/eric7/JediInterface/JediServer.py	Tue May 17 14:21:13 2022 +0200
@@ -506,10 +506,11 @@
                 None,
                 self.tr("Rename Variable"),
                 self.tr("Enter the new name for the variable:"),
-                QLineEdit.EchoMode.Normal
+                QLineEdit.EchoMode.Normal,
+                editor.selectedText()
             )
             
-            if ok and newName:
+            if ok and newName and self.__vm.checkAllDirty():
                 filename = editor.getFileName()
                 line, index = editor.getCursorPosition()
                 source = editor.text()
@@ -546,7 +547,7 @@
                 QLineEdit.EchoMode.Normal
             )
             
-            if ok and newName:
+            if ok and newName and editor.checkDirty():
                 filename = editor.getFileName()
                 sLine, sIndex, eLine, eIndex = editor.getSelection()
                 source = editor.text()
@@ -580,22 +581,23 @@
             if not idString:
                 return
             
-            filename = editor.getFileName()
-            line, index = editor.getCursorPosition()
-            source = editor.text()
-            
-            self.__ensureActive(idString)
-            
-            euuid = str(uuid.uuid4())
-            self.__editors[euuid] = editor
-            
-            self.sendJson("inlineVariable", {
-                "FileName": filename,
-                "Source": source,
-                "Line": line + 1,
-                "Index": index,
-                "Uuid": euuid,
-            }, idString=idString)
+            if editor.checkDirty():
+                filename = editor.getFileName()
+                line, index = editor.getCursorPosition()
+                source = editor.text()
+                
+                self.__ensureActive(idString)
+                
+                euuid = str(uuid.uuid4())
+                self.__editors[euuid] = editor
+                
+                self.sendJson("inlineVariable", {
+                    "FileName": filename,
+                    "Source": source,
+                    "Line": line + 1,
+                    "Index": index,
+                    "Uuid": euuid,
+                }, idString=idString)
     
     @pyqtSlot()
     def refactoringExtractFunction(self):
@@ -615,7 +617,7 @@
                 QLineEdit.EchoMode.Normal
             )
             
-            if ok and newName:
+            if ok and newName and editor.checkDirty():
                 filename = editor.getFileName()
                 sLine, sIndex, eLine, eIndex = editor.getSelection()
                 source = editor.text()

eric ide

mercurial