[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Should the interactive interpreter insert "return" in readline history?
- From: Tom N Harris <telliamed@...>
- Date: Fri, 19 Dec 2014 20:42:55 -0500
Lua 5.3 now implicitly adds a "return" to expressions entered interactively.
This is done prior to pushing the line in history when readline is enabled. So
recalling the command will include the "return" that was not typed. Would it
not be more polite for history to remember exactly what I typed and not the
implicit "return"? Consider if I'm testing a function then want to execute it
in a loop. After adding the "while ... do" I can pull the function from
history, but will have to erase the "return" that Lua helpfully added.
The problem of course is that Lua stores complete statements in history. It
can't close a statement until it compiles, and an expression won't compile
until it has a "return" added. Managing the history this way will be more
complicated, but perhaps worth it to make interactive editing friendlier?