Hacker News new | past | comments | ask | show | jobs | submit login
Hacking the Planet With Notcurses: A Guide to TUIs and Character Graphics [pdf] (nick-black.com)
115 points by mkj 36 days ago | hide | past | favorite | 33 comments



I wish I had more evidence-based arguments for my opinion, but I strongly believe text-based interfaces are among the best out there. They have an ability to squeeze in an uncanny amount of information in any given space, without turning cluttered.

If I think about it, even GUIs tend to be driven by text in most cases. The difference is that every word gets a graphical border (be it in the shape of a button, a tab, a menu item, or whatnot.) These borders are needed in a GUI where the location of the text is less predictable, and it helps novices to see the window under a menu while the menu is shown, but these are not problems for experienced users at predictable text-based interfaces.


One really great things about text interfaces is they're (drumroll) text-searchable! That's one huge benefit of emacs, if you're shown a huge list of options, hop into the buffer and just search. I've been frustrated by some parts of microsoft interfaces where I'm presented with lots of text options but couldn't search them (can't remember where).

A note on the attached PDF document, there seems to be a total blind spot about readability being damaged by dumb colours, look at Figure 8 on P11, I can read the coloured text but it is noticeably harder, therefore slower, than reading the white text on a black background. Also the light blue on white for listing 13 as another example.

Anyway, looking forward to reading it.


I think Emacs is an illuminating example, since its 'GUI' interfaces really outshine emacs being run in a terminal emulator. Text interfaces are great, but terminal emulators in particular are very limiting. Inlining images always requires hacks and even with hacks a terminal emulator can't do nice things like have multiple font sizes in the same frame (discounting double height/width modes, since they're so limited I've never seen them used effectively.)


It's not the case for me. I far prefer emacs in a terminal over the gui, and thats how I've used it for years. I can't run the gui on a gnu screen session on that server I've been working on, for example. I admit I'm probably the outlier on this though.


> I can't run the gui on a gnu screen session on that server I've been working on, for example.

Why not use Tramp Mode?


I do, frequently. From emacs-nox. Sometimes not though because some systems have weird things that break it. (security)


Nothing wrong with being an outlier but if you can explain, I'd like to know why you prefer it (when you can, that is).

I'm not mad on going mad with colours and effects, something that happens too much, but even some minimal visual feedback can be disproportionately helpful I feel.


I'm the kind of person who lives in the cli, so I love tui's, I use a tiling window manager and gnu screen heavily. For me, it just fits my workflow.

I have slowly been transitioning away from using emacs for everything though. I use it as my text editor but I no longer use it for rss, irc, email, etc. I would probably change my tune if I went back to that.


That is a very interesting point, and I'm with you on the extra facilities (typefaces, colours, highlighting, sizes, effects etc) that are possible and useful. I'll chew this over tonight. It's a good point.


> One really great things about text interfaces is they're (drumroll) text-searchable!

Same is true of web applications.


Unfortunately, many things can break text search in web applications: components that render into DOM only when they are visible and in the viewport, components that are covered by something else so you can't see them (even though you can search them), pictograms etc.


> I wish I had more evidence-based arguments for my opinion, but I strongly believe text-based interfaces are among the best out there.

That is very broad. The best for what? Efficient video editing? Music production?


Anything where information and/or buttons need to be presented to the user, really. Text-based interfaces tend to support a high density of either without loss of overview.

Part of this might be, as I allude to in my original comment, the lack of other visual structures that otherwise might distract from the content. Another part might be that humans are pretty darn good at interpreting text.


I think your comment reflects more on the poor state of GUI frameworks and desktop environments than any intrinsic virtue of terminal based UIs.


This is an excellent read - the topic of UIs for terminal emulators might seem dry but the author has done a really good job with this user manual. It's the library to replace ncurses. Worth a look for any Linux programmer.


Thanks for the kind words, hax0r! (I'm the author).

Notcurses 1.5.0 ought be out by this week's end, complete with "new" (as much as anything is "new") Quadrant Blitter Technique: https://nick-black.com/images/new-terminal-technique.png

and of course, if you've never seen it, be sure to check out `notcurses-demo`. it's come a long way since 1.1.0, but this video from January still captures the essence of the project: https://www.youtube.com/watch?v=-H1WkopWJNM

hack on!

ps. mysterious n-gate.com author [0], if you're reading this, you're doing the LORD's work.

[0] my guess is james mickens


>>and of course, if you've never seen it, be sure to check out `notcurses-demo`

That demo was dope. Thanks for putting that up and linking it. Probably the best way to communicate how far TUIs can go.


thanks! it looks a lot better recently -- the 1.4.0 version is much cleaner than that 1.1.0 garbage. i didn't link it because it starts with a minute of me talking (and looking absolutely hideous that day, ugh): https://www.youtube.com/watch?v=TvWdUfIStDI


http://n-gate.com/about/

Oh my, that is glorious! Thank you for introducing me to this website, on top of notcurses :)


Nick is, without exaggeration, the finest hacker I've had the pleasure to know and work with. Its hard to believe where Notcurses is considering he just started working on it at the end of last year.

The quality and quantity of his output is nothing short of astounding. Poke around his wiki/github, its worth it.


Does anyone know of any minimal TUI libraries? Something in the spirit of a VGA text buffer, that allows the user to manage their own cell buffer as a block of memory, and allows them to blit that to the terminal -- and ideally have that work across a variety of platforms and terminal emulators?


https://github.com/nsf/termbox is a very well known one, and has inspired several clones in other languages as well.


I second termbox. It's a well crafted library, and easy to understand by just reading the h file. I wrote the Ada binding for it just a few weeks ago.



You can use ncplane_blit_rgba() and ncplane_blit_bgrx() from Notcurses to freely blit RGBA data directly to the terminal. In addition, you'll benefit from the various advanced blitters built into Notcurses. Simply moving from pixels to cells in the naive method doesn't look good due to the different aspect ratios. Half blocks are a much better solution, and my quadrant blitter is superior to even those IMHO (all are available via the NCBLIT_* macros).


As an example, here's Notcurses as a backend for NEStopia, allowing you to play NES in the terminal: https://www.youtube.com/watch?v=PHOHxqGkTUA&t=77s (this video was very early and raw, apologies for the production quality or lack thereof).

I've experimentally rigged Notcurses as a backend for both Mesa and Cairo. Works fine, so long as you've got sufficient cells to back your canvas.


A little more advanced is CPPurses with a widget framework for creating TUIs,:

https://github.com/a-n-t-h-o-n-y/CPPurses


Thanks, I've added CPPurses to the Notcurses OTHERS.md file: https://github.com/dankamongmen/notcurses/blob/master/OTHERS...

Taking a quick look, I don't want to besmirch anyone else's efforts, and both of these projects look great. libtickit appears to be missing any kind of multimedia/pixel-based approach along the lines of Notcurses's ncvisual -- I'm not sure about CPPurses, but that one being written in C++ would seem to exclude pure C programs (obviously not if it's using POD structures etc).

Both look like good efforts, and there's plenty of room for more than one project in this space. I wish them both luck!


I was going to mention gui.cs but I don't think it does TRS-80 style memory access-to-draw like you were asking for.


Notcurses is nice, but I believe that tickit[1] is the most mature and exciting option out there. By the author of libtermkey, which was (and is?) the only library to properly read keys from a tty.

1: http://www.leonerd.org.uk/code/libtickit/


I am really excited for this. I have constantly felt like nurses was under-whelming, yet very very difficult to do anything with (lots of boiler plate).


Thank you for posting this! I was not aware of Notcurses, I just started using Ncurses for an emulator hobby project, will be an interesting read :)


A+++++




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: