Skip to content

Commit 26a4245

Browse files
author
Stephan Dilly
committed
better cmd ordering
1 parent ce45c88 commit 26a4245

File tree

4 files changed

+33
-20
lines changed

4 files changed

+33
-20
lines changed

src/app.rs

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use anyhow::{anyhow, Result};
1616
use asyncgit::{sync, AsyncNotification, CWD};
1717
use crossbeam_channel::Sender;
1818
use crossterm::event::{Event, KeyEvent};
19-
use strings::commands;
19+
use strings::{commands, order};
2020
use tui::{
2121
backend::Backend,
2222
layout::{Constraint, Direction, Layout, Rect},
@@ -373,16 +373,22 @@ impl App {
373373
}
374374
}
375375

376-
res.push(CommandInfo::new(
377-
commands::TOGGLE_TABS,
378-
true,
379-
!self.any_popup_visible(),
380-
));
381-
res.push(CommandInfo::new(
382-
commands::TOGGLE_TABS_DIRECT,
383-
true,
384-
!self.any_popup_visible(),
385-
));
376+
res.push(
377+
CommandInfo::new(
378+
commands::TOGGLE_TABS,
379+
true,
380+
!self.any_popup_visible(),
381+
)
382+
.order(order::NAV),
383+
);
384+
res.push(
385+
CommandInfo::new(
386+
commands::TOGGLE_TABS_DIRECT,
387+
true,
388+
!self.any_popup_visible(),
389+
)
390+
.order(order::NAV),
391+
);
386392

387393
res.push(
388394
CommandInfo::new(

src/components/filetree.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use anyhow::Result;
1717
use asyncgit::{hash, StatusItem, StatusItemType};
1818
use crossterm::event::Event;
1919
use std::{borrow::Cow, convert::From, path::Path};
20-
use strings::commands;
20+
use strings::{commands, order};
2121
use tui::{backend::Backend, layout::Rect, widgets::Text, Frame};
2222

2323
///
@@ -248,11 +248,14 @@ impl Component for FileTreeComponent {
248248
out: &mut Vec<CommandInfo>,
249249
force_all: bool,
250250
) -> CommandBlocking {
251-
out.push(CommandInfo::new(
252-
commands::NAVIGATE_TREE,
253-
!self.is_empty(),
254-
self.focused || force_all,
255-
));
251+
out.push(
252+
CommandInfo::new(
253+
commands::NAVIGATE_TREE,
254+
!self.is_empty(),
255+
self.focused || force_all,
256+
)
257+
.order(order::NAV),
258+
);
256259

257260
CommandBlocking::PassingOn
258261
}

src/strings.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ pub static HELP_TITLE: &str = "Help: all commands";
2828
pub static STASHING_FILES_TITLE: &str = "Files to Stash";
2929
pub static STASHING_OPTIONS_TITLE: &str = "Options";
3030

31+
pub mod order {
32+
pub static NAV: i8 = 1;
33+
}
34+
3135
pub mod commands {
3236
use crate::components::CommandText;
3337

src/tabs/status.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use asyncgit::{
1919
use components::{command_pump, visibility_blocking};
2020
use crossbeam_channel::Sender;
2121
use crossterm::event::Event;
22-
use strings::commands;
22+
use strings::{commands, order};
2323
use tui::layout::{Constraint, Direction, Layout};
2424

2525
///
@@ -326,7 +326,7 @@ impl Component for Status {
326326
(self.visible && self.focus == Focus::WorkDir)
327327
|| force_all,
328328
)
329-
.order(-2),
329+
.order(order::NAV),
330330
);
331331

332332
out.push(
@@ -336,7 +336,7 @@ impl Component for Status {
336336
(self.visible && self.focus == Focus::Stage)
337337
|| force_all,
338338
)
339-
.order(-2),
339+
.order(order::NAV),
340340
);
341341

342342
visibility_blocking(self)

0 commit comments

Comments
 (0)