Live data from Hacker News

Writing Programs with Ncurses

invisible-island.net

61–70 of 93 posts

Re: Writing Programs with Ncurses

#61
post #4

I love TUIs. They are clear, quick and easy to use. Probably because they require straightforward design. I just read the following links to build up foundation of knowledge first - low-level: http://%CA%9E.cc/irl/term.html https://viewsourcecode.org/snaptoken/kilo/02.enteringRawMode... https://en.wikipedia.org/wiki/ANSI_escape_code#Colors Other libraries: # C, C++, Python and Rust https://github.com/dankamongmen/not…

It feels like we live in a pretty good time for writing TUIs, CLIs and also small self-contained tools (thanks to languages like Go, which have a lot of libraries, are easy to use, but also compile to statically linked executables). What stuck with me was using the Typer library for a Python tool that i wrote: https://typer.tiangolo.com/ It made regular shell scripts into a fully fledged CLI with nested commands than…

Gooey is a similar tool to Typer that I have bookmarked for such cases, but never had the opportunity to use it.

https://github.com/chriskiehl/Gooey

Re: Writing Programs with Ncurses

#62
post #4

I love TUIs. They are clear, quick and easy to use. Probably because they require straightforward design. I just read the following links to build up foundation of knowledge first - low-level: http://%CA%9E.cc/irl/term.html https://viewsourcecode.org/snaptoken/kilo/02.enteringRawMode... https://en.wikipedia.org/wiki/ANSI_escape_code#Colors Other libraries: # C, C++, Python and Rust https://github.com/dankamongmen/not…

For C++, there is also ImTui that I wrote sometime ago: https://github.com/ggerganov/imtui I made a few sample apps with it, such as HN client and a WTF configuration tool. They are both linked in the repo if you are interested. I still want to make some other cool terminal app with it, but haven't found a nice idea yet.

This library looks really fun!

Thanks for sharing the link.

Re: Writing Programs with Ncurses

#63
post #19

Earlier quoted context omitted.

Mainframes do have a more sensible way to build a TUI than something like curses. A 3270 TUI is very similar to using html forms. The fields are named, have attributes, validation, and a so on. The mainframe sends the form, the user interacts with the form, and nothing is sent back to the server until either a field validation is needed or the "Enter" key is pressed. More detail: http://bitsavers.trailing-edge.com/pd…

Did you mean to link to a 380 page PDF book? Sure, it fits with the literal meaning of "more detail", but it doesn't feel helpful in a discussion context like this... I clicked on that link hoping to see one or two pages of info that made it clear how the whole system worked with more detail than you gave, but not a whole book of minutia that I don't have enough reason to care about at this point in the discussion.

You can and search for "Overview and Concepts".

I'm not aware of a summarized 2 pager as a standalone html page.

Re: Writing Programs with Ncurses

#64
post #19

Earlier quoted context omitted.

Mainframes do have a more sensible way to build a TUI than something like curses. A 3270 TUI is very similar to using html forms. The fields are named, have attributes, validation, and a so on. The mainframe sends the form, the user interacts with the form, and nothing is sent back to the server until either a field validation is needed or the "Enter" key is pressed. More detail: http://bitsavers.trailing-edge.com/pd…

Did you mean to link to a 380 page PDF book? Sure, it fits with the literal meaning of "more detail", but it doesn't feel helpful in a discussion context like this... I clicked on that link hoping to see one or two pages of info that made it clear how the whole system worked with more detail than you gave, but not a whole book of minutia that I don't have enough reason to care about at this point in the discussion.

There is no 2 page manual at IBM ;)

Re: Writing Programs with Ncurses

#65
post #58
post #47

Earlier quoted context omitted.

The only sad part here is that you didn’t get your own 3278 with beam spring keyboard ;-) People often equate a later fad with “modernisation” when a well architected app can be easy to manage even if written in COBOL and running under CICS. If a person can learn Java, they can learn to read COBOL.

>The only sad part here is that you didn’t get your own 3278 with beam spring keyboard ;-) Hey! I have my beloved HHKB Professional 2 since years :-) >If a person can learn Java, they can learn to read COBOL. Well...well yes! That's true especially the modern one's.

> Hey! I have my beloved HHKB Professional 2 since years :-)

Doesn’t come even close. ;-)

Re: Writing Programs with Ncurses

#66
Thomas Dickey has been maintaining this code by himself for years (decades?). Along with the timezone database, the terminal info database is a huge SPOF. It's too bad that this effort is mostly unrecognised.

Re: Writing Programs with Ncurses

#67
post #65
post #58

Earlier quoted context omitted.

>The only sad part here is that you didn’t get your own 3278 with beam spring keyboard ;-) Hey! I have my beloved HHKB Professional 2 since years :-) >If a person can learn Java, they can learn to read COBOL. Well...well yes! That's true especially the modern one's.

> Hey! I have my beloved HHKB Professional 2 since years :-) Doesn’t come even close. ;-)

Don't you dare to say anything more!!!

But i believe you ;)

Re: Writing Programs with Ncurses

#68
post #60
post #50

Earlier quoted context omitted.

I recently came across YAD ( https://sourceforge.net/projects/yad-dialog/ ), which is a improved version of dialog. Allows you to create a simple GUI, where all the entries are written to STDOUT. So, you can interface with your favorite language. For examples, see this page: http://smokey01.com/yad/

Note that the project hasn't been contributed to since 2017, and contains unfixed bugs from six years ago. Might be worth a fork or a rewrite.

It's active. Seems to have been moved to https://github.com/v1cont/yad

Re: Writing Programs with Ncurses

#69
post #4

I love TUIs. They are clear, quick and easy to use. Probably because they require straightforward design. I just read the following links to build up foundation of knowledge first - low-level: http://%CA%9E.cc/irl/term.html https://viewsourcecode.org/snaptoken/kilo/02.enteringRawMode... https://en.wikipedia.org/wiki/ANSI_escape_code#Colors Other libraries: # C, C++, Python and Rust https://github.com/dankamongmen/not…

> http://%CA%9E.cc/irl/term.html

Link is broken (malformed); should be (I think) http://xn--rpa.cc/irl/term.html.

Re: Writing Programs with Ncurses

#70
post #57
post #5

Earlier quoted context omitted.

It would be nice if curses programs all had a standard keymapping or signal that would invoke one of curses screen dump functions. Lacking that, a screenreader would have to jump through a lot of hoops to even know what's on the screen. I suppose you could use tmux instead...it seems to be able to dump the current screen. Either way, still a lot of work to do after you have the raw data.

You don't need to dump the screen, the screen reader takes care of letting you explore the screen by line, word, character, etc. Some curses programs work reasonably well with screen readers (e.g. Mutt and WeeChat). One useful way to make them more accessible is to put the hardware cursor somewhere useful, even if hidden. Mutt puts it on the same line as the currently-selected message, and if braille_friendly is set,…

> One useful way to make them more accessible is to put the hardware cursor somewhere useful, even if hidden.

You should be doing this anyway to account for hardware terminals where the cursor is always visible, including the traditional VGA/VESA text console that still gets used by default on PC hardware.

Post reply on HN