History

console.lua: style log lines in the terminal

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.

Guido Cella committed 2 years ago

Commit dfecc9f1 parent f33a4d24 files · +50 −33Browse files

Showing the changes to player/lua/input.lua (1 of 4 files). Show all

Unified · Split

player/lua/input.lua+6−3
@@ -49,9 +49,12 @@ function input.terminate() · 48 unmodified lines
4949 mp.commandv("script-message-to", "console", "disable")
5050 end
5151
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+ }))
5558 end
5659
5760 function input.log_error(message)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t