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 | mp.commandv("script-message-to", "console", "disable") | 49 | mp.commandv("script-message-to", "console", "disable") |
| 50 | end | 50 | end |
| 51 | 51 | ||
| 52 | function input.log(message, style) | 52 | function input.log(message, style, terminal_style) |
| 53 | mp.commandv("script-message-to", "console", "log", | 53 | mp.commandv("script-message-to", "console", "log", utils.format_json({ |
| 54 | utils.format_json({ text = message, style = style })) | 54 | text = message, |
| 55 | style = style, | ||
| 56 | terminal_style = terminal_style, | ||
| 57 | })) | ||
| 55 | end | 58 | end |
| 56 | 59 | ||
| 57 | function input.log_error(message) | 60 | function input.log_error(message) |