[vte] selection: Simplify code



commit e8964d96155dc992b951dd8ab5850b1376d0f254
Author: Christian Persch <chpe gnome org>
Date:   Tue Nov 10 21:33:07 2015 +0100

    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 76114fe..72115de 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -6078,20 +6078,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,
@@ -6106,7 +6104,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;
@@ -6126,7 +6124,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;
@@ -6166,7 +6164,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. */
@@ -10435,8 +10433,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;
                        }
@@ -10506,8 +10503,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]