-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
emacs: Fix sticky numeric param. after meta command (re: 13c3fb2)
Reproducer: type (each line folluwed by RETURN): set -o emacs : bad corret wrong Now type ESC 3 ESC _ to recall the third word ("corret") from the history. Type Ctrl+B to move the cursor back one position. Expected result: the cursor is over the 't' of 'corret' so you can insert missing the 'c', resulting in 'correct'. Actual result: the cursor moves back three positions instead of one, so it's over the second 'r' in 'corret' and inserting a 'c' would result in 'corcret'. Analysis: When the escape() function in emacs.c returns -1 to unset the current numeric parameter 'adjust', vt220_save_repeat is not reset (lines 600-602). However, this reset should only be avoided when processing escape codes related to VT220 keys, whose handling was introduced in the referenced commit. It should be saved for them because they are translated to native emacs commands (e.g. left arrow is translated to Ctrl+B) that are inserted into the input buffer and processed in another ed_emacsread pass. For all other ESC/meta commands, it should be reset as normal. src/cmd/ksh93/edit/emacs.c: - In ed_emacsread(), only reset vt220_save_repeat if escape() returns a value > -2. Change a -2 return back to -1 in the 'adjust' variable to prevent potential side effects. - In escape(), return -2 for all the VT220 escape sequences. On line 956, change the check for 'count == -1' to 'count < 0'. The effect is that the numeric parameter is still saved for VT220 escape sequences but correctly reset for all other meta commands.
- Loading branch information
Showing
5 changed files
with
51 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters