Add bracketed paste mode

This patch enables bracketed paste mode (
http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#Bracketed%20Paste%20Mode
).

It's mainly useful for text editors to disable line wrapping and auto
indentation when text is being pasted, rather than typed from keyboard.

On the emulator side, it is supported by at least xterm, urxvt,
gnome-terminal, putty, iterm2; and I have a patch for konsole.

On the application side, vim can be configured easily to handle this, and
I have pending patches for mcedit and joe. Probably many others also
support it.
Fix core in multi-line selection on OpenBSD

OpenBSD 5.3 amd64 release version with the most current st
version from git, crash and dump core when selecting multiple
lines whith the cursor.  This happens, because on line 964
of st.c (gp-1)->mode is accessed, although gp is still
pointing at the beginning of the array term.line[y] (see
line 939 for initialization of gp).
Add DSR cursor position sequence
Fix save/restore cursor

st was assuming that save/restore cursor position was independent
of the screen that was shown in each moment, but it is not true,
because each screen has a different save/restore buffer. This
patch fixes it.
People, learn to keep to styles. Thanks.
Add support for multiple charset definitions

vt100 has support for two defined charset, G0 and G1. Each charset
can be defined, but in each moment is selected only one of both
charset. This is usually used selecting a national charset in G0
and graphic charset in G1, so you can switch between graphic
charset and text charset without losing the national charset
already defined.

st hasn't support for national charsets, because it is an utf8
based terminal emulator, but it has support for graphic
charset because it is heavily used, but it only supports G0,
without understanding G1 selection sequences, which causes some
programs in some moments can print some garbage in the screen.

This patch adds a fake support for multiple charset definitions,
where we only support graphic charset and us-ascii charset, but
we allow more of one charset definition.

This patch allow define G0 until G3 charsets, but only accepts
select G0 or G1, and it accepts some national charset definitions
but all of them are mapped to us-ascii.
Simplify Mod1 logic in kpress(), eliminating locals and a memcpy.
Avoid buffer overrun in kpress() and remove limit on shortcut strings.
New ttysend() function calls ttywrite() and techo(). Honor MODE_ECHO when pasting in selnotify().
Avoid buffer overrun in bpress()

Use correct type for Mousekey.b (XButtonEvent.button).
Ignore numlock (Mod2Mask) for button events too.

Conflicts:
	config.def.h
	st.c
Fixed lock up when system time jumps backwards

Signed-off-by: Christoph Lohmann <20h@r-36.net>
Merge remote-tracking branch 'origin/master' into omaster
Simplify logic in match().
Simplify logic in kmap().