* st + patches and config
       
   URI git clone git://git.codevoid.de/st-sdk
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 3c79964f5505ddf4faa0c01c44b78c908d025c4f
   URI Author: Stefan Hagen <github@textmail.me>
       Date:   Mon, 14 May 2018 21:59:20 +0200
       
       st original source
       
       Diffstat:
         A FAQ                                 |     167 +++++++++++++++++++++++++++++++
         A LEGACY                              |      17 +++++++++++++++++
         A LICENSE                             |      34 +++++++++++++++++++++++++++++++
         A Makefile                            |      57 +++++++++++++++++++++++++++++++
         A README                              |      34 +++++++++++++++++++++++++++++++
         A TODO                                |      28 ++++++++++++++++++++++++++++
         A arg.h                               |      50 +++++++++++++++++++++++++++++++
         A config.def.h                        |     462 +++++++++++++++++++++++++++++++
         A config.mk                           |      28 ++++++++++++++++++++++++++++
         A st.1                                |     180 +++++++++++++++++++++++++++++++
         A st.c                                |    2619 +++++++++++++++++++++++++++++++
         A st.h                                |     123 +++++++++++++++++++++++++++++++
         A st.info                             |     222 ++++++++++++++++++++++++++++++
         A win.h                               |      38 +++++++++++++++++++++++++++++++
         A x.c                                 |    1951 +++++++++++++++++++++++++++++++
       
       15 files changed, 6010 insertions(+), 0 deletions(-)
       ---
   DIR diff --git a/FAQ b/FAQ
       @@ -0,0 +1,167 @@
       +## Why does st not handle utmp entries?
       +
       +Use the excellent tool of [utmp](http://git.suckless.org/utmp/) for this task.
       +
       +## Some _random program_ complains that st is unknown/not recognised/unsupported/whatever!
       +
       +It means that st doesn’t have any terminfo entry on your system. Chances are
       +you did not `make install`. If you just want to test it without installing it,
       +you can manually run `tic -sx st.info`.
       +
       +## Nothing works, and nothing is said about an unknown terminal!
       +
       +* Some programs just assume they’re running in xterm i.e. they don’t rely on
       +  terminfo. What you see is the current state of the “xterm compliance”.
       +* Some programs don’t complain about the lacking st description and default to
       +  another terminal. In that case see the question about terminfo.
       +
       +## I get some weird glitches/visual bug on _random program_!
       +
       +Try launching it with a different TERM: $ TERM=xterm myapp. toe(1) will give
       +you a list of available terminals, but you’ll most likely switch between xterm,
       +st or st-256color. The default value for TERM can be changed in config.h
       +(TNAME).
       +
       +## How do I scroll back up?
       +
       +Using a terminal multiplexer.
       +
       +* `st -e tmux` using C-b [
       +* `st -e screen` using C-a ESC
       +
       +## Why doesn't the Del key work in some programs?
       +
       +Taken from the terminfo manpage:
       +
       +        If the terminal has a keypad that transmits codes when the keys
       +        are pressed, this information can be given. Note that it is not
       +        possible to handle terminals where the keypad only works in
       +        local (this applies, for example, to the unshifted HP 2621 keys).
       +        If the keypad can be set to transmit or not transmit, give these
       +        codes as smkx and rmkx. Otherwise the keypad is assumed to
       +        always transmit.
       +
       +In the st case smkx=E[?1hE= and rmkx=E[?1lE>, so it is mandatory that
       +applications which want to test against keypad keys send these
       +sequences.
       +
       +But buggy applications (like bash and irssi, for example) don't do this. A fast
       +solution for them is to use the following command:
       +
       +        $ printf '\033[?1h\033=' >/dev/tty
       +
       +or
       +        $ tput smkx
       +
       +In the case of bash, readline is used. Readline has a different note in its
       +manpage about this issue:
       +
       +        enable-keypad (Off)
       +                When set to On, readline will try to enable the
       +                application keypad when it is called. Some systems
       +                need this to enable arrow keys.
       +
       +Adding this option to your .inputrc will fix the keypad problem for all
       +applications using readline.
       +
       +If you are using zsh, then read the zsh FAQ
       +<http://zsh.sourceforge.net/FAQ/zshfaq03.html#l25>:
       +
       +        It should be noted that the O / [ confusion can occur with other keys
       +        such as Home and End. Some systems let you query the key sequences
       +        sent by these keys from the system's terminal database, terminfo.
       +        Unfortunately, the key sequences given there typically apply to the
       +        mode that is not the one zsh uses by default (it's the "application"
       +        mode rather than the "raw" mode). Explaining the use of terminfo is
       +        outside of the scope of this FAQ, but if you wish to use the key
       +        sequences given there you can tell the line editor to turn on
       +        "application" mode when it starts and turn it off when it stops:
       +
       +                function zle-line-init () { echoti smkx }
       +                function zle-line-finish () { echoti rmkx }
       +                zle -N zle-line-init
       +                zle -N zle-line-finish
       +
       +Putting these lines into your .zshrc will fix the problems.
       +
       +## How can I use meta in 8bit mode?
       +
       +St supports meta in 8bit mode, but the default terminfo entry doesn't
       +use this capability. If you want it, you have to use the 'st-meta' value
       +in TERM.
       +
       +## I cannot compile st in OpenBSD
       +
       +OpenBSD lacks librt, despite it being mandatory in POSIX
       +<http://pubs.opengroup.org/onlinepubs/9699919799/utilities/c99.html#tag_20_11_13>.
       +If you want to compile st for OpenBSD you have to remove -lrt from config.mk, and
       +st will compile without any loss of functionality, because all the functions are
       +included in libc on this platform.
       +
       +## The Backspace Case
       +
       +St is emulating the Linux way of handling backspace being delete and delete being
       +backspace.
       +
       +This is an issue that was discussed in suckless mailing list
       +<http://lists.suckless.org/dev/1404/20697.html>. Here is why some old grumpy
       +terminal users wants its backspace to be how he feels it:
       +
       +        Well, I am going to comment why I want to change the behaviour
       +        of this key. When ASCII was defined in 1968, communication
       +        with computers was done using punched cards, or hardcopy
       +        terminals (basically a typewriter machine connected with the
       +        computer using a serial port).  ASCII defines DELETE as 7F,
       +        because, in punched-card terms, it means all the holes of the
       +        card punched; it is thus a kind of 'physical delete'. In the
       +        same way, the BACKSPACE key was a non-destructive backspace,
       +        as on a typewriter.  So, if you wanted to delete a character,
       +        you had to BACKSPACE and then DELETE.  Another use of BACKSPACE
       +        was to type accented characters, for example 'a BACKSPACE `'.
       +        The VT100 had no BACKSPACE key; it was generated using the
       +        CONTROL key as another control character (CONTROL key sets to
       +        0 b7 b6 b5, so it converts H (code 0x48) into BACKSPACE (code
       +        0x08)), but it had a DELETE key in a similar position where
       +        the BACKSPACE key is located today on common PC keyboards.
       +        All the terminal emulators emulated the difference between
       +        these keys correctly: the backspace key generated a BACKSPACE
       +        (^H) and delete key generated a DELETE (^?).
       +
       +        But a problem arose when Linus Torvalds wrote Linux. Unlike
       +        earlier terminals, the Linux virtual terminal (the terminal
       +        emulator integrated in the kernel) returned a DELETE when
       +        backspace was pressed, due to the VT100 having a DELETE key in
       +        the same position.  This created a lot of problems (see [1]
       +        and [2]). Since Linux has become the king, a lot of terminal
       +        emulators today generate a DELETE when the backspace key is
       +        pressed in order to avoid problems with Linux. The result is
       +        that the only way of generating a BACKSPACE on these systems
       +        is by using CONTROL + H. (I also think that emacs had an
       +        important point here because the CONTROL + H prefix is used
       +        in emacs in some commands (help commands).)
       +
       +        From point of view of the kernel, you can change the key
       +        for deleting a previous character with stty erase. When you
       +        connect a real terminal into a machine you describe the type
       +        of terminal, so getty configures the correct value of stty
       +        erase for this terminal. In the case of terminal emulators,
       +        however, you don't have any getty that can set the correct
       +        value of stty erase, so you always get the default value.
       +        For this reason, it is necessary to add 'stty erase ^H' to your
       +        profile if you have changed the value of the backspace key.
       +        Of course, another solution is for st itself to modify the
       +        value of stty erase.  I usually have the inverse problem:
       +        when I connect to non-Unix machines, I have to press CONTROL +
       +        h to get a BACKSPACE. The inverse problem occurs when a user
       +        connects to my Unix machines from a different system with a
       +        correct backspace key.
       +
       +        [1] http://www.ibb.net/~anne/keyboard.html
       +        [2] http://www.tldp.org/HOWTO/Keyboard-and-Console-HOWTO-5.html
       +
       +## But I really want the old grumpy behaviour of my terminal
       +
       +Apply [1].
       +
       +[1] http://st.suckless.org/patches/delkey
       +
   DIR diff --git a/LEGACY b/LEGACY
       @@ -0,0 +1,17 @@
       +A STATEMENT ON LEGACY SUPPORT
       +
       +In the terminal world there is much cruft that comes from old and unsup‐
       +ported terminals that inherit incompatible modes  and  escape  sequences
       +which noone is able to know, except when he/she comes from that time and
       +developed a graphical vt100 emulator at that time.
       +
       +One  goal  of  st is to only support what is really needed. When you en‐
       +counter a sequence which you really need, implement it.  But  while  you
       +are  at it,  do not add the other cruft you might encounter while sneek‐
       +ing at other terminal emulators. History has bloated them and  there  is
       +no real evidence that most of the sequences are used today.
       +
       +
       +Christoph Lohmann <20h@r-36.net>
       +2012-09-13T07:00:36.081271045+02:00
       +
   DIR diff --git a/LICENSE b/LICENSE
       @@ -0,0 +1,34 @@
       +MIT/X Consortium License
       +
       +© 2014-2018 Hiltjo Posthuma <hiltjo at codemadness dot org>
       +© 2018 Devin J. Pohly <djpohly at gmail dot com>
       +© 2014-2017 Quentin Rameau <quinq at fifth dot space>
       +© 2009-2012 Aurélien APTEL <aurelien dot aptel at gmail dot com>
       +© 2008-2017 Anselm R Garbe <garbeam at gmail dot com>
       +© 2012-2017 Roberto E. Vargas Caballero <k0ga at shike2 dot com>
       +© 2012-2016 Christoph Lohmann <20h at r-36 dot net>
       +© 2013 Eon S. Jeon <esjeon at hyunmu dot am>
       +© 2013 Alexander Sedov <alex0player at gmail dot com>
       +© 2013 Mark Edgar <medgar123 at gmail dot com>
       +© 2013-2014 Eric Pruitt <eric.pruitt at gmail dot com>
       +© 2013 Michael Forney <mforney at mforney dot org>
       +© 2013-2014 Markus Teich <markus dot teich at stusta dot mhn dot de>
       +© 2014-2015 Laslo Hunhold <dev at frign dot de>
       +
       +Permission is hereby granted, free of charge, to any person obtaining a
       +copy of this software and associated documentation files (the "Software"),
       +to deal in the Software without restriction, including without limitation
       +the rights to use, copy, modify, merge, publish, distribute, sublicense,
       +and/or sell copies of the Software, and to permit persons to whom the
       +Software is furnished to do so, subject to the following conditions:
       +
       +The above copyright notice and this permission notice shall be included in
       +all copies or substantial portions of the Software.
       +
       +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
       +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
       +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
       +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
       +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
       +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
       +DEALINGS IN THE SOFTWARE.
   DIR diff --git a/Makefile b/Makefile
       @@ -0,0 +1,57 @@
       +# st - simple terminal
       +# See LICENSE file for copyright and license details.
       +.POSIX:
       +
       +include config.mk
       +
       +SRC = st.c x.c
       +OBJ = $(SRC:.c=.o)
       +
       +all: options st
       +
       +options:
       +        @echo st build options:
       +        @echo "CFLAGS  = $(STCFLAGS)"
       +        @echo "LDFLAGS = $(STLDFLAGS)"
       +        @echo "CC      = $(CC)"
       +
       +config.h:
       +        cp config.def.h config.h
       +
       +.c.o:
       +        $(CC) $(STCFLAGS) -c $<
       +
       +st.o: config.h st.h win.h
       +x.o: arg.h st.h win.h
       +
       +$(OBJ): config.h config.mk
       +
       +st: $(OBJ)
       +        $(CC) -o $@ $(OBJ) $(STLDFLAGS)
       +
       +clean:
       +        rm -f st $(OBJ) st-$(VERSION).tar.gz
       +
       +dist: clean
       +        mkdir -p st-$(VERSION)
       +        cp -R FAQ LEGACY TODO LICENSE Makefile README config.mk\
       +                config.def.h st.info st.1 arg.h st.h win.h $(SRC)\
       +                st-$(VERSION)
       +        tar -cf - st-$(VERSION) | gzip > st-$(VERSION).tar.gz
       +        rm -rf st-$(VERSION)
       +
       +install: st
       +        mkdir -p $(DESTDIR)$(PREFIX)/bin
       +        cp -f st $(DESTDIR)$(PREFIX)/bin
       +        chmod 755 $(DESTDIR)$(PREFIX)/bin/st
       +        mkdir -p $(DESTDIR)$(MANPREFIX)/man1
       +        sed "s/VERSION/$(VERSION)/g" < st.1 > $(DESTDIR)$(MANPREFIX)/man1/st.1
       +        chmod 644 $(DESTDIR)$(MANPREFIX)/man1/st.1
       +        tic -sx st.info
       +        @echo Please see the README file regarding the terminfo entry of st.
       +
       +uninstall:
       +        rm -f $(DESTDIR)$(PREFIX)/bin/st
       +        rm -f $(DESTDIR)$(MANPREFIX)/man1/st.1
       +
       +.PHONY: all options clean dist install uninstall
   DIR diff --git a/README b/README
       @@ -0,0 +1,34 @@
       +st - simple terminal
       +--------------------
       +st is a simple terminal emulator for X which sucks less.
       +
       +
       +Requirements
       +------------
       +In order to build st you need the Xlib header files.
       +
       +
       +Installation
       +------------
       +Edit config.mk to match your local setup (st is installed into
       +the /usr/local namespace by default).
       +
       +Afterwards enter the following command to build and install st (if
       +necessary as root):
       +
       +    make clean install
       +
       +
       +Running st
       +----------
       +If you did not install st with make clean install, you must compile
       +the st terminfo entry with the following command:
       +
       +    tic -sx st.info
       +
       +See the man page for additional details.
       +
       +Credits
       +-------
       +Based on Aurélien APTEL <aurelien dot aptel at gmail dot com> bt source code.
       +
   DIR diff --git a/TODO b/TODO
       @@ -0,0 +1,28 @@
       +vt emulation
       +------------
       +
       +* double-height support
       +
       +code & interface
       +----------------
       +
       +* add a simple way to do multiplexing
       +
       +drawing
       +-------
       +* add diacritics support to xdraws()
       +        * switch to a suckless font drawing library
       +* make the font cache simpler
       +* add better support for brightening of the upper colors
       +
       +bugs
       +----
       +
       +* fix shift up/down (shift selection in emacs)
       +* remove DEC test sequence when appropriate
       +
       +misc
       +----
       +
       +    $ grep -nE 'XXX|TODO' st.c
       +
   DIR diff --git a/arg.h b/arg.h
       @@ -0,0 +1,50 @@
       +/*
       + * Copy me if you can.
       + * by 20h
       + */
       +
       +#ifndef ARG_H__
       +#define ARG_H__
       +
       +extern char *argv0;
       +
       +/* use main(int argc, char *argv[]) */
       +#define ARGBEGIN        for (argv0 = *argv, argv++, argc--;\
       +                                        argv[0] && argv[0][0] == '-'\
       +                                        && argv[0][1];\
       +                                        argc--, argv++) {\
       +                                char argc_;\
       +                                char **argv_;\
       +                                int brk_;\
       +                                if (argv[0][1] == '-' && argv[0][2] == '\0') {\
       +                                        argv++;\
       +                                        argc--;\
       +                                        break;\
       +                                }\
       +                                int i_;\
       +                                for (i_ = 1, brk_ = 0, argv_ = argv;\
       +                                                argv[0][i_] && !brk_;\
       +                                                i_++) {\
       +                                        if (argv_ != argv)\
       +                                                break;\
       +                                        argc_ = argv[0][i_];\
       +                                        switch (argc_)
       +
       +#define ARGEND                        }\
       +                        }
       +
       +#define ARGC()                argc_
       +
       +#define EARGF(x)        ((argv[0][i_+1] == '\0' && argv[1] == NULL)?\
       +                                ((x), abort(), (char *)0) :\
       +                                (brk_ = 1, (argv[0][i_+1] != '\0')?\
       +                                        (&argv[0][i_+1]) :\
       +                                        (argc--, argv++, argv[0])))
       +
       +#define ARGF()                ((argv[0][i_+1] == '\0' && argv[1] == NULL)?\
       +                                (char *)0 :\
       +                                (brk_ = 1, (argv[0][i_+1] != '\0')?\
       +                                        (&argv[0][i_+1]) :\
       +                                        (argc--, argv++, argv[0])))
       +
       +#endif
   DIR diff --git a/config.def.h b/config.def.h
       @@ -0,0 +1,462 @@
       +/* See LICENSE file for copyright and license details. */
       +
       +/*
       + * appearance
       + *
       + * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
       + */
       +static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
       +static int borderpx = 2;
       +
       +/*
       + * What program is execed by st depends of these precedence rules:
       + * 1: program passed with -e
       + * 2: utmp option
       + * 3: SHELL environment variable
       + * 4: value of shell in /etc/passwd
       + * 5: value of shell in config.h
       + */
       +static char *shell = "/bin/sh";
       +char *utmp = NULL;
       +char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400";
       +
       +/* identification sequence returned in DA and DECID */
       +char *vtiden = "\033[?6c";
       +
       +/* Kerning / character bounding-box multipliers */
       +static float cwscale = 1.0;
       +static float chscale = 1.0;
       +
       +/*
       + * word delimiter string
       + *
       + * More advanced example: " `'\"()[]{}"
       + */
       +char *worddelimiters = " ";
       +
       +/* selection timeouts (in milliseconds) */
       +static unsigned int doubleclicktimeout = 300;
       +static unsigned int tripleclicktimeout = 600;
       +
       +/* alt screens */
       +int allowaltscreen = 1;
       +
       +/* frames per second st should at maximum draw to the screen */
       +static unsigned int xfps = 120;
       +static unsigned int actionfps = 30;
       +
       +/*
       + * blinking timeout (set to 0 to disable blinking) for the terminal blinking
       + * attribute.
       + */
       +static unsigned int blinktimeout = 800;
       +
       +/*
       + * thickness of underline and bar cursors
       + */
       +static unsigned int cursorthickness = 2;
       +
       +/*
       + * bell volume. It must be a value between -100 and 100. Use 0 for disabling
       + * it
       + */
       +static int bellvolume = 0;
       +
       +/* default TERM value */
       +char *termname = "st-256color";
       +
       +/*
       + * spaces per tab
       + *
       + * When you are changing this value, don't forget to adapt the »it« value in
       + * the st.info and appropriately install the st.info in the environment where
       + * you use this st version.
       + *
       + *        it#$tabspaces,
       + *
       + * Secondly make sure your kernel is not expanding tabs. When running `stty
       + * -a` »tab0« should appear. You can tell the terminal to not expand tabs by
       + *  running following command:
       + *
       + *        stty tabs
       + */
       +unsigned int tabspaces = 8;
       +
       +/* Terminal colors (16 first used in escape sequence) */
       +static const char *colorname[] = {
       +        /* 8 normal colors */
       +        "black",
       +        "red3",
       +        "green3",
       +        "yellow3",
       +        "blue2",
       +        "magenta3",
       +        "cyan3",
       +        "gray90",
       +
       +        /* 8 bright colors */
       +        "gray50",
       +        "red",
       +        "green",
       +        "yellow",
       +        "#5c5cff",
       +        "magenta",
       +        "cyan",
       +        "white",
       +
       +        [255] = 0,
       +
       +        /* more colors can be added after 255 to use with DefaultXX */
       +        "#cccccc",
       +        "#555555",
       +};
       +
       +
       +/*
       + * Default colors (colorname index)
       + * foreground, background, cursor, reverse cursor
       + */
       +unsigned int defaultfg = 7;
       +unsigned int defaultbg = 0;
       +static unsigned int defaultcs = 256;
       +static unsigned int defaultrcs = 257;
       +
       +/*
       + * Default shape of cursor
       + * 2: Block ("█")
       + * 4: Underline ("_")
       + * 6: Bar ("|")
       + * 7: Snowman ("☃")
       + */
       +static unsigned int cursorshape = 2;
       +
       +/*
       + * Default columns and rows numbers
       + */
       +
       +static unsigned int cols = 80;
       +static unsigned int rows = 24;
       +
       +/*
       + * Default colour and shape of the mouse cursor
       + */
       +static unsigned int mouseshape = XC_xterm;
       +static unsigned int mousefg = 7;
       +static unsigned int mousebg = 0;
       +
       +/*
       + * Color used to display font attributes when fontconfig selected a font which
       + * doesn't match the ones requested.
       + */
       +static unsigned int defaultattr = 11;
       +
       +/*
       + * Internal mouse shortcuts.
       + * Beware that overloading Button1 will disable the selection.
       + */
       +static MouseShortcut mshortcuts[] = {
       +        /* button               mask            string */
       +        { Button4,              XK_ANY_MOD,     "\031" },
       +        { Button5,              XK_ANY_MOD,     "\005" },
       +};
       +
       +/* Internal keyboard shortcuts. */
       +#define MODKEY Mod1Mask
       +#define TERMMOD (ControlMask|ShiftMask)
       +
       +static Shortcut shortcuts[] = {
       +        /* mask                 keysym          function        argument */
       +        { XK_ANY_MOD,           XK_Break,       sendbreak,      {.i =  0} },
       +        { ControlMask,          XK_Print,       toggleprinter,  {.i =  0} },
       +        { ShiftMask,            XK_Print,       printscreen,    {.i =  0} },
       +        { XK_ANY_MOD,           XK_Print,       printsel,       {.i =  0} },
       +        { TERMMOD,              XK_Prior,       zoom,           {.f = +1} },
       +        { TERMMOD,              XK_Next,        zoom,           {.f = -1} },
       +        { TERMMOD,              XK_Home,        zoomreset,      {.f =  0} },
       +        { TERMMOD,              XK_C,           clipcopy,       {.i =  0} },
       +        { TERMMOD,              XK_V,           clippaste,      {.i =  0} },
       +        { TERMMOD,              XK_Y,           selpaste,       {.i =  0} },
       +        { TERMMOD,              XK_Num_Lock,    numlock,        {.i =  0} },
       +        { TERMMOD,              XK_I,           iso14755,       {.i =  0} },
       +};
       +
       +/*
       + * Special keys (change & recompile st.info accordingly)
       + *
       + * Mask value:
       + * * Use XK_ANY_MOD to match the key no matter modifiers state
       + * * Use XK_NO_MOD to match the key alone (no modifiers)
       + * appkey value:
       + * * 0: no value
       + * * > 0: keypad application mode enabled
       + * *   = 2: term.numlock = 1
       + * * < 0: keypad application mode disabled
       + * appcursor value:
       + * * 0: no value
       + * * > 0: cursor application mode enabled
       + * * < 0: cursor application mode disabled
       + * crlf value
       + * * 0: no value
       + * * > 0: crlf mode is enabled
       + * * < 0: crlf mode is disabled
       + *
       + * Be careful with the order of the definitions because st searches in
       + * this table sequentially, so any XK_ANY_MOD must be in the last
       + * position for a key.
       + */
       +
       +/*
       + * If you want keys other than the X11 function keys (0xFD00 - 0xFFFF)
       + * to be mapped below, add them to this array.
       + */
       +static KeySym mappedkeys[] = { -1 };
       +
       +/*
       + * State bits to ignore when matching key or button events.  By default,
       + * numlock (Mod2Mask) and keyboard layout (XK_SWITCH_MOD) are ignored.
       + */
       +static uint ignoremod = Mod2Mask|XK_SWITCH_MOD;
       +
       +/*
       + * Override mouse-select while mask is active (when MODE_MOUSE is set).
       + * Note that if you want to use ShiftMask with selmasks, set this to an other
       + * modifier, set to 0 to not use it.
       + */
       +static uint forceselmod = ShiftMask;
       +
       +/*
       + * This is the huge key array which defines all compatibility to the Linux
       + * world. Please decide about changes wisely.
       + */
       +static Key key[] = {
       +        /* keysym           mask            string      appkey appcursor */
       +        { XK_KP_Home,       ShiftMask,      "\033[2J",       0,   -1},
       +        { XK_KP_Home,       ShiftMask,      "\033[1;2H",     0,   +1},
       +        { XK_KP_Home,       XK_ANY_MOD,     "\033[H",        0,   -1},
       +        { XK_KP_Home,       XK_ANY_MOD,     "\033[1~",       0,   +1},
       +        { XK_KP_Up,         XK_ANY_MOD,     "\033Ox",       +1,    0},
       +        { XK_KP_Up,         XK_ANY_MOD,     "\033[A",        0,   -1},
       +        { XK_KP_Up,         XK_ANY_MOD,     "\033OA",        0,   +1},
       +        { XK_KP_Down,       XK_ANY_MOD,     "\033Or",       +1,    0},
       +        { XK_KP_Down,       XK_ANY_MOD,     "\033[B",        0,   -1},
       +        { XK_KP_Down,       XK_ANY_MOD,     "\033OB",        0,   +1},
       +        { XK_KP_Left,       XK_ANY_MOD,     "\033Ot",       +1,    0},
       +        { XK_KP_Left,       XK_ANY_MOD,     "\033[D",        0,   -1},
       +        { XK_KP_Left,       XK_ANY_MOD,     "\033OD",        0,   +1},
       +        { XK_KP_Right,      XK_ANY_MOD,     "\033Ov",       +1,    0},
       +        { XK_KP_Right,      XK_ANY_MOD,     "\033[C",        0,   -1},
       +        { XK_KP_Right,      XK_ANY_MOD,     "\033OC",        0,   +1},
       +        { XK_KP_Prior,      ShiftMask,      "\033[5;2~",     0,    0},
       +        { XK_KP_Prior,      XK_ANY_MOD,     "\033[5~",       0,    0},
       +        { XK_KP_Begin,      XK_ANY_MOD,     "\033[E",        0,    0},
       +        { XK_KP_End,        ControlMask,    "\033[J",       -1,    0},
       +        { XK_KP_End,        ControlMask,    "\033[1;5F",    +1,    0},
       +        { XK_KP_End,        ShiftMask,      "\033[K",       -1,    0},
       +        { XK_KP_End,        ShiftMask,      "\033[1;2F",    +1,    0},
       +        { XK_KP_End,        XK_ANY_MOD,     "\033[4~",       0,    0},
       +        { XK_KP_Next,       ShiftMask,      "\033[6;2~",     0,    0},
       +        { XK_KP_Next,       XK_ANY_MOD,     "\033[6~",       0,    0},
       +        { XK_KP_Insert,     ShiftMask,      "\033[2;2~",    +1,    0},
       +        { XK_KP_Insert,     ShiftMask,      "\033[4l",      -1,    0},
       +        { XK_KP_Insert,     ControlMask,    "\033[L",       -1,    0},
       +        { XK_KP_Insert,     ControlMask,    "\033[2;5~",    +1,    0},
       +        { XK_KP_Insert,     XK_ANY_MOD,     "\033[4h",      -1,    0},
       +        { XK_KP_Insert,     XK_ANY_MOD,     "\033[2~",      +1,    0},
       +        { XK_KP_Delete,     ControlMask,    "\033[M",       -1,    0},
       +        { XK_KP_Delete,     ControlMask,    "\033[3;5~",    +1,    0},
       +        { XK_KP_Delete,     ShiftMask,      "\033[2K",      -1,    0},
       +        { XK_KP_Delete,     ShiftMask,      "\033[3;2~",    +1,    0},
       +        { XK_KP_Delete,     XK_ANY_MOD,     "\033[P",       -1,    0},
       +        { XK_KP_Delete,     XK_ANY_MOD,     "\033[3~",      +1,    0},
       +        { XK_KP_Multiply,   XK_ANY_MOD,     "\033Oj",       +2,    0},
       +        { XK_KP_Add,        XK_ANY_MOD,     "\033Ok",       +2,    0},
       +        { XK_KP_Enter,      XK_ANY_MOD,     "\033OM",       +2,    0},
       +        { XK_KP_Enter,      XK_ANY_MOD,     "\r",           -1,    0},
       +        { XK_KP_Subtract,   XK_ANY_MOD,     "\033Om",       +2,    0},
       +        { XK_KP_Decimal,    XK_ANY_MOD,     "\033On",       +2,    0},
       +        { XK_KP_Divide,     XK_ANY_MOD,     "\033Oo",       +2,    0},
       +        { XK_KP_0,          XK_ANY_MOD,     "\033Op",       +2,    0},
       +        { XK_KP_1,          XK_ANY_MOD,     "\033Oq",       +2,    0},
       +        { XK_KP_2,          XK_ANY_MOD,     "\033Or",       +2,    0},
       +        { XK_KP_3,          XK_ANY_MOD,     "\033Os",       +2,    0},
       +        { XK_KP_4,          XK_ANY_MOD,     "\033Ot",       +2,    0},
       +        { XK_KP_5,          XK_ANY_MOD,     "\033Ou",       +2,    0},
       +        { XK_KP_6,          XK_ANY_MOD,     "\033Ov",       +2,    0},
       +        { XK_KP_7,          XK_ANY_MOD,     "\033Ow",       +2,    0},
       +        { XK_KP_8,          XK_ANY_MOD,     "\033Ox",       +2,    0},
       +        { XK_KP_9,          XK_ANY_MOD,     "\033Oy",       +2,    0},
       +        { XK_Up,            ShiftMask,      "\033[1;2A",     0,    0},
       +        { XK_Up,            Mod1Mask,       "\033[1;3A",     0,    0},
       +        { XK_Up,         ShiftMask|Mod1Mask,"\033[1;4A",     0,    0},
       +        { XK_Up,            ControlMask,    "\033[1;5A",     0,    0},
       +        { XK_Up,      ShiftMask|ControlMask,"\033[1;6A",     0,    0},
       +        { XK_Up,       ControlMask|Mod1Mask,"\033[1;7A",     0,    0},
       +        { XK_Up,ShiftMask|ControlMask|Mod1Mask,"\033[1;8A",  0,    0},
       +        { XK_Up,            XK_ANY_MOD,     "\033[A",        0,   -1},
       +        { XK_Up,            XK_ANY_MOD,     "\033OA",        0,   +1},
       +        { XK_Down,          ShiftMask,      "\033[1;2B",     0,    0},
       +        { XK_Down,          Mod1Mask,       "\033[1;3B",     0,    0},
       +        { XK_Down,       ShiftMask|Mod1Mask,"\033[1;4B",     0,    0},
       +        { XK_Down,          ControlMask,    "\033[1;5B",     0,    0},
       +        { XK_Down,    ShiftMask|ControlMask,"\033[1;6B",     0,    0},
       +        { XK_Down,     ControlMask|Mod1Mask,"\033[1;7B",     0,    0},
       +        { XK_Down,ShiftMask|ControlMask|Mod1Mask,"\033[1;8B",0,    0},
       +        { XK_Down,          XK_ANY_MOD,     "\033[B",        0,   -1},
       +        { XK_Down,          XK_ANY_MOD,     "\033OB",        0,   +1},
       +        { XK_Left,          ShiftMask,      "\033[1;2D",     0,    0},
       +        { XK_Left,          Mod1Mask,       "\033[1;3D",     0,    0},
       +        { XK_Left,       ShiftMask|Mod1Mask,"\033[1;4D",     0,    0},
       +        { XK_Left,          ControlMask,    "\033[1;5D",     0,    0},
       +        { XK_Left,    ShiftMask|ControlMask,"\033[1;6D",     0,    0},
       +        { XK_Left,     ControlMask|Mod1Mask,"\033[1;7D",     0,    0},
       +        { XK_Left,ShiftMask|ControlMask|Mod1Mask,"\033[1;8D",0,    0},
       +        { XK_Left,          XK_ANY_MOD,     "\033[D",        0,   -1},
       +        { XK_Left,          XK_ANY_MOD,     "\033OD",        0,   +1},
       +        { XK_Right,         ShiftMask,      "\033[1;2C",     0,    0},
       +        { XK_Right,         Mod1Mask,       "\033[1;3C",     0,    0},
       +        { XK_Right,      ShiftMask|Mod1Mask,"\033[1;4C",     0,    0},
       +        { XK_Right,         ControlMask,    "\033[1;5C",     0,    0},
       +        { XK_Right,   ShiftMask|ControlMask,"\033[1;6C",     0,    0},
       +        { XK_Right,    ControlMask|Mod1Mask,"\033[1;7C",     0,    0},
       +        { XK_Right,ShiftMask|ControlMask|Mod1Mask,"\033[1;8C",0,   0},
       +        { XK_Right,         XK_ANY_MOD,     "\033[C",        0,   -1},
       +        { XK_Right,         XK_ANY_MOD,     "\033OC",        0,   +1},
       +        { XK_ISO_Left_Tab,  ShiftMask,      "\033[Z",        0,    0},
       +        { XK_Return,        Mod1Mask,       "\033\r",        0,    0},
       +        { XK_Return,        XK_ANY_MOD,     "\r",            0,    0},
       +        { XK_Insert,        ShiftMask,      "\033[4l",      -1,    0},
       +        { XK_Insert,        ShiftMask,      "\033[2;2~",    +1,    0},
       +        { XK_Insert,        ControlMask,    "\033[L",       -1,    0},
       +        { XK_Insert,        ControlMask,    "\033[2;5~",    +1,    0},
       +        { XK_Insert,        XK_ANY_MOD,     "\033[4h",      -1,    0},
       +        { XK_Insert,        XK_ANY_MOD,     "\033[2~",      +1,    0},
       +        { XK_Delete,        ControlMask,    "\033[M",       -1,    0},
       +        { XK_Delete,        ControlMask,    "\033[3;5~",    +1,    0},
       +        { XK_Delete,        ShiftMask,      "\033[2K",      -1,    0},
       +        { XK_Delete,        ShiftMask,      "\033[3;2~",    +1,    0},
       +        { XK_Delete,        XK_ANY_MOD,     "\033[P",       -1,    0},
       +        { XK_Delete,        XK_ANY_MOD,     "\033[3~",      +1,    0},
       +        { XK_BackSpace,     XK_NO_MOD,      "\177",          0,    0},
       +        { XK_BackSpace,     Mod1Mask,       "\033\177",      0,    0},
       +        { XK_Home,          ShiftMask,      "\033[2J",       0,   -1},
       +        { XK_Home,          ShiftMask,      "\033[1;2H",     0,   +1},
       +        { XK_Home,          XK_ANY_MOD,     "\033[H",        0,   -1},
       +        { XK_Home,          XK_ANY_MOD,     "\033[1~",       0,   +1},
       +        { XK_End,           Contr