~petersanchez/st

3c99be68e8d3c4d67b2db54b8650bf55d769b98e — Roberto E. Vargas Caballero 11 years ago e790412
Add support for insert key

Insert key stands for a key which allows enter or leaves insert mode, so let
it generates the correct sequence to change between these modes:

   - Insert: Enter in insert mode.
   - Shift + Insert: Leave insert mode (replace mode).
   - Control + Insert: Insert a blank line.

Like Shift + Insert also paste text, if a user want this feature be full
functional he has to modify such shortcut.
---
 config.def.h |   16 ++++++++++++----
 st.info      |    3 +++
 2 files changed, 15 insertions(+), 4 deletions(-)
2 files changed, 15 insertions(+), 4 deletions(-)

M config.def.h
M st.info
M config.def.h => config.def.h +12 -4
@@ 125,8 125,12 @@ static Key key[] = {
	{ XK_KP_End,        XK_ANY_MOD,     "\033[4~",       0,    0,    0},
	{ XK_KP_Next,       ShiftMask,      "\033[6;2~",     0,    0,    0},
	{ XK_KP_Next,       XK_ANY_MOD,     "\033[6~",       0,    0,    0},
	{ XK_KP_Insert,     ShiftMask,      "\033[2;2~",     0,    0,    0},
	{ XK_KP_Insert,     XK_ANY_MOD,     "\033[2~",       0,    0,    0},
	{ XK_KP_Insert,     ShiftMask,      "\033[2;2~",    +1,    0,    0},
	{ XK_KP_Insert,     ShiftMask,      "\033[4l",      -1,    0,    0},
	{ XK_KP_Insert,     ControlMask,    "\033[L",       -1,    0,    0},
	{ XK_KP_Insert,     ControlMask,    "\033[2;5~",    +1,    0,    0},
	{ XK_KP_Insert,     XK_ANY_MOD,     "\033[4h",      -1,    0,    0},
	{ XK_KP_Insert,     XK_ANY_MOD,     "\033[2~",      +1,    0,    0},
	{ XK_KP_Delete,     ShiftMask,      "\033[3;2~",     0,    0,    0},
	{ XK_KP_Delete,     XK_ANY_MOD,     "\033[3~",       0,    0,    0},
	{ XK_KP_Multiply,   XK_ANY_MOD,     "\033Oj",       +2,    0,    0},


@@ 173,8 177,12 @@ static Key key[] = {
	{ XK_Return,        Mod1Mask,       "\033\r\n",      0,    0,   +1},
	{ XK_Return,        XK_ANY_MOD,     "\r",            0,    0,   -1},
	{ XK_Return,        XK_ANY_MOD,     "\r\n",          0,    0,   +1},
	{ XK_Insert,        ShiftMask,      "\033[2;2~",     0,    0,    0},
	{ XK_Insert,        XK_ANY_MOD,     "\033[2~",       0,    0,    0},
	{ XK_Insert,        ShiftMask,      "\033[4l",      -1,    0,    0},
	{ XK_Insert,        ShiftMask,      "\033[2;2~",    +1,    0,    0},
	{ XK_Insert,        ControlMask,    "\033[L",       -1,    0,    0},
	{ XK_Insert,        ControlMask,    "\033[2;5~",    +1,    0,    0},
	{ XK_Insert,        XK_ANY_MOD,     "\033[4h",      -1,    0,    0},
	{ XK_Insert,        XK_ANY_MOD,     "\033[2~",      +1,    0,    0},
	{ XK_Delete,        ShiftMask,      "\033[3;2~",     0,    0,    0},
	{ XK_Delete,        XK_ANY_MOD,     "\033[3~",       0,    0,    0},
	{ XK_Home,          ShiftMask,      "\033[1;2H",     0,    0,    0},

M st.info => st.info +3 -0
@@ 138,6 138,9 @@ st| simpleterm,
	kf62=\E[1;4Q,
	kf63=\E[1;4R,
	khome=\E[1~,
	kil1=\E[2;5~,
	krmir=\E[2;2~,
	kich1=\E[2~,
	knp=\E[6~,
	kmous=\E[M,
	kpp=\E[5~,