Skip to content

Commit

Permalink
palette: send oc on exit for color reset #285
Browse files Browse the repository at this point in the history
  • Loading branch information
dankamongmen committed Jan 18, 2020
1 parent 8695c67 commit c6d49d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lib/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ typedef struct notcurses {
char* rmkx; // leave keypad transmit mode (keypad_local)
char* getm; // get mouse events
char* initc; // set a palette entry's RGB value
char* oc; // restore original colors
bool RGBflag; // terminfo-reported "RGB" flag for 24bpc directcolor
bool CCCflag; // terminfo-reported "CCC" flag for palette set capability

Expand Down
4 changes: 4 additions & 0 deletions src/lib/notcurses.c
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@ interrogate_terminfo(notcurses* nc, const notcurses_options* opts,
term_verify_seq(&nc->sgr, "sgr");
term_verify_seq(&nc->sgr0, "sgr0");
term_verify_seq(&nc->op, "op");
term_verify_seq(&nc->oc, "oc");
term_verify_seq(&nc->clearscr, "clear");
term_verify_seq(&nc->cleareol, "el");
term_verify_seq(&nc->clearbol, "el1");
Expand Down Expand Up @@ -891,6 +892,9 @@ int notcurses_stop(notcurses* nc){
if(nc->sgr0 && term_emit("sgr0", nc->sgr0, nc->ttyfp, true)){
ret = -1;
}
if(nc->oc && term_emit("oc", nc->oc, nc->ttyfp, true)){
ret = -1;
}
ret |= notcurses_mouse_disable(nc);
ret |= tcsetattr(nc->ttyfd, TCSANOW, &nc->tpreserved);
while(nc->top){
Expand Down

0 comments on commit c6d49d0

Please sign in to comment.