tvi: redraw if screen is resized - neatvi - [fork] simple vi-type editor with U… | |
git clone git://src.adamsgaard.dk/neatvi | |
Log | |
Files | |
Refs | |
README | |
--- | |
commit c795b3c1947f41ac9ce17b769be45886e42e38a2 | |
parent 0aeab359ed17ba7247ce8cc1619a374a58ba8abe | |
Author: Ali Gholami Rudi <[email protected]> | |
Date: Wed, 20 Oct 2021 01:12:30 +0330 | |
vi: redraw if screen is resized | |
Diffstat: | |
M vi.c | 8 ++++++++ | |
1 file changed, 8 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/vi.c b/vi.c | |
t@@ -20,6 +20,7 @@ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
+#include <signal.h> | |
#include "vi.h" | |
static char vi_msg[EXLEN]; /* current message */ | |
t@@ -1044,12 +1045,19 @@ static void vc_execute(void) | |
term_push(buf, strlen(buf)); | |
} | |
+static void sigwinch(int signo) | |
+{ | |
+ vi_back(TK_CTL('l')); | |
+ vi_back(TK_CTL('c')); | |
+} | |
+ | |
static void vi(void) | |
{ | |
int xcol; | |
int mark; | |
char *ln; | |
int kmap = 0; | |
+ signal(SIGWINCH, sigwinch); | |
xtop = MAX(0, xrow - xrows / 2); | |
xoff = 0; | |
xcol = vi_off2col(xb, xrow, xoff); |