mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
raster: use terminfo indn to scroll multiple lines
This commit is contained in:
parent
b2480b36fe
commit
7ebd471471
@ -400,6 +400,7 @@ tinfo_debug_styles(const notcurses* nc, struct ncplane* n, const char* indent){
|
||||
tinfo_debug_cap(n, "u7", get_escape(ti, ESCAPE_U7));
|
||||
tinfo_debug_cap(n, "ccc", ti->caps.can_change_colors);
|
||||
tinfo_debug_cap(n, "rgb", ti->caps.rgb);
|
||||
tinfo_debug_cap(n, "csr", get_escape(ti, ESCAPE_CSR));
|
||||
finish_line(n);
|
||||
ncplane_putstr(n, indent);
|
||||
tinfo_debug_cap(n, "utf8", ti->caps.utf8);
|
||||
@ -408,6 +409,7 @@ tinfo_debug_styles(const notcurses* nc, struct ncplane* n, const char* indent){
|
||||
tinfo_debug_cap(n, "braille", ti->caps.braille);
|
||||
tinfo_debug_cap(n, "images", notcurses_canopen_images(nc));
|
||||
tinfo_debug_cap(n, "video", notcurses_canopen_videos(nc));
|
||||
tinfo_debug_cap(n, "indn", get_escape(ti, ESCAPE_INDN));
|
||||
finish_line(n);
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,9 @@ static inline int
|
||||
fbuf_flush(fbuf* f, FILE* fp){
|
||||
int ret = 0;
|
||||
if(f->used){
|
||||
if(blocking_write(fileno(fp), f->buf, f->used)){
|
||||
if(fflush(fp) == EOF){
|
||||
ret = -1;
|
||||
}else if(blocking_write(fileno(fp), f->buf, f->used)){
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
@ -296,7 +298,9 @@ static inline int
|
||||
fbuf_finalize(fbuf* f, FILE* fp){
|
||||
int ret = 0;
|
||||
if(f->used){
|
||||
if(blocking_write(fileno(fp), f->buf, f->used)){
|
||||
if(fflush(fp) == EOF){
|
||||
ret = -1;
|
||||
}else if(blocking_write(fileno(fp), f->buf, f->used)){
|
||||
ret = -1;
|
||||
}
|
||||
}
|
||||
|
@ -935,8 +935,22 @@ rasterize_scrolls(ncpile* p, fbuf* f){
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
while(p->scrolls){
|
||||
if(fbuf_putc(f, '\n') < 0){
|
||||
if(p->scrolls > 1){
|
||||
const char* indn = get_escape(&p->nc->tcache, ESCAPE_INDN);
|
||||
if(indn){
|
||||
if(fbuf_emit(f, tiparm(indn, p->scrolls)) < 0){
|
||||
return -1;
|
||||
}
|
||||
p->scrolls = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
const char* ind = get_escape(&p->nc->tcache, ESCAPE_IND);
|
||||
if(ind == NULL){
|
||||
ind = "\v";
|
||||
}
|
||||
while(p->scrolls > 0){
|
||||
if(fbuf_emit(f, ind) < 0){
|
||||
return -1;
|
||||
}
|
||||
--p->scrolls;
|
||||
|
@ -775,7 +775,10 @@ int interrogate_terminfo(tinfo* ti, const char* termtype, FILE* out, unsigned ut
|
||||
{ ESCAPE_RMUL, "rmul", },
|
||||
{ ESCAPE_SC, "sc", },
|
||||
{ ESCAPE_RC, "rc", },
|
||||
{ ESCAPE_IND, "ind", },
|
||||
{ ESCAPE_INDN, "indn", },
|
||||
{ ESCAPE_CLEAR, "clear", },
|
||||
{ ESCAPE_CSR, "csr", },
|
||||
{ ESCAPE_OC, "oc", },
|
||||
{ ESCAPE_RMKX, "rmkx", },
|
||||
{ ESCAPE_U7, "u7", },
|
||||
|
@ -60,12 +60,15 @@ typedef enum {
|
||||
ESCAPE_SMULX, // "Smulx" deparameterized: start extended underline
|
||||
ESCAPE_SMULNOX, // "Smulx" deparameterized: kill underline
|
||||
ESCAPE_RMXX, // "rmxx" end struckout
|
||||
ESCAPE_IND, // "ind" scroll 1 line up
|
||||
ESCAPE_INDN, // "indn" scroll n lines up
|
||||
ESCAPE_SC, // "sc" push the cursor onto the stack
|
||||
ESCAPE_RC, // "rc" pop the cursor off the stack
|
||||
ESCAPE_CLEAR, // "clear" clear screen and home cursor
|
||||
ESCAPE_INITC, // "initc" set up palette entry
|
||||
ESCAPE_GETM, // "getm" get mouse events
|
||||
ESCAPE_U7, // "u7" cursor position report
|
||||
ESCAPE_CSR, // "csr" change scroll region
|
||||
// Application synchronized updates, not present in terminfo
|
||||
// (https://gitlab.com/gnachman/iterm2/-/wikis/synchronized-updates-spec)
|
||||
ESCAPE_BSUM, // Begin Synchronized Update Mode
|
||||
|
Loading…
x
Reference in New Issue
Block a user