Skip to content

Commit acf1dc0

Browse files
committed
✨ feat: add commands indication
1 parent 8983206 commit acf1dc0

File tree

2 files changed

+57
-26
lines changed

2 files changed

+57
-26
lines changed

src/popups/conventional_commit.rs

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use unicode_segmentation::UnicodeSegmentation;
1616
use crate::components::visibility_blocking;
1717
use crate::queue::Queue;
1818
use crate::string_utils::trim_length_left;
19+
use crate::strings;
1920
use crate::ui::style::SharedTheme;
2021
use crate::{
2122
app::Environment,
@@ -466,7 +467,7 @@ impl ConventionalCommitPopup {
466467
Line::from(
467468
text.graphemes(true)
468469
.enumerate()
469-
.map(|(c_idx, c)| {
470+
.map(|(_, c)| {
470471
Span::styled(
471472
Cow::from(c.to_string()),
472473
self.theme.text(selected, selected),
@@ -665,32 +666,40 @@ impl Component for ConventionalCommitPopup {
665666
out: &mut Vec<CommandInfo>,
666667
force_all: bool,
667668
) -> CommandBlocking {
668-
// if self.is_visible() || force_all {
669-
// self.input.commands(out, force_all);
670-
//
671-
// out.push(CommandInfo::new(
672-
// strings::commands::create_branch_confirm_msg(
673-
// &self.key_config,
674-
// ),
675-
// true,
676-
// true,
677-
// ));
678-
// }
679-
//
680669
if self.is_visible() || force_all {
681-
// out.push(CommandInfo::new(
682-
// strings::commands::scroll_popup(&self.key_config),
683-
// true,
684-
// true,
685-
// ));
686-
//
687-
// out.push(CommandInfo::new(
688-
// strings::commands::close_fuzzy_finder(
689-
// &self.key_config,
690-
// ),
691-
// true,
692-
// true,
693-
// ));
670+
if self.is_insert {
671+
out.push(CommandInfo::new(
672+
strings::commands::exit_insert(&self.key_config),
673+
true,
674+
true,
675+
));
676+
} else {
677+
out.push(CommandInfo::new(
678+
strings::commands::insert(&self.key_config),
679+
true,
680+
true,
681+
));
682+
683+
out.push(CommandInfo::new(
684+
strings::commands::close_fuzzy_finder(
685+
&self.key_config,
686+
),
687+
true,
688+
true,
689+
));
690+
}
691+
692+
out.push(CommandInfo::new(
693+
strings::commands::scroll(&self.key_config),
694+
true,
695+
true,
696+
));
697+
698+
out.push(CommandInfo::new(
699+
strings::commands::open_submodule(&self.key_config),
700+
true,
701+
true,
702+
));
694703
}
695704

696705
visibility_blocking(self)

src/strings.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1884,4 +1884,26 @@ pub mod commands {
18841884
CMD_GROUP_LOG,
18851885
)
18861886
}
1887+
1888+
pub fn insert(key_config: &SharedKeyConfig) -> CommandText {
1889+
CommandText::new(
1890+
format!(
1891+
"Insert [{}]",
1892+
key_config.get_hint(key_config.keys.insert),
1893+
),
1894+
"enter in insert mode",
1895+
CMD_GROUP_LOG,
1896+
)
1897+
}
1898+
1899+
pub fn exit_insert(key_config: &SharedKeyConfig) -> CommandText {
1900+
CommandText::new(
1901+
format!(
1902+
"Exit Insert [{}]",
1903+
key_config.get_hint(key_config.keys.exit_popup),
1904+
),
1905+
"exit in insert mode",
1906+
CMD_GROUP_LOG,
1907+
)
1908+
}
18871909
}

0 commit comments

Comments
 (0)