patch_exploring

package
v0.54.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LINE selectMode = iota
	RANGE
	HUNK
)

Variables

This section is empty.

Functions

This section is empty.

Types

type State

type State struct {
	// contains filtered or unexported fields
}

State represents the current state of the patch explorer context i.e. when you're staging a file or you're building a patch from an existing commit this struct holds the info about the diff you're interacting with and what's currently selected.

func NewState

func NewState(diff string, selectedLineIdx int, view *gocui.View, oldState *State, useHunkModeByDefault bool) *State

func (*State) AdjustSelectedLineIdx

func (s *State) AdjustSelectedLineIdx(change int)

func (*State) CalculateOrigin

func (s *State) CalculateOrigin(currentOrigin int, bufferHeight int, numLines int) int

func (*State) CurrentHunkBounds added in v0.38.0

func (s *State) CurrentHunkBounds() (int, int)

returns first and last patch line index of current hunk

func (*State) CurrentLineNumber

func (s *State) CurrentLineNumber() int

func (*State) CycleLine

func (s *State) CycleLine(forward bool)

func (*State) CycleRange added in v0.41.0

func (s *State) CycleRange(forward bool)

This is called when we use shift+arrow to expand the range (i.e. a non-sticky range)

func (*State) CycleSelection

func (s *State) CycleSelection(forward bool)

func (*State) DismissHunkSelectMode added in v0.44.0

func (s *State) DismissHunkSelectMode()

func (*State) DragSelectLine added in v0.41.0

func (s *State) DragSelectLine(newSelectedLineIdx int)

func (*State) GetDiff

func (s *State) GetDiff() string

func (*State) GetSelectedPatchLineIdx added in v0.45.0

func (s *State) GetSelectedPatchLineIdx() int

func (*State) GetSelectedViewLineIdx added in v0.45.0

func (s *State) GetSelectedViewLineIdx() int

func (*State) LineIndicesOfAddedOrDeletedLinesInSelectedPatchRange added in v0.53.0

func (s *State) LineIndicesOfAddedOrDeletedLinesInSelectedPatchRange() []int

Returns the line indices of the selected patch range that are changes (i.e. additions or deletions)

func (*State) OnViewWidthChanged added in v0.45.0

func (s *State) OnViewWidthChanged(view *gocui.View)

func (*State) PlainRenderSelected

func (s *State) PlainRenderSelected() string

func (*State) RenderForLineIndices

func (s *State) RenderForLineIndices(includedLineIndices []int) string

func (*State) SelectBottom

func (s *State) SelectBottom()

func (*State) SelectLine

func (s *State) SelectLine(newSelectedLineIdx int)

For when you move the cursor without holding shift (meaning if we're in a non-sticky range select, we'll cancel it)

func (*State) SelectNewLineForRange

func (s *State) SelectNewLineForRange(newSelectedLineIdx int)

func (*State) SelectNextHunk added in v0.53.0

func (s *State) SelectNextHunk()

func (*State) SelectNextStageableLineOfSameIncludedState added in v0.53.0

func (s *State) SelectNextStageableLineOfSameIncludedState(includedLines []int, included bool)

func (*State) SelectPreviousHunk added in v0.53.0

func (s *State) SelectPreviousHunk()

func (*State) SelectTop

func (s *State) SelectTop()

func (*State) SelectedPatchRange added in v0.45.0

func (s *State) SelectedPatchRange() (int, int)

func (*State) SelectedViewRange added in v0.45.0

func (s *State) SelectedViewRange() (int, int)

func (*State) SelectingHunk

func (s *State) SelectingHunk() bool

func (*State) SelectingHunkEnabledByUser added in v0.53.0

func (s *State) SelectingHunkEnabledByUser() bool

func (*State) SelectingLine

func (s *State) SelectingLine() bool

func (*State) SelectingRange

func (s *State) SelectingRange() bool

func (*State) SetLineSelectMode

func (s *State) SetLineSelectMode()

func (*State) SetRangeIsSticky added in v0.41.0

func (s *State) SetRangeIsSticky(value bool)

func (*State) ToggleSelectHunk

func (s *State) ToggleSelectHunk()

func (*State) ToggleSelectRange

func (s *State) ToggleSelectRange(sticky bool)

func (*State) ToggleStickySelectRange added in v0.41.0

func (s *State) ToggleStickySelectRange()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL