Merge branch 'edi9999-patch-2'
This commit is contained in:
commit
bd506b186b
@ -158,7 +158,23 @@ class ReadlineBridge:
|
||||
widget = self._widget()
|
||||
if widget is None:
|
||||
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()
|
||||
widget.del_()
|
||||
|
||||
|
@ -234,6 +234,8 @@ def test_rl_kill_line(lineedit, bridge, text, deleted, rest):
|
||||
@pytest.mark.parametrize('text, deleted, rest', [
|
||||
('test delete|foobar', 'delete', 'test |foobar'),
|
||||
('test delete |foobar', 'delete ', 'test |foobar'),
|
||||
('open -t github.com/foo/bar |', 'github.com/foo/bar ', 'open -t |'),
|
||||
('open -t |github.com/foo/bar', '-t ', 'open |github.com/foo/bar'),
|
||||
fixme(('test del<ete>foobar', 'delete', 'test |foobar')),
|
||||
('test del<ete >foobar', 'del', 'test |ete foobar'), # wrong
|
||||
])
|
||||
|
Loading…
Reference in New Issue
Block a user