|
|
@ -1629,9 +1629,6 @@ int notcurses_cursor_enable(notcurses* nc, int y, int x){
|
|
|
|
if(nc->cursory == y && nc->cursorx == x){
|
|
|
|
if(nc->cursory == y && nc->cursorx == x){
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(nc->tcache.ttyfd < 0){
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fbuf f = {};
|
|
|
|
fbuf f = {};
|
|
|
|
if(fbuf_init_small(&f)){
|
|
|
|
if(fbuf_init_small(&f)){
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
@ -1641,17 +1638,14 @@ int notcurses_cursor_enable(notcurses* nc, int y, int x){
|
|
|
|
fbuf_free(&f);
|
|
|
|
fbuf_free(&f);
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(fbuf_finalize(&f, nc->ttyfp)){
|
|
|
|
if(nc->cursory < 0){ // we weren't visible before, need cnorm
|
|
|
|
|
|
|
|
const char* cnorm = get_escape(&nc->tcache, ESCAPE_CNORM);
|
|
|
|
|
|
|
|
if(!cnorm || fbuf_emit(&f, cnorm)){
|
|
|
|
|
|
|
|
fbuf_free(&f);
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// if we were already positive, we're already visible, no need to write cnorm
|
|
|
|
|
|
|
|
if(nc->cursory >= 0 && nc->cursorx >= 0){
|
|
|
|
|
|
|
|
nc->cursory = y;
|
|
|
|
|
|
|
|
nc->cursorx = x;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const char* cnorm = get_escape(&nc->tcache, ESCAPE_CNORM);
|
|
|
|
if(fbuf_finalize(&f, nc->ttyfp)){
|
|
|
|
if(!cnorm || tty_emit(cnorm, nc->tcache.ttyfd)){
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
nc->cursory = y;
|
|
|
|
nc->cursory = y;
|
|
|
@ -1664,7 +1658,6 @@ int notcurses_cursor_disable(notcurses* nc){
|
|
|
|
logerror("Cursor is not enabled\n");
|
|
|
|
logerror("Cursor is not enabled\n");
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(nc->tcache.ttyfd >= 0){
|
|
|
|
|
|
|
|
const char* cinvis = get_escape(&nc->tcache, ESCAPE_CIVIS);
|
|
|
|
const char* cinvis = get_escape(&nc->tcache, ESCAPE_CIVIS);
|
|
|
|
if(cinvis){
|
|
|
|
if(cinvis){
|
|
|
|
if(!tty_emit(cinvis, nc->tcache.ttyfd) && !ncflush(nc->ttyfp)){
|
|
|
|
if(!tty_emit(cinvis, nc->tcache.ttyfd) && !ncflush(nc->ttyfp)){
|
|
|
@ -1673,6 +1666,5 @@ int notcurses_cursor_disable(notcurses* nc){
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|