aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/acme/wind.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/acme/wind.c')
-rw-r--r--src/cmd/acme/wind.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cmd/acme/wind.c b/src/cmd/acme/wind.c
index 2b0369dd..a2106ed2 100644
--- a/src/cmd/acme/wind.c
+++ b/src/cmd/acme/wind.c
@@ -115,9 +115,12 @@ wintaglines(Window *w, Rectangle r)
/* if tag ends with \n, include empty line at end for typing */
n = w->tag.fr.nlines;
- bufread(&w->tag.file->b, w->tag.file->b.nc-1, &rune, 1);
+ if(w->tag.file->b.nc > 0)
+ bufread(&w->tag.file->b, w->tag.file->b.nc-1, &rune, 1);
if(rune == '\n')
n++;
+ if(n == 0)
+ n = 1;
return n;
}