refactored group renaming
All checks were successful
Version Check / check-version (pull_request) Successful in 2s

This commit is contained in:
2026-03-18 22:49:55 +01:00
parent ee85be4e6b
commit 029b4f9da8
2 changed files with 31 additions and 20 deletions

View File

@@ -242,8 +242,10 @@ impl App {
/// Transitions the application into Insert Mode with a specific variant. /// Transitions the application into Insert Mode with a specific variant.
pub fn enter_insert(&mut self, variant: InsertVariant) { pub fn enter_insert(&mut self, variant: InsertVariant) {
if let Some(var) = self.vars.get(self.selected) if let Some(var) = self.vars.get(self.selected) {
&& !var.is_group { if var.is_group {
self.enter_insert_key();
} else {
if !matches!(variant, InsertVariant::Substitute) { if !matches!(variant, InsertVariant::Substitute) {
self.sync_input_with_selected(); self.sync_input_with_selected();
} }
@@ -263,6 +265,7 @@ impl App {
} }
} }
} }
}
/// Commits the current input and transitions the application into Normal Mode. /// Commits the current input and transitions the application into Normal Mode.
pub fn enter_normal(&mut self) { pub fn enter_normal(&mut self) {

View File

@@ -103,10 +103,9 @@ pub fn draw(f: &mut Frame, app: &mut App, config: &Config) {
Span::styled(&var.key, key_style), Span::styled(&var.key, key_style),
]; ];
// Add status indicator if not present (only for leaf variables) // Add status indicator if not present
if !var.is_group {
match var.status { match var.status {
crate::format::ItemStatus::MissingFromActive => { crate::format::ItemStatus::MissingFromActive if !var.is_group => {
let missing_style = if is_selected { let missing_style = if is_selected {
Style::default().fg(theme.fg_highlight()).add_modifier(Modifier::BOLD) Style::default().fg(theme.fg_highlight()).add_modifier(Modifier::BOLD)
} else { } else {
@@ -114,6 +113,14 @@ pub fn draw(f: &mut Frame, app: &mut App, config: &Config) {
}; };
key_spans.push(Span::styled(" (missing)", missing_style)); key_spans.push(Span::styled(" (missing)", missing_style));
} }
crate::format::ItemStatus::MissingFromActive if var.is_group => {
let missing_style = if is_selected {
Style::default().fg(theme.fg_highlight()).add_modifier(Modifier::BOLD)
} else {
Style::default().fg(theme.fg_warning()).add_modifier(Modifier::BOLD)
};
key_spans.push(Span::styled(" (missing group)", missing_style));
}
crate::format::ItemStatus::Modified => { crate::format::ItemStatus::Modified => {
if !is_selected { if !is_selected {
key_spans.push(Span::styled(" (*)", Style::default().fg(theme.fg_modified()))); key_spans.push(Span::styled(" (*)", Style::default().fg(theme.fg_modified())));
@@ -121,7 +128,6 @@ pub fn draw(f: &mut Frame, app: &mut App, config: &Config) {
} }
_ => {} _ => {}
} }
}
let item_style = if is_selected { let item_style = if is_selected {
Style::default().bg(theme.bg_highlight()) Style::default().bg(theme.bg_highlight())
@@ -210,7 +216,9 @@ pub fn draw(f: &mut Frame, app: &mut App, config: &Config) {
// Show template value in normal mode if it differs // Show template value in normal mode if it differs
let display_text = if let Some(var) = current_var { let display_text = if let Some(var) = current_var {
if var.is_group { if matches!(app.mode, Mode::InsertKey) {
input_text.to_string()
} else if var.is_group {
"<group>".to_string() "<group>".to_string()
} else if matches!(app.mode, Mode::Normal) { } else if matches!(app.mode, Mode::Normal) {
format!("{}{}", input_text, extra_info) format!("{}{}", input_text, extra_info)