43 Commits

Author SHA1 Message Date
5692f32bcf CMake-ify, rename to termkey2 for the time being 2014-10-09 23:47:24 +02:00
36bc6cd095 Move to iconv
That is the major change in this commit.

Also Ctrl-modified keys now should work in URxvt,
which was surprisingly trivial to achieve.

Coming up next:
 - making sure the tests still work
 - introducing CMake
2014-09-28 03:59:12 +02:00
cac1f8373b Less code duplication 2014-09-23 03:05:01 +02:00
c0cc27c555 Introduce isatty(3) 2014-09-23 03:05:01 +02:00
75d3388a35 Introduce bsearch(3) 2014-09-23 03:05:01 +02:00
56f7847ce3 Add -Wextra 2014-09-23 03:05:01 +02:00
b630bf7a5f WIP: Is mine now (^3^)
Seriously though, I've got some issues with how this thing is designed,
as well as with its formatting, and when you add the fact that the
original author wants to merge this thing into his bigger library that
also handles terminal output, which I'll kindly leave to ncurses,
it kind of makes sense for me to do this.

Manpages have been removed as they are going to become obsolete and
they're rather difficult to maintain.  If anything, there will be
Doxygen-generated documentation.

The plan is to throw away any direct UTF-8 support and support all uni-
and multibyte character encodings.  However some unrelated refactoring
is about to come first.
2014-09-23 03:05:01 +02:00
Paul LeoNerd Evans
2ed8bae4f6 Don't try to write() the start/stop string if the fd is a pipe, because this will never work 2012-01-20 20:01:11 +00:00
Paul LeoNerd Evans
052738b8f4 Allow {start,stop}_driver to fail, abort constructor, have driver-ti try to write the entire start/stop string or error out on -1 2012-01-20 17:00:09 +00:00
Paul LeoNerd Evans
8d2fa34a52 (void)-cast calls to write() in driver-ti start/stop since we don't -really- care if they fail, there's not much we can do about it 2012-01-20 16:44:33 +00:00
Paul LeoNerd Evans
6d6afe788c Allow passing fd = -1 to constructor to make an instance not associated with an fd; must use push_bytes to provide it input 2012-01-18 14:03:39 +00:00
Paul LeoNerd Evans
e768f02219 Optionally support unibilium for reading terminfo instead of curses 2011-09-24 00:04:01 +01:00
Paul LeoNerd Evans
d8f6551972 Neaten logic by loading terminfo strings in a separate function from the constructor 2011-09-23 23:40:54 +01:00
Paul LeoNerd Evans
447a3e7ab9 strdup() needs 'define _XOPEN_SOURCE 600 - Petr Pavlu 2011-08-25 22:49:17 +01:00
Paul LeoNerd Evans
4ac0d752c4 Solaris requires #define _XPG6 2011-04-04 22:26:25 +01:00
Paul LeoNerd Evans
391f795c67 include <curses.h> before <term.h> as it's required in that order on Solaris 2011-03-30 20:24:06 +01:00
Paul LeoNerd Evans
c4bc0486d4 Moved mouse parsing code out of driver-ti.c into core termkey.c 2009-11-26 00:27:58 +00:00
Paul LeoNerd Evans
bdc22b8b3d Remember to zero key->modifiers for mouse events 2009-11-25 14:46:19 +00:00
Paul LeoNerd Evans
c9d2bd93fd Implement XTerm mouse parsing in terminfo driver 2009-11-24 01:31:35 +00:00
Paul LeoNerd Evans
be998cef1b Renamed all type names to CamelCaseNames for visual distinctness, separate from variables/functions 2009-07-15 20:40:44 +01:00
Paul LeoNerd Evans
ef669c134d Complete change of driver internals - peek and return size but don't eat bytes; eat later in getkey() 2008-12-10 00:23:47 +00:00
Paul LeoNerd Evans
43a99e64f2 strdup() the terminfo keypad_local and keypad_xmit strings at construct time, in case multiple instances and they change beneath us 2008-12-03 20:19:15 +00:00
Paul LeoNerd Evans
2c1bea4f15 Use a C99 flexible array member rather than the [0] hack 2008-12-02 01:05:47 +00:00
Paul LeoNerd Evans
d245285df2 Cast 'term' to (non-const) char* when passing to setupterm() because terminfo's prototypes don't use const 2008-11-28 19:48:41 +00:00
Paul LeoNerd Evans
fef558eeb4 Use sizeof() on assigned variables rather than types, to make code a little less fragile to type changes 2008-11-24 22:15:43 +00:00
Paul LeoNerd Evans
c6ff878411 Fixed another signed-vs-unsigned int comparison in driver-ti.c 2008-11-24 22:06:14 +00:00
Paul LeoNerd Evans
14561e2a30 Only print about unrecognised terminfo variable names when debugging 2008-11-18 15:55:29 +00:00
Paul LeoNerd Evans
4a108d4916 Compress trie nodes down to extent maps after loading, to save memory 2008-11-12 23:58:20 +00:00
Paul LeoNerd Evans
754214c200 Use a trie instead of a linear list of sequence strings in the terminfo driver - nicer lookup properties 2008-11-12 16:32:17 +00:00
Paul LeoNerd Evans
04e1926df6 Handle malloc() failures during setup of driver-ti 2008-11-12 16:10:58 +00:00
Paul LeoNerd Evans
30a3356815 Implemented free_driver() in terminfo driver 2008-11-09 22:38:10 +00:00
Paul LeoNerd Evans
09edf2377f Driver getkey() can return TERMKEY_RES_NONE which attempts getkey_simple() afterwards 2008-11-09 19:45:43 +00:00
Paul LeoNerd Evans
d50d772ca5 Drivers have names 2008-11-08 17:56:44 +00:00
Paul LeoNerd Evans
e880602944 Pass driver_info as explicit void* parameter into driver methods 2008-11-08 17:47:57 +00:00
Paul LeoNerd Evans
1c46f5edfa Recognise 'key_mouse' as an ignored terminfo key 2008-11-02 22:16:03 +00:00
Paul LeoNerd Evans
aef409c460 Terminfo driver needs to put terminal into 'keypad_xmit' mode when starting 2008-11-02 17:59:30 +00:00
Paul LeoNerd Evans
62d4e7eccb Pass the 'force' value through to getkey_simple() 2008-11-02 14:43:19 +00:00
Paul LeoNerd Evans
bb00cd64b1 Added many more key symbols and names + translations from terminfo 2008-10-10 01:11:24 +01:00
Paul LeoNerd Evans
2ceb64261a Binary search terminfo funcname => termkey sym conversion, rather than linear 2008-10-10 00:44:13 +01:00
Paul LeoNerd Evans
37156ad580 Added some TODO notes about handling realloc() failures 2008-10-09 23:53:35 +01:00
Paul LeoNerd Evans
2b08f88f19 Better free() tracking in constructor failure cases 2008-10-09 23:19:10 +01:00
Paul LeoNerd Evans
05639c4773 Pass 'term' string into new_driver virtual method; have drivers sensitive to it and return NULL if they can't handle. Try CSI driver first; only for xterm-alikes 2008-10-09 20:23:45 +01:00
Paul LeoNerd Evans
c974e61a8d Added initial attempt at a terminfo-driven driver 2008-10-08 02:04:47 +01:00