mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-10 01:29:05 -04:00
revert, revert, revert my idiot change
This commit is contained in:
parent
d902dae60b
commit
36d1eaf37b
@ -724,7 +724,7 @@ ncdirect_stop_minimal(void* vnc){
|
||||
if(cnorm && tty_emit(cnorm, nc->ctermfd)){
|
||||
ret = -1;
|
||||
}
|
||||
ret |= tcsetattr(nc->ctermfd, TCSANOW, &nc->tcache.tpreserved);
|
||||
ret |= tcsetattr(nc->ctermfd, TCSANOW, &nc->tpreserved);
|
||||
ret |= close(nc->ctermfd);
|
||||
}
|
||||
ret |= ncdirect_flush(nc);
|
||||
@ -761,12 +761,12 @@ ncdirect* ncdirect_core_init(const char* termtype, FILE* outfp, uint64_t flags){
|
||||
}
|
||||
// we don't need a controlling tty for everything we do; allow a failure here
|
||||
if((ret->ctermfd = get_tty_fd(NULL, ret->ttyfp)) >= 0){
|
||||
if(tcgetattr(ret->ctermfd, &ret->tcache.tpreserved)){
|
||||
if(tcgetattr(ret->ctermfd, &ret->tpreserved)){
|
||||
fprintf(stderr, "Couldn't preserve terminal state for %d (%s)\n", ret->ctermfd, strerror(errno));
|
||||
goto err;
|
||||
}
|
||||
if(!(flags & NCDIRECT_OPTION_INHIBIT_CBREAK)){
|
||||
if(cbreak_mode(ret->ctermfd, &ret->tcache.tpreserved)){
|
||||
if(cbreak_mode(ret->ctermfd, &ret->tpreserved)){
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
@ -793,7 +793,7 @@ ncdirect* ncdirect_core_init(const char* termtype, FILE* outfp, uint64_t flags){
|
||||
|
||||
err:
|
||||
if(ret->ctermfd >= 0){
|
||||
tcsetattr(ret->ctermfd, TCSANOW, &ret->tcache.tpreserved);
|
||||
tcsetattr(ret->ctermfd, TCSANOW, &ret->tpreserved);
|
||||
}
|
||||
drop_signals(ret);
|
||||
free(ret);
|
||||
|
@ -19,6 +19,7 @@ extern "C" {
|
||||
#include <signal.h>
|
||||
#include <wctype.h>
|
||||
#include <pthread.h>
|
||||
#include <termios.h>
|
||||
#include <stdbool.h>
|
||||
#include <unictype.h>
|
||||
#include <langinfo.h>
|
||||
@ -422,6 +423,7 @@ typedef struct ncdirect {
|
||||
uint64_t channels; // current channels
|
||||
uint16_t stylemask; // current styles
|
||||
ncinputlayer input; // input layer; we're in cbreak mode
|
||||
struct termios tpreserved; // terminal state upon entry
|
||||
// some terminals (e.g. kmscon) return cursor coordinates inverted from the
|
||||
// typical order. we detect it the first time ncdirect_cursor_yx() is called.
|
||||
bool detected_cursor_inversion; // have we performed inversion testing?
|
||||
@ -504,6 +506,7 @@ typedef struct notcurses {
|
||||
ncinputlayer input; // input layer; we're in cbreak mode
|
||||
FILE* renderfp; // debugging FILE* to which renderings are written
|
||||
tinfo tcache; // terminfo cache
|
||||
struct termios tpreserved; // terminal state upon entry
|
||||
pthread_mutex_t pilelock; // guards pile list, locks resize in render
|
||||
bool suppress_banner; // from notcurses_options
|
||||
|
||||
|
@ -84,7 +84,7 @@ notcurses_stop_minimal(void* vnc){
|
||||
if(cnorm && tty_emit(cnorm, nc->ttyfd)){
|
||||
ret = -1;
|
||||
}
|
||||
ret |= tcsetattr(nc->ttyfd, TCSANOW, &nc->tcache.tpreserved);
|
||||
ret |= tcsetattr(nc->ttyfd, TCSANOW, &nc->tpreserved);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -1022,12 +1022,12 @@ notcurses* notcurses_core_init(const notcurses_options* opts, FILE* outfp){
|
||||
ret->ttyfd = get_tty_fd(ret, ret->ttyfp);
|
||||
is_linux_console(ret, !!(opts->flags & NCOPTION_NO_FONT_CHANGES));
|
||||
if(ret->ttyfd >= 0){
|
||||
if(tcgetattr(ret->ttyfd, &ret->tcache.tpreserved)){
|
||||
if(tcgetattr(ret->ttyfd, &ret->tpreserved)){
|
||||
fprintf(stderr, "Couldn't preserve terminal state for %d (%s)\n", ret->ttyfd, strerror(errno));
|
||||
free(ret);
|
||||
return NULL;
|
||||
}
|
||||
if(cbreak_mode(ret->ttyfd, &ret->tcache.tpreserved)){
|
||||
if(cbreak_mode(ret->ttyfd, &ret->tpreserved)){
|
||||
free(ret);
|
||||
return NULL;
|
||||
}
|
||||
@ -1138,7 +1138,7 @@ err:
|
||||
fclose(ret->rstate.mstreamfp);
|
||||
}
|
||||
free(ret->rstate.mstream);
|
||||
tcsetattr(ret->ttyfd, TCSANOW, &ret->tcache.tpreserved);
|
||||
tcsetattr(ret->ttyfd, TCSANOW, &ret->tpreserved);
|
||||
drop_signals(ret);
|
||||
pthread_mutex_destroy(&ret->statlock);
|
||||
pthread_mutex_destroy(&ret->pilelock);
|
||||
|
@ -8,7 +8,6 @@ extern "C" {
|
||||
// internal header, not installed
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <termios.h>
|
||||
|
||||
struct ncpile;
|
||||
struct sprixel;
|
||||
@ -126,8 +125,6 @@ typedef struct tinfo {
|
||||
// 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)
|
||||
|
||||
struct termios tpreserved; // terminal state upon entry
|
||||
} tinfo;
|
||||
|
||||
// retrieve the terminfo(5)-style escape 'e' from tdesc (NULL if undefined).
|
||||
|
Loading…
x
Reference in New Issue
Block a user