Weirdly alternate buffer works
This commit is contained in:
parent
f6eaf81d8c
commit
81581b1905
2 changed files with 4 additions and 6 deletions
5
src/io.c
5
src/io.c
|
@ -171,8 +171,6 @@ void process_key()
|
|||
switch (cmd[0]) {
|
||||
case 'q':
|
||||
if (cmd[1] == '!') {
|
||||
write(STDOUT_FILENO, "\x1b[2J", 4);
|
||||
write(STDOUT_FILENO, "\x1b[H", 3);
|
||||
exit(0);
|
||||
break;
|
||||
} else {
|
||||
|
@ -181,8 +179,7 @@ void process_key()
|
|||
vip.mode = NORMAL;
|
||||
return;
|
||||
}
|
||||
write(STDOUT_FILENO, "\x1b[2J", 4);
|
||||
write(STDOUT_FILENO, "\x1b[H", 3);
|
||||
|
||||
exit(0);
|
||||
break;
|
||||
|
||||
|
|
|
@ -10,8 +10,7 @@ extern editor vip;
|
|||
|
||||
void die(const char *s)
|
||||
{
|
||||
write(STDOUT_FILENO, "\x1b[2J", 4);
|
||||
write(STDOUT_FILENO, "\x1b[H", 3);
|
||||
write(STDOUT_FILENO, "\x1b[2J\x1b[H", 7);
|
||||
perror(s);
|
||||
exit(1);
|
||||
}
|
||||
|
@ -21,6 +20,7 @@ void reset_term()
|
|||
if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &vip.termios) == -1) {
|
||||
die("tcsetattr");
|
||||
}
|
||||
write(STDOUT_FILENO, "\x1b[2J\x1b[?1049l", 12);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -28,6 +28,7 @@ void reset_term()
|
|||
*/
|
||||
void setup_term()
|
||||
{
|
||||
write(STDOUT_FILENO, "\x1b[?1049h\x1b[2J", 12);
|
||||
if (tcgetattr(STDIN_FILENO, &vip.termios) == -1) {
|
||||
die("tcgetattr");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue