summaryrefslogtreecommitdiffhomepage
path: root/tests/linux
diff options
context:
space:
mode:
authorSean Kurtz <seankurtz75@gmail.com>2026-11-18 13:05:38 -0600
committerSean Kurtz <seankurtz75@gmail.com>2026-11-18 13:05:38 -0600
commitbc0cab203252597d29cbce7fcba0ca4fadfbc846 (patch)
treed3a7f65bca4fcd2960c6a0cb6b2a2fa1670850a4 /tests/linux
parente46eeeea900703956783d835edd800567989ceb0 (diff)
downloadzash-bc0cab203252597d29cbce7fcba0ca4fadfbc846.tar.gz
edit_builtin: the emacs keys bash users reach for
meta-u, meta-l and meta-c change the case of a word, meta-t transposes the words either side of the cursor, meta-. inserts the last word of the previous line and meta-\\ collapses the blanks around the cursor. The rest of the map was already bash's: a BSD sh or a bash prompt is the target, not ksh's.
Diffstat (limited to 'tests/linux')
-rw-r--r--tests/linux/i-emacs.exp14
-rw-r--r--tests/linux/i-emacs.sh16
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/linux/i-emacs.exp b/tests/linux/i-emacs.exp
index a1a4754..a7fe58a 100644
--- a/tests/linux/i-emacs.exp
+++ b/tests/linux/i-emacs.exp
@@ -10,6 +10,20 @@ $ echo aa XXbb
aa XXbb
$ echo ba
ba
+$ echo HELLO
+HELLO
+$ echo hello
+hello
+$ echo Hello
+Hello
+$ echo bb aa
+bb aa
+$ echo alpha beta
+alpha beta
+$ echo beta
+beta
+$ echo xy
+xy
$ echo 'a^Ib' | tr '\t' T
aTb
$ 23456789012345678901234567890123456789012345678901234567890123456789 | wc -c
diff --git a/tests/linux/i-emacs.sh b/tests/linux/i-emacs.sh
index cb9bc6e..465b583 100644
--- a/tests/linux/i-emacs.sh
+++ b/tests/linux/i-emacs.sh
@@ -18,6 +18,22 @@ send echo aa bb cc\x1bb\x1bbXX\x1bf\x1bd\r
expect aa XXbb
send echo ab\x14\r
expect ba
+# bash's word keys: meta-u, meta-l, meta-c, meta-t
+send echo hello\x01\x06\x06\x06\x06\x06\x1bu\r
+expect HELLO
+send echo HELLO\x01\x06\x06\x06\x06\x06\x1bl\r
+expect hello
+send echo HELLO\x01\x06\x06\x06\x06\x06\x1bc\r
+expect Hello
+send echo aa bb\x01\x06\x06\x06\x06\x06\x06\x06\x1bt\r
+expect bb aa
+# meta-. takes the last word of the previous line; meta-\\ closes blanks
+send echo alpha beta\r
+expect alpha beta
+send echo \x1b.\r
+expect echo beta
+send echo x y\x1b[4D\x1b\\\r
+expect xy
# ^V inserts the next key literally
send echo 'a\x16\tb' | tr '\\t' T\r
expect aTb