prepare a cursor report queue #1692

pull/1923/head
nick black 3 years ago committed by nick black
parent 3df88384cd
commit 9746a06bde

@ -429,15 +429,21 @@ handle_queued_input(ncinputlayer* nc, ncinput* ni, int leftmargin, int topmargin
if(ni == NULL){
ni = &nireal;
}
// if there was some error in getc(), we still dole out the existing queue
if(nc->inputbuf_occupied == 0){
return -1;
}
int r = pop_input_keypress(nc);
char32_t ret = handle_getc(nc, r, ni, leftmargin, topmargin);
if(ret != (char32_t)-1){
ni->id = ret;
}
char32_t ret;
do{
// if there was some error in getc(), we still dole out the existing queue
if(nc->inputbuf_occupied == 0){
return -1;
}
int r = pop_input_keypress(nc);
ret = handle_getc(nc, r, ni, leftmargin, topmargin);
if(ret != (char32_t)-1){
ni->id = ret;
}
if(ret == NCKEY_CURSOR_LOCATION_REPORT){
// process this internally
}
}while(ret == NCKEY_CURSOR_LOCATION_REPORT);
return ret;
}

@ -145,6 +145,7 @@ void notcurses_stats_reset(notcurses* nc, ncstats* stats){
stash->sprixelelisions += nc->stats.sprixelelisions;
stash->sprixelbytes += nc->stats.sprixelbytes;
stash->appsync_updates += nc->stats.appsync_updates;
stash->input_errors += nc->stats.input_errors;
stash->fbbytes = nc->stats.fbbytes;
stash->planes = nc->stats.planes;
@ -193,13 +194,11 @@ void summarize_stats(notcurses* nc){
totalbuf, minbuf, avgbuf, maxbuf);
}
if(stats->renders || stats->failed_renders){
fprintf(stderr, "%ju failed render%s, %ju failed raster%s, %ju refresh%s\n",
stats->failed_renders,
stats->failed_renders == 1 ? "" : "s",
stats->failed_writeouts,
stats->failed_writeouts == 1 ? "" : "s",
stats->refreshes,
stats->refreshes == 1 ? "" : "es");
fprintf(stderr, "%ju failed render%s, %ju failed raster%s, %ju refresh%s, %ju input error%s\n",
stats->failed_renders, stats->failed_renders == 1 ? "" : "s",
stats->failed_writeouts, stats->failed_writeouts == 1 ? "" : "s",
stats->refreshes, stats->refreshes == 1 ? "" : "es",
stats->input_errors, stats->input_errors == 1 ? "" : "s");
fprintf(stderr, "RGB emits:elides: def %ju:%ju fg %ju:%ju bg %ju:%ju\n",
stats->defaultemissions,
stats->defaultelisions,

@ -69,6 +69,15 @@ typedef enum {
ESCAPE_MAX
} escape_e;
// when we read a cursor report, we put it on the queue for internal
// processing. this is necessary since it can be arbitrarily interleaved with
// other input when stdin is connected to our terminal. these are already
// processed to be 0-based.
typedef struct cursorreport {
int x, y;
struct cursorreport* next;
} cursorreport;
// we read input from one or two places. if stdin is connected to our
// controlling tty, we read only from that file descriptor. if it is
// connected to something else, and we have a controlling tty, we will
@ -93,6 +102,7 @@ typedef struct ncinputlayer {
// be reset (semantics are relied upon by widgets for mouse click detection).
uint64_t input_events;
struct esctrie* inputescapes; // trie of input escapes -> ncspecial_keys
cursorreport* creport_queue; // queue of cursor reports
} ncinputlayer;
// terminal interface description. most of these are acquired from terminfo(5)
@ -148,12 +158,12 @@ typedef struct tinfo {
// less one times the cell height. sixel_maxy is thus recomputed whenever
// we get a resize event. it is only defined if we have sixel_maxy_pristine,
// so kitty graphics (which don't force a scroll) never deal with this.
int sixel_maxy; // maximum working sixel height
int sixel_maxy_pristine; // maximum theoretical sixel height, as queried
int sixel_maxy; // maximum working sixel height
int sixel_maxy_pristine; // maximum theoretical sixel height, as queried
int sprixel_scale_height; // sprixel must be a multiple of this many rows
const char* termname; // terminal name from environment variables/init
char* termversion; // terminal version (freeform) from query responses
struct termios tpreserved; // terminal state upon entry
struct termios tpreserved;// terminal state upon entry
ncinputlayer input; // input layer
int default_rows; // LINES environment var / lines terminfo / 24

Loading…
Cancel
Save