mirror of
https://github.com/gitui-org/gitui
synced 2026-05-23 08:58:21 +00:00
better cmd ordering
This commit is contained in:
parent
ce45c886c1
commit
26a4245213
4 changed files with 33 additions and 20 deletions
28
src/app.rs
28
src/app.rs
|
|
@ -16,7 +16,7 @@ use anyhow::{anyhow, Result};
|
|||
use asyncgit::{sync, AsyncNotification, CWD};
|
||||
use crossbeam_channel::Sender;
|
||||
use crossterm::event::{Event, KeyEvent};
|
||||
use strings::commands;
|
||||
use strings::{commands, order};
|
||||
use tui::{
|
||||
backend::Backend,
|
||||
layout::{Constraint, Direction, Layout, Rect},
|
||||
|
|
@ -373,16 +373,22 @@ impl App {
|
|||
}
|
||||
}
|
||||
|
||||
res.push(CommandInfo::new(
|
||||
commands::TOGGLE_TABS,
|
||||
true,
|
||||
!self.any_popup_visible(),
|
||||
));
|
||||
res.push(CommandInfo::new(
|
||||
commands::TOGGLE_TABS_DIRECT,
|
||||
true,
|
||||
!self.any_popup_visible(),
|
||||
));
|
||||
res.push(
|
||||
CommandInfo::new(
|
||||
commands::TOGGLE_TABS,
|
||||
true,
|
||||
!self.any_popup_visible(),
|
||||
)
|
||||
.order(order::NAV),
|
||||
);
|
||||
res.push(
|
||||
CommandInfo::new(
|
||||
commands::TOGGLE_TABS_DIRECT,
|
||||
true,
|
||||
!self.any_popup_visible(),
|
||||
)
|
||||
.order(order::NAV),
|
||||
);
|
||||
|
||||
res.push(
|
||||
CommandInfo::new(
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use anyhow::Result;
|
|||
use asyncgit::{hash, StatusItem, StatusItemType};
|
||||
use crossterm::event::Event;
|
||||
use std::{borrow::Cow, convert::From, path::Path};
|
||||
use strings::commands;
|
||||
use strings::{commands, order};
|
||||
use tui::{backend::Backend, layout::Rect, widgets::Text, Frame};
|
||||
|
||||
///
|
||||
|
|
@ -248,11 +248,14 @@ impl Component for FileTreeComponent {
|
|||
out: &mut Vec<CommandInfo>,
|
||||
force_all: bool,
|
||||
) -> CommandBlocking {
|
||||
out.push(CommandInfo::new(
|
||||
commands::NAVIGATE_TREE,
|
||||
!self.is_empty(),
|
||||
self.focused || force_all,
|
||||
));
|
||||
out.push(
|
||||
CommandInfo::new(
|
||||
commands::NAVIGATE_TREE,
|
||||
!self.is_empty(),
|
||||
self.focused || force_all,
|
||||
)
|
||||
.order(order::NAV),
|
||||
);
|
||||
|
||||
CommandBlocking::PassingOn
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,10 @@ pub static HELP_TITLE: &str = "Help: all commands";
|
|||
pub static STASHING_FILES_TITLE: &str = "Files to Stash";
|
||||
pub static STASHING_OPTIONS_TITLE: &str = "Options";
|
||||
|
||||
pub mod order {
|
||||
pub static NAV: i8 = 1;
|
||||
}
|
||||
|
||||
pub mod commands {
|
||||
use crate::components::CommandText;
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ use asyncgit::{
|
|||
use components::{command_pump, visibility_blocking};
|
||||
use crossbeam_channel::Sender;
|
||||
use crossterm::event::Event;
|
||||
use strings::commands;
|
||||
use strings::{commands, order};
|
||||
use tui::layout::{Constraint, Direction, Layout};
|
||||
|
||||
///
|
||||
|
|
@ -326,7 +326,7 @@ impl Component for Status {
|
|||
(self.visible && self.focus == Focus::WorkDir)
|
||||
|| force_all,
|
||||
)
|
||||
.order(-2),
|
||||
.order(order::NAV),
|
||||
);
|
||||
|
||||
out.push(
|
||||
|
|
@ -336,7 +336,7 @@ impl Component for Status {
|
|||
(self.visible && self.focus == Focus::Stage)
|
||||
|| force_all,
|
||||
)
|
||||
.order(-2),
|
||||
.order(order::NAV),
|
||||
);
|
||||
|
||||
visibility_blocking(self)
|
||||
|
|
|
|||
Loading…
Reference in a new issue