mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Clean up script run interaction text
This commit is contained in:
parent
be4fc0908f
commit
8f77ad5830
4 changed files with 13 additions and 6 deletions
|
|
@ -247,3 +247,8 @@ int execute_shell_command(int fd, const char *command)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clear_line()
|
||||||
|
{
|
||||||
|
print("\r\033[K");
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,3 +35,4 @@ int read_poll(int fd, void *data, size_t len, int timeout);
|
||||||
double get_current_time(void);
|
double get_current_time(void);
|
||||||
bool match_patterns(const char *string, const char *patterns);
|
bool match_patterns(const char *string, const char *patterns);
|
||||||
int execute_shell_command(int fd, const char *command);
|
int execute_shell_command(int fd, const char *command);
|
||||||
|
void clear_line();
|
||||||
|
|
|
||||||
|
|
@ -513,7 +513,7 @@ void script_file_run(lua_State *L, const char *filename)
|
||||||
|
|
||||||
if (luaL_dofile(L, filename))
|
if (luaL_dofile(L, filename))
|
||||||
{
|
{
|
||||||
tio_warning_printf("lua: %s\n", lua_tostring(L, -1));
|
tio_warning_printf("lua: %s", lua_tostring(L, -1));
|
||||||
lua_pop(L, 1); /* pop error message from the stack */
|
lua_pop(L, 1); /* pop error message from the stack */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
11
src/tty.c
11
src/tty.c
|
|
@ -1020,9 +1020,15 @@ void handle_command_sequence(char input_char, char *output_char, bool *forward)
|
||||||
tio_printf("Run Lua script")
|
tio_printf("Run Lua script")
|
||||||
tio_printf_raw("Enter file name: ");
|
tio_printf_raw("Enter file name: ");
|
||||||
if (tio_readln())
|
if (tio_readln())
|
||||||
|
{
|
||||||
|
clear_line();
|
||||||
script_run(device_fd, line);
|
script_run(device_fd, line);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
clear_line();
|
||||||
script_run(device_fd, NULL);
|
script_run(device_fd, NULL);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_SHIFT_R:
|
case KEY_SHIFT_R:
|
||||||
|
|
@ -2201,11 +2207,6 @@ void forward_to_tty(int fd, char output_char)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clear_line()
|
|
||||||
{
|
|
||||||
print("\r\033[K");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void print_line(const char *string, int cursor_pos)
|
static void print_line(const char *string, int cursor_pos)
|
||||||
{
|
{
|
||||||
clear_line();
|
clear_line();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue