[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: |
Wed, 9 Oct 2024 18:27:55 -0400 |
On Wed, Oct 09, 2024 at 01:35:30PM +0000, Urban Söderberg via Bug reports for
ncurses, the GNU implementation of curses wrote:
> Hi Ncurses!
>
> We are using Ncurses C++ (6.1) in Linux to handle terminal-communication.
> The actual development was made several years ago.
> Recently a customer discovered an issue with certain printouts that have
> repeated/similar lines and with several spaces.
>
> Short description of the use-case:
> From a webpage a websocket is used to handle communication with our client.
> Our client is started and Ncurses is used for input/output.
> When a command is run the printout is presented in terminal-screen.
>
>
> An example when issue is seen:
> File: printout_similar_lines_and_several_spaces.png
> Here is the visible data alright but not all data when for example scrolling
> back in browsers terminal to see the upper part.
> Websocket shows that data is written from row 1 to 63 and after this a jump
> is made to row 1.
Reading the trace, I don't see that many rows (it's using cursor addressing
up to line 24) -- but knowing the screensize would help understand the trace.
If the application believes the screensize is 24x80, but the actual
terminal is not that size, you will see odd behavior.
That can happen with a serial connection. If your application permits
setting environment variables, setting LINES and COLUMNS to the actual
screensize is the usual workaround.
> Backspaces are seen as well.
If it's actually using ncurses (and not for example some terminfo-level code),
then ncurses may use backspaces if the terminal description's cub1 capability,
e.g.,
cub1=^H,
You could override that by changing it to
cub1=\E[D,
or disable that:
cub1@,
But without a correct screensize, scrolling and cursor movement will not
work properly.
That trace begins oddly. The \E[xxC's are right-cursor movement. But
moving the cursor right by 72 columns and _then_ starting a new line isn't
something that I'd expect to see from ncurses:
\E[72C
\nSCCP POLICING SPECIFICATION DATA
\E[47C
\n
\E[79C
\nOPERATING
\E[70C
\n
\E[79C
\nPCODE PI
\E[7CPVF
\E[24;30HPVAL
\E[46C
\n610 CGNS
Further, there's no explicit scrolling region in the trace (nor any
initialization), and most of the cursor addressing is to columns 17 or 30.
I'm skeptical that it's using anything other than terminfo (or even termcap).
While ncurses provides those interfaces, it has no control over how an
application uses the data.
Presumably I'm not going to see the source code, but a list of the ncurses
functions which this program calls should be something that you can provide.
> When exporting the total received data the printout is corrupt, lines missing
> and some overwritten.
> We see corrupt printout when viewing the received data, file:
> full_data_lines_are_missing_due_to_jump_back_to_line_1_ad_backspaces_seen.png
>
> Also see attached file: websocket_data_received_from_ncurses.txt
> Jump to row 1 is seen and some backspaces etc.
>
> How correct printout look like, file: Actual_command_and_its_printout.log
>
>
> An example when a printout is alright:
> File: printout_unique_lines_few_spaces
> Here is the visual data alright.
> When checking websocket no jump to row 1 is seen.
> Websocket shows that data is written from row 1 to 63 and after that row 63
> is used.
> When exporting output all rows are present.
>
>
> This jump back to row 1 and the backspaces really causes problem to us.
> Is there a way to get rid of that handling or is there any correction done in
> Ncurses?
>
>
> Best regards
> Urban
--
Thomas E. Dickey <dickey@invisible-island.net>
https://invisible-island.net
signature.asc
Description: PGP signature
- Strange behavior of Ncurses, Urban Söderberg, 2024/10/09
- Re: Strange behavior of Ncurses,
Thomas Dickey <=
- 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, 2024/10/12
- 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