7 ms·
Writing Programs with Ncurses
- mouse_ 2y agorelated: "On Terminal Control" https://xn--rpa.cc/irl/term.html https://xn--rpa.cc/irl/term.html
- xbar 2y agoDeclaring all sample code AGPLv3 in the footer is toxic. I'm glad I scrolled before I polluted my brain with unusable information.
- dooglius 2y agoUnless otherwise specified, you have no license to use any code you find on the Internet.
- echoangle 2y agoWith short code snippets, you arguably don’t need a license. Only if it’s notable enough to get copyright protection do you need permission to use it, right? I can copy hello world examples from websites and do whatever I want with them, I think.
- dooglius 2y agoI don't necessarily disagree (I am not a lawyer), my point is that reading an AGPL license at the bottom of the page can only be a good thing; it can only give you the ability to do more things than you could if had no notice been there.
- IncreasePosts 2y agoThat depends on the jurisdiction.
- sudahtigabulan 2y agoVery little, though. See the map: https://en.wikipedia.org/wiki/Berne_Convention https://en.wikipedia.org/wiki/Berne_Convention
- SoftTalker 2y agoAlways thought of (N)curses as the conceptual React framework for terminal applications. You tell it what the screen should look like and it figures out how to efficiently write just the changes needed to achieve that on the terminal.
- soulofmischief 2y agoThis is the difference between declarative and imperative design. Frameworks like mithril or React are declarative whereas the DOM is imperative.
- degrees57 2y agoI always liked that on SuSE, I had my choice with YaST of either the Ncurses interface or the GUI X Window System. The functionality was identical, but sometimes a GUI is pleasant.
- cranium 2y agoNcurses has always been on my list of cool things I wanted to learn but couldn't invest the time to actually build something with. Then I found Textual (Python library, https://textual.textualize.io/ https://textual.textualize.io/) which feels like its modern and prettier child. Not gonna lie, it's still not a turnkey solution that transformed my clumsy scripts into a beautiful TUI without work but it's close!
- autoexec 2y agoIt's kind of crazy how much work it takes to get an interface on the level of ancient software to work on modern systems.
- echoangle 2y agoIt took even more work to get it to work on the ancient systems though, right?
- shakna 2y agoTurbo TUIs were easy to make. You could make them asynchronous, non-blocking, include sound, and if you were using Borland's C compiler, all of that was built-in for you. They probably went to efforts to make it work an ancient system. But you really didn't have to.
- matt3210 2y agoNCurses is peak ui design
- keyle 2y agoIf that's the case, the AS/400 terminal was peak UX.
- internet101010 2y agoAS/400 was definitely peak reliability.
- dmd 2y agoI agree with that!
- gorjusborg 2y agoI mentally bin TUI applications in the same category as 2D video games. Not all of them are good, but there are way better chances that I like it than the 'other one' (3D game / GUI). I think the reasons are similar. When you don't have to focus so hard on what it should look like you spend more time on whether it is a pleasure to use.
- qwertygerty 2y agoThis is a great comment. I still reminisce about some rock solid TUI apps because they were extremely user friendly and productive. The moment the GUI came along and the mouse became part of the picture, plus the focus on looking pretty, effective interactions went out the window.
- bashmelek 2y agoThis is rather timely—I started playing with PDCurses after being inspired by Zed Shaw’s “Rogue is the Best Project”. It has been an interesting experience
- didgetmaster 2y agoI remember writing something a few decades ago using NCurses. I don't even remember what the program was, but I remember having to go back and forth tweaking the window sizes to make things fit together and look right.
- lepicz 2y agoi always wondered - why is ncurses so retarded with the Esc key? (there's usually delay between Esc taking action, one should press it once and then wait a second until it takes effect)
- Brian_K_White 2y agoEsc is a single byte which is the prefix for multi-byte escape sequences. Bytes arrive serially, one at a time, one after another. There is no predictable garanteed time between bytes. Any two bytes in the stream may arrive with any amount of time between them, 1 ns, 1s, 1 hour, 1 week... So anything that reads the bytes must have some sort of timeout whereby on seeing an esc, it waits up to some time for the rest of the escape sequence before giving up and treating the esc as a lone byte or a byte that was not lone but not not part of an escape sequence either. IE, no recognized termcap code ending with ";" etc. During that time it may be either waiting while no bytes are coming in, or it may be collecting bytes that haven't yet added up to some known terminal control code. Normally even a very long valid escape sequence would all come in a fraction of a second, and so you'd think a tiny timeout like 0.1 second would be fine, but there are such things as far slower baud rates, and even if your immediate terminal has an infinite baud rate, some link in the unknown chain to your terminal could be any other speed, and there can be unpredictable pauses in otherwise fast baud rates. Even on the modern internet the timeout needs to account for some router hiccough anywhere in the 1000 miles between the source & your terminal. Most apps that want to use esc as a direct "normal" key need to either use raw mode if that's even an option, or make the user type "esc-esc" instead of just "esc", and because of that, they just shouldn;t even be trying to do that in the first place, they should know better. It's not a good key to use for "abort" or anything else unless your environment is windows or dos.
- lepicz 2y agocool, thank you for shedding light on decade old mystery :)
- Brian_K_White 2y agoDon't ask me about the delete vs backspace vs break love triangle of death, or the 2 or more totally different definitions of the same "TERM=xterm" :)
- codr7 2y agoNcurses has its place, if you're doing a full featured form based app it helps a lot. That being said, if you're doing something less involved, controlling the terminal via ansi escape sequences is not rocket surgery. https://en.wikipedia.org/wiki/ANSI_escape_code https://en.wikipedia.org/wiki/ANSI_escape_code https://github.com/codr7/sharpl/blob/main/src/Sharpl/Term.cs https://github.com/codr7/sharpl/blob/main/src/Sharpl/Term.cs https://github.com/codr7/sharpl/tree/main/examples/fire https://github.com/codr7/sharpl/tree/main/examples/fire
- alanjay 2y agoNothing like curses to build an ascii pacman! https://m.youtube.com/watch?v=wZorbnsFeHQ https://m.youtube.com/watch?v=wZorbnsFeHQ
- DrillShopper 2y agoCracking up at the ghost that gets stuck in the maze wall.
- jmclnx 2y agoLooks good, but curses and I have a hard time. Ages ago on a mini I use to program, there was a very simple library I could call to format a screen. You told it modifiable field type and its text plus position on the screen. The screen was fixed at 80x24 plus no popups. I wish there was a simple wrapper for curses like that :) In the DOS Days, zortech c had a nice set of functions for screen input, disp_*, those were easy for my simple mind to understand to.
- MisterTea 2y agoI always love the look of a well laid out TUI. In uni there were color IBM terminals everywhere and that bright, colorful UI is burned into my mind. What I would like is a (n)curses library that uses a graphics back end instead of a TTY, preferably written in Go. I want a GTUI (Graphical-Text User Interface 8-) Side note, Anyone know a site that curates a list of TUI designs? And not just good ones but examples of bad and weird.
- eadmund 2y ago> The curses API may seem something of an archaism on UNIX desktops increasingly dominated by X, Motif, and Tcl/Tk. This sets the document at a particular point in time … in a lot of ways a better point in time. I really miss the mid-90s computer scene. Things worked, often well, and in comparison to today they were so low-latency!
- Jotalea 2y agoNot sure if it is my problem, but I can't access the site, it is blocked by a firewall I've never set up (and I'm using mobile data).
- sivanmz 2y agoI had a good experience with the Java Lanterna library https://github.com/mabe02/lanterna https://github.com/mabe02/lanterna