fixups for nixos
This commit is contained in:
24
main.c
24
main.c
@@ -867,11 +867,25 @@ delete_region(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
kwrite(const int fd, const char *buf, const int len)
|
||||||
|
{
|
||||||
|
int wlen = 0;
|
||||||
|
|
||||||
|
wlen = write(fd, buf, len);
|
||||||
|
assert(wlen != -1);
|
||||||
|
assert(wlen == len);
|
||||||
|
if (wlen == -1) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
die(const char *s)
|
die(const char *s)
|
||||||
{
|
{
|
||||||
(void)write(STDOUT_FILENO, "\x1b[2J", 4);
|
kwrite(STDOUT_FILENO, "\x1b[2J", 4);
|
||||||
(void)write(STDOUT_FILENO, "\x1b[H", 3);
|
kwrite(STDOUT_FILENO, "\x1b[H", 3);
|
||||||
|
|
||||||
perror(s);
|
perror(s);
|
||||||
exit(1);
|
exit(1);
|
||||||
@@ -2150,8 +2164,8 @@ void
|
|||||||
display_clear(struct abuf *ab)
|
display_clear(struct abuf *ab)
|
||||||
{
|
{
|
||||||
if (ab == NULL) {
|
if (ab == NULL) {
|
||||||
(void)write(STDOUT_FILENO, ESCSEQ "2J", 4);
|
kwrite(STDOUT_FILENO, ESCSEQ "2J", 4);
|
||||||
(void)write(STDOUT_FILENO, ESCSEQ "H", 3);
|
kwrite(STDOUT_FILENO, ESCSEQ "H", 3);
|
||||||
} else {
|
} else {
|
||||||
ab_append(ab, ESCSEQ "2J", 4);
|
ab_append(ab, ESCSEQ "2J", 4);
|
||||||
ab_append(ab, ESCSEQ "H", 3);
|
ab_append(ab, ESCSEQ "H", 3);
|
||||||
@@ -2365,7 +2379,7 @@ display_refresh(void)
|
|||||||
/* ab_append(&ab, ESCSEQ "1;2H", 7); */
|
/* ab_append(&ab, ESCSEQ "1;2H", 7); */
|
||||||
ab_append(&ab, ESCSEQ "?25h", 6);
|
ab_append(&ab, ESCSEQ "?25h", 6);
|
||||||
|
|
||||||
(void)write(STDOUT_FILENO, ab.b, ab.len);
|
kwrite(STDOUT_FILENO, ab.b, ab.len);
|
||||||
ab_free(&ab);
|
ab_free(&ab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user