diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-03-07 00:57:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-07 00:57:21 +0100 |
commit | 980dd7c011f66eccc83662027c3f6dcd23a40cb4 (patch) | |
tree | 26a91adb59d8f0c709eeca374d3bf0ec40429d92 | |
parent | 299f32dc012929f55e5b6b9aaf7c7aded9e7e489 (diff) | |
parent | 27c31434663ba20cd9b53827d4d3cb4d66b1cde3 (diff) | |
download | rneovim-980dd7c011f66eccc83662027c3f6dcd23a40cb4.tar.gz rneovim-980dd7c011f66eccc83662027c3f6dcd23a40cb4.tar.bz2 rneovim-980dd7c011f66eccc83662027c3f6dcd23a40cb4.zip |
Merge #9638 from mhinz/update-libtermkey
-rw-r--r-- | third-party/CMakeLists.txt | 4 | ||||
-rw-r--r-- | third-party/cmake/BuildLibtermkey.cmake | 4 | ||||
-rw-r--r-- | third-party/patches/libtermkey-Add-support-for-Windows.patch | 170 | ||||
-rw-r--r-- | third-party/patches/libtermkey-Fix-escape-sequences-for-MSVC.patch | 189 |
4 files changed, 2 insertions, 365 deletions
diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt index 18c73aa9c1..0b90ea52a4 100644 --- a/third-party/CMakeLists.txt +++ b/third-party/CMakeLists.txt @@ -143,8 +143,8 @@ set(LUAROCKS_SHA256 9eb3d0738fd02ad8bf39bcedccac4e83e9b5fff2bcca247c3584b925b207 set(UNIBILIUM_URL https://github.com/mauke/unibilium/archive/v2.0.0.tar.gz) set(UNIBILIUM_SHA256 78997d38d4c8177c60d3d0c1aa8c53fd0806eb21825b7b335b1768d7116bc1c1) -set(LIBTERMKEY_URL http://www.leonerd.org.uk/code/libtermkey/libtermkey-0.20.tar.gz) -set(LIBTERMKEY_SHA256 6c0d87c94ab9915e76ecd313baec08dedf3bd56de83743d9aa923a081935d2f5) +set(LIBTERMKEY_URL http://www.leonerd.org.uk/code/libtermkey/libtermkey-0.21.1.tar.gz) +set(LIBTERMKEY_SHA256 cecbf737f35d18f433c8d7864f63c0f878af41f8bd0255a3ebb16010dc044d5f) set(LIBVTERM_URL https://github.com/neovim/libvterm/archive/b45b648cab73f9667bde7c0c6045b285e22b3ecd.tar.gz) set(LIBVTERM_SHA256 37cc123deff29327efa654358c2ebaaf8589da03754ca5adb8ec47be386a0433) diff --git a/third-party/cmake/BuildLibtermkey.cmake b/third-party/cmake/BuildLibtermkey.cmake index 0b56674ad2..da65c87972 100644 --- a/third-party/cmake/BuildLibtermkey.cmake +++ b/third-party/cmake/BuildLibtermkey.cmake @@ -11,10 +11,6 @@ ExternalProject_Add(libtermkey -DTARGET=libtermkey -DUSE_EXISTING_SRC_DIR=${USE_EXISTING_SRC_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake - PATCH_COMMAND ${GIT_EXECUTABLE} -C ${DEPS_BUILD_DIR}/src/libtermkey init - COMMAND ${GIT_EXECUTABLE} -C ${DEPS_BUILD_DIR}/src/libtermkey apply --ignore-whitespace - ${CMAKE_CURRENT_SOURCE_DIR}/patches/libtermkey-Add-support-for-Windows.patch - ${CMAKE_CURRENT_SOURCE_DIR}/patches/libtermkey-Fix-escape-sequences-for-MSVC.patch CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/cmake/libtermkeyCMakeLists.txt ${DEPS_BUILD_DIR}/src/libtermkey/CMakeLists.txt diff --git a/third-party/patches/libtermkey-Add-support-for-Windows.patch b/third-party/patches/libtermkey-Add-support-for-Windows.patch deleted file mode 100644 index b839e94d05..0000000000 --- a/third-party/patches/libtermkey-Add-support-for-Windows.patch +++ /dev/null @@ -1,170 +0,0 @@ -From fbe91a958816d85fa93665eb8f7a7a8e05eb9650 Mon Sep 17 00:00:00 2001 -From: Rui Abreu Ferreira <raf-ep@gmx.com> -Date: Tue, 5 Apr 2016 00:12:41 +0100 -Subject: [PATCH] Add support for Windows - -Ported termkey for windows. - -- The TERMKEY_FLAG_NOTERMIOS is ignore in Windows, since there is no termios. -- The termkey_waitkey() function is not implemented in windows, since there - is no poll() alternative. -- The CMake recipe only supports unibilium, not curses. ---- - driver-ti.c | 8 +++++++- - termkey-internal.h | 11 ++++++++++- - termkey.c | 22 ++++++++++++++++++---- - 3 files changed, 35 insertions(+), 6 deletions(-) - -diff --git a/driver-ti.c b/driver-ti.c -index e673ab7..f5f8052 100644 ---- a/driver-ti.c -+++ b/driver-ti.c -@@ -17,7 +17,9 @@ - #include <ctype.h> - #include <stdio.h> - #include <string.h> --#include <unistd.h> -+#ifndef _WIN32 -+# include <unistd.h> -+#endif - #include <sys/types.h> - #include <sys/stat.h> - -@@ -338,8 +340,10 @@ static int start_driver(TermKey *tk, void *info) - if(fstat(tk->fd, &statbuf) == -1) - return 0; - -+#ifndef _WIN32 - if(S_ISFIFO(statbuf.st_mode)) - return 1; -+#endif - - // Can't call putp or tputs because they suck and don't give us fd control - len = strlen(start_string); -@@ -367,8 +371,10 @@ static int stop_driver(TermKey *tk, void *info) - if(fstat(tk->fd, &statbuf) == -1) - return 0; - -+#ifndef _WIN32 - if(S_ISFIFO(statbuf.st_mode)) - return 1; -+#endif - - /* The terminfo database will contain keys in application cursor key mode. - * We may need to enable that mode -diff --git a/termkey-internal.h b/termkey-internal.h -index 52829b3..b796729 100644 ---- a/termkey-internal.h -+++ b/termkey-internal.h -@@ -4,7 +4,14 @@ - #include "termkey.h" - - #include <stdint.h> --#include <termios.h> -+#ifndef _WIN32 -+# include <termios.h> -+#endif -+ -+#ifdef _MSC_VER -+#include <BaseTsd.h> -+typedef SSIZE_T ssize_t; -+#endif - - struct TermKeyDriver - { -@@ -41,8 +48,10 @@ struct TermKey { - size_t hightide; /* Position beyond buffstart at which peekkey() should next start - * normally 0, but see also termkey_interpret_csi */ - -+#ifndef _WIN32 - struct termios restore_termios; - char restore_termios_valid; -+#endif - - TermKey_Terminfo_Getstr_Hook *ti_getstr_hook; - void *ti_getstr_hook_data; -diff --git a/termkey.c b/termkey.c -index 2f01f3a..145b99f 100644 ---- a/termkey.c -+++ b/termkey.c -@@ -3,14 +3,20 @@ - - #include <ctype.h> - #include <errno.h> --#include <poll.h> --#include <unistd.h> -+#ifndef _WIN32 -+# include <poll.h> -+# include <unistd.h> -+# include <strings.h> -+#endif - #include <string.h> --#include <strings.h> - - #include <stdio.h> - --#define strcaseeq(a,b) (strcasecmp(a,b) == 0) -+#ifdef _MSC_VER -+# define strcaseeq(a,b) (_stricmp(a,b) == 0) -+#else -+# define strcaseeq(a,b) (strcasecmp(a,b) == 0) -+#endif - - void termkey_check_version(int major, int minor) - { -@@ -282,7 +288,9 @@ static TermKey *termkey_alloc(void) - tk->buffsize = 256; /* bytes */ - tk->hightide = 0; - -+#ifndef _WIN32 - tk->restore_termios_valid = 0; -+#endif - - tk->ti_getstr_hook = NULL; - tk->ti_getstr_hook_data = NULL; -@@ -483,6 +491,7 @@ int termkey_start(TermKey *tk) - if(tk->is_started) - return 1; - -+#ifndef _WIN32 - if(tk->fd != -1 && !(tk->flags & TERMKEY_FLAG_NOTERMIOS)) { - struct termios termios; - if(tcgetattr(tk->fd, &termios) == 0) { -@@ -517,6 +526,7 @@ int termkey_start(TermKey *tk) - tcsetattr(tk->fd, TCSANOW, &termios); - } - } -+#endif - - struct TermKeyDriverNode *p; - for(p = tk->drivers; p; p = p->next) -@@ -542,8 +552,10 @@ int termkey_stop(TermKey *tk) - if(p->driver->stop_driver) - (*p->driver->stop_driver)(tk, p->info); - -+#ifndef _WIN32 - if(tk->restore_termios_valid) - tcsetattr(tk->fd, TCSANOW, &tk->restore_termios); -+#endif - - tk->is_started = 0; - -@@ -1046,6 +1058,7 @@ TermKeyResult termkey_getkey_force(TermKey *tk, TermKeyKey *key) - return ret; - } - -+#ifndef _WIN32 - TermKeyResult termkey_waitkey(TermKey *tk, TermKeyKey *key) - { - if(tk->fd == -1) { -@@ -1105,6 +1118,7 @@ retry: - - /* UNREACHABLE */ - } -+#endif - - TermKeyResult termkey_advisereadable(TermKey *tk) - { --- -2.16.1.windows.4 - diff --git a/third-party/patches/libtermkey-Fix-escape-sequences-for-MSVC.patch b/third-party/patches/libtermkey-Fix-escape-sequences-for-MSVC.patch deleted file mode 100644 index c1099bd3c4..0000000000 --- a/third-party/patches/libtermkey-Fix-escape-sequences-for-MSVC.patch +++ /dev/null @@ -1,189 +0,0 @@ -diff --git a/t/30mouse.c b/t/30mouse.c ---- a/t/30mouse.c -+++ b/t/30mouse.c -@@ -14,7 +14,7 @@ int main(int argc, char *argv[]) - - tk = termkey_new_abstract("vt100", 0); - -- termkey_push_bytes(tk, "\e[M !!", 6); -+ termkey_push_bytes(tk, "\x1b[M !!", 6); - - key.type = -1; - is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for mouse press"); -@@ -38,7 +38,7 @@ int main(int argc, char *argv[]) - is_int(len, 21, "string length for press"); - is_str(buffer, "MousePress(1) @ (1,1)", "string buffer for press"); - -- termkey_push_bytes(tk, "\e[M@\"!", 6); -+ termkey_push_bytes(tk, "\x1b[M@\"!", 6); - - key.type = -1; - ev = -1; button = -1; line = -1; col = -1; -@@ -51,7 +51,7 @@ int main(int argc, char *argv[]) - is_int(col, 2, "mouse column for drag"); - is_int(key.modifiers, 0, "modifiers for press"); - -- termkey_push_bytes(tk, "\e[M##!", 6); -+ termkey_push_bytes(tk, "\x1b[M##!", 6); - - key.type = -1; - ev = -1; button = -1; line = -1; col = -1; -@@ -63,7 +63,7 @@ int main(int argc, char *argv[]) - is_int(col, 3, "mouse column for release"); - is_int(key.modifiers, 0, "modifiers for press"); - -- termkey_push_bytes(tk, "\e[M0++", 6); -+ termkey_push_bytes(tk, "\x1b[M0++", 6); - - key.type = -1; - ev = -1; button = -1; line = -1; col = -1; -@@ -81,7 +81,7 @@ int main(int argc, char *argv[]) - is_str(buffer, "C-MousePress(1)", "string buffer for Ctrl-press"); - - // rxvt protocol -- termkey_push_bytes(tk, "\e[0;20;20M", 10); -+ termkey_push_bytes(tk, "\x1b[0;20;20M", 10); - - key.type = -1; - is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for mouse press rxvt protocol"); -@@ -96,7 +96,7 @@ int main(int argc, char *argv[]) - is_int(col, 20, "mouse column for press rxvt protocol"); - is_int(key.modifiers, 0, "modifiers for press rxvt protocol"); - -- termkey_push_bytes(tk, "\e[3;20;20M", 10); -+ termkey_push_bytes(tk, "\x1b[3;20;20M", 10); - - is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for mouse release rxvt protocol"); - -@@ -111,7 +111,7 @@ int main(int argc, char *argv[]) - is_int(key.modifiers, 0, "modifiers for release rxvt protocol"); - - // SGR protocol -- termkey_push_bytes(tk, "\e[<0;30;30M", 11); -+ termkey_push_bytes(tk, "\x1b[<0;30;30M", 11); - - key.type = -1; - is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for mouse press SGR encoding"); -@@ -127,7 +127,7 @@ int main(int argc, char *argv[]) - is_int(col, 30, "mouse column for press SGR"); - is_int(key.modifiers, 0, "modifiers for press SGR"); - -- termkey_push_bytes(tk, "\e[<0;30;30m", 11); -+ termkey_push_bytes(tk, "\x1b[<0;30;30m", 11); - - key.type = -1; - is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for mouse release SGR encoding"); -@@ -139,7 +139,7 @@ int main(int argc, char *argv[]) - - is_int(ev, TERMKEY_MOUSE_RELEASE, "mouse event for release SGR"); - -- termkey_push_bytes(tk, "\e[<0;500;300M", 13); -+ termkey_push_bytes(tk, "\x1b[<0;500;300M", 13); - - key.type = -1; - ev = -1; button = -1; line = -1; col = -1; -diff --git a/t/31position.c b/t/31position.c -index 1748211..86ad1bc 100644 ---- a/t/31position.c -+++ b/t/31position.c -@@ -11,7 +11,7 @@ int main(int argc, char *argv[]) - - tk = termkey_new_abstract("vt100", 0); - -- termkey_push_bytes(tk, "\e[?15;7R", 8); -+ termkey_push_bytes(tk, "\x1b[?15;7R", 8); - - is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for position report"); - -@@ -25,7 +25,7 @@ int main(int argc, char *argv[]) - /* A plain CSI R is likely to be <F3> though. - * This is tricky :/ - */ -- termkey_push_bytes(tk, "\e[R", 3); -+ termkey_push_bytes(tk, "\x1b[R", 3); - - is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for <F3>"); - -diff --git a/t/32modereport.c b/t/32modereport.c -index 31de400..5e49705 100644 ---- a/t/32modereport.c -+++ b/t/32modereport.c -@@ -11,7 +11,7 @@ int main(int argc, char *argv[]) - - tk = termkey_new_abstract("vt100", 0); - -- termkey_push_bytes(tk, "\e[?1;2$y", 8); -+ termkey_push_bytes(tk, "\x1b[?1;2$y", 8); - - is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for mode report"); - -@@ -23,7 +23,7 @@ int main(int argc, char *argv[]) - is_int(mode, 1, "mode number from mode report"); - is_int(value, 2, "mode value from mode report"); - -- termkey_push_bytes(tk, "\e[4;1$y", 7); -+ termkey_push_bytes(tk, "\x1b[4;1$y", 7); - - is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for mode report"); - -diff --git a/t/38csi.c b/t/38csi.c -index 9d186f6..fd592d5 100644 ---- a/t/38csi.c -+++ b/t/38csi.c -@@ -13,7 +13,7 @@ int main(int argc, char *argv[]) - - tk = termkey_new_abstract("vt100", 0); - -- termkey_push_bytes(tk, "\e[5;25v", 7); -+ termkey_push_bytes(tk, "\x1b[5;25v", 7); - - is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for CSI v"); - -@@ -26,14 +26,14 @@ int main(int argc, char *argv[]) - is_int(args[1], 25, "args[1] for unknown CSI"); - is_int(command, 'v', "command for unknown CSI"); - -- termkey_push_bytes(tk, "\e[?w", 4); -+ termkey_push_bytes(tk, "\x1b[?w", 4); - - is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for CSI ? w"); - is_int(key.type, TERMKEY_TYPE_UNKNOWN_CSI, "key.type for unknown CSI"); - is_int(termkey_interpret_csi(tk, &key, args, &nargs, &command), TERMKEY_RES_KEY, "interpret_csi yields RES_KEY"); - is_int(command, '?'<<8 | 'w', "command for unknown CSI"); - -- termkey_push_bytes(tk, "\e[?$x", 5); -+ termkey_push_bytes(tk, "\x1b[?$x", 5); - - is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for CSI ? $x"); - is_int(key.type, TERMKEY_TYPE_UNKNOWN_CSI, "key.type for unknown CSI"); -diff --git a/t/39dcs.c b/t/39dcs.c -index c517411..f065477 100644 ---- a/t/39dcs.c -+++ b/t/39dcs.c -@@ -12,7 +12,7 @@ int main(int argc, char *argv[]) - tk = termkey_new_abstract("xterm", 0); - - // 7bit DCS -- termkey_push_bytes(tk, "\eP1$r1 q\e\\", 10); -+ termkey_push_bytes(tk, "\x1bP1$r1 q\x1b\\", 10); - - is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for DCS"); - -@@ -38,7 +38,7 @@ int main(int argc, char *argv[]) - is_int(termkey_getkey(tk, &key), TERMKEY_RES_NONE, "getkey again yields RES_NONE"); - - // 7bit OSC -- termkey_push_bytes(tk, "\e]15;abc\e\\", 10); -+ termkey_push_bytes(tk, "\x1b]15;abc\x1b\\", 10); - - is_int(termkey_getkey(tk, &key), TERMKEY_RES_KEY, "getkey yields RES_KEY for OSC"); - -@@ -51,7 +51,7 @@ int main(int argc, char *argv[]) - is_int(termkey_getkey(tk, &key), TERMKEY_RES_NONE, "getkey again yields RES_NONE"); - - // False alarm -- termkey_push_bytes(tk, "\eP", 2); -+ termkey_push_bytes(tk, "\x1bP", 2); - - is_int(termkey_getkey(tk, &key), TERMKEY_RES_AGAIN, "getkey yields RES_AGAIN for false alarm"); - |