aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornoname <noname@inventati.org>2015-05-01 02:22:32 +0000
committerRoberto E. Vargas Caballero <k0ga@shike2.com>2015-05-04 11:41:55 +0200
commit8751809aff596fc2030026713651c11b3743f88e (patch)
tree2f68eb90ddc861d90fd9d5902870b4995b16ca24
parent765bb0fd1420e36b04ecc03c18f01f5bda96c563 (diff)
downloadst-8751809aff596fc2030026713651c11b3743f88e.tar.gz
st-8751809aff596fc2030026713651c11b3743f88e.tar.bz2
selsnap: simplify SNAP_LINE case
Also make sure y never exceeds term.row-1 even if ATTR_WRAP is set for some reason.
-rw-r--r--st.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/st.c b/st.c
index 87f3ed2..789e795 100644
--- a/st.c
+++ b/st.c
@@ -772,15 +772,15 @@ selsnap(int *x, int *y, int direction) {
* previous line will be selected.
*/
*x = (direction < 0) ? 0 : term.col - 1;
- if(direction < 0 && *y > 0) {
+ if(direction < 0) {
for(; *y > 0; *y += direction) {
if(!(term.line[*y-1][term.col-1].mode
& ATTR_WRAP)) {
break;
}
}
- } else if(direction > 0 && *y < term.row-1) {
- for(; *y < term.row; *y += direction) {
+ } else if(direction > 0) {
+ for(; *y < term.row-1; *y += direction) {
if(!(term.line[*y][term.col-1].mode
& ATTR_WRAP)) {
break;