1
1

prompt: let ^K erase text after cursor (if any), otherwise whole answer

In most cases, the cursor will be at the end of what the user typed
at the prompt (or retrieved from history), and ^K will work as it
always did, erasing the whole answer.  But if the user has moved the
cursor to somewhere in the middle of the answer, a ^K will now erase
just the part after the cursor.  A second ^K will erase the rest.

Inspired-by: Tasos Papastylianou <tpapastylianou@hotmail.com>
Этот коммит содержится в:
Benno Schulenberg 2022-01-29 17:18:37 +01:00
родитель 97f4a3f4eb
Коммит ff5084479b

Просмотреть файл

@ -157,10 +157,10 @@ void do_statusbar_backspace(void)
}
}
/* Zap some or all text from the answer. */
/* Zap the part of the answer after the cursor, or the whole answer. */
void do_statusbar_cut_text(void)
{
if (!ISSET(CUT_FROM_CURSOR))
if (answer[typing_x] == '\0')
typing_x = 0;
answer[typing_x] = '\0';