|
|
@ -1103,6 +1103,10 @@ int ncdirect_fg(ncdirect* nc, unsigned rgb){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int notcurses_cursor_enable(notcurses* nc, int y, int x){
|
|
|
|
int notcurses_cursor_enable(notcurses* nc, int y, int x){
|
|
|
|
|
|
|
|
if(nc->cursory >= 0 || nc->cursorx >= 0){
|
|
|
|
|
|
|
|
logerror(nc, "Cursor is already enabled\n");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
if(y < 0 || x < 0){
|
|
|
|
if(y < 0 || x < 0){
|
|
|
|
logerror(nc, "Illegal cursor placement: %d, %d\n", y, x);
|
|
|
|
logerror(nc, "Illegal cursor placement: %d, %d\n", y, x);
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
@ -1113,25 +1117,28 @@ int notcurses_cursor_enable(notcurses* nc, int y, int x){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(nc->ttyfd >= 0){
|
|
|
|
if(nc->ttyfd >= 0){
|
|
|
|
if(nc->tcache.cnorm){
|
|
|
|
if(nc->tcache.cnorm){
|
|
|
|
if(stage_cursor(nc, nc->ttyfp, y, x) || fflush(nc->ttyfp)){
|
|
|
|
if(stage_cursor(nc, nc->ttyfp, y, x) == 0){
|
|
|
|
return -1;
|
|
|
|
if(!tty_emit("cnorm", nc->tcache.cnorm, nc->ttyfd) && !fflush(nc->ttyfp)){
|
|
|
|
}
|
|
|
|
|
|
|
|
nc->cursory = y;
|
|
|
|
nc->cursory = y;
|
|
|
|
nc->cursorx = x;
|
|
|
|
nc->cursorx = x;
|
|
|
|
if(tty_emit("cnorm", nc->tcache.cnorm, nc->ttyfd) == 0){
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int notcurses_cursor_disable(notcurses* nc){
|
|
|
|
int notcurses_cursor_disable(notcurses* nc){
|
|
|
|
nc->cursory = -1;
|
|
|
|
if(nc->cursorx < 0 || nc->cursory < 0){
|
|
|
|
nc->cursorx = -1;
|
|
|
|
logerror(nc, "Cursor is not enabled");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
if(nc->ttyfd >= 0){
|
|
|
|
if(nc->ttyfd >= 0){
|
|
|
|
if(nc->tcache.civis){
|
|
|
|
if(nc->tcache.civis){
|
|
|
|
if(tty_emit("civis", nc->tcache.civis, nc->ttyfd) == 0){
|
|
|
|
if(!tty_emit("civis", nc->tcache.civis, nc->ttyfd) && !fflush(nc->ttyfp)){
|
|
|
|
|
|
|
|
nc->cursory = -1;
|
|
|
|
|
|
|
|
nc->cursorx = -1;
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1140,7 +1147,12 @@ int notcurses_cursor_disable(notcurses* nc){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int notcurses_cursor_move_yx(notcurses* nc, int y, int x){
|
|
|
|
int notcurses_cursor_move_yx(notcurses* nc, int y, int x){
|
|
|
|
if(nc->cursory >= 0 && nc->cursorx >= 0){
|
|
|
|
if(nc->cursory < 0 || nc->cursorx < 0){
|
|
|
|
|
|
|
|
logerror(nc, "Cursor is not enabled");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(y < 0 || x < 0){
|
|
|
|
|
|
|
|
logerror(nc, "Illegal cursor placement: %d, %d\n", y, x);
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(stage_cursor(nc, nc->ttyfp, y, x) || fflush(nc->ttyfp)){
|
|
|
|
if(stage_cursor(nc, nc->ttyfp, y, x) || fflush(nc->ttyfp)){
|
|
|
|