[vte] selection: Simplify code



commit 2a321165c62c7362b9d225d98e6cc153b6817f8c
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!

 src/vte.cc |   22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index 5016d79..8bfbebd 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -5973,20 +5973,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,
@@ -6001,7 +5999,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;
@@ -6021,7 +6019,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;
@@ -6061,7 +6059,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. */
@@ -10389,8 +10387,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;
                        }
@@ -10460,8 +10457,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]