[openssh-commits] [openssh] 01/02: upstream: If editline has been switched to vi mode (i.e. via "bind
git+noreply at mindrot.org
git+noreply at mindrot.org
Thu Jan 22 11:12:29 AEDT 2026
This is an automated email from the git hooks/post-receive script.
djm pushed a commit to branch master
in repository openssh.
commit b0d0b71651b5a19d0dbd27b623ebb4fc43145560
Author: sthen at openbsd.org <sthen at openbsd.org>
AuthorDate: Wed Jan 21 15:44:51 2026 +0000
upstream: If editline has been switched to vi mode (i.e. via "bind
-v" in .editrc), setup a keybinding so that command mode can be entered. Diff
originally from Walter Alejandro Iglesias with tweaks. Feedback from Crystal
Kolipe. ok djm
OpenBSD-Commit-ID: 5786e17ccd83573e2d86418023f9bc768223336a
---
sftp.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/sftp.c b/sftp.c
index c463899c4..b5adc09de 100644
--- a/sftp.c
+++ b/sftp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp.c,v 1.247 2025/10/13 00:54:29 djm Exp $ */
+/* $OpenBSD: sftp.c,v 1.248 2026/01/21 15:44:51 sthen Exp $ */
/*
* Copyright (c) 2001-2004 Damien Miller <djm at openbsd.org>
*
@@ -2228,6 +2228,7 @@ interactive_loop(struct sftp_conn *conn, char *file1, char *file2)
int err, interactive;
EditLine *el = NULL;
#ifdef USE_LIBEDIT
+ const char *editor;
History *hl = NULL;
HistEvent hev;
extern char *__progname;
@@ -2261,6 +2262,10 @@ interactive_loop(struct sftp_conn *conn, char *file1, char *file2)
el_set(el, EL_BIND, "\\e\\e[D", "ed-prev-word", NULL);
/* make ^w match ksh behaviour */
el_set(el, EL_BIND, "^w", "ed-delete-prev-word", NULL);
+
+ /* el_source() may have changed EL_EDITOR to vi */
+ if (el_get(el, EL_EDITOR, &editor) == 0 && editor[0] == 'v')
+ el_set(el, EL_BIND, "^[", "vi-command-mode", NULL);
}
#endif /* USE_LIBEDIT */
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list