From e3ea953ff406fdab58c7ced150f29e7b27614da3 Mon Sep 17 00:00:00 2001 From: waterhouse Date: Fri, 26 Jul 2013 20:35:34 -0700 Subject: [PATCH] Ctrl+E should insert suggested completion and then go to end of line (Closes #91, #932) Currently, control-E is bound to `end-of-line`. This patch modifes the `end-of-line` procedure so that, if it is invoked when the cursor is at the end of a command and there is pending completion text, it will accept the completion text and move to the end. The behavior of `end-of-line` will not otherwise be altered. --- reader.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/reader.cpp b/reader.cpp index 8febb7994..7753bd759 100644 --- a/reader.cpp +++ b/reader.cpp @@ -3114,10 +3114,17 @@ const wchar_t *reader_readline(void) case R_END_OF_LINE: { - while (buff[data->buff_pos] && - buff[data->buff_pos] != L'\n') + if (data->buff_pos < data->command_length()) { - data->buff_pos++; + while (buff[data->buff_pos] && + buff[data->buff_pos] != L'\n') + { + data->buff_pos++; + } + } + else + { + accept_autosuggestion(true); } reader_repaint();