diff options
author | Christian Persch <chpe@gnome.org> | 2015-10-16 21:30:12 +0200 |
---|---|---|
committer | Christian Persch <chpe@gnome.org> | 2015-10-20 21:04:36 +0200 |
commit | 2a321165c62c7362b9d225d98e6cc153b6817f8c (patch) | |
tree | 29415c9463f4685eb82c80799d33492e6ac316ca | |
parent | 7f74ef1e23ee5120bfc37f5daa0fc068fcbe6eae (diff) | |
download | vte-2a321165c62c7362b9d225d98e6cc153b6817f8c.tar.gz |
selection: Simplify code
vte_cell_is_between is only ever called with inclusive=TRUE, so
drop that parameter. TODO: cleanup this function!
-rw-r--r-- | src/vte.cc | 22 |
1 files changed, 9 insertions, 13 deletions
@@ -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; |