refactored group renaming
All checks were successful
Version Check / check-version (pull_request) Successful in 2s
All checks were successful
Version Check / check-version (pull_request) Successful in 2s
This commit is contained in:
@@ -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();
|
||||||
}
|
}
|
||||||
@@ -262,6 +264,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.
|
||||||
|
|||||||
44
src/ui.rs
44
src/ui.rs
@@ -103,24 +103,30 @@ 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 if !var.is_group => {
|
||||||
crate::format::ItemStatus::MissingFromActive => {
|
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 {
|
Style::default().fg(theme.fg_warning()).add_modifier(Modifier::BOLD)
|
||||||
Style::default().fg(theme.fg_warning()).add_modifier(Modifier::BOLD)
|
};
|
||||||
};
|
key_spans.push(Span::styled(" (missing)", missing_style));
|
||||||
key_spans.push(Span::styled(" (missing)", missing_style));
|
|
||||||
}
|
|
||||||
crate::format::ItemStatus::Modified => {
|
|
||||||
if !is_selected {
|
|
||||||
key_spans.push(Span::styled(" (*)", Style::default().fg(theme.fg_modified())));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
|
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 => {
|
||||||
|
if !is_selected {
|
||||||
|
key_spans.push(Span::styled(" (*)", Style::default().fg(theme.fg_modified())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
let item_style = if is_selected {
|
let item_style = if is_selected {
|
||||||
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user