invert DECSDM for terminals with sprixel_cursor_hack set #1782

pull/1792/head
nick black 3 years ago committed by Nick Black
parent 574eef2e28
commit fc390da020

@ -867,7 +867,7 @@ int sixel_destroy(const notcurses* nc, const ncpile* p, FILE* out, sprixel* s);
int kitty_destroy(const notcurses* nc, const ncpile* p, FILE* out, sprixel* s);
int kitty_remove(int id, FILE* out);
int kitty_clear_all(int fd);
int sixel_init(int fd);
int sixel_init(const tinfo* t, int fd);
int sprite_init(const tinfo* t, int fd);
int sprite_clear_all(const tinfo* t, int fd);
int kitty_shutdown(int fd);

@ -859,10 +859,15 @@ int sixel_draw(const ncpile* p, sprixel* s, FILE* out){
return 0;
}
int sixel_init(int fd){
int sixel_init(const tinfo* ti, int fd){
// \e[?8452: DECSDM private "sixel scrolling" mode keeps the sixel from
// scrolling, but puts it at the current cursor location (as opposed to
// the upper left corner of the screen).
if(ti->sprixel_cursor_hack){
// except MLterm (and a few others, possibly including the physical VT340),
// which inverts the usual sense of DECSDM.
return tty_emit("\e[?80l\e[?8452h", fd);
}
return tty_emit("\e[?80;8452h", fd);
}

@ -205,7 +205,7 @@ int sprite_init(const tinfo* t, int fd){
if(t->pixel_init == NULL){
return 0;
}
return t->pixel_init(fd);
return t->pixel_init(t, fd);
}
uint8_t* sprixel_auxiliary_vector(const sprixel* s){

@ -126,7 +126,7 @@ typedef struct tinfo {
// perform the inverse of pixel_wipe, restoring an annihilated sprixcell.
int (*pixel_rebuild)(struct sprixel* s, int y, int x, uint8_t* auxvec);
int (*pixel_remove)(int id, FILE* out); // kitty only, issue actual delete command
int (*pixel_init)(int fd); // called when support is detected
int (*pixel_init)(const struct tinfo*, int fd); // called when support is detected
int (*pixel_draw)(const struct ncpile* p, struct sprixel* s, FILE* out);
int (*pixel_shutdown)(int fd); // called during context shutdown
int (*pixel_clear_all)(int fd); // called during startup, kitty only
@ -140,8 +140,10 @@ typedef struct tinfo {
bool AMflag; // "AM" flag for automatic movement to next line
// mlterm resets the cursor (i.e. makes it visible) any time you print
// a sprixel. we work around this spiritedly unorthodox decision.
bool sprixel_cursor_hack; // do sprixels reset the cursor? (mlterm)
// a sprixel. we work around this spiritedly unorthodox decision. it
// furthermore interprets DECSDM in the reverse sense of most terminals
// (though possibly in conformance with the actual VT340).
bool sprixel_cursor_hack; // mlterm fixes
} tinfo;
// retrieve the terminfo(5)-style escape 'e' from tdesc (NULL if undefined).

Loading…
Cancel
Save