[vte/wip/bug746690] selection: Simplify code



commit ac9a19942d4725ae04bd9767a2ab6253b4083c86
Author: Christian Persch <chpe gnome org>
Date:   Fri Oct 16 21:30:12 2015 +0200

    selection: Simplify code
    
    vte_cell_is_between is only ever called with inclusive=TRUE, so
    drop that parameter. TODO: cleanup this function!
    
    (cherry picked from commit 2a321165c62c7362b9d225d98e6cc153b6817f8c)

 src/vte.cc |   22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index 5a8de6d..ab6e736 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -6067,20 +6067,18 @@ vte_line_is_wrappable(VteTerminal *terminal, glong row)
        return rowdata && rowdata->attr.soft_wrapped;
 }
 
-/* Check if the given point is in the region between the two points,
- * optionally treating the second point as included in the region or not. */
+/* Check if the given point is in the region between the two points */
 static gboolean
 vte_cell_is_between(glong col, glong row,
-                   glong acol, glong arow, glong bcol, glong brow,
-                   gboolean inclusive)
+                   glong acol, glong arow, glong bcol, glong brow)
 {
        /* Negative between never allowed. */
        if ((arow > brow) || ((arow == brow) && (acol > bcol))) {
                return FALSE;
        }
-       /* Zero-length between only allowed if we're being inclusive. */
+       /* Degenerate span? */
        if ((row == arow) && (row == brow) && (col == acol) && (col == bcol)) {
-               return inclusive;
+               return TRUE;
        }
        /* A cell is between two points if it's on a line after the
         * specified area starts, or before the line where it ends,
@@ -6095,7 +6093,7 @@ vte_cell_is_between(glong col, glong row,
                        if (col < bcol) {
                                return TRUE;
                        } else {
-                               if ((col == bcol) && inclusive) {
+                               if (col == bcol) {
                                        return TRUE;
                                } else {
                                        return FALSE;
@@ -6115,7 +6113,7 @@ vte_cell_is_between(glong col, glong row,
                        if (col < bcol) {
                                return TRUE;
                        } else {
-                               if ((col == bcol) && inclusive) {
+                               if (col == bcol) {
                                        return TRUE;
                                } else {
                                        return FALSE;
@@ -6155,7 +6153,7 @@ vte_cell_is_selected(VteTerminal *terminal, glong col, glong row, gpointer data)
 
        /* Now it boils down to whether or not the point is between the
         * begin and endpoint of the selection. */
-       return vte_cell_is_between(col, row, ss.col, ss.row, se.col, se.row, TRUE);
+       return vte_cell_is_between(col, row, ss.col, ss.row, se.col, se.row);
 }
 
 /* Once we get text data, actually paste it in. */
@@ -10426,8 +10424,7 @@ vte_terminal_draw_rows(VteTerminal *terminal,
                                                terminal->pvt->match_start.col,
                                                terminal->pvt->match_start.row,
                                                terminal->pvt->match_end.col,
-                                               terminal->pvt->match_end.row,
-                                               TRUE);
+                                               terminal->pvt->match_end.row);
                        } else {
                                hilite = FALSE;
                        }
@@ -10497,8 +10494,7 @@ vte_terminal_draw_rows(VteTerminal *terminal,
                                                                terminal->pvt->match_start.col,
                                                                terminal->pvt->match_start.row,
                                                                terminal->pvt->match_end.col,
-                                                               terminal->pvt->match_end.row,
-                                                               TRUE);
+                                                               terminal->pvt->match_end.row);
                                        }
                                        if (nhilite != hilite) {
                                                break;


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