-
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.
edit.c: disable multiline editing on invalid $TERM
Reproducer: set TERM to an unknown terminal or one that does not support cursor movement, and watch multiline editing go haywire. Multiline editing should be auto-disabled under such conditions. src/cmd/ksh93/edit/edit.c: - Rename CURSOR_UP and ERASE_EOS to use lowercase names as they are not macros. - get_tput(): Tweaks. Forget pre-existing escape sequences when tput(1) currently cannot provide them. - ed_setup(): If e_multiline is on, and getting the tput(1) escape sequences upon a $TERM change fails, then disable e_multiline. To make this work correctly, we have to move this whole block to immediately before the code that adjusts the window size for single-line editing. - ed_read(): Tweak and correct the code for redrawing the command-line on SIGWINCH in multiline mode. Using e_cur (the current position) as a factor in determining the number of lines to move up was incorrect, as that is the current position, not the total line length; for that, we need e_peol. (re: bb4f23e) src/cmd/ksh93/features/cmds: - Modernise a couple of old Bourne shell usages. POSIX shells can remove initial and final " with parameter expansion operators. src/cmd/ksh93/include/edit.h: - Remove two global vars that are unused after the above ed_setup() change; a locally scoped static variable is better here. src/cmd/ksh93/tests/pty.sh: - Four tests started failing because they depend on the specific behaviour of the multiline editor, which is now disabled because the pty tests are run with TERM=dumb so tput(1) will not return any escape sequences. Use TERM=vt100 for those (the DEC VT100 was pretty much the original ANSI escape sequence terminal, so it should be known about by just about every operating system).
- Loading branch information
Showing
6 changed files
with
83 additions
and
42 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
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