eric7/JediInterface/JediServer.py

branch
eric7
changeset 9067
abad8563ee7d
parent 8943
23f9c7b9e18e
child 9069
938039ea15ca
--- a/eric7/JediInterface/JediServer.py	Wed May 11 19:46:40 2022 +0200
+++ b/eric7/JediInterface/JediServer.py	Tue May 17 08:51:43 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