From bc2ebce0869d6c9cf233a8a818832c072e45fc40 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Wed, 4 Mar 2020 14:56:04 +0100 Subject: [PATCH] Make ctrl-d behave like delete, but exit on an empty line. This is the default readline behavior. --- src/mainclient/shell.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mainclient/shell.c b/src/mainclient/shell.c index 1ef3fd5c..9b736627 100644 --- a/src/mainclient/shell.c +++ b/src/mainclient/shell.c @@ -620,8 +620,12 @@ static int line() { clearlines(); return -1; case 4: /* ctrl-d, eof */ - clearlines(); - return -1; + if (gbl_len == 0) { /* quit on empty line */ + clearlines(); + return -1; + } + kdelete(1); + break; case 5: /* ctrl-e */ gbl_pos = gbl_len; refresh();