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/javascript (1 of 4 files). Show all

Unified · Split

player/javascript/defaults.js+6−3
@@ -675,9 +675,12 @@ mp.input = { · 674 unmodified lines
675675 terminate: function () {
676676 mp.commandv("script-message-to", "console", "disable");
677677 },
678− log: function (message, style) {
679− mp.commandv("script-message-to", "console", "log",
680− JSON.stringify({ text: message, style: style }));
678+ log: function (message, style, terminal_style) {
679+ mp.commandv("script-message-to", "console", "log", JSON.stringify({
680+ text: message,
681+ style: style,
682+ terminal_style: terminal_style,
683+ }));
681684 },
682685 log_error: function (message) {
683686 mp.commandv("script-message-to", "console", "log",

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