Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Sep 2021 09:01:58 GMT
From:      Piotr Pawel Stefaniak <pstef@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 9413dfd331e7 - main - sh: reset sh bindings on bind -e, bind -v
Message-ID:  <202109220901.18M91waT092502@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by pstef:

URL: https://cgit.FreeBSD.org/src/commit/?id=9413dfd331e705a1d7909fe41f06a30e43c442f7

commit 9413dfd331e705a1d7909fe41f06a30e43c442f7
Author:     Piotr Pawel Stefaniak <pstef@FreeBSD.org>
AuthorDate: 2021-09-19 20:17:01 +0000
Commit:     Piotr Pawel Stefaniak <pstef@FreeBSD.org>
CommitDate: 2021-09-22 08:54:51 +0000

    sh: reset sh bindings on bind -e, bind -v
    
    Until this change, any bindings set in histedit() were lost on calls to
    bindcmd().
    
    Only bind -e and bind -v call libedit's keymacro_reset(). Currently you
    cannot fool libedit/map.c:map_bind() by trying something like bind -le
    as when p[0] == '-', it does a switch statement on p[1].
---
 bin/sh/histedit.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c
index 938df284a06c..37b62cef5746 100644
--- a/bin/sh/histedit.c
+++ b/bin/sh/histedit.c
@@ -559,6 +559,13 @@ bindcmd(int argc, char **argv)
 
 	fclose(out);
 
+	if (argc > 1 && argv[1][0] == '-' &&
+	    memchr("ve", argv[1][1], 2) != NULL) {
+		Vflag = argv[1][1] == 'v';
+		Eflag = !Vflag;
+		histedit();
+	}
+
 	INTON;
 
 	return ret;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109220901.18M91waT092502>