mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Parse quotes when extracting words from command history (#291)
This avoids splitting on quoted whitespace when extracting words from the command history using the emacs M-. or vi _ command. Example: if the prior command is $ ls Stairway\ To\ Heaven.mp3 then, M-. in Emacs editing mode (and _ in vi mode) now inserts Stairway\ To\ Heaven.mp3 instead of Heaven.mp3. The behavior is similar for 'Stairway To Heaven.mp3' and "Stairway To Heaven.mp3". src/cmd/ksh93/edit/history.c: hist_word(): - Skip over single-quoted and double-quoted strings and backslash-escaped characters. src/cmd/ksh93/tests/pty.sh: - Add regression test for this feature in vi mode. Since emacs and vi both use the same code for this, that should be good enough. Co-authored-by: Martijn Dekker <martijn@inlv.org>
This commit is contained in:
parent
d087b031f0
commit
7439e3dffe
3 changed files with 36 additions and 4 deletions
|
|
@ -812,5 +812,19 @@ r ^:test-1: echo ok\r\n$
|
|||
r ^ok\r\n$
|
||||
!
|
||||
|
||||
# err_exit #
|
||||
((SHOPT_VSH)) && tst $LINENO <<"!"
|
||||
L split on quoted whitespace when extracting words from command history
|
||||
# https://github.com/ksh93/ksh/pull/291
|
||||
|
||||
d 15
|
||||
p :test-1:
|
||||
w true ls One\\ "Two Three"$'Four Five'.mp3
|
||||
r ^:test-1: true ls One\\ "Two Three"\$'Four Five'\.mp3\r\n$
|
||||
p :test-2:
|
||||
w :\E_
|
||||
r ^:test-2: : One\\ "Two Three"\$'Four Five'\.mp3\r\n$
|
||||
!
|
||||
|
||||
# ======
|
||||
exit $((Errors<125?Errors:125))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue