Add Lua REPL mode and multiline edit function in the mode.

Typing "@repl" after Ctrl-t r, enter Lua REPL mode.
Typing "@exit" in REPL mode will return you to normal mode.

Note:
- the determination of continuation lines is not done automatically, and
  if the end of a line is \, it is determined to be a continuation
  instruction.
- In REPL mode, tio's main loop is blocked. (Ctrl-t q works.)

Example:
>> t = {1,2,3,4,5}
>> for _,v in ipairs(t) do\
>>     print(v,"\r")\
>> end

Implementation improvements:
- Add tty_init() and script_interp_init() in order to only once
  initialization.
- Fix script function to work without device_fd.
This commit is contained in:
yabu76 2025-12-30 11:41:39 +09:00
parent c25a379fbb
commit 266338a926
5 changed files with 155 additions and 37 deletions

View file

@ -123,6 +123,12 @@ int main(int argc, char *argv[])
socket_configure();
}
/* Script interpreter init */
script_interp_init();
/* Initialize tty module once on program start */
tty_init();
/* Spawn input handling into separate thread */
tty_input_thread_create();