From 9e1c7e011707b63a878caa9be589da7c5a6908ec Mon Sep 17 00:00:00 2001 From: Edgar Hipp Date: Wed, 22 Jun 2016 16:30:38 +0200 Subject: [PATCH] Update readline.py --- qutebrowser/misc/readline.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/qutebrowser/misc/readline.py b/qutebrowser/misc/readline.py index cb0ffd996..5dd9d19c6 100644 --- a/qutebrowser/misc/readline.py +++ b/qutebrowser/misc/readline.py @@ -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_() @@ -211,3 +227,4 @@ class ReadlineBridge: if widget is None: return widget.backspace() +