Skip to content

Commit 68cd028

Browse files
authored
feat: new rt.term exports terminal emulator information (#2442)
1 parent 3606bc7 commit 68cd028

File tree

6 files changed

+48
-42
lines changed

6 files changed

+48
-42
lines changed

Cargo.lock

Lines changed: 29 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ ratatui = { version = "0.29.0", features = [ "unstable-rendered-line
3636
regex = "1.11.1"
3737
scopeguard = "1.2.0"
3838
serde = { version = "1.0.218", features = [ "derive" ] }
39-
serde_json = "1.0.139"
39+
serde_json = "1.0.140"
4040
tokio = { version = "1.43.0", features = [ "full" ] }
4141
tokio-stream = "0.1.17"
4242
tokio-util = "0.7.13"

yazi-codegen/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ proc-macro = true
1313

1414
[dependencies]
1515
# External dependencies
16-
syn = { version = "2.0.98", features = [ "full" ] }
17-
quote = "1.0.38"
16+
syn = { version = "2.0.99", features = [ "full" ] }
17+
quote = "1.0.39"

yazi-config/preset/keymap-default.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -232,17 +232,17 @@ keymap = [
232232
{ on = "<C-[>", run = "escape", desc = "Go back the normal mode, or cancel input" },
233233

234234
# Mode
235-
{ on = "i", run = "insert", desc = "Enter insert mode" },
236-
{ on = "I", run = [ "move first-char", "insert" ], desc = "Move to the BOL, and enter insert mode" },
237-
{ on = "a", run = "insert --append", desc = "Enter append mode" },
238-
{ on = "A", run = [ "move eol", "insert --append" ], desc = "Move to the EOL, and enter append mode" },
239-
{ on = "v", run = "visual", desc = "Enter visual mode" },
240-
{ on = "r", run = "replace", desc = "Replace a single character" },
235+
{ on = "i", run = "insert", desc = "Enter insert mode" },
236+
{ on = "I", run = [ "move first-char", "insert" ], desc = "Move to the BOL, and enter insert mode" },
237+
{ on = "a", run = "insert --append", desc = "Enter append mode" },
238+
{ on = "A", run = [ "move eol", "insert --append" ], desc = "Move to the EOL, and enter append mode" },
239+
{ on = "v", run = "visual", desc = "Enter visual mode" },
240+
{ on = "r", run = "replace", desc = "Replace a single character" },
241241

242242
# Selection
243-
{ on = "V", run = [ "move bol", "visual", "move eol" ], desc = "Select from BOL to EOL" },
244-
{ on = "<C-A>", run = [ "move eol", "visual", "move bol" ], desc = "Select from EOL to BOL" },
245-
{ on = "<C-E>", run = [ "move bol", "visual", "move eol" ], desc = "Select from BOL to EOL" },
243+
{ on = "V", run = [ "move bol", "visual", "move eol" ], desc = "Select from BOL to EOL" },
244+
{ on = "<C-A>", run = [ "move eol", "visual", "move bol" ], desc = "Select from EOL to BOL" },
245+
{ on = "<C-E>", run = [ "move bol", "visual", "move eol" ], desc = "Select from BOL to EOL" },
246246

247247
# Character-wise movement
248248
{ on = "h", run = "move -1", desc = "Move back a character" },

yazi-fm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ tokio-stream = { workspace = true }
4343
tracing = { workspace = true }
4444
tracing-appender = "0.2.3"
4545
tracing-subscriber = { version = "0.3.19", features = [ "env-filter" ] }
46-
textwrap = "0.16.1"
46+
textwrap = "0.16.2"
4747

4848
[target."cfg(unix)".dependencies]
4949
libc = { workspace = true }

yazi-plugin/src/config/runtime.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use mlua::{IntoLua, Lua, LuaSerdeExt, SerializeOptions, Value};
2+
use yazi_adapter::EMULATOR;
23
use yazi_boot::ARGS;
34
use yazi_config::{MGR, PREVIEW, TASKS, THEME};
45

@@ -16,6 +17,7 @@ impl<'a> Runtime<'a> {
1617
Composer::make(lua, 10, |lua, key| {
1718
match key {
1819
b"args" => Self::args(lua)?,
20+
b"term" => Self::term(lua)?,
1921
b"mgr" => Self::mgr(lua)?,
2022
b"plugin" => super::Plugin::compose(lua)?,
2123
b"preview" => Self::preview(lua)?,
@@ -37,6 +39,10 @@ impl<'a> Runtime<'a> {
3739
})
3840
}
3941

42+
fn term(lua: &Lua) -> mlua::Result<Value> {
43+
lua.create_table_from([("light", EMULATOR.get().light)])?.into_lua(lua)
44+
}
45+
4046
fn mgr(lua: &Lua) -> mlua::Result<Value> {
4147
Composer::make(lua, 15, |lua, key| {
4248
match key {

0 commit comments

Comments
 (0)