ttag tweak - plan9port - [fork] Plan 9 from user space | |
git clone git://src.adamsgaard.dk/plan9port | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit ad80f8701dbe465dba573051f725729375947a39 | |
parent d3285dcb5cd45ccea1e9a7cf439f61f771f08274 | |
Author: rsc <devnull@localhost> | |
Date: Fri, 16 Dec 2005 19:34:13 +0000 | |
ttag tweak | |
Diffstat: | |
M src/cmd/acme/wind.c | 23 +++++++++++------------ | |
1 file changed, 11 insertions(+), 12 deletions(-) | |
--- | |
diff --git a/src/cmd/acme/wind.c b/src/cmd/acme/wind.c | |
t@@ -117,25 +117,15 @@ wintaglines(Window *w, Rectangle r) | |
bufread(&w->tag.file->b, w->tag.file->b.nc-1, &rune, 1); | |
if(rune == '\n') | |
n++; | |
- | |
- /* cannot magically shrink tag - would lose focus */ | |
- if(n < w->taglines) | |
- n = w->taglines; | |
- | |
- /* on initial expansion, create an extra line */ | |
- if(n < 2){ | |
- rune = '\n'; | |
- textinsert(&w->tag, w->tag.file->b.nc, &rune, 1, TRUE); | |
- n = 2; | |
- } | |
return n; | |
} | |
int | |
winresize(Window *w, Rectangle r, int safe, int keepextra) | |
{ | |
- int y; | |
+ int y, mouseintag; | |
Image *b; | |
+ Point p; | |
Rectangle br, r1; | |
if(0) fprint(2, "winresize %d %R safe=%d keep=%d h=%d\n", w->id, r, safe, keep… | |
t@@ -149,7 +139,9 @@ if(0) fprint(2, "winresize %d %R safe=%d keep=%d h=%d\n", … | |
r1 = r; | |
r1.max.y = min(r.max.y, r1.min.y + w->taglines*font->height); | |
y = r1.max.y; | |
+ mouseintag = ptinrect(mouse->xy, w->tag.all); | |
if(1 || !safe || !w->tagsafe || !eqrect(w->tag.all, r1)){ | |
+ | |
w->taglines = wintaglines(w, r); | |
w->tagsafe = TRUE; | |
} | |
t@@ -170,6 +162,13 @@ if(0) fprint(2, "=> %R (%R)\n", w->tag.all, w->tag.fr.r); | |
br.max.x = br.min.x + Dx(b->r); | |
br.max.y = br.min.y + Dy(b->r); | |
draw(screen, br, b, nil, b->r.min); | |
+/* TAG */ | |
+ if(mouseintag && !ptinrect(mouse->xy, w->tag.all)){ | |
+ p = mouse->xy; | |
+ p.y = w->tag.all.max.y-3; | |
+ moveto(mousectl, p); | |
+ } | |
+/* END TAG */ | |
} | |