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>
We should add a configure option --enable-readline-compat, or sth, so
rl_complete2() (removed in this commit) becomes the new rl_complete(),
and the current rl_complete() becomes el_complete().
The current implementation of rl_complete2() was is incomplete and also
not working properly. To eliminate any confusion on the matter this
patch removes it. To restore functionality we should, at the very
least, merge with complete() and possibly also refactor rl_find_token()
to share code with the legacy el_find_word().
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>