diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-09-16 06:22:42 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-09-16 06:22:42 -0700 |
commit | 70c93c1c95138d5c97bfabf25d83b79487f19f51 (patch) | |
tree | a43016b40c6c8f44bf7cfee8486db6e906a66d53 /parser.l | |
parent | 3733d13790f3ec3da3f1396d01f57d08710982f9 (diff) | |
download | txr-70c93c1c95138d5c97bfabf25d83b79487f19f51.tar.gz txr-70c93c1c95138d5c97bfabf25d83b79487f19f51.tar.bz2 txr-70c93c1c95138d5c97bfabf25d83b79487f19f51.zip |
linenoise: enhanced multi-line mode with line breaks.
The linenoise multi-line mode is just a glorified line
wrapper, and not actualy a multi-line editor, like in GNU
Readline and others. This commit fixes it. The edit buffer can
now contain line breaks, separated by carriage return
characters. (In single-line mode, these characters continue
to be displayed as ^M). The row and column calculations in the
multi-line refresh follow this data representation.
* linenoise/linenoise.c (sync_data_to_buf): This function
now takes an extra argument telling it whether multi-line mode
is in effect for the rendering. In multi-line mode, the prompt
is now added to the display data, so that multi-line refresh
is simplified by not having to account for the prompt length
in various calculations. Also, in multi-line mode, carriage
returns are rendered to display as CR-LF pairs, since they
denote embedded line breaks.
(complete_line): Pass mlmode to sync_data_to_buf.
(struct row_values): New struct, for returning multiple
row values out of a function.
(screen_rows, col_offset_in_str): New static functions.
(refresh_multiline): Modified to use screen_rows and
col_offset_in_str for its calculations, and not to deal with
the prompt at all, since the prompt is rolled into the display
data.
(refresh_line, edit_insert): Pass mlmode to sync_data_to_buf.
* txr.1: Documented multi-line mode.
Diffstat (limited to 'parser.l')
0 files changed, 0 insertions, 0 deletions