mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-10-06 05:57:38 -04:00
Extract editDiffLine from editLine
The `e` keybinding resolves the file/line of the selected diff line and opens it in the editor. A forthcoming right-click handler needs the same resolve-and-edit step for the clicked line rather than the selected one, so split it out behind a view-line-index argument. No behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
aa4ff00898
commit
5b0091f650
@@ -291,9 +291,13 @@ func (self *MainViewController) editLine() error {
|
||||
if !self.context.GetView().Highlight {
|
||||
return nil
|
||||
}
|
||||
// Figure out the clicked file and line the same way entering staging does.
|
||||
info, ok := self.c.Helpers().Staging.GetDiffLineInfo(
|
||||
self.context.GetViewName(), self.context.GetView().SelectedLineIdx())
|
||||
return self.editDiffLine(self.context.GetView().SelectedLineIdx())
|
||||
}
|
||||
|
||||
// editDiffLine opens the file the given diff line belongs to in the editor, at
|
||||
// that line. The file and line are resolved the same way entering staging does.
|
||||
func (self *MainViewController) editDiffLine(viewLineIdx int) error {
|
||||
info, ok := self.c.Helpers().Staging.GetDiffLineInfo(self.context.GetViewName(), viewLineIdx)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user