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.
This commit is contained in:
waterhouse 2013-07-26 20:35:34 -07:00 committed by David Adam (zanchey)
parent 8dd9602f06
commit e3ea953ff4

View file

@ -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();