Skip to content

Commit a28e9df

Browse files
macevhiczMHendricks
authored andcommitted
Handle when getSelection returns empty selection
1 parent a688146 commit a28e9df

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

preditor/gui/workboxwidget.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,12 @@ def __save__(self):
150150

151151
def __selected_text__(self, start_of_line=False, selectText=False):
152152
line, s, end, e = self.getSelection()
153-
if line == -1:
153+
154+
# Sometime self.getSelection returns values that equate to a non-existent
155+
# selection, ie start and end are the same, so let's process it as if there is
156+
# no selection
157+
selectionIsEmpty = line == end and s == e
158+
if line == -1 or selectionIsEmpty:
154159
# Nothing is selected, return the current line of text
155160
line, index = self.getCursorPosition()
156161
txt = self.text(line)

0 commit comments

Comments
 (0)