summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorTitanSnow <[email protected]>2017-05-10 18:55:43 +0800
committerTitanSnow <[email protected]>2017-05-10 19:21:31 +0800
commit86f74ff4d66738713e596ef5f9cba3275be3958c (patch)
tree1eb5efe0430fc3fb18faf90e0ce6c671c070d67b /core/src
parent1210d50fff01fe3089e57b458bb8a884b0d34d1b (diff)
fix history_list on macos
Diffstat (limited to 'core/src')
-rw-r--r--core/src/xmake/readline/history_list.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/src/xmake/readline/history_list.c b/core/src/xmake/readline/history_list.c
index 30df2ef6f..3b0f8c0d3 100644
--- a/core/src/xmake/readline/history_list.c
+++ b/core/src/xmake/readline/history_list.c
@@ -48,6 +48,19 @@ tb_int_t xm_readline_history_list(lua_State* lua)
// history list
lua_newtable(lua);
+#ifdef TB_CONFIG_OS_MACOSX
+ for (tb_int_t i = 1; i <= history_length; ++i)
+ {
+ lua_newtable(lua);
+ // field line
+ lua_pushstring(lua, "line");
+ lua_pushstring(lua, history_get(i) -> line);
+ lua_settable(lua, -3);
+
+ // set back
+ lua_rawseti(lua, -2, i);
+ }
+#else
tb_int_t i = 1;
for (HIST_ENTRY **p = history_list(); *p; ++p, ++i)
{
@@ -60,6 +73,7 @@ tb_int_t xm_readline_history_list(lua_State* lua)
// set back
lua_rawseti(lua, -2, i);
}
+#endif
// ok
return 1;