[vte] widget: Modify selection boundaries to match xterm's behavior



commit c632c336a5cdca8ea3f1856973a359431b61136a
Author: Egmont Koblinger <egmont gmail com>
Date:   Sun Jan 18 17:51:07 2015 +0100

    widget: Modify selection boundaries to match xterm's behavior
    
    https://bugzilla.gnome.org/show_bug.cgi?id=725909

 src/vte.c |   31 ++++++++++++++-----------------
 1 files changed, 14 insertions(+), 17 deletions(-)
---
diff --git a/src/vte.c b/src/vte.c
index 3da2807..b63c745 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -6449,24 +6449,21 @@ vte_terminal_extend_selection_expand (VteTerminal *terminal)
                        if (cell->attr.fragment || cell->c != 0)
                                break;
                }
-               /* If the start point is to its right, then move the
-                * startpoint up to the beginning of the next line
-                * unless that would move the startpoint after the end
-                * point, or we're in select-by-line mode. */
-               if ((sc->col >= i) &&
-                               (terminal->pvt->selection_type != selection_type_line)) {
-                       if (sc->row < ec->row) {
-                               sc->col = 0;
-                               sc->row++;
-                       } else {
-                               sc->col = i;
-                       }
-               }
        } else {
-               /* Snap to the leftmost column. */
-               sc->col = 0;
-       }
-       sc->col = find_start_column (terminal, sc->col, sc->row);
+                i = 0;
+       }
+        if (sc->col > i) {
+                if (terminal->pvt->selection_type == selection_type_char) {
+                        /* If the start point is neither over the used cells, nor over the first
+                         * unused one, then move it to the next line. This way you can still start
+                         * selecting at the newline character by clicking over the first unused cell.
+                         * See bug 725909. */
+                        sc->col = -1;
+                        sc->row++;
+                } else if (terminal->pvt->selection_type == selection_type_word) {
+                        sc->col = i;
+                }
+        }
 
        /* Handle end-of-line at the end-cell. */
        rowdata = _vte_terminal_find_row_data(terminal, ec->row);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]