mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-12-04 02:36:02 +00:00
Compare commits
3 Commits
4545c2d8e8
...
b0d79e598d
Author | SHA1 | Date | |
---|---|---|---|
|
b0d79e598d | ||
|
fa69885b6c | ||
|
63da751e59 |
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -425,6 +425,7 @@ dependencies = [
|
||||||
"tree-sitter-highlight",
|
"tree-sitter-highlight",
|
||||||
"tui-term",
|
"tui-term",
|
||||||
"unicode-width 0.2.0",
|
"unicode-width 0.2.0",
|
||||||
|
"vt100-ctt",
|
||||||
"zips",
|
"zips",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1096,7 +1097,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "72af159125ce32b02ceaced6cffae6394b0e6b6dfd4dc164a6c59a2db9b3c0b0"
|
checksum = "72af159125ce32b02ceaced6cffae6394b0e6b6dfd4dc164a6c59a2db9b3c0b0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ratatui",
|
"ratatui",
|
||||||
"vt100",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1147,9 +1147,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "vt100"
|
name = "vt100-ctt"
|
||||||
version = "0.15.2"
|
version = "0.15.3"
|
||||||
source = "git+https://github.com/ChrisTitusTech/vt100-rust#e41fb3d8fb5fd01dd2d076c9a25823a31656012f"
|
source = "git+https://github.com/ChrisTitusTech/vt100-rust#39136a6232d043d8447afa7d47805b6f6baa09ee"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa",
|
"itoa",
|
||||||
"log",
|
"log",
|
||||||
|
|
|
@ -8,9 +8,6 @@ members = ["tui", "core", "xtask"]
|
||||||
default-members = ["tui", "core"]
|
default-members = ["tui", "core"]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
[patch.crates-io]
|
|
||||||
vt100 = { git = "https://github.com/ChrisTitusTech/vt100-rust" }
|
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
opt-level = "z"
|
opt-level = "z"
|
||||||
debug = false
|
debug = false
|
||||||
|
|
|
@ -18,7 +18,7 @@ clap = { version = "4.5.20", features = ["derive", "std"], default-features = fa
|
||||||
oneshot = { version = "0.1.8", features = ["std"], default-features = false }
|
oneshot = { version = "0.1.8", features = ["std"], default-features = false }
|
||||||
portable-pty = "0.8.1"
|
portable-pty = "0.8.1"
|
||||||
ratatui = { version = "0.29.0", features = ["crossterm"], default-features = false }
|
ratatui = { version = "0.29.0", features = ["crossterm"], default-features = false }
|
||||||
tui-term = "0.2.0"
|
tui-term = { version = "0.2.0", default-features = false }
|
||||||
temp-dir = "0.1.14"
|
temp-dir = "0.1.14"
|
||||||
time = { version = "0.3.36", features = ["formatting", "local-offset", "macros"], default-features = false }
|
time = { version = "0.3.36", features = ["formatting", "local-offset", "macros"], default-features = false }
|
||||||
unicode-width = { version = "0.2.0", default-features = false }
|
unicode-width = { version = "0.2.0", default-features = false }
|
||||||
|
@ -31,6 +31,7 @@ anstyle = { version = "1.0.8", default-features = false }
|
||||||
ansi-to-tui = { version = "7.0.0", default-features = false }
|
ansi-to-tui = { version = "7.0.0", default-features = false }
|
||||||
zips = "0.1.7"
|
zips = "0.1.7"
|
||||||
nix = { version = "0.29.0", features = [ "user" ] }
|
nix = { version = "0.29.0", features = [ "user" ] }
|
||||||
|
vt100-ctt = { git = "https://github.com/ChrisTitusTech/vt100-rust" }
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "linutil"
|
name = "linutil"
|
||||||
|
|
|
@ -18,10 +18,9 @@ use std::{
|
||||||
thread::JoinHandle,
|
thread::JoinHandle,
|
||||||
};
|
};
|
||||||
use time::{macros::format_description, OffsetDateTime};
|
use time::{macros::format_description, OffsetDateTime};
|
||||||
use tui_term::{
|
use tui_term::widget::PseudoTerminal;
|
||||||
vt100::{self, Screen},
|
use vt100_ctt::{Parser, Screen};
|
||||||
widget::PseudoTerminal,
|
|
||||||
};
|
|
||||||
pub struct RunningCommand {
|
pub struct RunningCommand {
|
||||||
/// A buffer to save all the command output (accumulates, until the command exits)
|
/// A buffer to save all the command output (accumulates, until the command exits)
|
||||||
buffer: Arc<Mutex<Vec<u8>>>,
|
buffer: Arc<Mutex<Vec<u8>>>,
|
||||||
|
@ -285,7 +284,7 @@ impl RunningCommand {
|
||||||
// Process the buffer with a parser with the current screen size
|
// Process the buffer with a parser with the current screen size
|
||||||
// We don't actually need to create a new parser every time, but it is so much easier this
|
// We don't actually need to create a new parser every time, but it is so much easier this
|
||||||
// way, and doesn't cost that much
|
// way, and doesn't cost that much
|
||||||
let mut parser = vt100::Parser::new(size.height, size.width, 1000);
|
let mut parser = Parser::new(size.height, size.width, 1000);
|
||||||
let mutex = self.buffer.lock();
|
let mutex = self.buffer.lock();
|
||||||
let buffer = mutex.as_ref().unwrap();
|
let buffer = mutex.as_ref().unwrap();
|
||||||
parser.process(buffer);
|
parser.process(buffer);
|
||||||
|
|
|
@ -66,6 +66,7 @@ pub struct AppState {
|
||||||
tip: String,
|
tip: String,
|
||||||
size_bypass: bool,
|
size_bypass: bool,
|
||||||
skip_confirmation: bool,
|
skip_confirmation: bool,
|
||||||
|
mouse_enabled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum Focus {
|
pub enum Focus {
|
||||||
|
@ -123,6 +124,7 @@ impl AppState {
|
||||||
tip: get_random_tip(),
|
tip: get_random_tip(),
|
||||||
size_bypass,
|
size_bypass,
|
||||||
skip_confirmation,
|
skip_confirmation,
|
||||||
|
mouse_enabled: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
|
@ -206,6 +208,7 @@ impl AppState {
|
||||||
hints.push(Shortcut::new("Next tab", ["Tab"]));
|
hints.push(Shortcut::new("Next tab", ["Tab"]));
|
||||||
hints.push(Shortcut::new("Previous tab", ["Shift-Tab"]));
|
hints.push(Shortcut::new("Previous tab", ["Shift-Tab"]));
|
||||||
hints.push(Shortcut::new("Important actions guide", ["g"]));
|
hints.push(Shortcut::new("Important actions guide", ["g"]));
|
||||||
|
hints.push(Shortcut::new("Toggle mouse", ["m"]));
|
||||||
|
|
||||||
("Command list", hints.into_boxed_slice())
|
("Command list", hints.into_boxed_slice())
|
||||||
}
|
}
|
||||||
|
@ -489,7 +492,7 @@ impl AppState {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn handle_mouse(&mut self, event: &MouseEvent) -> bool {
|
pub fn handle_mouse(&mut self, event: &MouseEvent) -> bool {
|
||||||
if !self.drawable {
|
if !self.drawable || !self.mouse_enabled {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -651,6 +654,7 @@ impl AppState {
|
||||||
KeyCode::Char('g') => self.toggle_task_list_guide(),
|
KeyCode::Char('g') => self.toggle_task_list_guide(),
|
||||||
KeyCode::Char('v') | KeyCode::Char('V') => self.toggle_multi_select(),
|
KeyCode::Char('v') | KeyCode::Char('V') => self.toggle_multi_select(),
|
||||||
KeyCode::Char(' ') if self.multi_select => self.toggle_selection(),
|
KeyCode::Char(' ') if self.multi_select => self.toggle_selection(),
|
||||||
|
KeyCode::Char('m') => self.mouse_enabled = !self.mouse_enabled,
|
||||||
_ => {}
|
_ => {}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user