diff -Nru lua-readline-3.0/debian/changelog lua-readline-3.1/debian/changelog
--- lua-readline-3.0/debian/changelog 2021-08-17 08:14:38.000000000 +0000
+++ lua-readline-3.1/debian/changelog 2022-04-30 04:46:29.000000000 +0000
@@ -1,3 +1,9 @@
+lua-readline (3.1-1) unstable; urgency=medium
+
+ * New upstream release.
+
+ -- Sergei Golovan
-This module does not work lua -i
+This module does not work with lua -i
because that runs its own readline,
and the two conflict with each other.
find /usr/lib -name 'libreadline.*' -print
- luarocks install \
- https://www.pjb.com.au/comp/lua/readline-3.0-0.rockspec \
+ luarocks install readline\
READLINE_INCDIR=/usr/local/Cellar/readline/8.1/include \
READLINE_LIBDIR=/usr/local/Cellar/readline/8.1/lib \
HISTORY_INCDIR=/usr/local/Cellar/readline/8.1/include \
diff -Nru lua-readline-3.0/readline.lua lua-readline-3.1/readline.lua
--- lua-readline-3.0/readline.lua 2021-04-18 05:42:54.000000000 +0000
+++ lua-readline-3.1/readline.lua 2022-04-20 04:21:45.000000000 +0000
@@ -141,6 +141,7 @@
Option[k] = v
prv.clear_history()
local rc = M.read_history( Option['histfile'] ) -- 1.2
+ OldHistoryLength = prv.history_length() -- 3.1
end
elseif k == 'keeplines' or k == 'minlength' then
if type(v) ~= 'number' then
@@ -204,10 +205,47 @@
if rc ~= 0 then warn('append_history: '..prv.strerror(rc)) end
rc = prv.history_truncate_file ( histfile, Option['keeplines'] )
if rc ~= 0 then warn('history_truncate_file: '..prv.strerror(rc)) end
+ -- reset OldHistoryLength in case it's used again ... er: 3.1?
+ -- OldHistoryLength = n -- is this useful ?
end
return
end
+--[[
+20220420
+https://tiswww.cwru.edu/php/chet/readline/history.html#SEC15
+
+Function: int read_history (const char *filename)
+ Add the contents of filename to the history list, a line at a
+ time. If filename is NULL, then read from `~/.history'. Returns 0
+ if successful, or errno if not.
+
+Function: int read_history_range (const char *filename, int from, int to)
+ Read a range of lines from filename, adding them to the history
+ list. Start reading at line from and end at to. If from is zero, start
+ at the beginning. If to is less than from, then read until the end of
+ the file. If filename is NULL, then read from `~/.history'. Returns
+ 0 if successful, or errno if not.
+
+Function: int write_history (const char *filename)
+ Write the current history to filename, overwriting filename if
+ necessary. If filename is NULL, then write the history list to
+ `~/.history'. Returns 0 on success, or errno on a read or write error.
+
+Function: int append_history (int nelements, const char *filename)
+ Append the last nelements of the history list to filename. If filename
+ is NULL, then append to `~/.history'. Returns 0 on success, or errno
+ on a read or write error.
+
+Function: int history_truncate_file (const char *filename, int nlines)
+ Truncate the history file filename, leaving only the last nlines
+ lines. If filename is NULL, then `~/.history' is truncated. Returns
+ 0 on success, or errno on failure.
+
+Seems something's going wrong with n-OldHistoryLength ...
+]]
+
+
function M.strerror ( errnum )
return prv.strerror(tonumber(errnum))
end