aboutsummarylogtreecommitdiffstats
path: root/st.c
diff options
context:
space:
mode:
authorChristoph Lohmann2013-05-04 08:05:11 +0200
committerChristoph Lohmann2013-05-04 08:05:11 +0200
commitd8745a0796b7da5862e7b714b5a08042c4d4b779 (patch)
tree270da0f67188b9012f33deeedb5350649599d519 /st.c
parent829040d3eebab7727bf44ae16c8ea396ccbc71d1 (diff)
downloadaur-d8745a0796b7da5862e7b714b5a08042c4d4b779.tar.gz
Select to the end of row if end of line is reached.
Thanks Alexander Rezinsky <alexrez@gmail.com>!
Diffstat (limited to 'st.c')
-rw-r--r--st.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/st.c b/st.c
index d73aaa1e67ef..e2e6c57e29d1 100644
--- a/st.c
+++ b/st.c
@@ -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:
/*
@@ -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;
}
}