selsnap: simplify SNAP_LINE case Also make sure y never exceeds term.row-1 even if ATTR_WRAP is set for some reason.
noname noname@inventati.org
1 files changed,
3 insertions(+),
3 deletions(-)
jump to
M
st.c
→
st.c
@@ -772,15 +772,15 @@ * has set ATTR_WRAP at its end. Then the whole next or
* 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;