On Tue, Dec 23, 2014 at 03:17:12PM -0600, Rob Landley wrote:
> On 12/23/2014 01:44 PM, Rich Felker wrote:
> > On Tue, Dec 23, 2014 at 10:23:43AM -0600, Rob Landley wrote:
> >> If you export $ROWS and $COLUMNS it'll do that instead of probe, and I
> >> can add a compile-time config symbol to switch it off if you care that 
> >> much.
> > 
> > Exporting ROWS and COLUMNS precludes runtime size changes though. The
> > correct way to handle size is TIOCGWINSZ. Perhaps you could use
> > TIOCGWINSZ for device numbers that indicate virtual terminal or pty
> > and only fall back to the ugly methods for serial ports?
> 
> Look at the current code:
> 
> http://landley.net/hg/toybox/file/45fb262230c9/lib/lib.c#l588
> 
> It checks the size. If it get zeroes, it checks the environment
> variables. If those are blank _then_ you do the ascii probe.
> 
> Except the way I've set it up a wrapper function calls that and then
> does the ascii probe if it returns 0, because the ascii probe isn't
> always appropriate. (But the line editing thing can do the ascii probe,
> because any time it gets the reply escape sequence it can asynchronously
> update its idea of the screen size and where the cursor is, since a
> proper probe should probably query both because your shell prompt isn't
> guaranteed to start at the left edge of the screen if the output of the
> previous program didn't end with a newline.)

Sounds reasonable.

> >>>> I do follow a security researcher on twitter (@0xabad1dea) and for a
> >>>> while she had as her handle:
> >>>>
> >>>>   echo -e "Melissa \xe2\x80\xae ασσιλέΜ \xe2\x80\xed"
> >>>>
> >>>> So it would be nice to get the reversal codes to work. But given that
> >>>> xfce's terminal doesn't handle it either...
> >>>>
> >>>> (Dalias wrote a terminal that probably does. I should compile/install
> >>>> that and try it out...)
> >>>
> >>> Mine doesn't. Bidirectional text is the main (only?) multilingual
> >>> feature uuterm is missing.
> >>
> >> Even for just "more", the fontmetrics of combining characters is... fun.
> >>
> >> I _mostly_ punt this to the display layer, but this piece of
> >> infrastructure probably should care.
> > 
> > Programs writing to a terminal have no need to care specially about
> > RTL characters; it's all in the presentation layer. On the other hand
> > they _might_ need to know about RTL/LTR overrides (but probably not)
> > and they probably need to know about bidi _nesting_ (if you care to
> > support that, but it's probably useless).
> 
> I need proper utf8/unicode test cases. Right now I'm thinking of looking
> at the backscroll of @fakeapstylebook from December 23 last year for
> tweets like
> https://twitter.com/FakeAPStylebook/status/415263262629171201 and
> https://twitter.com/FakeAPStylebook/status/415142987778117632
> 
> But better test cases would be nice...

I wouldn't really worry about it. From the standpoint of an
application writing to a terminal, all you need to know is wcwidth(),
i.e. the number of logical columns the character occupies. This
doesn't need fancy test cases; just one character of each width (0, 1,
2, or negative==unprintable) is all you need.

Rich
_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to