diff options
author | Julian Aron Prenner <julian@linux4you.it> | 2014-01-18 10:18:29 +0100 |
---|---|---|
committer | Julian Aron Prenner <julian@linux4you.it> | 2014-01-18 10:18:29 +0100 |
commit | 3728fc7dba0fd0e7f381b1cb909cd197a9e5254a (patch) | |
tree | 12668dd2fb2f7660dcefea8893c2614b23139748 /reader.cpp | |
parent | 88eae68987863fbd34b34e12219c9a8c67c61d7b (diff) |
Add kill-selection function and visual binds for 'y' and 'd'
Diffstat (limited to 'reader.cpp')
-rw-r--r-- | reader.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -2436,7 +2436,7 @@ size_t reader_get_cursor_pos() return data->buff_pos; } -bool reader_get_selection_pos(size_t &start, size_t &stop) +bool reader_get_selection(size_t &start, size_t &len) { if (!data) { @@ -2449,7 +2449,7 @@ bool reader_get_selection_pos(size_t &start, size_t &stop) else { start = data->sel_start_pos; - stop = data->sel_stop_pos; + len = std::min(data->sel_stop_pos - data->sel_start_pos + 1, data->command_length()); return true; } } @@ -3850,6 +3850,17 @@ const wchar_t *reader_readline(void) break; } + case R_KILL_SELECTION: + { + bool newv = (last_char != R_KILL_SELECTION); + size_t start, len; + if(reader_get_selection(start, len)) + { + reader_kill(start, len, KILL_APPEND, newv); + } + break; + } + /* Other, if a normal character, we add it to the command */ default: { |