--- a/eric6/QScintilla/SearchReplaceWidget.py Wed Sep 25 18:25:43 2019 +0200 +++ b/eric6/QScintilla/SearchReplaceWidget.py Wed Sep 25 18:37:35 2019 +0200 @@ -9,8 +9,9 @@ from PyQt5.QtCore import pyqtSignal, Qt, pyqtSlot, QEvent -from PyQt5.QtWidgets import QWidget, QHBoxLayout, QToolButton, QScrollArea, \ - QSizePolicy, QFrame +from PyQt5.QtWidgets import ( + QWidget, QHBoxLayout, QToolButton, QScrollArea, QSizePolicy, QFrame +) from .Editor import Editor @@ -308,10 +309,14 @@ if selections is None: selections = self.__selections if selections: - lineNumbers = [sel[0] for sel in selections] + \ - [sel[2] for sel in selections] - indexNumbers = [sel[1] for sel in selections] + \ - [sel[3] for sel in selections] + lineNumbers = ( + [sel[0] for sel in selections] + + [sel[2] for sel in selections] + ) + indexNumbers = ( + [sel[1] for sel in selections] + + [sel[3] for sel in selections] + ) startLine, startIndex, endLine, endIndex = ( min(lineNumbers), min(indexNumbers), max(lineNumbers), max(indexNumbers)) @@ -462,9 +467,11 @@ lineFrom, indexFrom = aw.lineIndexFromPosition(tgtPos) lineTo, indexTo = aw.lineIndexFromPosition(tgtPos + tgtLen) for sel in self.__selections: - if lineFrom == sel[0] and \ - indexFrom >= sel[1] and \ - indexTo <= sel[3]: + if ( + lineFrom == sel[0] and + indexFrom >= sel[1] and + indexTo <= sel[3] + ): indicate = True break else: @@ -501,8 +508,10 @@ lineFrom, indexFrom, lineTo, indexTo = aw.getSelection() boundary = self.__selectionBoundary() if backwards: - if self.ui.selectionCheckBox.isChecked() and \ - (lineFrom, indexFrom, lineTo, indexTo) == boundary: + if ( + self.ui.selectionCheckBox.isChecked() and + (lineFrom, indexFrom, lineTo, indexTo) == boundary + ): # initial call line, index = boundary[2:] else: @@ -513,10 +522,12 @@ else: line = lineFrom index = indexFrom - if self.ui.selectionCheckBox.isChecked() and \ - line == boundary[0] and \ - index >= 0 and \ - index < boundary[1]: + if ( + self.ui.selectionCheckBox.isChecked() and + line == boundary[0] and + index >= 0 and + index < boundary[1] + ): ok = False if ok and index < 0: @@ -539,8 +550,10 @@ else: index = aw.lineLength(line) else: - if self.ui.selectionCheckBox.isChecked() and \ - (lineFrom, indexFrom, lineTo, indexTo) == boundary: + if ( + self.ui.selectionCheckBox.isChecked() and + (lineFrom, indexFrom, lineTo, indexTo) == boundary + ): # initial call line, index = boundary[:2] else: @@ -567,24 +580,30 @@ lineFrom, indexFrom, lineTo, indexTo = aw.getSelection() if len(self.__selections) > 1: for sel in self.__selections: - if lineFrom == sel[0] and \ - indexFrom >= sel[1] and \ - indexTo <= sel[3]: + if ( + lineFrom == sel[0] and + indexFrom >= sel[1] and + indexTo <= sel[3] + ): ok = True break else: ok = False - elif (lineFrom == boundary[0] and indexFrom >= boundary[1]) or \ - (lineFrom > boundary[0] and lineFrom < boundary[2]) or \ - (lineFrom == boundary[2] and indexFrom <= boundary[3]): + elif ( + (lineFrom == boundary[0] and indexFrom >= boundary[1]) or + (lineFrom > boundary[0] and lineFrom < boundary[2]) or + (lineFrom == boundary[2] and indexFrom <= boundary[3]) + ): ok = True else: ok = False if not ok and len(self.__selections) > 1: # try again - while not ok and \ + while ( + not ok and ((backwards and lineFrom >= boundary[0]) or - (not backwards and lineFrom <= boundary[2])): + (not backwards and lineFrom <= boundary[2])) + ): for ind in range(len(self.__selections)): if lineFrom == self.__selections[ind][0]: after = indexTo > self.__selections[ind][3] @@ -593,13 +612,15 @@ line, index = self.__selections[ind][2:] else: if ind > 0: - line, index = \ + line, index = ( self.__selections[ind - 1][2:] + ) else: if after: if ind < len(self.__selections) - 1: - line, index = \ + line, index = ( self.__selections[ind + 1][:2] + ) else: line, index = self.__selections[ind][:2] break @@ -616,14 +637,17 @@ posix=posixMode, cxx11=cxx11Mode) if ok: - lineFrom, indexFrom, lineTo, indexTo = \ + lineFrom, indexFrom, lineTo, indexTo = ( aw.getSelection() - if lineFrom < boundary[0] or \ - lineFrom > boundary[2] or \ - indexFrom < boundary[1] or \ - indexFrom > boundary[3] or \ - indexTo < boundary[1] or \ - indexTo > boundary[3]: + ) + if ( + lineFrom < boundary[0] or + lineFrom > boundary[2] or + indexFrom < boundary[1] or + indexFrom > boundary[3] or + indexTo < boundary[1] or + indexTo > boundary[3] + ): ok = False break if not ok: @@ -644,23 +668,28 @@ posix=posixMode, cxx11=cxx11Mode) if ok: - lineFrom, indexFrom, lineTo, indexTo = \ + lineFrom, indexFrom, lineTo, indexTo = ( aw.getSelection() + ) if len(self.__selections) > 1: for sel in self.__selections: - if lineFrom == sel[0] and \ - indexFrom >= sel[1] and \ - indexTo <= sel[3]: + if ( + lineFrom == sel[0] and + indexFrom >= sel[1] and + indexTo <= sel[3] + ): ok = True break else: ok = False - elif (lineFrom == boundary[0] and - indexFrom >= boundary[1]) or \ - (lineFrom > boundary[0] and - lineFrom < boundary[2]) or \ - (lineFrom == boundary[2] and - indexFrom <= boundary[3]): + elif ( + (lineFrom == boundary[0] and + indexFrom >= boundary[1]) or + (lineFrom > boundary[0] and + lineFrom < boundary[2]) or + (lineFrom == boundary[2] and + indexFrom <= boundary[3]) + ): ok = True else: ok = False @@ -728,8 +757,9 @@ if not self.__finding and isinstance(editor, Editor): if editor.hasSelectedText(): selections = editor.getSelections() - line1, index1, line2, index2 = \ + line1, index1, line2, index2 = ( self.__selectionBoundary(selections) + ) if line1 != line2: self.ui.selectionCheckBox.setEnabled(True) self.ui.selectionCheckBox.setChecked(True) @@ -779,8 +809,10 @@ self.__finding = True # Check enabled status due to dual purpose usage of this method - if not self.ui.replaceButton.isEnabled() and \ - not self.ui.replaceSearchButton.isEnabled(): + if ( + not self.ui.replaceButton.isEnabled() and + not self.ui.replaceSearchButton.isEnabled() + ): return ftxt = self.ui.findtextCombo.currentText() @@ -871,16 +903,20 @@ lineFrom, indexFrom, lineTo, indexTo = aw.getSelection() if len(self.__selections) > 1: for sel in self.__selections: - if lineFrom == sel[0] and \ - indexFrom >= sel[1] and \ - indexTo <= sel[3]: + if ( + lineFrom == sel[0] and + indexFrom >= sel[1] and + indexTo <= sel[3] + ): ok = True break else: ok = False - elif (lineFrom == boundary[0] and indexFrom >= boundary[1]) or \ - (lineFrom > boundary[0] and lineFrom < boundary[2]) or \ - (lineFrom == boundary[2] and indexFrom <= boundary[3]): + elif ( + (lineFrom == boundary[0] and indexFrom >= boundary[1]) or + (lineFrom > boundary[0] and lineFrom < boundary[2]) or + (lineFrom == boundary[2] and indexFrom <= boundary[3]) + ): ok = True else: ok = False @@ -892,8 +928,9 @@ after = indexTo > self.__selections[ind][3] if after: if ind < len(self.__selections) - 1: - line, index = \ + line, index = ( self.__selections[ind + 1][:2] + ) else: line, index = self.__selections[ind][:2] break @@ -908,14 +945,17 @@ posix=posixMode, cxx11=cxx11Mode) if ok: - lineFrom, indexFrom, lineTo, indexTo = \ + lineFrom, indexFrom, lineTo, indexTo = ( aw.getSelection() - if lineFrom < boundary[0] or \ - lineFrom > boundary[2] or \ - indexFrom < boundary[1] or \ - indexFrom > boundary[3] or \ - indexTo < boundary[1] or \ - indexTo > boundary[3]: + ) + if ( + lineFrom < boundary[0] or + lineFrom > boundary[2] or + indexFrom < boundary[1] or + indexFrom > boundary[3] or + indexTo < boundary[1] or + indexTo > boundary[3] + ): ok = False break @@ -1054,8 +1094,8 @@ """ super(SearchReplaceSlidingWidget, self).__init__(parent) - self.__searchReplaceWidget = \ - SearchReplaceWidget(replace, vm, self, True) + self.__searchReplaceWidget = SearchReplaceWidget( + replace, vm, self, True) self.__layout = QHBoxLayout(self) self.setLayout(self.__layout)