Hi Ingo, On Mon, Apr 05 2021 20:30:39 +0200, Ingo Schwarze wrote: > Whether all control chars are always width 0 can maybe also be > disputed. Again, the stronger argument seems to me that they are. > If they weren't, they would not be control characters but alphanumeric, > punctuation, spaces, or special printable characters, none of which > they are. I say width 1 and 2 require standalone glyphs that are > normally used for the character. Besides, no operating system > correctly identifies this as a control character and yet gives it > width 1.
I agree with your assessments about iswcntrl and iswprint. My original patch proposed to keep those return values as is, and only change the wcwidth() from 0 to 1. > I insist that the discussion should remain very strictly formal, > about the properties and classification in the Unicode data files > and nothing else. If people start arguing about what makes sense > for any particular character, that's already an argument going > astray. In general I agree, but I contend that SHY is, unfortunately, a little bit special. This confusion about its printability and/or column width is definitely not unique to OpenBSD. > > So going by this phrase the character should not be printed > > When formatting a document, for example for printing on paper or > the online equivalent like PostScript or PDF, i agree. But i > strongly prefer the terminal to always display this character because > the terminal's usual purpose is not nice text formatting for visual > consumption. It should usually show the full content of strings > or files, be it for inspection or for editing. Omitting characters > in such contexts sets nasty traps for the person working with the > terminal. I agree with this completely - you said it better than I could have. This is another reason why I think it makes sense for this character to have wcwidth() of 1 - applications that are "SHY-aware" can print (or not) the soft hyphen however they wish, but terminal software seems to almost always ask wcwidth() to figure out the column width. Indeed, terminal software is where I ran into the problem of SHY sometimes being invisible. > So i say nothing should be changed at all in OpenBSD. > > Yes, that means column counting is wrong on the terminal, but that's > a very minor problem, if it's a problem at all, compared to the havoc > that could result from not showing the character on the terminal at > all, and it cannot be fixed without causing worse problems in situations > that matter more. Right, I am not at all advocating to hide the SHY on the terminal - quite the contrary, I want to make its width consistent. The current situation, with SHY having a wcwidth() of 0 causes, for example, the following discrepancy between xterm(1) (on the left) and tmux(1) in xterm(1) (on the right): https://hacktheplanet.fi/shytmux.png -- in tmux, the SHY is not visible. The other issues I observed with discrepancies between OpenBSD and other systems I already outlined in my initial mail. -- Lauri Tirkkonen | lotheac @ IRCnet