bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why doesn't ncurses use my Terminfo file's `cols` and `lines`?


From: Thomas Dickey
Subject: Re: Why doesn't ncurses use my Terminfo file's `cols` and `lines`?
Date: Wed, 21 Jun 2023 16:50:31 -0400

On Wed, Jun 21, 2023 at 11:23:27AM -0400, Stefan Monnier wrote:
> I apologize for this question which is not intended to be a bug-report,
> but I'm not sure where else to post it (and neither have I found the
> documentation about the meaning of each element in a Terminfo file).
> 
> I have an old Terminfo file which used to work OK many years ago
> according to my memory, but now it refuses to obey the `cols` and
> `lines` settings (and potentially others, since the cursor keys don't
> work right either, but I haven't looked in detail at that problem yet).

It's in the manpage - setupterm:

       The  terminfo  variables lines and columns are initialized by setupterm
       as follows:

       •   If use_env(FALSE) has been called, values  for  lines  and  columns
           specified in terminfo are used.

       •   Otherwise,  if  the  environment variables LINES and COLUMNS exist,
           their values are used.  If these environment variables do not exist
           and  the program is running in a window, the current window size is
           used.  Otherwise, if the environment variables do  not  exist,  the
           values for lines and columns specified in the terminfo database are
           used.

(the manpage refers to the long names for terminfo, so lines/columns is
in the terminfo files as lines/cols).

Also, use_tioctl and use_env.  But aside from adding use_tioctl in 2012

        https://invisible-island.net/ncurses/NEWS.html#t20120714

the rules for initialization haven't changed for a long time (barring bugs
of course).  That "current window size" refers to information from a
TIOCGWINSZ ioctl.

> Here's an example session showing the problem:
> 
>     % echo $LINES $COLUMNS
>      

"stty -a" might show some size...

For example:
        speed 38400 baud; rows 40; columns 80; line = 0;

In a quick check, if I disable the TIOCGWINSZ call in ncurses, and test
your terminfo, ncurses does set lines/cols as you expect.  If your terminal
is connected directly to a serial port, I would not expect stty to give a
size -- but if it's through some intermediate application (even something
such as ssh, which "should" not helpfully provide a size), then that could
be providing a size.

>     % tput -T hds3200-w50 cols
>     80
>     % tput -T hds3200-w50 lines
>     24
>     % infocmp hds3200-w50
>     #       Reconstructed via infocmp from file: 
> /home/monnier/.terminfo/h/hds3200-w50
>     hds3200-w50|Human Designed Systems HDS3200 model 20; VT220 7bits; 50x132; 
> auto-wrap=no,
>             mir, xenl, xon,
>             cols#132, lines#50, vt#3,
>             acsc=jjkkllmmnnqqttuuvvwwxx, bel=^G, blink=\E[5m$<2>,
>             bold=\E[1m$<2>, civis=\E[?25l, clear=\E[H\E[2J$<50>,
>             cnorm=\E[?25h, cr=\r, csr=\E[%i%p1%d;%p2%dr, cub1=^H,
>             cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH$<10>,
>             cuu1=\E[A, dch1=\E[P, dl1=\E[M, ed=\E[J$<50>, el=\E[K$<3>,
>             home=\E[H, ht=^I, if=/usr/share/tabset/vt100, il1=\E[L,
>             ind=\ED$<20/>, is2=\E[1;24r\E[24;1H, kbs=^H, kcmd=\E[17~,
>             kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdl1=\E[3~,
>             kf1=\EOP, kf10=\E[11~, kf11=\E[12~, kf12=\E[13~,
>             kf13=\E[14~, kf14=\E[15~, kf17=\E[18~, kf18=\E[19~,
>             kf19=\E[20~, kf2=\EOQ, kf20=\E[21~, kf3=\EOR, kf4=\EOS,
>             kf6=\E[7~, kf7=\E[8~, kf8=\E[9~, kf9=\E[10~, kfnd=\E[1~,
>             khlp=\E[16~, kil1=\E[2~, knp=\E[6~, kpp=\E[5~, kslt=\E[4~,
>             lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, rc=\E8, rev=\E[7m$<2>,
>             rf=/usr/share/tabset/vt100, ri=\EM$<14/>,
>             rmacs=\E(B$<4>, rmam=\E[?7l, rmir=\E[4l, rmso=\E[27m,
>             rmul=\E[24m, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h,
>             rs3=\E[?3h, sc=\E7,
>             
> sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;,
>             sgr0=\E[m$<2>, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h,
>             smso=\E[7m, smul=\E[4m,
>     %
> 
> My terminal has a 132x50 screen and my Terminfo file sets `cols#132` and
> `lines#50` accordingly, but applications that use ncurses all believe
> that it's only a 80x24 screen.
> What am I doing wrong?   Where should I look?
> 
> 
>         Stefan
> 
> 

-- 
Thomas E. Dickey <dickey@invisible-island.net>
https://invisible-island.net

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]