Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@
# Number of scrollback lines to keep in the pseudo terminal
# scrollback_lines = 1000

# Whether to switch active pane on mouse hover (default: false)
# focus_on_hover = false

# Enable or disable mouse support in the TUI (default: true)
# mouse = true

# Load a TUI theme from a file.
# Absolute paths are used as-is.
# Relative paths are resolved relative to the theme directories, in the following order:
Expand Down
13 changes: 13 additions & 0 deletions crates/tracexec-core/src/cli/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,17 @@ pub struct TuiModeArgs {
requires = "tty"
)]
pub scrollback_lines: Option<usize>,
#[clap(
long,
help = "Focus pane when the mouse hovers over it instead of requiring a click",
requires = "tty"
)]
pub focus_on_hover: Option<bool>,
#[clap(
long,
help = "Enable or disable mouse support in the TUI (default: true)"
)]
pub mouse: Option<bool>,
#[clap(
long = "theme",
help = "Path to a theme file to use for the TUI.",
Expand Down Expand Up @@ -576,6 +587,8 @@ impl TuiModeArgs {
self.frame_rate = self.frame_rate.or(config.frame_rate);
self.max_events = self.max_events.or(config.max_events);
self.scrollback_lines = self.scrollback_lines.or(config.scrollback_lines);
self.focus_on_hover = self.focus_on_hover.or(config.focus_on_hover);
self.mouse = self.mouse.or(config.mouse);
if self.theme_file.is_none()
&& let Some(path) = config.theme_file
{
Expand Down
2 changes: 2 additions & 0 deletions crates/tracexec-core/src/cli/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ pub struct TuiModeConfig {
pub frame_rate: Option<f64>,
pub max_events: Option<u64>,
pub scrollback_lines: Option<usize>,
pub focus_on_hover: Option<bool>,
pub mouse: Option<bool>,
#[serde(rename = "theme-file")]
pub theme_file: Option<PathBuf>,
#[serde(default)]
Expand Down
5 changes: 5 additions & 0 deletions crates/tracexec-core/src/cli/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ impl KeyList {
pub fn first(&self) -> Option<&KeyBinding> {
self.0.first()
}

/// Returns the first key binding as a KeyEvent, for use in mouse click simulation.
pub fn first_key_event(&self) -> Option<KeyEvent> {
self.first().map(|b| KeyEvent::new(b.code, b.modifiers))
}
}

impl From<Vec<KeyBinding>> for KeyList {
Expand Down
4 changes: 4 additions & 0 deletions crates/tracexec-core/src/cli/tui_theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ pub struct ThemeSpec {
pub inline_timestamp: Option<StyleSpec>,
pub cli_flag: Option<StyleSpec>,
pub help_key: Option<StyleSpec>,
pub help_key_hover: Option<StyleSpec>,
pub help_desc: Option<StyleSpec>,
pub help_desc_hover: Option<StyleSpec>,
pub fancy_help_desc: Option<StyleSpec>,
pub pid_success: Option<StyleSpec>,
pub pid_failure: Option<StyleSpec>,
Expand Down Expand Up @@ -152,7 +154,9 @@ impl ThemeSpec {
inline_timestamp,
cli_flag,
help_key,
help_key_hover,
help_desc,
help_desc_hover,
fancy_help_desc,
pid_success,
pid_failure,
Expand Down
6 changes: 5 additions & 1 deletion crates/tracexec-core/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ use chrono::{
Local,
};
use clap::ValueEnum;
use crossterm::event::KeyEvent;
use crossterm::event::{
KeyEvent,
MouseEvent,
};
use enumflags2::BitFlags;
use filterable_enum::FilterableEnum;
use nix::{
Expand Down Expand Up @@ -55,6 +58,7 @@ pub use parent::*;
pub enum Event {
ShouldQuit,
Key(KeyEvent),
Mouse(MouseEvent),
Tracer(TracerMessage),
Render,
Resize { width: u16, height: u16 },
Expand Down
2 changes: 2 additions & 0 deletions crates/tracexec-tui/src/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ pub enum Action {
PrevMatch,
// Terminal
HandleTerminalKeyPress(KeyEvent),
// Help bar mouse click
HandleHelpBarClick(KeyEvent),
// Breakpoint
ShowBreakpointManager,
CloseBreakpointManager,
Expand Down
Loading