Terminal key input library
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Přemysl Eric Janouch 4282f3715c
Fix cursor keys etc. in unibilium
unibi_pkey_xmit was the wrong constant.
7 years ago
cmake Try harder to get ncursesw 8 years ago
tests Make ASCII NUL imply Ctrl-Space instead of C-@ 7 years ago
.gitignore Miscellaneous little changes 9 years ago
.travis.yml Fix Travis CI notifications 8 years ago
CMakeLists.txt Make unibilium work at all 7 years ago
LICENSE WIP: Is mine now (^3^) 9 years ago
README.adoc Fix README 8 years ago
config-version.cmake.in CMake-ify, rename to termkey2 for the time being 9 years ago
config.cmake.in Rename to termo 9 years ago
demo-async.c Get rid of most block comments 9 years ago
demo-draw.c Rewrite the mouse API 9 years ago
demo-glib.c Rename to termo 9 years ago
demo.c Rewrite the mouse API 9 years ago
driver-csi.c Don't interpret an n*<Esc> as (n-1)*<Alt>-<Esc> 8 years ago
driver-ti.c Fix cursor keys etc. in unibilium 7 years ago
termo-config.h.in Rename to termo 9 years ago
termo-internal.h Don't interpret an n*<Esc> as (n-1)*<Alt>-<Esc> 8 years ago
termo.c Make ASCII NUL imply Ctrl-Space instead of C-@ 7 years ago
termo.h Rewrite the mouse API 9 years ago



termo is a library providing an alternative to ncurses' handling of terminal input. ncurses does a really terrible job at that, mainly wrt. mouse support which seems to be utterly broken. If you can drag things in a terminal application, such as in VIM, I can assure you its not using ncurses for that. (At least not with ncurses older than 6.0.)

Since terminal I/O is really complicated and full of special cases, this project doesnt aspire to also replace the output part of ncurses, but is rather complementary to it. In the end it makes use of its terminfo library.

The API isnt stable yet. Tell me what needs to be done so I can fix it first.

Building and Installing

Build dependencies: cmake >= 2.8.5, pkg-config
Optional dependencies: Unibilium (alternative for curses), GLib (for the demos)

$ git clone https://github.com/pjanouch/termo.git
$ mkdir termo/build
$ cd termo/build

To install the library, you can do either the usual:

# make install

Or you can try telling CMake to make a package for you. For Debian it is:

$ cpack -G DEB
# dpkg -i termo-*.deb

To see the library in action, you can try running the demos, which are statically linked against the library, and hence they can be run as they are:

$ make demos

Whats Different From the Original termkey?

The main change is throwing away any UTF-8 dependent code, making the library capable of handling all unibyte and multibyte encodings supported by iconv on your system. The characters are still presented as Unicode in the end, however, as the other sensible option is wchar_t and that doesnt really work well, see http://gnu.org/software/libunistring/manual/libunistring.html#The-wchar_005ft-mess

To make the mouse parsing support actually useful, some API has been added to set the proper modes on request, and unset them appropriately while destroying. You can have a look at demo-draw.c for an example.

Another change worth mentioning is the usage of CMake instead of the problematic libtool-based Makefile. Now you can include this project in your other CMake-based projects and simply import the target. No package maintainer action is needed for you to enjoy the benefits of proper terminal input.

The rest is just me going silly over formatting and various unimportant stuff. Oh, and Ive deleted the manpages. It needs more Doxygen. :) TBD

Contributing and Support

Use this projects GitHub to report any bugs, request features, or submit pull requests. If you want to discuss this project, or maybe just hang out with the developer, feel free to join me at irc://irc.janouch.name, channel #dev.


termo is based on the termkey library, originally written by Paul Evans <leonerd@leonerd.org.uk>, with additional changes made by Přemysl Janouch <p.janouch@gmail.com>.

You may use the software under the terms of the MIT license, the text of which is included within the package, see the file LICENSE.