From 92b625a334b5653070f86dbb0ccc7cef1fc64e5b Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Tue, 2 May 2017 12:52:48 -0400 Subject: [PATCH] Tweaked redraw logic to ensure content is update *after* layout so that it can be done according to window/view size --- TODO.md | 1 + lib/win.c | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/TODO.md b/TODO.md index 320bc0e..409b33e 100644 --- a/TODO.md +++ b/TODO.md @@ -14,6 +14,7 @@ Up Next: Straight-up Bugs: +* Window manager will close window without regard to modified status * fix crash on saving read-only file * fix crash on save to file that can't be created * tab inserts dont coalesce like one would expect diff --git a/lib/win.c b/lib/win.c index 52715a3..a4b52d9 100644 --- a/lib/win.c +++ b/lib/win.c @@ -166,7 +166,6 @@ static void layout(int width, int height) { /* place the status region */ view_resize(statview, 1, Regions[STATUS].width / fwidth); - view_update(statview, &(Regions[STATUS].csrx), &(Regions[STATUS].csry)); /* Place the tag region relative to status */ Regions[TAGS].y = 5 + Regions[STATUS].y + Regions[STATUS].height; @@ -175,7 +174,6 @@ static void layout(int width, int height) { size_t tagrows = view_limitrows(tagview, maxtagrows, tagcols); Regions[TAGS].height = tagrows * fheight; view_resize(tagview, tagrows, tagcols); - view_update(tagview, &(Regions[TAGS].csrx), &(Regions[TAGS].csry)); /* Place the scroll region relative to tags */ Regions[SCROLL].x = 0; @@ -189,16 +187,17 @@ static void layout(int width, int height) { Regions[EDIT].height = (height - Regions[EDIT].y - 5); Regions[EDIT].width = width - Regions[SCROLL].width - 5; view_resize(editview, Regions[EDIT].height / fheight, Regions[EDIT].width / fwidth); - view_update(editview, &(Regions[EDIT].csrx), &(Regions[EDIT].csry)); } static void onredraw(int width, int height) { size_t fheight = x11_font_height(Font); size_t fwidth = x11_font_width(Font); - /* layout and draw the three text regions */ - onupdate(); // Let the user program update the status and other content layout(width, height); + onupdate(); // Let the user program update the status and other content + view_update(win_view(STATUS), &(Regions[STATUS].csrx), &(Regions[STATUS].csry)); + view_update(win_view(TAGS), &(Regions[TAGS].csrx), &(Regions[TAGS].csry)); + view_update(win_view(EDIT), &(Regions[EDIT].csrx), &(Regions[EDIT].csry)); onlayout(); // Let the user program update the scroll bar for (int i = 0; i < SCROLL; i++) { -- 2.49.0