[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Strange behavior of Ncurses
From: |
Thomas Dickey |
Subject: |
Re: Strange behavior of Ncurses |
Date: |
Sat, 12 Oct 2024 09:52:31 -0400 (EDT) |
----- Original Message -----
| From: "G. Branden Robinson" <g.branden.robinson@gmail.com>
| To: "Urban Söderberg" <Urban.Soderberg@knowit.se>
| Cc: "Thomas Dickey" <dickey@his.com>, "Ncurses Mailing List"
<bug-ncurses@gnu.org>, "Gustav W. Uppenberg"
| <gustav.uppenberg@knowit.se>, "Roxana Prelipceanu"
<roxana.prelipceanu@knowit.se>, "Pauline Littbrand"
| <pauline.littbrand@knowit.se>, "Kristoffer Mattila"
<kristoffer.mattila@knowit.se>
| Sent: Friday, October 11, 2024 2:11:02 PM
| Subject: Re: Strange behavior of Ncurses
| At 2024-10-11T13:18:16+0000, Urban Söderberg wrote:
|> We did strace on our application and could see that character
|> sequences are caused by ncurses.
|>
|> File: dev-pts-2-trace3.log
|> Printout lines starting with spaces.
|> We can see several lines like this:
|> [pid 2001732] 12:04:54.106158 write(1</dev/pts/2<char 136:2>>,
"\33[J\33[1;17H",
|> 10) = 10 <0.000015>
|> This causes issues.
|
| Just FYI, the sequence in question,
|
| \33[J
|
| looks like "CSI J", the ECMA-48 escape sequence for clearing the screen,
| [1] and
|
| \33[1;17H
|
| looks like "CSI H", the ECMA-48 escape sequence for (absolute) cursor
| positioning ("CUP").
|
| A copy of ECMA-48 can be found here:
|
|
https://www.ecma-international.org/wp-content/uploads/ECMA-48_5th_edition_june_1991.pdf
|
| If ncurses is emitting those sequences, it is likely because the
| terminfo database entry for the value of $TERM on the system records
| that they are how to manifest the operations in question.
Actually, ncurses could emit those strings, but because ncurses optimizes
cursor movement, the only way it would be sending the cursor to the right
margin and _then_ going to the next line would be if the application were
forcing the screen to be updated and causing ncurses to wait for keyboard
input. That's kind of unlikely.
It's a lot more likely that the application is a low-level terminfo or termcap
application which does no optimization. If the application is stripped and
statically linked, it would take some work to prove this, but if it's not,
then someone could use "nm" to list the functions it uses.
If it's using initscr or newterm, that says it could be using cursor
optimization.
It's still possible that the developer bypasses all of that (think "printf"...).
strace won't tell me any of that. "nm" or "nm -D" is the way to start
collecting data.
|
| Is your $TERM correct?
|
| Regards,
| Branden
|
| [1] ECMA-48 calls it "ERASE IN PAGE"; the ctlseqs.ms document calls it
| "Erase in Display". Both abbreviate it as "ED".
--
Thomas E. Dickey <dickey@invisible-island.net>
https://invisible-island.net
- Strange behavior of Ncurses, Urban Söderberg, 2024/10/09
- Re: Strange behavior of Ncurses, Thomas Dickey, 2024/10/09
- RE: Strange behavior of Ncurses, Urban Söderberg, 2024/10/11
- Re: Strange behavior of Ncurses, G. Branden Robinson, 2024/10/11
- Re: Strange behavior of Ncurses,
Thomas Dickey <=
- RE: Strange behavior of Ncurses, Urban Söderberg, 2024/10/16
- Re: ***UNCHECKED*** RE: Strange behavior of Ncurses, Thomas Dickey, 2024/10/16
- RE: ***UNCHECKED*** RE: Strange behavior of Ncurses, Urban Söderberg, 2024/10/17
- Re: ***UNCHECKED*** RE: Strange behavior of Ncurses, Thomas Dickey, 2024/10/17
- RE: ***UNCHECKED*** RE: Strange behavior of Ncurses, Urban Söderberg, 2024/10/18
- Re: ***UNCHECKED*** RE: Strange behavior of Ncurses, G. Branden Robinson, 2024/10/18
- RE: ***UNCHECKED*** RE: Strange behavior of Ncurses, Urban Söderberg, 2024/10/18
- Re: RE: Strange behavior of Ncurses, Thomas Dickey, 2024/10/18
- Re: Strange behavior of Ncurses, Thomas Dickey, 2024/10/19
- Re: Strange behavior of Ncurses, Thomas Dickey, 2024/10/20