shithub: riscv

Download patch

ref: 873f381e29d4e045075f842bd8a453bdbf2b6c45
parent: ca313087c1715a0331a58c01ad104632d366f057
author: Igor Böhm <igor@9lab.org>
date: Tue Mar 15 06:49:00 EDT 2022

acme: fix hiding of top windows when loading a dump file (thanks Xiao-Yong)

When loading an acme dump file that contains a window with only one
tag line, there are cases where acme hides that window (i.e.  not even
its tag is visible).

The following commands reproduce the issue:

 % ed <<EOE
1
i
/tmp
/lib/font/bit/pelm/unicode.8.font
/lib/font/bit/pelm/unicode.8.font
          0
f          0           5         175         175           1
          5          40         175           1           0 /sys/src/cmd/acme/ Del Snarf Get | Look
f          0           4         330         330           3
          4          27         330           1           0 /tmp/ Del Snarf Get | Look
.
,w /tmp/test.dump
Q
EOE
 % window -dx 900 -dy 600  'acme -l /tmp/test.dump'

This issue was introduced in commit 47b7dc5ccd77bc247ab15cfab3a7a8f955771c70.

--- a/sys/src/cmd/acme/wind.c
+++ b/sys/src/cmd/acme/wind.c
@@ -188,6 +188,8 @@
 		w->taglines = wintaglines(w, r);
 		r1.max.y = min(r.max.y, r1.min.y + w->taglines*font->height);
 	}
+	if(Dy(r1) < font->height)
+		r1.max.y = r1.min.y+font->height;
 	/* If needed, resize & redraw tag. */
 	y = r1.max.y;
 	if(!safe || !w->tagsafe || !eqrect(w->tag.r, r1)){