Everything you ever wanted to know about terminals (2018)

6 years ago (xn--rpa.cc)

The lack of attention to (or, rather, the complete disregard of) proper capitalization is ridiculous. This is the second post I'm seeing in two days that feature this "style". Quite a disturbing trend, if you ask me.

  • What is ridiculous and disturbing about using lowercase letters at the beginning of your sentences? In a world where this trend continues your eye will become used to it and it will no longer be a distracting shock from what your eye is used to.

  • ever heard of konsequente kleinschreibung?

    • Never heard about it before seeing your comment. However, I have just looked it up and I think that the very limited scope (both temporal and geographical) of this "movement" just additionally emphasizes and supports the points that I have made in this thread.

  • Here are a few seventh bits (01000000, \100, 64, 0x40) for your ANDing pleasure, so you can pull a Timothy Dexter and peper and solt it as you plese: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

I recently rewrote my fork of cplay and got fed up with curses. Boy do I wish I had found this article earlier because it describes everything I painfully had to cobble together. This is great!

Just one nit: Doing stuff in a signal handler is usually a bad idea because it can interrupt your code at any time. The usual work around is a trick called "self-pipe". https://ldpreload.com/blog/signalfd-is-useless

For anyone interested, I created a library in the process: https://github.com/xi/boon (It takes some inspiration from react but bare with me, I think it actually makes sense.)

Oh man, they left out the part I was hoping to find out more about!

> it's good form to have a function called resize() or similar that you run on program start and later when the terminal window is resized. while there is a horrible way to do this with ANSI escapes, it's better to just bite the bullet and learn how to use ioctls and termios.

I wanted to know about the horrible ANSI escape sequences to send that can query the window size. Afaict one has to read from the terminal to get the answer--but these are control sequences that could be inserted into the normal stream--when, where, how?

that site has great personal branding. recall seeing other articles from lexi halle on the feediverse some time ago and immediately recognized it.

great content too.

What's this stuff about:

> also, i'm a) a nobody and b) a woman. nothing i wrote would ever gain any traction; any project designed to supplant ncurses needs to come from someone who's actually known to the FOSS community. and a maintainer who isn't a cripple.

Did ncurses gain popularity because of the identity of its maintainer(s)?! I was of the impression that it's whoever gets there first.

That’s pretty nasty - this article is factually incorrect in probably the worst way: the code will work on author’s computer, but not for other people [0]

Not to mention that it is missing “good citizen” features like turning off colors when stdout is not a tty.

[0] https://news.ycombinator.com/item?id=18125374

  • > (...) the code will work on author’s computer, but not for other people

    Is it actually the case?

    The comment you cite says the code won't work on xterm or gnome-terminal.

    I've checked with what I had available: XTerm(330) and GNOME Terminal 3.30.1 using VTE 0.54.1. On both terminals the last code sample from the post works perfectly fine as far as I can tell.

    What terminal should I use to see improper behavior of the program?

  • > “good citizen” features like turning off colors when stdout is not a tty.

    Better solution: do not detect whether your output is a tty or not.

    Let the user decide they want colors or not by using `--color=always` or `--color=never` or similar.

    There's few things worse than writing a script and getting different output just because you're no longer running the program interactively.

    • I don't see how this is supposed to work? Let's take "grep" for example -- you want both of these to work, and print color to terminal:

          grep box file.txt
          grep box file.txt | grep -v orange-box
      

      Having --color=always is nice sometimes, but there is a reason grep has "--color=auto" and it is the default. If we write invisible characters to file, this breaks all sorts of tools, so it is much safer and more predictable to not include them.

      2 replies →

    • Gah i got bit by this with 'jq'!

      > $ echo "{}" | jq > {} > $ echo "{}" | jq > out.json > jq - commandline JSON processor [version 1.5-1-a5b5cbe] ... etc ...

      Turns out when stdout isn't a tty you _must_ specify a filter (in this case '.')

      2 replies →

  • > Not to mention that it is missing “good citizen” features like turning off colors when stdout is not a tty.

    It's a tutorial, not a 1000 page book. Some things won't be in there.

    Besides, detecting stdout or tty isn't even relevant for interactive TUI applications.

ncurses is a lot more readable than just dropping raw control codes into your source code, and it works, whereas raw control codes might work and often don't.

Interesting, but I wish it was less emotionally charged.

But very cool using macros to make an easy styling "language"!

I was just reading up an ANSI escape sequences a few days ago, this is gold.

I adore the format and writing style too.