Update readline.py
This commit is contained in:
parent
2b285740d9
commit
9e1c7e0117
@ -158,7 +158,23 @@ class ReadlineBridge:
|
|||||||
widget = self._widget()
|
widget = self._widget()
|
||||||
if widget is None:
|
if widget is None:
|
||||||
return
|
return
|
||||||
widget.cursorWordBackward(True)
|
cursor_position = widget.cursorPosition()
|
||||||
|
text = widget.text()
|
||||||
|
|
||||||
|
target_position = cursor_position
|
||||||
|
|
||||||
|
is_word_boundary = True
|
||||||
|
while is_word_boundary and target_position > 0:
|
||||||
|
is_word_boundary = text[target_position - 1] == " "
|
||||||
|
target_position-=1
|
||||||
|
|
||||||
|
is_word_boundary = False
|
||||||
|
while not is_word_boundary and target_position > 0:
|
||||||
|
is_word_boundary = text[target_position - 1] == " "
|
||||||
|
target_position-=1
|
||||||
|
|
||||||
|
moveby = cursor_position - target_position - 1
|
||||||
|
widget.cursorBackward(True, moveby)
|
||||||
self._deleted[widget] = widget.selectedText()
|
self._deleted[widget] = widget.selectedText()
|
||||||
widget.del_()
|
widget.del_()
|
||||||
|
|
||||||
@ -211,3 +227,4 @@ class ReadlineBridge:
|
|||||||
if widget is None:
|
if widget is None:
|
||||||
return
|
return
|
||||||
widget.backspace()
|
widget.backspace()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user