[vte/wip/bug746690] Revert "selection: Simplify code"
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/wip/bug746690] Revert "selection: Simplify code"
- Date: Wed, 21 Oct 2015 09:53:48 +0000 (UTC)
commit a50e7f0316edfe83793b6f85edeec1f7fb2d21fe
Author: Christian Persch <chpe gnome org>
Date: Wed Oct 21 11:52:29 2015 +0200
Revert "selection: Simplify code"
This reverts commit 2a321165c62c7362b9d225d98e6cc153b6817f8c.
src/vte.cc | 22 +++++++++++++---------
1 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index ab6e736..5a8de6d 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -6067,18 +6067,20 @@ 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 */
+/* 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. */
static gboolean
vte_cell_is_between(glong col, glong row,
- glong acol, glong arow, glong bcol, glong brow)
+ glong acol, glong arow, glong bcol, glong brow,
+ gboolean inclusive)
{
/* Negative between never allowed. */
if ((arow > brow) || ((arow == brow) && (acol > bcol))) {
return FALSE;
}
- /* Degenerate span? */
+ /* Zero-length between only allowed if we're being inclusive. */
if ((row == arow) && (row == brow) && (col == acol) && (col == bcol)) {
- return TRUE;
+ return inclusive;
}
/* A cell is between two points if it's on a line after the
* specified area starts, or before the line where it ends,
@@ -6093,7 +6095,7 @@ vte_cell_is_between(glong col, glong row,
if (col < bcol) {
return TRUE;
} else {
- if (col == bcol) {
+ if ((col == bcol) && inclusive) {
return TRUE;
} else {
return FALSE;
@@ -6113,7 +6115,7 @@ vte_cell_is_between(glong col, glong row,
if (col < bcol) {
return TRUE;
} else {
- if (col == bcol) {
+ if ((col == bcol) && inclusive) {
return TRUE;
} else {
return FALSE;
@@ -6153,7 +6155,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);
+ return vte_cell_is_between(col, row, ss.col, ss.row, se.col, se.row, TRUE);
}
/* Once we get text data, actually paste it in. */
@@ -10424,7 +10426,8 @@ 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);
+ terminal->pvt->match_end.row,
+ TRUE);
} else {
hilite = FALSE;
}
@@ -10494,7 +10497,8 @@ 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);
+ terminal->pvt->match_end.row,
+ TRUE);
}
if (nhilite != hilite) {
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]