From 882c1f371557d1d02a438d5ab3d5af2707cf05b9 Mon Sep 17 00:00:00 2001 From: Tony Wang Date: Thu, 18 Sep 2014 22:31:04 +0800 Subject: [PATCH] consistent return for delete_word_from_cursor_back bpython would crash when option-backspace on empty line --- bpython/curtsiesfrontend/manual_readline.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bpython/curtsiesfrontend/manual_readline.py b/bpython/curtsiesfrontend/manual_readline.py index dd51d590e..4be8bb961 100644 --- a/bpython/curtsiesfrontend/manual_readline.py +++ b/bpython/curtsiesfrontend/manual_readline.py @@ -268,7 +268,7 @@ def titlecase_next_word(cursor_offset, line): def delete_word_from_cursor_back(cursor_offset, line): """Whatever my option-delete does in bash on my mac""" if not line: - return cursor_offset, line + return cursor_offset, line, '' starts = [m.start() for m in list(re.finditer(r'\b\w', line)) if m.start() < cursor_offset] if starts: return starts[-1], line[:starts[-1]] + line[cursor_offset:], line[starts[-1]:cursor_offset]