1. 42
  1. 9

    Not afraid to ask; have implemented > 1 terminal emulators; designed and implemented > 1 TUI APIs; got a few hundred hours of ncurses (and Turbo Vision!) work behind me. Everything being stated in the article would make things worse than just cursing.

    A curses application can be salvaged; it is possible to lift and translate its abstractions into something else, heck right now I can run the ‘gui’ command in lldb and it turns into desktop integrated windows here. Hardcoding the composed and ‘rasterised’ output as escape sequences assuming a certain terminal on the other side turns the abstractions into a computer vision problem, –––– as a line or as part of a border as part of a window?

    For all the ugly that ncurses has inside of it, at least abstractions are provided that can be worked with to deal with legacy compatibility. There are notions of screens, panels, menus, scrolling, mouse input, forms and synchronisation - not an irreversible soup of \x1b[0m fuckery, it’s a stupid trick for bolding a font and gets dumber by the second you need to do everything after typesetting. Having an overloadable symbol for synch alone warrants curses above vt100 diarrhoea.

    better yet - you have termbox, turbo-vision and yes, arcan-tui.

    1. 8

      A lot of good stuff in there, but this stood out:

      #define szstr(str) str,sizeof(str)

      and should probably be:

      #define szstr(str) str,sizeof(str)-1

      since sizeof(“foo”) is 4 (includes the terminating \0)

      1. 1

        Not my article–just sharing! Send it to her: lexi at hale.su

        1. 2

          To “-1 spam”, it’s on her home page.

      2. 4

        Previous discussion (the article has been moved).

        1. 3

          Tangential to the article, I’ve read in many places that ncurses is a bad API (say the unix hater’s book), but what would be a good API for TUIs? Can someome point to me examples?

          1. 3

            I believe that following UH, no terminal UI could be good.

            1. 1

              what would be a good API for TUIs?

              There aren’t any, I’m afraid, but there are options better than ncurses, such as slang and termbox.

            2. 5

              I enjoyed this, but I have to say the affectation of not capitalizing initial letters makes prose harder to read. Good content, though.

              1. 2

                Really interesting content, don’t know if it’s worth pointing this out but the use of signal for anything other than setting the disposition of a signal is non-portable and should generally be avoided, sigaction is the preferred method for portably installing a signal handler.