add chord fix from plan 9

This commit is contained in:
rsc 2006-02-06 23:10:48 +00:00
parent 6cb755b60b
commit 8b9a1d4cfe
2 changed files with 10 additions and 7 deletions

View file

@ -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;
}