A minimal terminal API shard omarluq/termisu

I’m building Termisu, a small, minimal terminal API inspired by Termbox and Termbox-Go. The goal is to offer a simple, lightweight foundation for building text based UIs on *nix systems.

I don’t use Windows myself, so cross-platform support isn’t on my immediate roadmap, but I’m open to contributions if anyone wants to explore that side.

If you’d like to try it out and give feedback or suggestions, I’d really appreciate it!

6 Likes

Interesting, but for some reason the output is incorrect. The demo should have a box, but the first line for me is:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%p1%dG╗

TERM is xterm-256color

Will do some troubleshooting on my side…

1 Like

Has to be the terminal. wezterm and alacritty do weird characters, as does xfce4-terminal, but ghostty prints correctly. I’ll have to figure that out.

1 Like

Good Catch, thanks for reporting, I just pushed a fix for the bug.
The problem was in the terminfo parser:

  1. Wrong EXTENDED_MAGIC constant: Was using octal 0o542 (354) instead of decimal 542, causing incorrect offset calculations for 32-bit extended terminfo format
  2. Incomplete capability ordering: Missing the complete 414-entry STRING_CAPS array in correct ncurses order

The fix implements proper name-based capability lookup and correctly handles extended format. With TERM=xterm-256color, you should now get clean ANSI sequences like \e[?1049h instead of the garbage %p1%dG output.

The different behavior across terminals likely depends on whether they use standard (16-bit) vs extended (32-bit) terminfo format.

Pull the latest changes and it should work correctly! :tada: