]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libxcmd: use emacs mode for command history editing
authorDarrick J. Wong <djwong@kernel.org>
Fri, 25 Feb 2022 22:32:48 +0000 (17:32 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Fri, 25 Feb 2022 22:32:48 +0000 (17:32 -0500)
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 <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
db/input.c
libxcmd/input.c

index 448e84b09c9cba473f082946124be1276ed40424..d811359902af35f30c0bf2d3bf305e9ae55ead51 100644 (file)
@@ -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) {
index e3fa626a7252223172ca5a00f8b508d076b8e829..fa80e5abb224eeea02b4fd3450958cb5f1bb6b12 100644 (file)
@@ -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)