commit 5b2b4c031ad9fb766fe739f3ed767a0235179ecf
parent 834da0c67cdf325d910899a426463b1ddff09a67
Author: ssnf <ssnf@ssnf.xyz>
Date: Fri, 12 Aug 2022 11:45:48 +0000
fix for wrong Frame data when resizing the terminal
Diffstat:
M | sim.c | | | 18 | ++++++++++++++++-- |
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/sim.c b/sim.c
@@ -109,6 +109,7 @@ static void fr_zero(Frame*);
static void gmove(int arg);
static void paste(int arg);
static void pline();
+static void resize();
static void search(int arg);
static int selection(int arg);
static void str_init(String* p);
@@ -463,7 +464,7 @@ insert(int arg)
break;
}
for (;;) {
- win_query(&w);
+ resize();
fr_update();
switch (c.s[0] = fgetc(stdin)) {
case Esc:
@@ -853,6 +854,19 @@ pline()
}
static void
+resize()
+{
+ Window wt;
+
+ win_query(&wt);
+ if (wt.wx != w.wx || wt.wy != w.wy) {
+ w.wx = wt.wx;
+ w.wy = wt.wy;
+ fr_zero(fr);
+ }
+}
+
+static void
search(int arg)
{
Posn pos;
@@ -1079,7 +1093,7 @@ main(int argc, char* argv[])
file_load(f);
}
for (;;) {
- win_query(&w);
+ resize();
fr_update();
c = fgetc(stdin);
for (i = 0; i < LENGTH(keys); ++i) {