aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Lohmann <20h@r-36.net>2013-05-04 08:05:11 +0200
committerChristoph Lohmann <20h@r-36.net>2013-05-04 08:05:11 +0200
commit634c247fa76a5f649cdcc51109970e46ddaf5c32 (patch)
tree8f42272af65dd8c93633480b7b37bcf3f7d02c7a
parent5938fa9d32379815757a83076069584f29a8d276 (diff)
downloadst-634c247fa76a5f649cdcc51109970e46ddaf5c32.tar.gz
st-634c247fa76a5f649cdcc51109970e46ddaf5c32.tar.bz2
st-634c247fa76a5f649cdcc51109970e46ddaf5c32.zip
Select to the end of row if end of line is reached.
Thanks Alexander Rezinsky <alexrez@gmail.com>!
-rw-r--r--st.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/st.c b/st.c
index d73aaa1..e2e6c57 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;
}
}