mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 07:36:27 -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:
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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue