[hackers] [st] Select to the end of row if end of line is reached. || Christoph Lohmann
commit 634c247fa76a5f649cdcc51109970e46ddaf5c32
Author: Christoph Lohmann <20h_AT_r-36.net>
Date: Sat May 4 08:05:11 2013 +0200
Select to the end of row if end of line is reached.
Thanks Alexander Rezinsky <alexrez_AT_gmail.com>!
diff --git a/st.c b/st.c
index d73aaa1..e2e6c57 100644
--- a/st.c
+++ b/st.c
_AT_@ -679,6 +679,8 @@ selected(int x, int y) {
void
selsnap(int mode, int *x, int *y, int direction) {
+ int i;
+
switch(mode) {
case SNAP_WORD:
/*
_AT_@ -735,6 +737,16 @@ selsnap(int mode, int *x, int *y, int direction) {
}
break;
default:
+ /*
+ * Select the whole line when the end of line is reached.
+ */
+ if(direction > 0) {
+ 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 Sat May 04 2013 - 08:08:08 CEST
This archive was generated by hypermail 2.3.0
: Sat May 04 2013 - 08:12:16 CEST