[vte/wip/egmont/bidi] mouse tracking and reporting
- From: Egmont Koblinger <egmontkob src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/wip/egmont/bidi] mouse tracking and reporting
- Date: Wed, 19 Sep 2018 11:25:46 +0000 (UTC)
commit 3190aabd8e61067c3f1b735ac951fe082744030f
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 2e6b5020..58f296eb 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -1514,9 +1514,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
@@ -5940,6 +5953,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);
@@ -8973,7 +8990,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 ce89123b..7c4f09c3 100644
--- a/src/vteinternal.hh
+++ b/src/vteinternal.hh
@@ -746,6 +746,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]