]> git.neil.brown.name Git - edlib.git/commitdiff
Change pane_resize() to return Bool
authorNeilBrown <neil@brown.name>
Tue, 8 Aug 2023 22:49:22 +0000 (08:49 +1000)
committerNeilBrown <neil@brown.name>
Fri, 11 Aug 2023 04:36:17 +0000 (14:36 +1000)
pane_resize() now reports if any change happened.
One caller wants this.

Signed-off-by: NeilBrown <neil@brown.name>
DOC/TODO.md
core-pane.c
core.h
render-lines.c

index 0eb4a15d964ef3facb5a7cc3ff2c40929e787e57..143a58999a5c3420d7824d3871992b4e824281ce 100644 (file)
@@ -17,7 +17,7 @@ the file.
 - [X] revalidate_start shouldn't find cursor on line where it is known
       not to be
 - [X] call_render_line_to_point() never returns negative - why do we check?
-- [ ] should pane_resize() report if any change happened?
+- [X] should pane_resize() report if any change happened?
 - [ ] I think I want a "Workspaces" concept, maybe tabbed set of tile
       collections.  I would have one of mail and one for each project
       that I might be looking in.  I have lots of documents, but few
index 0ff75cf63d7829f95e6c08fa305547f210c2e1f9..6a643e0f91a5a407eeaa3d5a31989d77a4fcedb3 100644 (file)
@@ -637,7 +637,7 @@ void pane_free(struct pane *p safe)
                unalloc_safe(p, pane);
 }
 
-void pane_resize(struct pane *p safe, int x, int y, int w, int h)
+bool pane_resize(struct pane *p safe, int x, int y, int w, int h)
 {
        int damage = 0;
 
@@ -662,6 +662,7 @@ void pane_resize(struct pane *p safe, int x, int y, int w, int h)
        pane_damaged(p, damage);
        if (damage)
                pane_notify("Notify:resize", p);
+       return !!damage;
 }
 
 void pane_reparent(struct pane *p safe, struct pane *newparent safe)
diff --git a/core.h b/core.h
index bd5aa6e9893bb97c0327e8f2e43eaa6e711006f8..b6cae64b52704ef143bf278c6a172b7da1b56d0d 100644 (file)
--- a/core.h
+++ b/core.h
@@ -471,7 +471,7 @@ void pane_reparent(struct pane *p safe, struct pane *newparent safe);
 void pane_move_after(struct pane *p safe, struct pane *after);
 void pane_subsume(struct pane *p safe, struct pane *parent safe);
 void pane_close(struct pane *p safe);
-void pane_resize(struct pane *p safe, int x, int y, int w, int h);
+bool pane_resize(struct pane *p safe, int x, int y, int w, int h);
 void pane_focus(struct pane *p);
 bool pane_has_focus(struct pane *p);
 void pane_damaged(struct pane *p, int type);
index 65e90854cff096cc84b05b8b83247bdca6f8bc0e..3ddbca1f7389a48b80191b876588aac3e0bfe2cd 100644 (file)
@@ -821,9 +821,8 @@ static void find_lines(struct mark *pm safe, struct pane *p safe,
             m && m->mdata ; m = vmark_next(m)) {
                struct pane *hp = m->mdata;
                int cols;
-               hp->damaged &= ~DAMAGED_SIZE;
-               pane_resize(hp, hp->x, y, hp->w, hp->h);
-               if (hp->damaged & DAMAGED_SIZE && !rl->background_uniform)
+               if (pane_resize(hp, hp->x, y, hp->w, hp->h) &&
+                   !rl->background_uniform)
                        pane_damaged(hp, DAMAGED_REFRESH);
                y += hp->h;
                cols = pane_attr_get_int(hp, "width", 0);