- 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>
The filename completion handler fallback will now be enabled by default.
To disable it a new GNU Readline function pointer will be added.
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>