From: NeilBrown Date: Tue, 8 Aug 2023 22:49:22 +0000 (+1000) Subject: Change pane_resize() to return Bool X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=171a95af7bffab42b7d5c6153b5d0a83653217b7;p=edlib.git Change pane_resize() to return Bool pane_resize() now reports if any change happened. One caller wants this. Signed-off-by: NeilBrown --- diff --git a/DOC/TODO.md b/DOC/TODO.md index 0eb4a15d..143a5899 100644 --- a/DOC/TODO.md +++ b/DOC/TODO.md @@ -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 diff --git a/core-pane.c b/core-pane.c index 0ff75cf6..6a643e0f 100644 --- a/core-pane.c +++ b/core-pane.c @@ -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 bd5aa6e9..b6cae64b 100644 --- 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); diff --git a/render-lines.c b/render-lines.c index 65e90854..3ddbca1f 100644 --- a/render-lines.c +++ b/render-lines.c @@ -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);