mirror of
https://github.com/gitui-org/gitui
synced 2026-05-24 01:18:21 +00:00
feat(diff): allow opening editor from immutable diff views
- remove is_immutable guard from can_edit_file() so the edit_file keybinding works in Log -> Files -> Diff and other read-only views - move the edit_item command info outside the !is_immutable block - line number is passed via the existing goto logic; no extra change needed - only mutating operations (stage, unstage, reset hunk) remain gated on is_immutable 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Co-Authored-By: Claude Code 2.1.143 (Claude Code) Signed-Off-By: Paal Øye-Strømme <paal.o.eye@gmail.com>
This commit is contained in:
parent
5e304f6ea5
commit
b6fa83d482
1 changed files with 7 additions and 6 deletions
|
|
@ -153,7 +153,7 @@ impl DiffComponent {
|
||||||
}
|
}
|
||||||
///
|
///
|
||||||
const fn can_edit_file(&self) -> bool {
|
const fn can_edit_file(&self) -> bool {
|
||||||
!self.is_immutable && !self.current.path.is_empty()
|
!self.current.path.is_empty()
|
||||||
}
|
}
|
||||||
///
|
///
|
||||||
pub fn clear(&mut self, pending: bool) {
|
pub fn clear(&mut self, pending: bool) {
|
||||||
|
|
@ -773,12 +773,13 @@ impl Component for DiffComponent {
|
||||||
.hidden(),
|
.hidden(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
out.push(CommandInfo::new(
|
||||||
|
strings::commands::edit_item(&self.key_config),
|
||||||
|
self.can_edit_file(),
|
||||||
|
self.focused() && self.can_edit_file(),
|
||||||
|
));
|
||||||
|
|
||||||
if !self.is_immutable {
|
if !self.is_immutable {
|
||||||
out.push(CommandInfo::new(
|
|
||||||
strings::commands::edit_item(&self.key_config),
|
|
||||||
self.can_edit_file(),
|
|
||||||
self.focused() && self.can_edit_file(),
|
|
||||||
));
|
|
||||||
out.push(CommandInfo::new(
|
out.push(CommandInfo::new(
|
||||||
strings::commands::diff_hunk_remove(&self.key_config),
|
strings::commands::diff_hunk_remove(&self.key_config),
|
||||||
self.selected_hunk.is_some(),
|
self.selected_hunk.is_some(),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue