Skip to content

Commit d8bff84

Browse files
committed
refactor: improve playback controls UX
- Change keybindings to follow TUI player conventions: Space=play/pause, h/l=line step, H/L=change step, p/n=commit nav - Add ESC menu with Key Bindings, About, and Exit options - Remove --playback-controls flag, make controls always available - Remove playback_controls from config - Remove inline help text from status bar
1 parent 2506b99 commit d8bff84

7 files changed

Lines changed: 201 additions & 177 deletions

File tree

‎README.md‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,6 @@ gitlogue --commit abc123 --loop
107107
# Loop through a commit range
108108
gitlogue --commit HEAD~10..HEAD --loop
109109

110-
# Enable manual playback controls (Ctrl+j/Ctrl+l commit prev/next, j/l line prev/next, J/L change prev/next, k=play/pause)
111-
gitlogue --playback-controls --order asc
112-
113110
# View staged changes (default)
114111
gitlogue diff
115112

‎docs/configuration.md‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ ignore_patterns = []
5353
# Examples: ["*.java:50", "*.xml:5", "*.rs:30"]
5454
speed_rules = []
5555

56-
# Enable manual playback controls (Ctrl+j/Ctrl+l for commits, j/l for line prev/next, J/L for change prev/next)
57-
playback_controls = false
5856
```
5957

6058
## Configuration Options
@@ -188,16 +186,6 @@ speed_rules = [
188186

189187
Note: CLI `--speed-rule` flags take priority over config file rules. Rules are evaluated in order (CLI first, then config).
190188

191-
### `playback_controls`
192-
193-
Enable keyboard playback controls without needing to pass `--playback-controls` each time.
194-
195-
- **Type**: Boolean
196-
- **Default**: `false`
197-
- **Example**: `playback_controls = true`
198-
199-
When set to `true`, gitlogue starts with manual controls enabled so you can use `Ctrl+j`/`Ctrl+l` for commit navigation, `j`/`l` for stepping to the previous/next line, and `J`/`L` for stepping to the previous/next change.
200-
201189
## Configuration Priority
202190

203191
Settings are applied in the following order (highest priority first):

‎docs/usage.md‎

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -217,25 +217,6 @@ This is especially useful when viewing a specific commit or commit range and you
217217
- Desktop ricing and ambience
218218
- Educational replays of feature development
219219

220-
### `--playback-controls[=BOOL]`
221-
222-
Enable manual playback controls. When active:
223-
224-
- `Ctrl+j` jumps to the previous commit in history
225-
- `Ctrl+l` advances to the next commit
226-
- `j` steps to the previous line chunk
227-
- `l` steps to the next line chunk
228-
- `J` jumps to the previous change/file
229-
- `L` jumps to the next change/file
230-
- `k` toggles play/pause
231-
232-
```bash
233-
gitlogue --playback-controls --order asc # Enable controls while replaying sequentially
234-
gitlogue --playback-controls=false # Explicitly disable controls
235-
```
236-
237-
Manual controls are most useful with sequential orders (`asc`/`desc`) or commit ranges where you want to narrate each change at your own pace while stepping line-by-line.
238-
239220
### `--help`
240221

241222
Display help information:
@@ -350,7 +331,6 @@ gitlogue diff --unstaged
350331
| `-t, --theme <NAME>` | Theme to use |
351332
| `--background[=BOOL]` | Show background colors (use `--background=false` for transparent) |
352333
| `--loop[=BOOL]` | Loop the animation continuously |
353-
| `--playback-controls[=BOOL]` | Enable manual playback controls inside diff mode |
354334
| `-i, --ignore <PATTERN>` | Ignore files matching pattern (can be specified multiple times) |
355335
| `--speed-rule <PATTERN:MS>` | Set typing speed for files matching pattern |
356336

@@ -381,15 +361,13 @@ gitlogue diff -i "*.lock" -i "dist/**"
381361

382362
While gitlogue is running:
383363

384-
- `Esc` - Quit the application
364+
- `Esc` - Open menu (Key Bindings / About / Exit)
365+
- `q` - Quit the application
385366
- `Ctrl+C` - Quit the application
386-
- `Ctrl+j` - (with `--playback-controls`) jump to the previous commit
387-
- `Ctrl+l` - (with `--playback-controls`) jump to the next commit
388-
- `j` - (with `--playback-controls`) step to the previous line chunk
389-
- `l` - (with `--playback-controls`) step to the next line chunk
390-
- `J` - (with `--playback-controls`) jump to the previous change/file
391-
- `L` - (with `--playback-controls`) jump to the next change/file
392-
- `k` - (with `--playback-controls`) toggle play/pause
367+
- `Space` - Play / Pause
368+
- `h` / `l` - Step line back / forward
369+
- `H` / `L` - Step change back / forward
370+
- `p` / `n` - Previous / Next commit
393371

394372
## Use Cases
395373

‎src/config.rs‎

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ pub struct Config {
1919
pub ignore_patterns: Vec<String>,
2020
#[serde(default)]
2121
pub speed_rules: Vec<String>,
22-
#[serde(default = "default_playback_controls")]
23-
pub playback_controls: bool,
2422
}
2523

2624
fn default_theme() -> String {
@@ -47,10 +45,6 @@ fn default_ignore_patterns() -> Vec<String> {
4745
Vec::new()
4846
}
4947

50-
fn default_playback_controls() -> bool {
51-
false
52-
}
53-
5448
impl Default for Config {
5549
fn default() -> Self {
5650
Self {
@@ -61,7 +55,6 @@ impl Default for Config {
6155
loop_playback: default_loop(),
6256
ignore_patterns: default_ignore_patterns(),
6357
speed_rules: Vec::new(),
64-
playback_controls: default_playback_controls(),
6558
}
6659
}
6760
}
@@ -102,8 +95,6 @@ impl Config {
10295
doc["background"] = toml_edit::value(self.background);
10396
doc["order"] = toml_edit::value(self.order.as_str());
10497
doc["loop"] = toml_edit::value(self.loop_playback);
105-
doc["playback_controls"] = toml_edit::value(self.playback_controls);
106-
10798
// Update ignore_patterns as array
10899
let mut array = toml_edit::Array::new();
109100
for pattern in &self.ignore_patterns {
@@ -168,18 +159,14 @@ impl Config {
168159
\n\
169160
# Speed rules for different file types (pattern:milliseconds)\n\
170161
# Examples: [\"*.java:50\", \"*.xml:5\", \"*.rs:30\"]\n\
171-
speed_rules = {}\n\
172-
\n\
173-
# Enable manual playback controls (j/k/l)\n\
174-
playback_controls = {}\n",
162+
speed_rules = {}\n",
175163
self.theme,
176164
self.speed,
177165
self.background,
178166
self.order,
179167
self.loop_playback,
180168
patterns_str,
181-
speed_rules_str,
182-
self.playback_controls
169+
speed_rules_str
183170
)
184171
};
185172

‎src/main.rs‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,6 @@ pub struct Args {
9191
)]
9292
pub loop_playback: Option<bool>,
9393

94-
#[arg(
95-
long = "playback-controls",
96-
num_args = 0..=1,
97-
default_missing_value = "true",
98-
value_name = "BOOL",
99-
help = "Enable manual playback controls (j=prev, k=play/pause, l=next)"
100-
)]
101-
pub playback_controls: Option<bool>,
102-
10394
#[arg(long, help = "Display third-party license information")]
10495
pub license: bool,
10596

@@ -196,10 +187,6 @@ pub enum Commands {
196187
#[arg(long = "speed-rule", value_name = "PATTERN:MS", action = clap::ArgAction::Append,
197188
help = "Set typing speed for files matching pattern (e.g., '*.java:50')")]
198189
speed_rule: Vec<String>,
199-
200-
#[arg(long = "playback-controls", num_args = 0..=1, default_missing_value = "true", value_name = "BOOL",
201-
help = "Enable manual playback controls (j=prev, k=play/pause, l=next)")]
202-
playback_controls: Option<bool>,
203190
},
204191
}
205192

@@ -297,7 +284,6 @@ fn main() -> Result<()> {
297284
loop_playback,
298285
ignore,
299286
speed_rule,
300-
playback_controls,
301287
} => {
302288
let repo_path = args.validate()?;
303289
let repo = GitRepository::open(&repo_path)?;
@@ -325,7 +311,6 @@ fn main() -> Result<()> {
325311
let speed = speed.unwrap_or(config.speed);
326312
let background = background.unwrap_or(config.background);
327313
let loop_playback = loop_playback.unwrap_or(false);
328-
let manual_controls = playback_controls.unwrap_or(config.playback_controls);
329314

330315
let mut theme = Theme::load(theme_name)?;
331316
if !background {
@@ -354,7 +339,6 @@ fn main() -> Result<()> {
354339
None,
355340
false,
356341
speed_rules,
357-
manual_controls,
358342
);
359343
ui.set_diff_mode(Some(mode));
360344
ui.load_commit(metadata);
@@ -423,7 +407,6 @@ fn main() -> Result<()> {
423407
}
424408

425409
let loop_playback = args.loop_playback.unwrap_or(config.loop_playback);
426-
let manual_controls = args.playback_controls.unwrap_or(config.playback_controls);
427410
let mut theme = Theme::load(theme_name)?;
428411

429412
// Apply transparent background if requested
@@ -484,7 +467,6 @@ fn main() -> Result<()> {
484467
args.commit.clone(),
485468
is_range_mode,
486469
speed_rules,
487-
manual_controls,
488470
);
489471
ui.load_commit(metadata);
490472
ui.run()?;

‎src/panes/status_bar.rs‎

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,12 @@ impl StatusBarPane {
1919
area: Rect,
2020
metadata: Option<&CommitMetadata>,
2121
theme: &Theme,
22-
playback_status: Option<&str>,
2322
) {
2423
let block = Block::default()
2524
.style(Style::default().bg(theme.background_left))
2625
.padding(Padding::vertical(1));
2726

28-
let mut status_lines = if let Some(meta) = metadata {
27+
let status_lines = if let Some(meta) = metadata {
2928
let is_working_tree = meta.hash == "working-tree";
3029
let hash_display = if is_working_tree {
3130
"working"
@@ -71,16 +70,6 @@ impl StatusBarPane {
7170
)])]
7271
};
7372

74-
if let Some(status) = playback_status {
75-
status_lines.insert(
76-
0,
77-
Line::from(vec![Span::styled(
78-
status,
79-
Style::default().fg(theme.status_message),
80-
)]),
81-
);
82-
}
83-
8473
let content = SelectableParagraph::new(status_lines)
8574
.block(block)
8675
.background_style(Style::default().bg(theme.background_left))

0 commit comments

Comments
 (0)