diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-09-20 11:49:29 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-09-20 11:49:29 -0700 |
commit | 3df312a334ad3b2dbd146e5fb8b2bd2f9e086165 (patch) | |
tree | ac46bc4ed4a01828b0ada53be1f5aaa0b24df2e0 /linenoise/LICENSE | |
parent | 24193f782a02939d6f4c7a197b44beb97202e1a0 (diff) | |
download | txr-3df312a334ad3b2dbd146e5fb8b2bd2f9e086165.tar.gz txr-3df312a334ad3b2dbd146e5fb8b2bd2f9e086165.tar.bz2 txr-3df312a334ad3b2dbd146e5fb8b2bd2f9e086165.zip |
linenoise: visual select and clipboard copy/paste.
* linenoise/linenoise.c (struc lino_state): New member,
clip, sel, end, dsel, dend, need_refresh, selmode.
(sync_data_to_buf): Update the sel and end members
of the structure based on dsel and dend, the way
pos is being updated from dpos.
(refresh_singleline, refresh_multiline): If visual selection
mode is in effect, show the selected region in inverse video.
(update_sel, clear_sel, yank_sel, delete_sel):
New static function.
(edit_insert): Delete the selection before inserting, so that
the character appears to replace the selection.
Set need_refresh flag instead of calling refresh_line.
(edit_insert_str): New static function. Inserts string,
replacing existing selection, if any.
(paren_jump, edit_move_left, edit_move_right, edit_move_home,
edit_move_end, edit_history_next): Set new
need_refresh flag instead of calling refresh_line directly.
(edit_delete): If selection is in effect, just delete the
selection and return. Set need_refresh flag instead
of calling refresh_line.
(edit_backspace): If selection is in effect, and selection
is not inverted (cursor is to the right of selection)
then just delete the selection. Otherwise delete the
selection, and perform the backspace. Set need_refresh flag
instead of calling refresh_line.
(edit_delete_prev_word): Delete the selection and the word
before the selection. Set need_refresh flag
instead of calling refresh_line.
(edit_in_editor): Set need_refresh_flag instead of
calling refresh_line, and cancel visual selection mode.
(edit): Clear selection mode on entry. Update the selection
variables on each loop iteration. Honor the need_refresh
flag. New commands implemented: Ctrl-S, Ctrl-Q, Ctrl-X Ctrl-Q.
Some commands need to set need_refresh flag.
Some need to cancel selection mode.
(lino_copy): Set the clip member of the cloned structure
to null, otherwise there will be a double free of the
clipboard buffer.
(lino_cleanup): Free the clipboard and null out the pointer.
* txr.1: Documented visual select.
Diffstat (limited to 'linenoise/LICENSE')
0 files changed, 0 insertions, 0 deletions