patch_exploring

package
v0.40.2 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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, oldState *State, log *logrus.Entry) *State

func (*State) AdjustSelectedLineIdx

func (s *State) AdjustSelectedLineIdx(change int)

func (*State) CalculateOrigin

func (s *State) CalculateOrigin(currentOrigin int, bufferHeight 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) CycleHunk

func (s *State) CycleHunk(forward bool)

func (*State) CycleLine

func (s *State) CycleLine(forward bool)

func (*State) CycleSelection

func (s *State) CycleSelection(forward bool)

func (*State) GetDiff

func (s *State) GetDiff() string

func (*State) GetSelectedLineIdx

func (s *State) GetSelectedLineIdx() int

func (*State) PlainRenderSelected

func (s *State) PlainRenderSelected() string

func (*State) RenderForLineIndices

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

func (*State) SelectBottom

func (s *State) SelectBottom()

func (*State) SelectLine

func (s *State) SelectLine(newSelectedLineIdx int)

func (*State) SelectNewLineForRange

func (s *State) SelectNewLineForRange(newSelectedLineIdx int)

func (*State) SelectTop

func (s *State) SelectTop()

func (*State) SelectedRange

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

func (*State) SelectingHunk

func (s *State) SelectingHunk() 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) ToggleSelectHunk

func (s *State) ToggleSelectHunk()

func (*State) ToggleSelectRange

func (s *State) ToggleSelectRange()

Jump to

Keyboard shortcuts

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