I'm not sure exactly where to find canonical documentation for these
codes, but this seems to match what my terminal produces (macOS + iTerm2
+ Fish + Tmux).
It might also be nice to have some more support for editing the bindings
for these characters; sequences of more than one character are not
supported by `el_bind_key` and similar.
It was previously subject to a sort of off-by-one error, because of the
addition of `NILSTR` in `el_prep`. This should allow a history size of 1
to function correctly now.
- Use same namespace like other tty movement functions
- Replace globally exposed itoa() and dangerous strcpy() with snprintf()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
The Ctrl-R search prompt and failed search text may be longer than
the regular CLI prompt. This patch clears the line to remove any
lingering artefacts.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
The screen should only be cleared on Ctrl-L *and* empty regular line,
not when searching with an empty string.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Like Ctrl-D, when on an empty line we clear the screen, when editing a
garbled line we refresh the line.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Fixes crash when dividing by the number of columns,
which was computed as zero in this situation.
Instead, always have at least one "column" even if it wraps.
When the point is on whitespace between two words skipping forward, or
killing forward, should result in the new point being moved to the next
word:
foo bar fox gnu
^
=>
foo bar fox gnu
^
Before this patch the point moved to 'b'. After this patch the point
moves to the first letter of the next word, 'f'. Kill forward word now
properly kills 'bar' and moves to the first whitespace letter after
'bar'. Both are now behaving like FSF Readline.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This rather big patch adds support for the GNU Readline alternate
interface, for use with event loops:
void rl_callback_handler_install (const char *prompt, rl_vcpfunc_t *lhandler);
void rl_callback_read_char (void);
void rl_callback_handler_remove (void);
The code has been tested using the testit and excallback examples.
Both regular editing and searching works as intended.
Also, the problem with lingering artefacts on screen when scrolling
through the history has been fixed.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>