I'd like to throw in another suggestion, S-Lang, which is roughly comparable to curses/ncurses in its abstraction level. The description from its home page probably summarizes it better:

S-Lang is a multi-platform programmer's library designed to allow a developer to create robust multi-platform software. It provides facilities required by interactive applications such as display/screen management, keyboard input, keymaps, and so on. (...)

And, as to the support beyond the Unix world (from the INSTALL.pc file):

The slang library is available for OS/2, MSDOS, and WIN32 (windows 9x/NT) systems. This _includes_ the various GNU environments such as DJGPP, and MINGW32. For CYGWIN, follow the UNIX instructions.

(Actually, it's not only that, but also a full programming language / interpreter, etc., but the cited part should about fit what you're interested in...)

One advantage is that it's both stable (been around since the mid-90's) and actively maintained (latest release June 2007).

A number of well-known programs with a text-based UI make use of it (or optionally may be linked against it, instead of ncurses), like for example mc (Midnight Commander file manager), mutt (mail client), slrn (newsreader), lynx (html browser), and various text editors.

In principle, there's also a Perl binding for it Term::Slang. Unfortunately, it dates back to the year 2K, and doesn't seem to be maintained any longer. Anyhow, the module is a decent start, and it should be rather straightforward to upgrade/extend for anyone determined (or even addicted to programming, like you :).

Actually, I just tried building it against the most recent S-lang library v2.1.1. As expected, it did no longer work, but it took me only about half an hour to come up with fixes/workarounds for the fatal errors. There are still 7 compile warnings left that need to be taken care of... but that should be doable as well. (Most incompatibilities were related to changed function names and/or argument lists, in particular with respect to readline functionality). /msg me privately if you want the diffs.

Anyhow, now it builds, and you (well, I, at the moment :) can run the Perl examples that come with Term::Slang, e.g. draw-bow, which draws a typical text UI dialog box with a message and Yes/No/Cancel buttons and a line-chars frame around it, centered within the terminal.

That's about 80 lines of Perl code (including the boilerplate), so you'll probably want to abstract away often used functionality in libs (widgets like dialog boxes, etc.).

(BTW, if you get anything along these lines working properly, please let me know — I'm personally a big fan of text-based user interfaces, and being able to easily create them with Perl would definitely be a plus...)


In reply to Re: console editor by almut
in thread console editor by misc

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.