diff --git a/kilo.c b/kilo.c index bb2dd3f..14d18af 100644 --- a/kilo.c +++ b/kilo.c @@ -13,7 +13,11 @@ /*** data ***/ -struct termios orig_termios; +struct editorConfig { + struct termios orig_termios; +}; + +struct editorConfig E; /*** terminal ***/ @@ -28,16 +32,16 @@ void die(const char* s) { } void disableRawMode() { - if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_termios) == -1) + if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &E.orig_termios) == -1) die("tcsetattr"); } void enableRawMode() { - if (tcgetattr(STDIN_FILENO, &orig_termios) == -1) + if (tcgetattr(STDIN_FILENO, &E.orig_termios) == -1) die("tcgetattr"); atexit(disableRawMode); - struct termios raw = orig_termios; + struct termios raw = E.orig_termios; raw.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON); raw.c_oflag &= ~(OPOST);