From: Darrick J. Wong Date: Fri, 25 Feb 2022 22:32:48 +0000 (-0500) Subject: libxcmd: use emacs mode for command history editing X-Git-Tag: v5.15.0-rc1~23 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=3aef6357ea94a1b699ea48fbc2d54879ca820307;p=thirdparty%2Fxfsprogs-dev.git libxcmd: use emacs mode for command history editing Prior to xfsprogs 5.7.0, we built xfsprogs with libreadline support by default. In its default configuration, that library interpreted various keystrokes in a direct manner (e.g. backspace deletes the character to the left of the cursor), which seems consistent with how emacs behaves. However, libeditline's default keybindings are consistent with vim, which means that suddenly users are presented with not the same line editing interface that they had before. Since libeditline is configurable (put "bind -v" in editrc if you really want vim mode), let's put things back the way they were. At least as much as we can. Fixes: bbe12eb9 ("xfsprogs: remove libreadline support") Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Signed-off-by: Eric Sandeen --- diff --git a/db/input.c b/db/input.c index 448e84b09..d81135990 100644 --- a/db/input.c +++ b/db/input.c @@ -227,6 +227,7 @@ fetchline(void) el_set(el, EL_SIGNAL, 1); el_set(el, EL_PROMPT, el_get_prompt); el_set(el, EL_HIST, history, (const char *)hist); + el_set(el, EL_EDITOR, "emacs"); } if (inputstacksize == 1) { diff --git a/libxcmd/input.c b/libxcmd/input.c index e3fa626a7..fa80e5abb 100644 --- a/libxcmd/input.c +++ b/libxcmd/input.c @@ -45,6 +45,7 @@ fetchline(void) el_set(el, EL_SIGNAL, 1); el_set(el, EL_PROMPT, el_get_prompt); el_set(el, EL_HIST, history, (const char *)hist); + el_set(el, EL_EDITOR, "emacs"); } cmd = el_gets(el, &count); if (!cmd)