bug-ncurses
[Top][All Lists]
Advanced

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

Re: Tabstop width not reset by reset command, or hardcoded to wrong widt


From: Vincent Huisman
Subject: Re: Tabstop width not reset by reset command, or hardcoded to wrong width
Date: Sun, 26 May 2019 23:13:21 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

On 26-05-2019 16:39, Thomas Dickey wrote:
Offhand, using hard-resets in rs1/rs2 would reinforce that assumption,
and eliminate the overhead of constructing tab-stops to make "it" match
the user's expectations.  You see, the documentation says that "it" matches
the power-up behavior.  It doesn't tell ncurses to initialize it to that
value.

This is in reset_cmd, I assumed that that's not called on whatever initialisation, but only on actual calls to the reset utility? I have little experience with the inner workings of ncurses so I'm not up to speed on the "init sequence". Reading the man page on reset, I see that reset does nothing with tabs because tset does the initialisation, even though it says that it should reset the terminal modes to "sane" values, so I guess that should include clearing any messed-up tabstops. I'd say that if you're seeing it as two different things, reset should do reinitialisation of tabs as a separate action from whatever it is that tset might do later on. That way you can still avoid the tabstop construction in tset but restore the original power-up behaviour (as per terminfo) on reset. At least, that's what I'd expect from reset.

The one example with "it" to a value other than 8 is interesting, in part
because it won't work as documented above since it lacks the set/clear
capabilities for tab stops.  (If the entry were for something that people
_use_, I'd investigate and fix, but since the system's defunct, it's only
of academic interest).

But what I'm mostly trying to focus on is that the tab initialisation code only runs for init_tabs!=8. The vast majority of terminals in the standard terminfo database have init_tabs=8 so for those terminals it basically means that you could replace the entire function body by "return FALSE;". So that's on terminals that people _use_, like xterm and linux:

Actual behaviour on clean TERM=linux:
$ tabs 2 > accidental_binary_file; echo -e "\ta"
        a
$ cat accidental_binary_file; echo -e "\ta"
  a
$ reset; echo -e "\ta"
  a

Expected behaviour:
$ reset; echo -e "\ta"
        a

Seeing that you seem to say that the reset_tabstops() call is supposed to be a tset-only thing and not a reset-thing, that would imply that reset needs its own reset_tabstops function (independent from tset) that is always executed as long as the terminal supports ct/st.

Regarding reset_tabstops in tset, the value of init_tabs on its own says nothing about the terminal capabilities as far as I can tell, so if you're trying to avoid running code on terminals that have specific features then you should check for those specific features rather than this unrelated variable.

Am I making sense, or am I misunderstanding this completely?

Sincerely,

Vincent Huisman



reply via email to

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