diff options
author | Igor Böhm <igor@9lab.org> | 2022-01-04 19:11:07 +0000 |
---|---|---|
committer | Igor Böhm <igor@9lab.org> | 2022-01-04 19:11:07 +0000 |
commit | 47b7dc5ccd77bc247ab15cfab3a7a8f955771c70 (patch) | |
tree | 659c75b40c289523ac430ac90fa579749cab520d /sys/src/cmd/acme/text.c | |
parent | 369cba5f938d3f804210b6e09d36c6f7ecb017fa (diff) |
acme: fix window and scrollbar display glitches at bottom fringe of column
The following patch fixes acme display glitches at the bottom fringe
of columns when adding/moving/resizing windows.
Here an example of an easy to reproduce case:
• https://invidio.xamh.de/watch?v=iLekQrxycaM
…opening acme and resizing a column to the right is all that is needed.
The functions winresize(…) and textresize(…) are extended with an
additional parameter `fillfringe` to indicate if a window/tag shall
fill a potential fringe area that would otherwise remain white.
The changes have been inspired by the approach taken in plan9port
acme.
Diffstat (limited to 'sys/src/cmd/acme/text.c')
-rw-r--r-- | sys/src/cmd/acme/text.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/sys/src/cmd/acme/text.c b/sys/src/cmd/acme/text.c index b313ed4a4..3aed6f828 100644 --- a/sys/src/cmd/acme/text.c +++ b/sys/src/cmd/acme/text.c @@ -68,14 +68,14 @@ textredraw(Text *t, Rectangle r, Font *f, Image *b, int odx) } int -textresize(Text *t, Rectangle r) +textresize(Text *t, Rectangle r, int fillfringe) { int odx; - if(Dy(r) > 0) - r.max.y -= Dy(r)%t->font->height; - else + if(Dy(r) <= 0) r.max.y = r.min.y; + else if(!fillfringe) + r.max.y -= Dy(r)%t->font->height; odx = Dx(t->all); t->all = r; t->scrollr = r; @@ -84,7 +84,14 @@ textresize(Text *t, Rectangle r) r.min.x += Scrollwid+Scrollgap; frclear(t, 0); textredraw(t, r, t->font, t->b, odx); - return r.max.y; + if(fillfringe && t->r.max.y < t->all.max.y){ + /* draw background in bottom fringe of text window */ + r.min.x -= Scrollgap; + r.min.y = t->r.max.y; + r.max.y = t->all.max.y; + draw(screen, r, t->cols[BACK], nil, ZP); + } + return t->all.max.y; } void @@ -276,7 +283,7 @@ textload(Text *t, uint q0, char *file, int setqid) if(u != t){ if(u->org > u->file->nc) /* will be 0 because of reset(), but safety first */ u->org = 0; - textresize(u, u->all); + textresize(u, u->all, TRUE); textbacknl(u, u->org, 0); /* go to beginning of line */ } textsetselect(u, q0, q0); |