On Fri, May 12, 2017 at 12:01:52PM +0200, Hiltjo Posthuma wrote:
> On Sun, May 07, 2017 at 05:31:26PM +0200, Hiltjo Posthuma wrote:
> > Hey,
> >
> > mg crashes with certain (unicode) characters and moving the cursor to the
> > end of the line.
> >
> > The characters are printed to the screen as \nnn in vtpute() and vtcol is
> > updated, however vteeol() will write beyond the buffer.
> >
> > A test file contains the data:
> >
> > ——————————————————
> >
> > It is printed to the screen as: \342\200\224\342... etc.
> >
> > It is safer to use vtpute() here because it checks if vtcol >= 0.
> >
> > Below is a patch:
> >
> >
> > diff --git a/usr.bin/mg/display.c b/usr.bin/mg/display.c
> > index 7af723ce268..d7c22554753 100644
> > --- a/usr.bin/mg/display.c
> > +++ b/usr.bin/mg/display.c
> > @@ -381,11 +381,8 @@ vtpute(int c)
> > void
> > vteeol(void)
> > {
> > - struct video *vp;
> > -
> > - vp = vscreen[vtrow];
> > while (vtcol < ncol)
> > - vp->v_text[vtcol++] = ' ';
> > + vtpute(' ');
> > }
> >
> > /*
> >
>
Any OKs or feedback? :)
I've been private messaged that there are developments on unicode support[0]
in mg, but in the meantime it would be nice if it would not crash in this
case I think.
[0] - https://github.com/hboetes/mg/tree/display-wide-characters
--
Kind regards,
Hiltjo