1
0
mirror of https://github.com/alrayyes/st synced 2023-11-14 15:56:30 +00:00

selsnap: simplify SNAP_LINE case

Also make sure y never exceeds term.row-1 even if ATTR_WRAP is set for
some reason.
This commit is contained in:
noname 2015-05-01 02:22:32 +00:00 committed by Roberto E. Vargas Caballero
parent 765bb0fd14
commit 8751809aff

6
st.c
View File

@ -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;