eric6/QScintilla/Editor.py

changeset 8235
78e6d29eb773
parent 8231
377c24760c37
child 8239
59a9a658618c
diff -r fcb6b4b96274 -r 78e6d29eb773 eric6/QScintilla/Editor.py
--- a/eric6/QScintilla/Editor.py	Tue Apr 13 18:02:59 2021 +0200
+++ b/eric6/QScintilla/Editor.py	Tue Apr 13 19:59:17 2021 +0200
@@ -3936,10 +3936,7 @@
         
         # get the selection boundaries
         lineFrom, indexFrom, lineTo, indexTo = self.getSelection()
-        if indexTo == 0:
-            endLine = lineTo - 1
-        else:
-            endLine = lineTo
+        endLine = lineTo if indexTo else lineTo - 1
         
         self.beginUndoAction()
         # iterate over the lines
@@ -3967,10 +3964,7 @@
         
         # get the selection boundaries
         lineFrom, indexFrom, lineTo, indexTo = self.getSelection()
-        if indexTo == 0:
-            endLine = lineTo - 1
-        else:
-            endLine = lineTo
+        endLine = lineTo if indexTo else lineTo - 1
         
         self.beginUndoAction()
         # iterate over the lines
@@ -4113,10 +4107,7 @@
         
         # get the selection boundaries
         lineFrom, indexFrom, lineTo, indexTo = self.getSelection()
-        if indexTo == 0:
-            endLine = lineTo - 1
-        else:
-            endLine = lineTo
+        endLine = lineTo if indexTo else lineTo - 1
         
         self.beginUndoAction()
         # iterate over the lines
@@ -4180,11 +4171,7 @@
         
         # get the selection
         lineFrom, indexFrom, lineTo, indexTo = self.getSelection()
-        
-        if indexTo == 0:
-            endLine = lineTo - 1
-        else:
-            endLine = lineTo
+        endLine = lineTo if indexTo else lineTo - 1
         
         self.beginUndoAction()
         # iterate over the lines
@@ -7043,10 +7030,7 @@
             @type str
             """
             startChar = encString[0]
-            if len(encString) == 2:
-                endChar = encString[1]
-            else:
-                endChar = startChar
+            endChar = encString[1] if len(encString) == 2 else startChar
             
             sline, sindex, eline, eindex = self.getSelection()
             replaceText = startChar + self.selectedText() + endChar
@@ -8341,10 +8325,7 @@
         wordEndPos = self.positionFromLineIndex(line, wordEnd)
         
         regExp = re.compile(r"\b{0}\b".format(word))
-        if forward:
-            startPos = wordEndPos
-        else:
-            startPos = wordStartPos
+        startPos = wordEndPos if forward else wordStartPos
         
         matches = [m for m in regExp.finditer(self.text())]
         if matches:

eric ide

mercurial