Skip to content

Instantly share code, notes, and snippets.

@mattn
Created June 4, 2014 04:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattn/b6341a1d272aa80431c5 to your computer and use it in GitHub Desktop.
Save mattn/b6341a1d272aa80431c5 to your computer and use it in GitHub Desktop.
diff -r bed71c37618c src/getchar.c
--- a/src/getchar.c Thu May 29 14:36:29 2014 +0200
+++ b/src/getchar.c Wed Jun 04 13:26:20 2014 +0900
@@ -5267,39 +5267,39 @@
{(char_u *)"<C-X> \"*d", VIS_SEL},
/* Missing: CTRL-C (cancel) and CTRL-V (block selection) */
# else
- {(char_u *)"\316w <C-Home>", NORMAL+VIS_SEL},
- {(char_u *)"\316w <C-Home>", INSERT+CMDLINE},
- {(char_u *)"\316u <C-End>", NORMAL+VIS_SEL},
- {(char_u *)"\316u <C-End>", INSERT+CMDLINE},
+ {(char_u *)K_NUL_STR "w <C-Home>", NORMAL+VIS_SEL},
+ {(char_u *)K_NUL_STR "w <C-Home>", INSERT+CMDLINE},
+ {(char_u *)K_NUL_STR "u <C-End>", NORMAL+VIS_SEL},
+ {(char_u *)K_NUL_STR "u <C-End>", INSERT+CMDLINE},
/* paste, copy and cut */
# ifdef FEAT_CLIPBOARD
# ifdef DJGPP
- {(char_u *)"\316\122 \"*P", NORMAL}, /* SHIFT-Insert is "*P */
- {(char_u *)"\316\122 \"-d\"*P", VIS_SEL}, /* SHIFT-Insert is "-d"*P */
- {(char_u *)"\316\122 \022\017*", INSERT}, /* SHIFT-Insert is ^R^O* */
- {(char_u *)"\316\222 \"*y", VIS_SEL}, /* CTRL-Insert is "*y */
+ {(char_u *)K_NUL_STR "\122 \"*P", NORMAL}, /* SHIFT-Insert is "*P */
+ {(char_u *)K_NUL_STR "\122 \"-d\"*P", VIS_SEL}, /* SHIFT-Insert is "-d"*P */
+ {(char_u *)K_NUL_STR "\122 \022\017*", INSERT}, /* SHIFT-Insert is ^R^O* */
+ {(char_u *)K_NUL_STR "\222 \"*y", VIS_SEL}, /* CTRL-Insert is "*y */
# if 0 /* Shift-Del produces the same code as Del */
- {(char_u *)"\316\123 \"*d", VIS_SEL}, /* SHIFT-Del is "*d */
+ {(char_u *)K_NUL_STR "\123 \"*d", VIS_SEL}, /* SHIFT-Del is "*d */
# endif
- {(char_u *)"\316\223 \"*d", VIS_SEL}, /* CTRL-Del is "*d */
+ {(char_u *)K_NUL_STR "\223 \"*d", VIS_SEL}, /* CTRL-Del is "*d */
{(char_u *)"\030 \"-d", VIS_SEL}, /* CTRL-X is "-d */
# else
- {(char_u *)"\316\324 \"*P", NORMAL}, /* SHIFT-Insert is "*P */
- {(char_u *)"\316\324 \"-d\"*P", VIS_SEL}, /* SHIFT-Insert is "-d"*P */
- {(char_u *)"\316\324 \022\017*", INSERT}, /* SHIFT-Insert is ^R^O* */
- {(char_u *)"\316\325 \"*y", VIS_SEL}, /* CTRL-Insert is "*y */
- {(char_u *)"\316\327 \"*d", VIS_SEL}, /* SHIFT-Del is "*d */
- {(char_u *)"\316\330 \"*d", VIS_SEL}, /* CTRL-Del is "*d */
+ {(char_u *)K_NUL_STR "\324 \"*P", NORMAL}, /* SHIFT-Insert is "*P */
+ {(char_u *)K_NUL_STR "\324 \"-d\"*P", VIS_SEL}, /* SHIFT-Insert is "-d"*P */
+ {(char_u *)K_NUL_STR "\324 \022\017*", INSERT}, /* SHIFT-Insert is ^R^O* */
+ {(char_u *)K_NUL_STR "\325 \"*y", VIS_SEL}, /* CTRL-Insert is "*y */
+ {(char_u *)K_NUL_STR "\327 \"*d", VIS_SEL}, /* SHIFT-Del is "*d */
+ {(char_u *)K_NUL_STR "\330 \"*d", VIS_SEL}, /* CTRL-Del is "*d */
{(char_u *)"\030 \"-d", VIS_SEL}, /* CTRL-X is "-d */
# endif
# else
- {(char_u *)"\316\324 P", NORMAL}, /* SHIFT-Insert is P */
- {(char_u *)"\316\324 \"-dP", VIS_SEL}, /* SHIFT-Insert is "-dP */
- {(char_u *)"\316\324 \022\017\"", INSERT}, /* SHIFT-Insert is ^R^O" */
- {(char_u *)"\316\325 y", VIS_SEL}, /* CTRL-Insert is y */
- {(char_u *)"\316\327 d", VIS_SEL}, /* SHIFT-Del is d */
- {(char_u *)"\316\330 d", VIS_SEL}, /* CTRL-Del is d */
+ {(char_u *)K_NUL_STR "\324 P", NORMAL}, /* SHIFT-Insert is P */
+ {(char_u *)K_NUL_STR "\324 \"-dP", VIS_SEL}, /* SHIFT-Insert is "-dP */
+ {(char_u *)K_NUL_STR "\324 \022\017\"", INSERT}, /* SHIFT-Insert is ^R^O" */
+ {(char_u *)K_NUL_STR "\325 y", VIS_SEL}, /* CTRL-Insert is y */
+ {(char_u *)K_NUL_STR "\327 d", VIS_SEL}, /* SHIFT-Del is d */
+ {(char_u *)K_NUL_STR "\330 d", VIS_SEL}, /* CTRL-Del is d */
# endif
# endif
#endif
diff -r bed71c37618c src/globals.h
--- a/src/globals.h Thu May 29 14:36:29 2014 +0200
+++ b/src/globals.h Wed Jun 04 13:26:20 2014 +0900
@@ -387,10 +387,12 @@
* which one is preferred, au_new_curbuf is set to it */
EXTERN buf_T *au_new_curbuf INIT(= NULL);
-/* When deleting the buffer and autocmd_busy is TRUE, do not free the buffer
- * but link it in the list starting with au_pending_free_buf, using b_next.
- * Free the buffer when autocmd_busy is set to FALSE. */
+/* When deleting the buffer/window and autocmd_busy is TRUE, do not free the
+ * buffer/window. but link it in the list starting with
+ * au_pending_free_buf/ap_pending_free_win, using b_next/w_next.
+ * Free the buffer/window when autocmd_busy is set to FALSE. */
EXTERN buf_T *au_pending_free_buf INIT(= NULL);
+EXTERN win_T *au_pending_free_win INIT(= NULL);
#endif
#ifdef FEAT_MOUSE
diff -r bed71c37618c src/keymap.h
--- a/src/keymap.h Thu May 29 14:36:29 2014 +0200
+++ b/src/keymap.h Wed Jun 04 13:26:20 2014 +0900
@@ -16,7 +16,8 @@
* For MSDOS some keys produce codes larger than 0xff. They are split into two
* chars, the first one is K_NUL (same value used in term.h).
*/
-#define K_NUL (0xce) /* for MSDOS: special key follows */
+#define K_NUL (0xff) /* for MSDOS: special key follows */
+#define K_NUL_STR "\377"
/*
* K_SPECIAL is the first byte of a special key code and is always followed by
diff -r bed71c37618c src/term.c
--- a/src/term.c Thu May 29 14:36:29 2014 +0200
+++ b/src/term.c Wed Jun 04 13:26:20 2014 +0900
@@ -431,7 +431,7 @@
/*
* These codes are valid when nansi.sys or equivalent has been installed.
* Function keys on a PC are preceded with a NUL. These are converted into
- * K_NUL '\316' in mch_inchar(), because we cannot handle NULs in key codes.
+ * K_NUL '\377' in mch_inchar(), because we cannot handle NULs in key codes.
* CTRL-arrow is used instead of SHIFT-arrow.
*/
#ifdef __EMX__
@@ -474,42 +474,42 @@
# else
{(int)KS_CRI, "\033[%dC"},
# endif
- {K_UP, "\316H"},
- {K_DOWN, "\316P"},
- {K_LEFT, "\316K"},
- {K_RIGHT, "\316M"},
- {K_S_LEFT, "\316s"},
- {K_S_RIGHT, "\316t"},
- {K_F1, "\316;"},
- {K_F2, "\316<"},
- {K_F3, "\316="},
- {K_F4, "\316>"},
- {K_F5, "\316?"},
- {K_F6, "\316@"},
- {K_F7, "\316A"},
- {K_F8, "\316B"},
- {K_F9, "\316C"},
- {K_F10, "\316D"},
- {K_F11, "\316\205"}, /* guessed */
- {K_F12, "\316\206"}, /* guessed */
- {K_S_F1, "\316T"},
- {K_S_F2, "\316U"},
- {K_S_F3, "\316V"},
- {K_S_F4, "\316W"},
- {K_S_F5, "\316X"},
- {K_S_F6, "\316Y"},
- {K_S_F7, "\316Z"},
- {K_S_F8, "\316["},
- {K_S_F9, "\316\\"},
- {K_S_F10, "\316]"},
- {K_S_F11, "\316\207"}, /* guessed */
- {K_S_F12, "\316\210"}, /* guessed */
- {K_INS, "\316R"},
- {K_DEL, "\316S"},
- {K_HOME, "\316G"},
- {K_END, "\316O"},
- {K_PAGEDOWN, "\316Q"},
- {K_PAGEUP, "\316I"},
+ {K_UP, K_NUL_STR "H"},
+ {K_DOWN, K_NUL_STR "P"},
+ {K_LEFT, K_NUL_STR "K"},
+ {K_RIGHT, K_NUL_STR "M"},
+ {K_S_LEFT, K_NUL_STR "s"},
+ {K_S_RIGHT, K_NUL_STR "t"},
+ {K_F1, K_NUL_STR ";"},
+ {K_F2, K_NUL_STR "<"},
+ {K_F3, K_NUL_STR "="},
+ {K_F4, K_NUL_STR ">"},
+ {K_F5, K_NUL_STR "?"},
+ {K_F6, K_NUL_STR "@"},
+ {K_F7, K_NUL_STR "A"},
+ {K_F8, K_NUL_STR "B"},
+ {K_F9, K_NUL_STR "C"},
+ {K_F10, K_NUL_STR "D"},
+ {K_F11, K_NUL_STR "\205"}, /* guessed */
+ {K_F12, K_NUL_STR "\206"}, /* guessed */
+ {K_S_F1, K_NUL_STR "T"},
+ {K_S_F2, K_NUL_STR "U"},
+ {K_S_F3, K_NUL_STR "V"},
+ {K_S_F4, K_NUL_STR "W"},
+ {K_S_F5, K_NUL_STR "X"},
+ {K_S_F6, K_NUL_STR "Y"},
+ {K_S_F7, K_NUL_STR "Z"},
+ {K_S_F8, K_NUL_STR "["},
+ {K_S_F9, K_NUL_STR "\\"},
+ {K_S_F10, K_NUL_STR "]"},
+ {K_S_F11, K_NUL_STR "\207"}, /* guessed */
+ {K_S_F12, K_NUL_STR "\210"}, /* guessed */
+ {K_INS, K_NUL_STR "R"},
+ {K_DEL, K_NUL_STR "S"},
+ {K_HOME, K_NUL_STR "G"},
+ {K_END, K_NUL_STR "O"},
+ {K_PAGEDOWN, K_NUL_STR "Q"},
+ {K_PAGEUP, K_NUL_STR "I"},
# endif
# if defined(MSDOS)
@@ -561,56 +561,56 @@
#ifdef DJGPP
{(int)KS_VB, "\033|B"}, /* visual bell */
#endif
- {K_UP, "\316H"},
- {K_DOWN, "\316P"},
- {K_LEFT, "\316K"},
- {K_RIGHT, "\316M"},
- {K_S_LEFT, "\316s"},
- {K_S_RIGHT, "\316t"},
- {K_S_TAB, "\316\017"},
- {K_F1, "\316;"},
- {K_F2, "\316<"},
- {K_F3, "\316="},
- {K_F4, "\316>"},
- {K_F5, "\316?"},
- {K_F6, "\316@"},
- {K_F7, "\316A"},
- {K_F8, "\316B"},
- {K_F9, "\316C"},
- {K_F10, "\316D"},
- {K_F11, "\316\205"},
- {K_F12, "\316\206"},
- {K_S_F1, "\316T"},
- {K_S_F2, "\316U"},
- {K_S_F3, "\316V"},
- {K_S_F4, "\316W"},
- {K_S_F5, "\316X"},
- {K_S_F6, "\316Y"},
- {K_S_F7, "\316Z"},
- {K_S_F8, "\316["},
- {K_S_F9, "\316\\"},
- {K_S_F10, "\316]"},
- {K_S_F11, "\316\207"},
- {K_S_F12, "\316\210"},
- {K_INS, "\316R"},
- {K_DEL, "\316S"},
- {K_HOME, "\316G"},
- {K_END, "\316O"},
- {K_PAGEDOWN, "\316Q"},
- {K_PAGEUP, "\316I"},
- {K_KPLUS, "\316N"},
- {K_KMINUS, "\316J"},
- {K_KMULTIPLY, "\3167"},
- {K_K0, "\316\332"},
- {K_K1, "\316\336"},
- {K_K2, "\316\342"},
- {K_K3, "\316\346"},
- {K_K4, "\316\352"},
- {K_K5, "\316\356"},
- {K_K6, "\316\362"},
- {K_K7, "\316\366"},
- {K_K8, "\316\372"},
- {K_K9, "\316\376"},
+ {K_UP, K_NUL_STR "H"},
+ {K_DOWN, K_NUL_STR "P"},
+ {K_LEFT, K_NUL_STR "K"},
+ {K_RIGHT, K_NUL_STR "M"},
+ {K_S_LEFT, K_NUL_STR "s"},
+ {K_S_RIGHT, K_NUL_STR "t"},
+ {K_S_TAB, K_NUL_STR "\017"},
+ {K_F1, K_NUL_STR ";"},
+ {K_F2, K_NUL_STR "<"},
+ {K_F3, K_NUL_STR "="},
+ {K_F4, K_NUL_STR ">"},
+ {K_F5, K_NUL_STR "?"},
+ {K_F6, K_NUL_STR "@"},
+ {K_F7, K_NUL_STR "A"},
+ {K_F8, K_NUL_STR "B"},
+ {K_F9, K_NUL_STR "C"},
+ {K_F10, K_NUL_STR "D"},
+ {K_F11, K_NUL_STR "\205"},
+ {K_F12, K_NUL_STR "\206"},
+ {K_S_F1, K_NUL_STR "T"},
+ {K_S_F2, K_NUL_STR "U"},
+ {K_S_F3, K_NUL_STR "V"},
+ {K_S_F4, K_NUL_STR "W"},
+ {K_S_F5, K_NUL_STR "X"},
+ {K_S_F6, K_NUL_STR "Y"},
+ {K_S_F7, K_NUL_STR "Z"},
+ {K_S_F8, K_NUL_STR "["},
+ {K_S_F9, K_NUL_STR "\\"},
+ {K_S_F10, K_NUL_STR "]"},
+ {K_S_F11, K_NUL_STR "\207"},
+ {K_S_F12, K_NUL_STR "\210"},
+ {K_INS, K_NUL_STR "R"},
+ {K_DEL, K_NUL_STR "S"},
+ {K_HOME, K_NUL_STR "G"},
+ {K_END, K_NUL_STR "O"},
+ {K_PAGEDOWN, K_NUL_STR "Q"},
+ {K_PAGEUP, K_NUL_STR "I"},
+ {K_KPLUS, K_NUL_STR "N"},
+ {K_KMINUS, K_NUL_STR "J"},
+ {K_KMULTIPLY, K_NUL_STR "7"},
+ {K_K0, K_NUL_STR "\332"},
+ {K_K1, K_NUL_STR "\336"},
+ {K_K2, K_NUL_STR "\342"},
+ {K_K3, K_NUL_STR "\346"},
+ {K_K4, K_NUL_STR "\352"},
+ {K_K5, K_NUL_STR "\356"},
+ {K_K6, K_NUL_STR "\362"},
+ {K_K7, K_NUL_STR "\366"},
+ {K_K8, K_NUL_STR "\372"},
+ {K_K9, K_NUL_STR "\376"},
# endif
# if defined(WIN3264) || defined(ALL_BUILTIN_TCAPS) || defined(__EMX__)
@@ -678,64 +678,64 @@
{(int)KS_CS, "\033|%i%d;%dr"},/* scroll region */
# endif
- {K_UP, "\316H"},
- {K_DOWN, "\316P"},
- {K_LEFT, "\316K"},
- {K_RIGHT, "\316M"},
- {K_S_UP, "\316\304"},
- {K_S_DOWN, "\316\317"},
- {K_S_LEFT, "\316\311"},
- {K_C_LEFT, "\316s"},
- {K_S_RIGHT, "\316\313"},
- {K_C_RIGHT, "\316t"},
- {K_S_TAB, "\316\017"},
- {K_F1, "\316;"},
- {K_F2, "\316<"},
- {K_F3, "\316="},
- {K_F4, "\316>"},
- {K_F5, "\316?"},
- {K_F6, "\316@"},
- {K_F7, "\316A"},
- {K_F8, "\316B"},
- {K_F9, "\316C"},
- {K_F10, "\316D"},
- {K_F11, "\316\205"},
- {K_F12, "\316\206"},
- {K_S_F1, "\316T"},
- {K_S_F2, "\316U"},
- {K_S_F3, "\316V"},
- {K_S_F4, "\316W"},
- {K_S_F5, "\316X"},
- {K_S_F6, "\316Y"},
- {K_S_F7, "\316Z"},
- {K_S_F8, "\316["},
- {K_S_F9, "\316\\"},
- {K_S_F10, "\316]"},
- {K_S_F11, "\316\207"},
- {K_S_F12, "\316\210"},
- {K_INS, "\316R"},
- {K_DEL, "\316S"},
- {K_HOME, "\316G"},
- {K_S_HOME, "\316\302"},
- {K_C_HOME, "\316w"},
- {K_END, "\316O"},
- {K_S_END, "\316\315"},
- {K_C_END, "\316u"},
- {K_PAGEDOWN, "\316Q"},
- {K_PAGEUP, "\316I"},
- {K_KPLUS, "\316N"},
- {K_KMINUS, "\316J"},
- {K_KMULTIPLY, "\316\067"},
- {K_K0, "\316\332"},
- {K_K1, "\316\336"},
- {K_K2, "\316\342"},
- {K_K3, "\316\346"},
- {K_K4, "\316\352"},
- {K_K5, "\316\356"},
- {K_K6, "\316\362"},
- {K_K7, "\316\366"},
- {K_K8, "\316\372"},
- {K_K9, "\316\376"},
+ {K_UP, K_NUL_STR "H"},
+ {K_DOWN, K_NUL_STR "P"},
+ {K_LEFT, K_NUL_STR "K"},
+ {K_RIGHT, K_NUL_STR "M"},
+ {K_S_UP, K_NUL_STR "\304"},
+ {K_S_DOWN, K_NUL_STR "\317"},
+ {K_S_LEFT, K_NUL_STR "\311"},
+ {K_C_LEFT, K_NUL_STR "s"},
+ {K_S_RIGHT, K_NUL_STR "\313"},
+ {K_C_RIGHT, K_NUL_STR "t"},
+ {K_S_TAB, K_NUL_STR "\017"},
+ {K_F1, K_NUL_STR ";"},
+ {K_F2, K_NUL_STR "<"},
+ {K_F3, K_NUL_STR "="},
+ {K_F4, K_NUL_STR ">"},
+ {K_F5, K_NUL_STR "?"},
+ {K_F6, K_NUL_STR "@"},
+ {K_F7, K_NUL_STR "A"},
+ {K_F8, K_NUL_STR "B"},
+ {K_F9, K_NUL_STR "C"},
+ {K_F10, K_NUL_STR "D"},
+ {K_F11, K_NUL_STR "\205"},
+ {K_F12, K_NUL_STR "\206"},
+ {K_S_F1, K_NUL_STR "T"},
+ {K_S_F2, K_NUL_STR "U"},
+ {K_S_F3, K_NUL_STR "V"},
+ {K_S_F4, K_NUL_STR "W"},
+ {K_S_F5, K_NUL_STR "X"},
+ {K_S_F6, K_NUL_STR "Y"},
+ {K_S_F7, K_NUL_STR "Z"},
+ {K_S_F8, K_NUL_STR "["},
+ {K_S_F9, K_NUL_STR "\\"},
+ {K_S_F10, K_NUL_STR "]"},
+ {K_S_F11, K_NUL_STR "\207"},
+ {K_S_F12, K_NUL_STR "\210"},
+ {K_INS, K_NUL_STR "R"},
+ {K_DEL, K_NUL_STR "S"},
+ {K_HOME, K_NUL_STR "G"},
+ {K_S_HOME, K_NUL_STR "\302"},
+ {K_C_HOME, K_NUL_STR "w"},
+ {K_END, K_NUL_STR "O"},
+ {K_S_END, K_NUL_STR "\315"},
+ {K_C_END, K_NUL_STR "u"},
+ {K_PAGEDOWN, K_NUL_STR "Q"},
+ {K_PAGEUP, K_NUL_STR "I"},
+ {K_KPLUS, K_NUL_STR "N"},
+ {K_KMINUS, K_NUL_STR "J"},
+ {K_KMULTIPLY, K_NUL_STR "\067"},
+ {K_K0, K_NUL_STR "\332"},
+ {K_K1, K_NUL_STR "\336"},
+ {K_K2, K_NUL_STR "\342"},
+ {K_K3, K_NUL_STR "\346"},
+ {K_K4, K_NUL_STR "\352"},
+ {K_K5, K_NUL_STR "\356"},
+ {K_K6, K_NUL_STR "\362"},
+ {K_K7, K_NUL_STR "\366"},
+ {K_K8, K_NUL_STR "\372"},
+ {K_K9, K_NUL_STR "\376"},
# endif
# if defined(VMS) || defined(ALL_BUILTIN_TCAPS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment