On Tue, Feb 20, 2024 at 04:15:30PM +0800, Paul Wise wrote:
$ tput sgr0 | hd
00000000 1b 28 42 1b 5b 6d |.(B.[m|
Here's the culprit. The code you asked for is "\e[0m" -- shortenable to non-canonical but valid "\e[m", which is the second half of tput's output.
What you did not ask for, is "\e(B", which is not allowed in UTF-8 mode, and in non-Unicode world would switch to an ancient "US" charset.
Maybe that is true for the Linux console, but we are talking about xterm here.
Putting aside arguments if this code is allowed or not (eg. the author of Putty has strong feelings on the matter), it's very clearly not what you asked for, thus the real bug is on tput's side.
Thus:
"tput sgr0" should produce sgr0, not setusg0 sgr0.
It does of course produce sgr0, i.e. it emits whatever escape sequence $TERM's terminfo entry declares as sgr0. In the case of xterm-256color, sgr0=\E(B\E[m.
The reason for including \E(B here is that sgr0 should cancel the
effects of a previous smacs (start alternate character set) sequence and
thus includes the rmacs (end alternate character set) escape sequence.
People are relying on this behavior, see #595484 for instance.
Closing the bug, because everything works as intended.
On Tue, Feb 20, 2024 at 07:41:42PM +0100, Sven Joachim wrote:
The reason for including \E(B here is that sgr0 should cancel the
effects of a previous smacs (start alternate character set) sequence and
thus includes the rmacs (end alternate character set) escape sequence.
Then it combines two completely different concepts in one label. SGR is
for character attributes, G0/G1 are for encoding.
Closing the bug, because everything works as intended.
Well, I'm not going to fight a BTS war, but I don't agree with your
decision.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 300 |
Nodes: | 16 (2 / 14) |
Uptime: | 05:14:08 |
Calls: | 6,706 |
Files: | 12,236 |
Messages: | 5,350,492 |