0011-linenoise.patch 925 B

123456789101112131415161718192021222324
  1. Add support of linenoise (replace readline)
  2. see discussion, http://lua-users.org/lists/lua-l/2010-03/msg00879.html
  3. Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
  4. Index: b/src/luaconf.h
  5. ===================================================================
  6. --- a/src/luaconf.h
  7. +++ b/src/luaconf.h
  8. @@ -279,6 +279,13 @@
  9. if (lua_strlen(L,idx) > 0) /* non-empty line? */ \
  10. add_history(lua_tostring(L, idx)); /* add it to history */
  11. #define lua_freeline(L,b) ((void)L, free(b))
  12. +#elif defined(LUA_USE_LINENOISE)
  13. +#include <linenoise.h>
  14. +#define lua_readline(L,b,p) ((void)L, ((b)=linenoise(p)) != NULL)
  15. +#define lua_saveline(L,idx) \
  16. + if (lua_strlen(L,idx) > 0) /* non-empty line? */ \
  17. + linenoiseHistoryAdd(lua_tostring(L, idx)); /* add it to history */
  18. +#define lua_freeline(L,b) ((void)L, free(b))
  19. #else
  20. #define lua_readline(L,b,p) \
  21. ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \