[hackers] [st] selsnap: simplify SNAP_LINE case || noname

From: <git_AT_suckless.org>
Date: Mon, 4 May 2015 14:23:30 +0200 (CEST)

commit 8751809aff596fc2030026713651c11b3743f88e
Author: noname <noname_AT_inventati.org>
Date: Fri May 1 02:22:32 2015 +0000

    selsnap: simplify SNAP_LINE case
    
    Also make sure y never exceeds term.row-1 even if ATTR_WRAP is set for
    some reason.

diff --git a/st.c b/st.c
index 87f3ed2..789e795 100644
--- a/st.c
+++ b/st.c
_AT_@ -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;
Received on Mon May 04 2015 - 14:23:30 CEST

This archive was generated by hypermail 2.3.0 : Mon May 04 2015 - 14:24:14 CEST