Currently mouse button-motion events generated by dragging the cursor
outside the urxvt window have coordinates outside the range of valid
cells. Clamping these coordinates to the minimum and maximum row/column
number would be more useful and is consistent with xterm.
---
 src/command.C | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/command.C b/src/command.C
index 69ec0eed..6f2e5b74 100644
--- a/src/command.C
+++ b/src/command.C
@@ -1283,8 +1283,8 @@ rxvt_term::mouse_report (XButtonEvent &ev)
   int x, y;
   bool release = ev.type == ButtonRelease;
 
-  x = Pixel2Col (ev.x) + 1;
-  y = Pixel2Row (ev.y) + 1;
+  x = 1 + clamp (Pixel2Col (ev.x), 0, ncol - 1);
+  y = 1 + clamp (Pixel2Row (ev.y), 0, nrow - 1);
 
   if (ev.type == MotionNotify)
     {
-- 
2.40.1


_______________________________________________
rxvt-unicode mailing list
[email protected]
http://lists.schmorp.de/mailman/listinfo/rxvt-unicode

Reply via email to