On 2018-02-25 02:29:28, Adam Borowski wrote:
>> undertime prints terminal escape sequences to pipes and files.
>
> There are two types of escape sequences here:
>
> • SGR.  These make sense, as undertime uses color to convey its output.
> A plain text interface would be a reasonable request but is probably a feature
> (anarcat: you can detect non-terminals by !isatty(1) ).

What's SGR? Do you mean:

https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters

If so, could you expand on what you would expect this would look like?
keep in mind that undertime doesn't generate those escape sequences on
its own: it passes a list of rows to the terminaltables library and lets
it handle that on its own.

undertime is written in python, so:

no Python documentation found for 'isatty'

There is, of course, os.isatty():

https://docs.python.org/3/library/os.html#os.isatty

..and sys.stdout.isatty(). But isn't this something that should be
handled by the underlying terminaltables library?

> • VT100 line drawing.  These codes shouldn't be used these days: there's a
> debate whether they're allowed within an UTF-8 locale, as the relevant
> standard seems to say no.  I for one consider this interpretation bogus,
> especially as it forces programs to know about locales even if they don't
> have a reason to care, and _most_ terminal authors think so as well -- but
> "most" doesn't mean all.  Here's some information:
> https://www.chiark.greenend.org.uk/~sgtatham/putty/wishlist/utf8-plus-vt100.html
> and putty is one of terminals that does otherwise.
>
> Also, tools like "less -R", which support colors well, don't handle such
> line drawing.  This includes my ansi2txt and ansi2html -- understanding
> these codes would be a reasonable feature, but, like less' author, I haven't
> either thought nor bothered to implement that yet.  Thus, let's assume those
> who claim supporting them with UTF-8 is wrong are right :þ .
>
> This leaves two options for you: either you can detect if the locale is
> UTF-8 and switch codes you output accordingly, or you can consider this a
> waste of your time and just output Unicode unconditionally.  As the latter
> works cleanly with redirection and other non-terminal receivers, this is
> what I'd suggest.  It's overdue to declare ancient locales unsupported.

So this sounds like a total nightmare that makes timezones and GUI
toolkits look like an awesome time at the beach. In fact, this makes me
want to rewrite the whole thing to *not* output on the terminal and
instead use Kivy or some other gaming engine to output a beautiful
interface like http://worldchatclock.com/ instead.

Again: I didn't write those escape sequences, I just use terminaltables
blindly because it supports colors neatly. I have found other
alternatives, documented in the source here:

https://gitlab.com/anarcat/undertime/blob/master/undertime#L46

All of those are in Debian, so it's not a problem to switch, but before
I start messing around with that stuff, I'd love it if someone could do
a little research and see how, exactly, we're supposed output a table,
in Python, on a terminal. When you do, keep in mind that this is only
part of the problem... We also need to:

 * have multi-row cells: https://gitlab.com/anarcat/undertime/issues/2
 * support colors, keeping in mind bugs like #891378
 * support long names (like America/Los_Angeles) without exploding
 * support unicode
 * fallback properly on pipes

Let me know when you're done. :p More seriously, underline is
(deliberately) a small program: 200 lines, and half of that is usage
instructions, comments and metadata. So it should be fairly easy to
hack...

Thanks for the bug report!

A.

-- 
My passionate sense of social justice and social responsibility has
always contrasted oddly with my pronounced lack of need for direct
contact with other human beings and communities. I am truly a "lone
traveler" and have never belonged to my country, my home, my friends,
or even my immediate family, with my whole heart; in the face of all
these ties, I have never lost a sense of distance and a need for
solitude.
                       - Albert Einstein

Reply via email to