update_selection always removes the old selection

This commit is contained in:
Daniel Micay 2012-09-07 18:55:01 -04:00
parent 4b164c1e82
commit aa0cc3b7e3
1 changed files with 3 additions and 4 deletions

View File

@ -78,19 +78,18 @@ void launch_browser(char *url) {
} }
static void update_selection(VteTerminal *vte, const select_info *select) { static void update_selection(VteTerminal *vte, const select_info *select) {
if (select->mode == vi_mode::command) {
vte_terminal_select_none(vte); vte_terminal_select_none(vte);
if (select->mode == vi_mode::command) {
return; // not in visual mode return; // not in visual mode
} }
const long n_columns = vte_terminal_get_column_count(vte);
long cursor_col, cursor_row; long cursor_col, cursor_row;
vte_terminal_get_cursor_position(vte, &cursor_col, &cursor_row); vte_terminal_get_cursor_position(vte, &cursor_col, &cursor_row);
vte_terminal_select_none(vte);
vte_terminal_set_selection_block_mode(vte, select->mode == vi_mode::visual_block); vte_terminal_set_selection_block_mode(vte, select->mode == vi_mode::visual_block);
const long n_columns = vte_terminal_get_column_count(vte);
if (select->mode == vi_mode::visual) { if (select->mode == vi_mode::visual) {
const long begin = select->begin_row * n_columns + select->begin_col; const long begin = select->begin_row * n_columns + select->begin_col;
const long end = cursor_row * n_columns + cursor_col; const long end = cursor_row * n_columns + cursor_col;