Skip to content

Commit

Permalink
feat: make UI extensions easier
Browse files Browse the repository at this point in the history
  • Loading branch information
sxyazi committed Jul 8, 2024
1 parent 11547ee commit 0fbb5a6
Show file tree
Hide file tree
Showing 52 changed files with 645 additions and 401 deletions.
25 changes: 14 additions & 11 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ body:
- macOS
- Windows
- Windows WSL
- FreeBSD X11
- FreeBSD Wayland
validations:
required: true
- type: input
Expand All @@ -22,31 +24,32 @@ body:
placeholder: "ex: kitty v0.32.2"
validations:
required: true
- type: dropdown
id: tried_main
attributes:
label: Did you try the latest code to see if this problem got fixed?
options:
- Tried, but the problem still
- Not tried, and I'll explain why below
validations:
required: true
- type: textarea
id: debug
attributes:
label: "`yazi --debug` output"
description: Please do a `yazi --debug` and paste the output here.
description: Please run `yazi --debug` and paste the debug information here.
value: |
<details>
<!-- Paste the output between the backticks below: -->
```sh
<!-- ↓↓↓ Paste the output here: ↓↓↓ -->
```
</details>
validations:
required: true
- type: dropdown
id: tried_main
attributes:
label: Did you try the latest nightly build to see if the problem got fixed?
options:
- Yes, and I updated the debug information above (`yazi --debug`) to the nightly that I tried
- No, and I'll explain why below
validations:
required: true
- type: textarea
id: description
attributes:
Expand Down
44 changes: 22 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions yazi-boot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ yazi-config = { path = "../yazi-config", version = "0.2.5" }
yazi-shared = { path = "../yazi-shared", version = "0.2.5" }

# External dependencies
clap = { version = "4.5.7", features = [ "derive" ] }
clap = { version = "4.5.8", features = [ "derive" ] }
serde = { version = "1.0.203", features = [ "derive" ] }

[build-dependencies]
clap = { version = "4.5.7", features = [ "derive" ] }
clap_complete = "4.5.6"
clap = { version = "4.5.8", features = [ "derive" ] }
clap_complete = "4.5.7"
clap_complete_nushell = "4.5.2"
clap_complete_fig = "4.5.1"
vergen = { version = "8.3.1", features = [ "build", "git", "gitcl" ] }
10 changes: 5 additions & 5 deletions yazi-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ yazi-shared = { path = "../yazi-shared", version = "0.2.5" }

# External dependencies
anyhow = "1.0.86"
clap = { version = "4.5.7", features = [ "derive" ] }
clap = { version = "4.5.8", features = [ "derive" ] }
crossterm = "0.27.0"
md-5 = "0.10.6"
serde_json = "1.0.117"
serde_json = "1.0.120"
tokio = { version = "1.38.0", features = [ "full" ] }
toml_edit = "0.22.14"

[build-dependencies]
anyhow = "1.0.86"
clap = { version = "4.5.7", features = [ "derive" ] }
clap_complete = "4.5.6"
clap = { version = "4.5.8", features = [ "derive" ] }
clap_complete = "4.5.7"
clap_complete_fig = "4.5.1"
clap_complete_nushell = "4.5.2"
serde_json = "1.0.117"
serde_json = "1.0.120"
vergen = { version = "8.3.1", features = [ "build", "git", "gitcl" ] }

[[bin]]
Expand Down
2 changes: 1 addition & 1 deletion yazi-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ yazi-shared = { path = "../yazi-shared", version = "0.2.5" }
# External dependencies
anyhow = "1.0.86"
arc-swap = "1.7.1"
bitflags = "2.5.0"
bitflags = "2.6.0"
crossterm = "0.27.0"
globset = "0.4.14"
indexmap = "2.2.6"
Expand Down
6 changes: 3 additions & 3 deletions yazi-config/preset/theme.toml
Original file line number Diff line number Diff line change
Expand Up @@ -773,9 +773,9 @@ conds = [
{ if = "sticky", text = "" },

# Fallback
{ if = "dir", text = "" },
{ if = "exec", text = "" },
{ if = "!dir", text = "" },
{ if = "dir", text = "󰉋" },
{ if = "exec", text = "" },
{ if = "!dir", text = "󰈔" },
]

# : }}}
2 changes: 1 addition & 1 deletion yazi-config/preset/yazi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ previewers = [
]

[input]
cursor_blink = true
cursor_blink = false

# cd
cd_title = "Change directory:"
Expand Down
7 changes: 1 addition & 6 deletions yazi-config/src/layout.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
use ratatui::layout::Rect;

#[derive(Default)]
#[derive(Clone, Copy, Default)]
pub struct Layout {
pub header: Rect,

pub parent: Rect,
pub current: Rect,
pub preview: Rect,

pub status: Rect,
}
9 changes: 8 additions & 1 deletion yazi-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,20 @@ pub fn init() -> anyhow::Result<()> {
// TODO: Remove in v0.3.2
for c in &KEYMAP.manager {
for r in &c.run {
if r.name == "shell" && !r.bool("confirm") && !r.bool("interactive") {
if r.name != "shell" {
continue;
}
if !r.bool("confirm") && !r.bool("interactive") {
eprintln!(
r#"WARNING: In Yazi v0.3, the behavior of the interactive `shell` (i.e., shell templates) must be explicitly specified with `--interactive`.
Please replace e.g. `shell` with `shell --interactive`, `shell "my-template"` with `shell "my-template" --interactive`, in your keymap.toml"#
);
return Ok(());
} else if r.bool("confirm") && r.bool("interactive") {
eprintln!(
"The `shell` command cannot specify both `--confirm` and `--interactive` at the same time.",
);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion yazi-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ yazi-shared = { path = "../yazi-shared", version = "0.2.5" }

# External dependencies
anyhow = "1.0.86"
bitflags = "2.5.0"
bitflags = "2.6.0"
crossterm = "0.27.0"
dirs = "5.0.1"
futures = "0.3.30"
Expand Down
2 changes: 1 addition & 1 deletion yazi-dds/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ anyhow = "1.0.86"
mlua = { version = "0.9.9", features = [ "lua54" ] }
parking_lot = "0.12.3"
serde = { version = "1.0.203", features = [ "derive" ] }
serde_json = "1.0.117"
serde_json = "1.0.120"
tokio = { version = "1.38.0", features = [ "full" ] }
tokio-stream = "0.1.15"
tokio-util = "0.7.11"
Expand Down
27 changes: 14 additions & 13 deletions yazi-fm/src/app/commands/mouse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,18 @@ impl App {
return;
}

if layout.current.contains(position) {
self.mouse_do(components::Current::mouse, event, Some(layout.current));
} else if layout.preview.contains(position) {
self.mouse_do(components::Preview::mouse, event, Some(layout.preview));
} else if layout.parent.contains(position) {
self.mouse_do(components::Parent::mouse, event, Some(layout.parent));
} else if layout.header.contains(position) {
self.mouse_do(components::Header::mouse, event, Some(layout.header));
} else if layout.status.contains(position) {
self.mouse_do(components::Status::mouse, event, Some(layout.status));
}
// TODO
// if layout.current.contains(position) {
// self.mouse_do(components::Current::mouse, event, Some(layout.current));
// } else if layout.preview.contains(position) {
// self.mouse_do(components::Preview::mouse, event, Some(layout.preview));
// } else if layout.parent.contains(position) {
// self.mouse_do(components::Parent::mouse, event, Some(layout.parent));
// } else if layout.header.contains(position) {
// self.mouse_do(components::Header::mouse, event, Some(layout.header));
// } else if layout.status.contains(position) {
// self.mouse_do(components::Status::mouse, event, Some(layout.status));
// }
}

fn mouse_do(
Expand All @@ -49,7 +50,7 @@ impl App {
if matches!(event.kind, MouseEventKind::Down(_) if MANAGER.mouse_events.draggable()) {
let evt = yazi_plugin::bindings::MouseEvent::cast(&LUA, event);
if let (Ok(evt), Ok(root)) = (evt, LUA.globals().raw_get::<_, Table>("Root")) {
root.raw_set("drag_start", evt).ok();
root.raw_set("_drag_start", evt).ok();
}
}

Expand All @@ -59,7 +60,7 @@ impl App {
}

if let Err(e) = Lives::scope(&self.cx, move |_| f(event)) {
error!("{:?}", e);
error!("{e}");
}
}
}
Loading

0 comments on commit 0fbb5a6

Please sign in to comment.