[vte/wip/egmont/bidi: 6/14] mouse tracking and reporting
- From: Egmont Koblinger <egmontkob src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/wip/egmont/bidi: 6/14] mouse tracking and reporting
- Date: Wed, 7 Nov 2018 13:36:57 +0000 (UTC)
commit 10b39b9db3d379999da86ff34140c2d63191ebba
Author: Egmont Koblinger <egmont gmail com>
Date: Wed Sep 19 13:25:31 2018 +0200
mouse tracking and reporting
BIDI-STATUS | 4 ++++
src/vte.cc | 19 ++++++++++++++++++-
src/vteinternal.hh | 1 +
3 files changed, 23 insertions(+), 1 deletion(-)
---
diff --git a/BIDI-STATUS b/BIDI-STATUS
index a30f5f33..b8657f00 100644
--- a/BIDI-STATUS
+++ b/BIDI-STATUS
@@ -7,6 +7,8 @@ Done:
paragraph has a foreign directionality character.
- Mouse highlighting (logical in normal modes, visual in rectangle mode).
- Copying text in logical modes.
+- Mouse reporting.
+- Regex match and explicit hyperlink underlining on hover.
- VTE_DEBUG=bidi highlights characters with resolved RTL directionality.
- Test file.
- Configure flag.
@@ -17,6 +19,8 @@ Bugs:
is split or two paragraphs are joined is just a first hack, needs to be
reviewed, adjusted, fixed properly.
- Copying text in rectangle mode.
+- Crashes when mouse selection initiates scrolling.
+- Crashes with quitting mc using mouse.
Missing from first release:
- Adjust mouse reporting.
diff --git a/src/vte.cc b/src/vte.cc
index 9a3e1de5..4d480de0 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -1502,9 +1502,22 @@ Terminal::grid_coords_from_view_coords(vte::view::coords const& pos) const
vte::grid::row_t row = pixel_to_row(pos.y);
+ /* BiDi: convert to logical column. */
+ vte::base::BidiRow const* bidirow = m_ringview.get_row_map(confine_grid_row(row));
+ col = bidirow->vis2log(col);
+
return vte::grid::coords(row, col);
}
+vte::grid::row_t
+Terminal::confine_grid_row(vte::grid::row_t const& row) const
+{
+ auto first_row = first_displayed_row();
+ auto last_row = last_displayed_row();
+
+ return CLAMP(row, first_row, last_row);
+}
+
/*
* Terminal::confined_grid_coords_from_view_coords:
* @pos: the view coordinates
@@ -5971,6 +5984,10 @@ Terminal::match_hilite_update()
glong col = pos.x / m_cell_width;
glong row = pixel_to_row(pos.y);
+ /* BiDi: convert to logical column. */
+ vte::base::BidiRow const* bidirow = m_ringview.get_row_map(confine_grid_row(row));
+ col = bidirow->vis2log(col);
+
_vte_debug_print(VTE_DEBUG_EVENTS,
"Match hilite update (%ld, %ld) -> %ld, %ld\n",
pos.x, pos.y, col, row);
@@ -8998,7 +9015,7 @@ Terminal::draw_rows(VteScreen *screen_,
determine_colors(cell, selected, &nfore, &nback, &ndeco);
nhilite = (nhyperlink && cell->attr.hyperlink_idx == m_hyperlink_hover_idx) ||
- (!nhyperlink && m_match != nullptr && m_match_span.contains(row, col));
+ (!nhyperlink && m_match != nullptr && m_match_span.contains(row,
bidirow->vis2log(col)));
/* See if it no longer fits the run. */
if (item_count > 0 &&
diff --git a/src/vteinternal.hh b/src/vteinternal.hh
index 729efbe5..89a66a71 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -744,6 +744,7 @@ public:
inline bool grid_coords_in_scrollback(vte::grid::coords const& rowcol) const { return rowcol.row() <
m_screen->insert_delta; }
+ vte::grid::row_t confine_grid_row(vte::grid::row_t const& row) const;
vte::grid::coords confine_grid_coords(vte::grid::coords const& rowcol) const;
vte::grid::coords confined_grid_coords_from_event(GdkEvent const* event) const;
vte::grid::coords confined_grid_coords_from_view_coords(vte::view::coords const& pos) const;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]