When running the console in the terminal, style log lines with the same escape sequences as msg.c. mp.input can also specify terminal escape sequences, e.g. a script to select a playlist entry can invert the color of the selection. Also add a missing newline to help's error message.
Showing the changes to player/lua/input.lua (1 of 4 files). Show all
Unified · Split
| @@ -49,9 +49,12 @@ function input.terminate() · 48 unmodified lines | ||
| 49 | 49 | mp.commandv("script-message-to", "console", "disable") |
| 50 | 50 | end |
| 51 | 51 | |
| 52 | −function input.log(message, style) | |
| 53 | − mp.commandv("script-message-to", "console", "log", | |
| 54 | − utils.format_json({ text = message, style = style })) | |
| 52 | +function input.log(message, style, terminal_style) | |
| 53 | + mp.commandv("script-message-to", "console", "log", utils.format_json({ | |
| 54 | + text = message, | |
| 55 | + style = style, | |
| 56 | + terminal_style = terminal_style, | |
| 57 | + })) | |
| 55 | 58 | end |
| 56 | 59 | |
| 57 | 60 | function input.log_error(message) |