mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-17 00:18:05 +02:00
Handle wrapped lines in patch explorer state
So far, lines in the view corresponded 1:1 to lines in the patch. Once we turn on wrapping for the staging view (which we don't do yet), this is no longer true, so we need to convert from view lines to patch lines or vice versa all over the place.
This commit is contained in:
@ -136,13 +136,13 @@ func (self *PatchBuildingController) toggleSelection() error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
currentLineIsStaged := lo.Contains(includedLineIndices, state.GetSelectedLineIdx())
|
||||
currentLineIsStaged := lo.Contains(includedLineIndices, state.GetSelectedPatchLineIdx())
|
||||
if currentLineIsStaged {
|
||||
toggleFunc = self.c.Git().Patch.PatchBuilder.RemoveFileLineRange
|
||||
}
|
||||
|
||||
// add range of lines to those set for the file
|
||||
firstLineIdx, lastLineIdx := state.SelectedRange()
|
||||
firstLineIdx, lastLineIdx := state.SelectedPatchRange()
|
||||
|
||||
if err := toggleFunc(filename, firstLineIdx, lastLineIdx); err != nil {
|
||||
// might actually want to return an error here
|
||||
|
Reference in New Issue
Block a user