Commit b554eff
Changed files (1)
kilo.c
@@ -13,7 +13,11 @@
/*** data ***/
-struct termios orig_termios;
+struct editor_config {
+ struct termios orig_termios;
+};
+
+struct editor_config E;
/*** terminal ***/
@@ -26,15 +30,15 @@ void die(const char *s) {
}
void disable_raw_mode() {
- if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_termios) == -1)
+ if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &E.orig_termios) == -1)
die("tcsetattr");
}
void enable_raw_mode() {
- if (tcgetattr(STDIN_FILENO, &orig_termios) == -1) die("tcgetattr");
+ if (tcgetattr(STDIN_FILENO, &E.orig_termios) == -1) die("tcgetattr");
atexit(disable_raw_mode);
- struct termios raw = orig_termios;
+ struct termios raw = E.orig_termios;
raw.c_lflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON);
raw.c_lflag &= ~(OPOST);
raw.c_lflag &= ~(CS8);