Re: pretty borders for slitherins

2019-09-26 Thread Ted Unangst
Nicholas Marriott wrote:
> OK seems like it is always using ACS which is correct.
> 
> I just remembered jmc asked me about this before and it turned out that
> ACS doesn't work with the DRM console - I don't think the font have the
> right symbol for either ACS or UTF-8 line drawing, but there may be
> other problems in there as well.
> 
> If you are using DRM you can set TERM to pccon0 which is a variant with
> ASCII line drawing and ncurses will use ASCII for line drawing.

ah, yes, env TERM=pccon0 causes correct fallback to --|| style lines.



Re: pretty borders for slitherins

2019-09-26 Thread Nicholas Marriott
OK seems like it is always using ACS which is correct.

I just remembered jmc asked me about this before and it turned out that
ACS doesn't work with the DRM console - I don't think the font have the
right symbol for either ACS or UTF-8 line drawing, but there may be
other problems in there as well.

If you are using DRM you can set TERM to pccon0 which is a variant with
ASCII line drawing and ncurses will use ASCII for line drawing.




On Wed, Sep 25, 2019 at 05:02:17PM -0500, Scott Cheloha wrote:
> On Wed, Sep 25, 2019 at 08:29:47PM +0100, Nicholas Marriott wrote:
> > It will use either UTF-8 characters or the ACS characters from TERM.
> > 
> > The way it decides which is somewhat confusing and it looks like it is
> > choosing to use UTF-8 even when I wouldn't expect it to so I'm not sure
> > it is actually working correctly in our ncurses version.
> > 
> > I don't think UTF-8 line drawing works properly, at least with the DRM
> > wscons.
> > 
> > What do you have in TERM now? Can you see if the borders are OK with
> > "TERM=xterm snake"? This seems to use ACS rather than UTF-8. If it does
> > I'll see if I can figure out why it choosing UTF-8 borders for the
> > others.
> 
> In wscons I have vt220.  The borders are even more screwy with
> `TERM=xterm snake` in the wscons.  Now you have pairs of question
> marks instead of just a single '?'.
> 
> The (maybe not so) odd thing is that in a real xterm if I do
> `TERM=vt220 snake` the borders are fine.  So yeah, I don't know how
> our ncurses is deciding what to do.
> 
> > You can run it in script(1) to see what it is using for the border (lots
> > of 'q' or 'x' means ACS).
> 
> I see a string of 'q' in the typescript when in the xterm and TERM=xterm:
> 
> ESC[?1049hESC[1;24rESC(BESC[mESC[4lESC[?7hESC[?1hESC=ESC[HESC[2J Worm
> ESC(0ESC[0mlqkESC(B
> ESC(0ESC[0mxESC(BESC[79GESC(0ESC[0mxESC(B
> ESC(0ESC[0mxESC(BESC[79GESC(0ESC[0mxESC(B
> 
> in xterm when TERM=vt220:
> 
> ESC)0ESC[1;24rESC[mESC(BESC[4lESC[?7hESC[HESC[J Worm
> ESC[0mESC(0lqkESC(B
> ESC[0mESC(0xESC(BESC[77CESC[0mESC(0xESC(B
> ESC[0mESC(0xESC(BESC[77CESC[0mESC(0xESC(B
> 
> in wscons when TERM=vt220:
> 
> ESC)0ESC[1;45rESC[mESC(BESC[4lESC[?7hESC[HESC[J Worm
> ESC[0mESC(0lqkESC(B
> ESC[0mESC(0xESC(BESC[157CESC[0mESC(0xESC(B
> ESC[0mESC(0xESC(BESC[157CESC[0mESC(0xESC(B
> 
> in wscons when TERM=xterm:
> 
> ESC[?1049hESC[1;45rESC(BESC[mESC[4lESC[?7hESC[?1hESC=ESC[HESC[2J Worm
> ESC(0ESC[0mlqkESC(B
> ESC(0ESC[0mxESC(BESC[159GESC(0ESC[0mxESC(B
> ESC(0ESC[0mxESC(BESC[159GESC(0ESC[0mxESC(B
> 
> ... so it's doing something based on TERM.



Re: pretty borders for slitherins

2019-09-25 Thread Scott Cheloha
On Wed, Sep 25, 2019 at 08:29:47PM +0100, Nicholas Marriott wrote:
> It will use either UTF-8 characters or the ACS characters from TERM.
> 
> The way it decides which is somewhat confusing and it looks like it is
> choosing to use UTF-8 even when I wouldn't expect it to so I'm not sure
> it is actually working correctly in our ncurses version.
> 
> I don't think UTF-8 line drawing works properly, at least with the DRM
> wscons.
> 
> What do you have in TERM now? Can you see if the borders are OK with
> "TERM=xterm snake"? This seems to use ACS rather than UTF-8. If it does
> I'll see if I can figure out why it choosing UTF-8 borders for the
> others.

In wscons I have vt220.  The borders are even more screwy with
`TERM=xterm snake` in the wscons.  Now you have pairs of question
marks instead of just a single '?'.

The (maybe not so) odd thing is that in a real xterm if I do
`TERM=vt220 snake` the borders are fine.  So yeah, I don't know how
our ncurses is deciding what to do.

> You can run it in script(1) to see what it is using for the border (lots
> of 'q' or 'x' means ACS).

I see a string of 'q' in the typescript when in the xterm and TERM=xterm:

ESC[?1049hESC[1;24rESC(BESC[mESC[4lESC[?7hESC[?1hESC=ESC[HESC[2J Worm
ESC(0ESC[0mlqkESC(B
ESC(0ESC[0mxESC(BESC[79GESC(0ESC[0mxESC(B
ESC(0ESC[0mxESC(BESC[79GESC(0ESC[0mxESC(B

in xterm when TERM=vt220:

ESC)0ESC[1;24rESC[mESC(BESC[4lESC[?7hESC[HESC[J Worm
ESC[0mESC(0lqkESC(B
ESC[0mESC(0xESC(BESC[77CESC[0mESC(0xESC(B
ESC[0mESC(0xESC(BESC[77CESC[0mESC(0xESC(B

in wscons when TERM=vt220:

ESC)0ESC[1;45rESC[mESC(BESC[4lESC[?7hESC[HESC[J Worm
ESC[0mESC(0lqkESC(B
ESC[0mESC(0xESC(BESC[157CESC[0mESC(0xESC(B
ESC[0mESC(0xESC(BESC[157CESC[0mESC(0xESC(B

in wscons when TERM=xterm:

ESC[?1049hESC[1;45rESC(BESC[mESC[4lESC[?7hESC[?1hESC=ESC[HESC[2J Worm
ESC(0ESC[0mlqkESC(B
ESC(0ESC[0mxESC(BESC[159GESC(0ESC[0mxESC(B
ESC(0ESC[0mxESC(BESC[159GESC(0ESC[0mxESC(B

... so it's doing something based on TERM.



Re: pretty borders for slitherins

2019-09-25 Thread Nicholas Marriott
It will use either UTF-8 characters or the ACS characters from TERM.

The way it decides which is somewhat confusing and it looks like it is
choosing to use UTF-8 even when I wouldn't expect it to so I'm not sure
it is actually working correctly in our ncurses version.

I don't think UTF-8 line drawing works properly, at least with the DRM
wscons.

What do you have in TERM now? Can you see if the borders are OK with
"TERM=xterm snake"? This seems to use ACS rather than UTF-8. If it does
I'll see if I can figure out why it choosing UTF-8 borders for the
others.

You can run it in script(1) to see what it is using for the border (lots
of 'q' or 'x' means ACS).


On Wed, Sep 25, 2019 at 11:15:01AM -0500, Scott Cheloha wrote:
> On Mon, Sep 23, 2019 at 06:23:32PM -0400, Ted Unangst wrote:
> > snake and worm draw boxes, but they can be prettier by using the default
> > style, which will use line drawing instead of ugly -*| characters.
> > 
> > should do the right thing on a vt100, but only tested in xterm.
> 
> It looks much prettier in an xterm but in the system console I'm
> getting question marks.  Is that a limitation of the terminal or
> am I missing the glyphs?  Dunno if this is the expected behavior
> but it is uglier than what we had before.
> 
> Also, you forgot to delete the prototype for drawbox().
> 
> > Index: snake/snake.c
> > ===
> > RCS file: /home/cvs/src/games/snake/snake.c,v
> > retrieving revision 1.34
> > diff -u -p -r1.34 snake.c
> > --- snake/snake.c   28 Jun 2019 13:32:52 -  1.34
> > +++ snake/snake.c   13 Sep 2019 17:05:19 -
> > @@ -450,23 +450,8 @@ setup(void)
> > pchar([i], SNAKETAIL);
> > }
> > pchar([0], SNAKEHEAD);
> > -   drawbox();
> > +   border(0, 0, 0, 0, 0, 0, 0, 0);
> > refresh();
> > -}
> > -
> > -void
> > -drawbox(void)
> > -{
> > -   int i;
> > -
> > -   for (i = 1; i <= ccnt; i++) {
> > -   mvaddch(0, i, '-');
> > -   mvaddch(lcnt + 1, i, '-');
> > -   }
> > -   for (i = 0; i <= lcnt + 1; i++) {
> > -   mvaddch(i, 0, '|');
> > -   mvaddch(i, ccnt + 1, '|');
> > -   }
> >  }
> >  
> >  void
> > Index: worm/worm.c
> > ===
> > RCS file: /home/cvs/src/games/worm/worm.c,v
> > retrieving revision 1.39
> > diff -u -p -r1.39 worm.c
> > --- worm/worm.c 24 Aug 2018 11:14:49 -  1.39
> > +++ worm/worm.c 13 Sep 2019 16:51:39 -
> > @@ -122,7 +122,7 @@ main(int argc, char **argv)
> > }
> > stw = newwin(1, COLS-1, 0, 0);
> > tv = newwin(LINES-1, COLS-1, 1, 0);
> > -   box(tv, '*', '*');
> > +   box(tv, 0, 0);
> > scrollok(tv, FALSE);
> > scrollok(stw, FALSE);
> > wmove(stw, 0, 0);
> > 
> 



Re: pretty borders for slitherins

2019-09-25 Thread Mike Larkin
On Wed, Sep 25, 2019 at 10:53:21AM -0600, Theo de Raadt wrote:
> Ted Unangst  wrote:
>
> > Scott Cheloha wrote:
> > > On Mon, Sep 23, 2019 at 06:23:32PM -0400, Ted Unangst wrote:
> > > > snake and worm draw boxes, but they can be prettier by using the default
> > > > style, which will use line drawing instead of ugly -*| characters.
> > > >
> > > > should do the right thing on a vt100, but only tested in xterm.
> > >
> > > It looks much prettier in an xterm but in the system console I'm
> > > getting question marks.  Is that a limitation of the terminal or
> > > am I missing the glyphs?  Dunno if this is the expected behavior
> > > but it is uglier than what we had before.
> >
> > ah, that's disappointing. my understanding is it should revert to ascii, but
> > there seems to be a flaw, either in curses or my understanding. curses!
>
> If I recall, curses needs a little bit more initialization if you want
> it to do the right thing
>
> this trap was set because we don't have a curses maintainer, but look
> now we do, since it is mostly the games who need this, maybe mlarkin
> can help you
>

How did I get pulled into this? :)



Re: pretty borders for slitherins

2019-09-25 Thread Theo de Raadt
Ted Unangst  wrote:

> Scott Cheloha wrote:
> > On Mon, Sep 23, 2019 at 06:23:32PM -0400, Ted Unangst wrote:
> > > snake and worm draw boxes, but they can be prettier by using the default
> > > style, which will use line drawing instead of ugly -*| characters.
> > > 
> > > should do the right thing on a vt100, but only tested in xterm.
> > 
> > It looks much prettier in an xterm but in the system console I'm
> > getting question marks.  Is that a limitation of the terminal or
> > am I missing the glyphs?  Dunno if this is the expected behavior
> > but it is uglier than what we had before.
> 
> ah, that's disappointing. my understanding is it should revert to ascii, but
> there seems to be a flaw, either in curses or my understanding. curses!

If I recall, curses needs a little bit more initialization if you want
it to do the right thing

this trap was set because we don't have a curses maintainer, but look
now we do, since it is mostly the games who need this, maybe mlarkin
can help you 



Re: pretty borders for slitherins

2019-09-25 Thread Ted Unangst
Scott Cheloha wrote:
> On Mon, Sep 23, 2019 at 06:23:32PM -0400, Ted Unangst wrote:
> > snake and worm draw boxes, but they can be prettier by using the default
> > style, which will use line drawing instead of ugly -*| characters.
> > 
> > should do the right thing on a vt100, but only tested in xterm.
> 
> It looks much prettier in an xterm but in the system console I'm
> getting question marks.  Is that a limitation of the terminal or
> am I missing the glyphs?  Dunno if this is the expected behavior
> but it is uglier than what we had before.

ah, that's disappointing. my understanding is it should revert to ascii, but
there seems to be a flaw, either in curses or my understanding. curses!



Re: pretty borders for slitherins

2019-09-25 Thread Scott Cheloha
On Mon, Sep 23, 2019 at 06:23:32PM -0400, Ted Unangst wrote:
> snake and worm draw boxes, but they can be prettier by using the default
> style, which will use line drawing instead of ugly -*| characters.
> 
> should do the right thing on a vt100, but only tested in xterm.

It looks much prettier in an xterm but in the system console I'm
getting question marks.  Is that a limitation of the terminal or
am I missing the glyphs?  Dunno if this is the expected behavior
but it is uglier than what we had before.

Also, you forgot to delete the prototype for drawbox().

> Index: snake/snake.c
> ===
> RCS file: /home/cvs/src/games/snake/snake.c,v
> retrieving revision 1.34
> diff -u -p -r1.34 snake.c
> --- snake/snake.c 28 Jun 2019 13:32:52 -  1.34
> +++ snake/snake.c 13 Sep 2019 17:05:19 -
> @@ -450,23 +450,8 @@ setup(void)
>   pchar([i], SNAKETAIL);
>   }
>   pchar([0], SNAKEHEAD);
> - drawbox();
> + border(0, 0, 0, 0, 0, 0, 0, 0);
>   refresh();
> -}
> -
> -void
> -drawbox(void)
> -{
> - int i;
> -
> - for (i = 1; i <= ccnt; i++) {
> - mvaddch(0, i, '-');
> - mvaddch(lcnt + 1, i, '-');
> - }
> - for (i = 0; i <= lcnt + 1; i++) {
> - mvaddch(i, 0, '|');
> - mvaddch(i, ccnt + 1, '|');
> - }
>  }
>  
>  void
> Index: worm/worm.c
> ===
> RCS file: /home/cvs/src/games/worm/worm.c,v
> retrieving revision 1.39
> diff -u -p -r1.39 worm.c
> --- worm/worm.c   24 Aug 2018 11:14:49 -  1.39
> +++ worm/worm.c   13 Sep 2019 16:51:39 -
> @@ -122,7 +122,7 @@ main(int argc, char **argv)
>   }
>   stw = newwin(1, COLS-1, 0, 0);
>   tv = newwin(LINES-1, COLS-1, 1, 0);
> - box(tv, '*', '*');
> + box(tv, 0, 0);
>   scrollok(tv, FALSE);
>   scrollok(stw, FALSE);
>   wmove(stw, 0, 0);
> 



pretty borders for slitherins

2019-09-23 Thread Ted Unangst
snake and worm draw boxes, but they can be prettier by using the default
style, which will use line drawing instead of ugly -*| characters.

should do the right thing on a vt100, but only tested in xterm.

Index: snake/snake.c
===
RCS file: /home/cvs/src/games/snake/snake.c,v
retrieving revision 1.34
diff -u -p -r1.34 snake.c
--- snake/snake.c   28 Jun 2019 13:32:52 -  1.34
+++ snake/snake.c   13 Sep 2019 17:05:19 -
@@ -450,23 +450,8 @@ setup(void)
pchar([i], SNAKETAIL);
}
pchar([0], SNAKEHEAD);
-   drawbox();
+   border(0, 0, 0, 0, 0, 0, 0, 0);
refresh();
-}
-
-void
-drawbox(void)
-{
-   int i;
-
-   for (i = 1; i <= ccnt; i++) {
-   mvaddch(0, i, '-');
-   mvaddch(lcnt + 1, i, '-');
-   }
-   for (i = 0; i <= lcnt + 1; i++) {
-   mvaddch(i, 0, '|');
-   mvaddch(i, ccnt + 1, '|');
-   }
 }
 
 void
Index: worm/worm.c
===
RCS file: /home/cvs/src/games/worm/worm.c,v
retrieving revision 1.39
diff -u -p -r1.39 worm.c
--- worm/worm.c 24 Aug 2018 11:14:49 -  1.39
+++ worm/worm.c 13 Sep 2019 16:51:39 -
@@ -122,7 +122,7 @@ main(int argc, char **argv)
}
stw = newwin(1, COLS-1, 0, 0);
tv = newwin(LINES-1, COLS-1, 1, 0);
-   box(tv, '*', '*');
+   box(tv, 0, 0);
scrollok(tv, FALSE);
scrollok(stw, FALSE);
wmove(stw, 0, 0);