diff options
author | Soumith Chintala <soumith@gmail.com> | 2016-10-28 05:47:11 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-28 05:47:11 +0300 |
commit | 216531666d303c28a1c7f6a0e20e7804231a2ca8 (patch) | |
tree | 49dcb1a9e5a0559e8efc81662949562e844c2498 | |
parent | 47fec15d184fd613c3e5425f9dd5dbb11adef5fb (diff) | |
parent | 9ee945bd8b2e28c011e791fad1af7ddf2a94b238 (diff) |
Merge pull request #55 from BTNC/master
fix for windows with wineditline
-rw-r--r-- | init.lua | 13 | ||||
-rw-r--r-- | readline.c | 8 | ||||
-rw-r--r-- | trepl-scm-1.rockspec | 8 | ||||
-rw-r--r-- | utils.c | 2 |
4 files changed, 24 insertions, 7 deletions
@@ -46,10 +46,15 @@ local function isWindows() package.config:sub(1,1) == '\\' end -if isWindows() or (not cutils.isatty()) then +local hasTPut = true -- default true for non windows +if isWindows() then + hasTPut = sys.fexecute('where tput'):find('tput') +end + +if not hasTPut or not cutils.isatty() then noColors() else - local outp = os.execute('tput colors >/dev/null') + local outp = os.execute('tput colors >' .. (isWindows() and 'NUL' or '/dev/null')) if type(outp) == 'boolean' and not outp then noColors() elseif type(outp) == 'number' and outp ~= 0 then @@ -520,6 +525,10 @@ local aliases = [[ alias lla='ls -lahF'; ]] +if isWindows() then + aliases = "" +end + -- Penlight pcall(require,'pl') @@ -4,8 +4,12 @@ #include "lua.h" #include "lauxlib.h" #include "lualib.h" +#ifndef WinEditLine #include <readline/readline.h> #include <readline/history.h> +#else +#include <editline/readline.h> +#endif #include <ctype.h> #if LUA_VERSION_NUM == 501 @@ -260,12 +264,16 @@ static int f_setup(lua_State *L) /* Break words at every non-identifier character except '.' and ':'. */ rl_completer_word_break_characters = "\t\r\n !\"#$%&'()*+,-/;<=>?@[\\]^`{|}~"; +#ifndef WinEditLine rl_completer_quote_characters = "\"'"; +#endif /* #if RL_READLINE_VERSION < 0x0600 */ rl_completion_append_character = '\0'; /* #endif */ rl_attempted_completion_function = lua_rl_complete; +#ifndef WinEditLine rl_initialize(); +#endif return 0; } diff --git a/trepl-scm-1.rockspec b/trepl-scm-1.rockspec index 54269b0..62d6812 100644 --- a/trepl-scm-1.rockspec +++ b/trepl-scm-1.rockspec @@ -40,10 +40,10 @@ build = { ['readline'] = { sources = {'readline.c'}, libraries = {'readline'}, - defines = {"USE_READLINE_STATIC"}, - incdirs = {"windows"}, - libdirs = {"windows"}, - libraries = {'readline-win'} + defines = {"WinEditLine"}, + incdirs = {"..\\..\\win-files\\3rd\\wineditline-2.101\\include"}, + libdirs = {"..\\..\\win-files\\3rd\\wineditline-2.101\\lib64"}, + libraries = {'edit_static', 'user32'} } } } @@ -13,7 +13,7 @@ int treplutils_isatty(lua_State *L) { - lua_pushboolean(L, 0); + lua_pushboolean(L, _isatty(1)); return 1; } |