diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2009-10-26 19:19:16 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2009-10-26 19:19:16 -0400 |
commit | af5726e0c546f9a4914dd80c03e11e1aadc034f2 (patch) | |
tree | 0ebc5c27f32be81557ab694659fbcc0e59a7eb0a /src | |
parent | de1bd5a05102d26f211d4f636aea2662c6b4e7fc (diff) |
Finish selection rework
Bug 598124 - The selection does not only change when the mousebutton is released
Only update selection when mouse-button is released (or focus lost).
Also, update PRIMARY when _select_all() is called.
Diffstat (limited to 'src')
-rw-r--r-- | src/vte.c | 27 |
1 files changed, 9 insertions, 18 deletions
@@ -6167,9 +6167,7 @@ vte_terminal_start_selection(VteTerminal *terminal, GdkEventButton *event, static gboolean _vte_terminal_maybe_end_selection (VteTerminal *terminal) { - /* If Shift is held down, or we're not in events mode, - * copy the selected text. */ - if (terminal->pvt->selecting || !terminal->pvt->mouse_tracking_mode) { + if (terminal->pvt->selecting) { /* Copy only if something was selected. */ if (terminal->pvt->has_selection && !terminal->pvt->selecting_restart && @@ -6639,9 +6637,6 @@ vte_terminal_extend_selection(VteTerminal *terminal, long x, long y, "Selection changed to " "(%ld,%ld) to (%ld,%ld).\n", sc->col, sc->row, ec->col, ec->row); - - vte_terminal_copy_primary(terminal); - vte_terminal_emit_selection_changed(terminal); } static void @@ -6694,16 +6689,7 @@ vte_terminal_select_all (VteTerminal *terminal) _vte_debug_print(VTE_DEBUG_SELECTION, "Selecting *all* text.\n"); - g_free (terminal->pvt->selection); - terminal->pvt->selection = - vte_terminal_get_text_range (terminal, - terminal->pvt->selection_start.row, - terminal->pvt->selection_start.col, - terminal->pvt->selection_end.row, - terminal->pvt->selection_end.col, - vte_cell_is_selected, - NULL, NULL); - + vte_terminal_copy_primary(terminal); vte_terminal_emit_selection_changed (terminal); _vte_invalidate_all (terminal); } @@ -7069,7 +7055,11 @@ vte_terminal_button_release(GtkWidget *widget, GdkEventButton *event) event->button, x, y); switch (event->button) { case 1: - handled = _vte_terminal_maybe_end_selection (terminal); + /* If Shift is held down, or we're not in events mode, + * copy the selected text. */ + if ((terminal->pvt->modifiers & GDK_SHIFT_MASK) || + !terminal->pvt->mouse_tracking_mode) + handled = _vte_terminal_maybe_end_selection (terminal); break; case 2: if ((terminal->pvt->modifiers & GDK_SHIFT_MASK) || @@ -13765,12 +13755,13 @@ _vte_terminal_select_text(VteTerminal *terminal, terminal->pvt->selection_end.col = end_col; terminal->pvt->selection_end.row = end_row; vte_terminal_copy_primary(terminal); + vte_terminal_emit_selection_changed(terminal); + _vte_invalidate_region (terminal, MIN (start_col, start_row), MAX (start_col, start_row), MIN (start_row, end_row), MAX (start_row, end_row), FALSE); - vte_terminal_emit_selection_changed(terminal); } void |