in præfix sequences (like ANSI cursor keys), leading to annoying effects
if we forget that
this patch changes the behaviour so that another character is read/peeked
at (since this is done in the main loop after ESC anyway, no function loss
through the delay) if ESC leads in a prefix-1 sequence, and if the peeked
character leads in a prefix-1 or prefix-2 sequence when in state prefix-1,
it’s still enacted (XXX document this in manpage)
empty) appears pushed into the history, so that, when pressing cursor-up
or ^P, with a cursor-down or ^N you get it back, unless you modify a line
retrieved from the history, in which case it will overwrite the saved line
and place the current history pointer past the entered history lines
This is for Emacs mode; Vi mode had something similar already, and shares
some code and data
XXX there are several static buffers of size LINE (currently 4096) in here
use the libc functions for converting between multibyte strings and wide
strings in here any more, besides mksh has slightly different needs than
SUSv3 compliance ⇒ hand-craft optimised and unrolled functions for that
• sync the mksh-internal wcwidth function with libc
‣ only if !MKSH_SMALL
‣ add appropriate regression test
• if FPOSIX is set, do not close fds > 2 on exec, Debian #499139
• add appropriate regression tests for keeping fds private or not
developers, I understand about 1% of the source code only) yet still
functional (just not en par with the emacs editing mode, but no known
regressions over oksh (in -current) and better functionality than most
other korn shells, according to Yofuh)
plug a memleak when freeing io redirection in commands.
the leaked memory is actually reclaimed when the command
finishes but may grow until that happens, e.g. during
command execution.
ok phessler@.
testing sobrado@ jmc@ oga@.
• fix vi mode (which, however, is officially orphaned) multi-line $PS1 by
using a similar algorithm for prompt skipping as emacs mode (changing
the meaning of prompt_trunc variable and using prompt_redraw, just even
more efficiently than vi mode); reported by asarch via IRC
• fix multi-line prompts if last line is “too large” by using emacs mode
algorithm of just internally appending a newline, while here ☺ this even
saves us having to re-add the prompt_skip variable…
WARNING: this is only barely tested, as almost nobody ever uses vi mode
⇒ test yourself, there may be bugs (e.g. off-by-ones); already known is
that the vi input line editing mode is NOT multibyte safe…
removes the \n part of a “\\\n” sequence, but not the backslash ⇒ we can’t
use line continuation in a here document
someone might want to add this to *(autoconf) Portable Shell::
in the MKSH_SMALL case… so the speed, code size, and number of insns
is the same as before for that, except that the NULL pointer check is
moved to possibly save a function call, and that the function call may
be inlined or jumped
• others: fix 6 (!) cases of non-constant or side-effect arguments
to the str_save() or str_nsave() macros, and other abuse of them
• also fix some cosmetics and other un-nice code while here
missing for a while yet its disappearance was unnoticed because…
• distrib/special/mksh/Makefile: sync check categories, this was missed
• mksh.hts: sync clog