[hackers] [st] - Extend selection to whole line when end of the line is reached

From: Alexander Rezinsky <alexrez_AT_gmail.com>
Date: Sun, 28 Apr 2013 21:47:38 -0700

iff --git a/st.c b/st.c
index ec26241..7720446 100644
--- a/st.c
+++ b/st.c
_AT__AT_ -726,6 +726,22 @@ selsnap(int mode, int *x, int *y, int direction) {
                }
                break;
        default:
+ /*
+ * extend selection to whole line when
+ * end of the line is reached (like in rxvt).
+ * Note that terminal multiplexers like
+ * gnu-screen and tmux fill line with spaces.
+ */
+ if (direction > 0) {
+ int i = term.col;
+
+ while (--i > 0 && term.line[*y][i].c[0] == ' ')
+ /* nothing */ ;
+ if (i > 0 && i < *x) {
+ *x= term.col - 1;
+ }
+ }
+
                break;
        }
 }
Received on Mon Apr 29 2013 - 06:47:38 CEST

This archive was generated by hypermail 2.3.0 : Mon Apr 29 2013 - 06:48:20 CEST