stage_cursor(): verify cuf1/cuf before using them #789

pull/816/head
nick black 4 years ago
parent 3aedec2501
commit 889f02bf6e
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -734,13 +734,15 @@ stage_cursor(notcurses* nc, FILE* out, int y, int x){
if(nc->rstate.y == y){ // only need move x
const int xdiff = x - nc->rstate.x;
if(xdiff > 0){
if(xdiff == 1){
ret = term_emit("cuf1", tiparm(nc->tcache.cuf1), out, false);
}else{
ret = term_emit("cuf", tiparm(nc->tcache.cuf, xdiff), out, false);
if(nc->tcache.cuf && nc->tcache.cuf1){
if(xdiff == 1){
ret = term_emit("cuf1", tiparm(nc->tcache.cuf1), out, false);
}else{
ret = term_emit("cuf", tiparm(nc->tcache.cuf, xdiff), out, false);
}
nc->rstate.x = x;
return ret;
}
nc->rstate.x = x;
return ret;
}else if(xdiff == 0){
return 0; // no move needed
}

Loading…
Cancel
Save