li

package
v0.0.0-...-175d837 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: MIT Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultConfig = `

[Scroll]
PaddingTop = 10
PaddingBottom = 10

[Mouse]
ScrollLines = 5

[Buffer]
ExpandTabs = true
TabWidth = 4

[UI]
StatusWidth = 20
JournalHeight = 2
MaxOutlineDistance = 2000
  [UI.ViewList]
  HideTimeoutSeconds = 1
  MarginLeft = 120
  Width = 30

[ViewGroup]
Layouts = [
  'VerticalSplit',
  'HorizontalSplit',
  'BinarySplit',
  'Stacked',
]

  [[ViewGroup.Groups]]
  Layouts = [
    'Stacked',
    'BinarySplit',
    'VerticalSplit',
    'HorizontalSplit',
  ]

  [[ViewGroup.Groups]]
  Layouts = [
    'Stacked',
    'BinarySplit',
    'VerticalSplit',
    'HorizontalSplit',
  ]

[Style]

  [Style.Default]
  FG = 0xBBBBBB
  BG = 0x222222
  Bold = false
  Underline = false

  [Style.Highlight]
  FG = 0xAAFF00
  BG = 0x222222

  [Style.Completion]
  BG = 0x444444

  [Style.CompletionSelected]
  BG = 0x336666

  [Style.Hint]
  Bold = true
  FG = 0xDEAD01

[ReadMode]

  [ReadMode.SequenceCommand]

  'F2' = 'ToggleMacroRecording'

  'Rune[` + "`" + `]' = 'ToggleJournalHeight'
  'Rune[#]' = 'LineBegin'
  'Rune[$]' = 'LineEnd'

  'Rune[w]' = 'FocusPrevViewInGroup'
  'Rune[e]' = 'FocusNextViewInGroup'
  'Rune[y]' = 'NewClipFromSelection'
  'Rune[U]' = 'PageUp'
  'Rune[u]' = 'UndoDuration1'
  'Rune[i]' = 'EnableEditMode'
  'Rune[O]' = 'EditNewLineAbove'
  'Rune[o]' = 'EditNewLineBelow'
  'Rune[p]' = 'InsertLastClip'
  'Rune[{]' = 'PrevEmptyLine'
  'Rune[[]' = 'PrevDedentLine'
  'Rune[}]' = 'NextEmptyLine'
  'Rune[]]' = 'NextDedentLine'

  'Rune[a]' = 'Append'
  'Rune[A]' = 'AppendAtLineEnd'
  'Rune[d]' = 'Delete'
  'Rune[d] Rune[d]' = 'DeleteLine'
  'Rune[F]' = 'PrevRune'
  'Rune[f]' = 'NextRune'
  'Rune[G]' = 'ScrollAbsOrEnd'
  'Rune[g] Rune[g]' = 'ScrollAbsOrHome'
  'Rune[h]' = 'MoveLeft'
  'Rune[j]' = 'MoveDown'
  'Rune[k]' = 'MoveUp'
  'Rune[l]' = 'MoveRight'
  'Rune[m]' = 'ShowCommandPalette'

  'Rune[z] Rune[t]' = 'ScrollCursorToUpper'
  'Rune[z] Rune[z]' = 'ScrollCursorToMiddle'
  'Rune[z] Rune[b]' = 'ScrollCursorToLower'
  'Rune[x]' = 'DeleteRune'
  'Rune[c]' = 'Change'
  'Rune[c] Rune[w]' = 'ChangeToWordEnd'
  'Rune[c] Rune[c]' = 'ChangeLine'
  'Rune[v]' = 'ToggleSelection'
  'Rune[b]' = 'ShowViewSwitcher'
  'Rune[M]' = 'PageDown'
  'Rune[/]' = 'ShowSearchDialog'

  'Rune[,] Rune[q]' = 'CloseView'
  'Rune[,] Rune[w]' = 'SyncViewToFile'
  'Rune[,] Rune[t]' = 'ChoosePathAndLoad'
  'Rune[,] Rune[f]' = 'NextLineWithRune'
  'Rune[,] Rune[g]' = 'NextViewGroupLayout'
  'Rune[,] Rune[v]' = 'NextViewLayout'

  'Rune[,] Rune[N]' = 'CurrentTime'

  'Rune[.] Rune[g]' = 'PrevViewGroupLayout'
  'Rune[.] Rune[f]' = 'PrevLineWithRune'
  'Rune[.] Rune[v]' = 'PrevViewLayout'

  'Alt+Rune[u]' = 'RedoLatest'

  'Ctrl+U' = 'Undo'
  'Ctrl+O' = 'ShowCommandPalette'

[EditMode]
DisableSequence = "kd"

  [EditMode.SequenceCommand]

  'Esc' = 'DisableEditMode'

  'Ctrl+O' = 'ShowCommandPalette'

[Undo]
DurationMS1 = 1000

[Debug]
Verbose = false

[LanguageServerProtocol]
Enable = false

[Formatter]
DelaySeconds = 5

[Completion]
DelayMilliseconds = 100

`

Variables

View Source
var (
	HexColor = tcell.NewHexColor
	RGBColor = tcell.NewRGBColor
)
View Source
var Log = log
View Source
var NamedCommands = func() Commands {
	m := make(map[string]CommandSpec)
	o := reflect.ValueOf(new(Command))
	t := o.Elem().Type()
	for i := 0; i < o.NumMethod(); i++ {
		spec := o.Method(i).Interface().(func() CommandSpec)()
		name := t.Method(i).Name
		spec.Name = name
		if spec.Desc == "" {
			spec.Desc = spec.Name
		}
		m[spec.Name] = spec
	}
	return m
}()
View Source
var NamedLayouts = func() map[string]Layout {
	m := make(map[string]Layout)
	var f Layout
	v := reflect.ValueOf(f)
	t := reflect.TypeOf(f)
	for i := 0; i < t.NumMethod(); i++ {
		name := t.Method(i).Name
		var fn Layout
		fnValue := reflect.ValueOf(&fn)
		fnValue.Elem().Set(v.Method(i))
		m[name] = fn
	}
	return m
}()
View Source
var NamedViewSortKeys = func() map[string]ViewSortFunc {
	m := make(map[string]ViewSortFunc)
	v := reflect.ValueOf(new(ViewSortKey))
	t := v.Type()
	for i := 0; i < v.NumMethod(); i++ {
		name := t.Method(i).Name
		fn := v.Method(i).Interface().(ViewSortFunc)
		m[name] = fn
	}
	return m
}()
View Source
var SameStyle = StyleFunc(func(style Style) Style {
	return style
})

Functions

func AsCurrentMoment

func AsCurrentMoment(moment *Moment) (
	_ func() CurrentMoment,
)

func AsCurrentView

func AsCurrentView(view *View) (
	_ func() CurrentView,
)

func ElementFrom

func ElementFrom(specs ...any) _ElementFrom

func ElementFunc

func ElementFunc(fn any, provides ...any) _ElementFunc

func ElementWith

func ElementWith(elem Element, provides ...any) _ElementWith

func FocusNextViewInGroup

func FocusNextViewInGroup(
	curGroup CurrentViewGroup,
	cur CurrentView,
	linkedAll LinkedAll,
)

func FocusPrevViewInGroup

func FocusPrevViewInGroup(
	curGroup CurrentViewGroup,
	cur CurrentView,
	linkedAll LinkedAll,
)

func IsEditing

func IsEditing(modes []Mode) bool

func Margin

func Margin(spec ...int) _Margin

func NextViewGroupLayout

func NextViewGroupLayout(
	idx ViewGroupLayoutIndex,
	config ViewGroupConfig,
)

func NextViewLayout

func NextViewLayout(
	curGroup CurrentViewGroup,
)

func Padding

func Padding(spec ...int) _Padding

func PrevViewGroupLayout

func PrevViewGroupLayout(
	idx ViewGroupLayoutIndex,
	config ViewGroupConfig,
)

func PrevViewLayout

func PrevViewLayout(
	curGroup CurrentViewGroup,
)

func Rect

func Rect(specs ...any) _Rect

func RedoLatest

func RedoLatest(
	cur CurrentView,
	linkedAll LinkedAll,
	scope Scope,
)

func ShowSearchDialog

func ShowSearchDialog(
	scope Scope,
	moveCursor MoveCursor,
	pushOverlay PushOverlay,
	closeOverlay CloseOverlay,
)

func SyncViewToFile

func SyncViewToFile(
	cur CurrentView,
	sync SyncBufferMomentToFile,
	show ShowMessage,
) (err error)

func Text

func Text(specs ...any) _Text

func Undo

func Undo(
	cur CurrentView,
	scope Scope,
)

func UndoDuration1

func UndoDuration1(
	cur CurrentView,
	config UndoConfig,
	scope Scope,
)

func VerticalScroll

func VerticalScroll(e Element, offset int) _VerticalScroll

Types

type Abort

type Abort bool

func ExecuteCommandFunc

func ExecuteCommandFunc(
	fn Func,
	scope Scope,
	set SetStrokeSpecs,
	reset ResetStrokeSpecs,
) (
	abort Abort,
)

TODO scopify

type AddCompletionCandidate

type AddCompletionCandidate func(CompletionCandidate)

type AddLineHint

type AddLineHint func(*Moment, int, []string)

type AddStatusSection

type AddStatusSection func(string, [][]any)

type AfterFunc

type AfterFunc any

type Align

type Align uint8
const (
	AlignLeft Align = iota
	AlignRight
	AlignCenter
)

type AppendJournal

type AppendJournal func(
	format string,
	args ...any,
)

type ApplyChange

type ApplyChange func(
	moment *Moment,
	change Change,
) (
	newMoment *Moment,
	numRunesInserted int,
)

type BGColor

type BGColor Color

type Bold

type Bold bool

type Box

type Box struct {
	Top    int
	Left   int
	Bottom int
	Right  int
}

func (Box) Contains

func (b Box) Contains(b2 Box) bool

func (Box) Height

func (b Box) Height() int

func (Box) Intersect

func (b Box) Intersect(b2 Box) bool

func (Box) Width

func (b Box) Width() int

type Buffer

type Buffer struct {
	ID               BufferID
	Path             string
	AbsPath          string
	AbsDir           string
	LastSyncFileInfo FileInfo
	Linebreak        Linebreak
	// contains filtered or unexported fields
}

func (*Buffer) SetLanguage

func (b *Buffer) SetLanguage(scope Scope, lang Language)

type BufferConfig

type BufferConfig struct {
	ExpandTabs bool
	TabWidth   int
}

type BufferID

type BufferID int64

type CalculateLineHeights

type CalculateLineHeights func(
	moment *Moment,
	lineRange [2]int,
) (
	info map[int]int,
)

type CalculateSumLineHeight

type CalculateSumLineHeight func(
	moment *Moment,
	lineRange [2]int,
) int

type Cell

type Cell struct {
	Rune          rune
	Len           int // number of bytes in utf8 encoding
	Width         int // visual width without padding
	DisplayWidth  int // visual width with padding
	DisplayOffset int // visual column offset with padding in line
	RuneOffset    int // rune offset in line
	ByteOffset    int // utf8 byte offset in line
	UTF16Offset   int // byte offset in utf16 encoding in line
}

type Change

type Change struct {
	Op     Op
	String string   // for Insert
	Begin  Position // for Insert or Delete
	// for Delete operation, one of End and Number must be set
	End    Position // for Delete
	Number int      // for Delete
}

type ChangeText

type ChangeText func() (
	abort Abort,
)

type ChangeToWordEnd

type ChangeToWordEnd func()

type Clip

type Clip struct {
	Moment *Moment
	Range  Range
	// contains filtered or unexported fields
}

func (*Clip) String

func (c *Clip) String() string

type CloseOverlay

type CloseOverlay func(
	id ID,
)

type CloseView

type CloseView func()

type Color

type Color = tcell.Color

type Colors

type Colors struct {
	Black   tcell.Color
	Red     tcell.Color
	Green   tcell.Color
	Yellow  tcell.Color
	Blue    tcell.Color
	Magenta tcell.Color
	Cyan    tcell.Color
	White   tcell.Color

	LightBlack   tcell.Color
	LightRed     tcell.Color
	LightGreen   tcell.Color
	LightYellow  tcell.Color
	LightBlue    tcell.Color
	LightMagenta tcell.Color
	LightCyan    tcell.Color
	LightWhite   tcell.Color
}

type Command

type Command struct{}

func (Command) About

func (_ Command) About() (spec CommandSpec)

func (Command) Append

func (_ Command) Append() (spec CommandSpec)

func (Command) AppendAtLineEnd

func (_ Command) AppendAtLineEnd() (spec CommandSpec)

func (Command) Change

func (_ Command) Change() (spec CommandSpec)

func (Command) ChangeLine

func (_ Command) ChangeLine() (spec CommandSpec)

func (Command) ChangeToWordEnd

func (_ Command) ChangeToWordEnd() (spec CommandSpec)

func (Command) ChoosePathAndLoad

func (_ Command) ChoosePathAndLoad() (spec CommandSpec)

func (Command) CloseView

func (_ Command) CloseView() (spec CommandSpec)

func (Command) CurrentTime

func (_ Command) CurrentTime() (spec CommandSpec)

func (Command) Delete

func (_ Command) Delete() (spec CommandSpec)

func (Command) DeleteLine

func (_ Command) DeleteLine() (spec CommandSpec)

func (Command) DeletePrevRune

func (_ Command) DeletePrevRune() (spec CommandSpec)

func (Command) DeleteRune

func (_ Command) DeleteRune() (spec CommandSpec)

func (Command) DisableEditMode

func (_ Command) DisableEditMode() (spec CommandSpec)

func (Command) EditNewLineAbove

func (_ Command) EditNewLineAbove() (spec CommandSpec)

func (Command) EditNewLineBelow

func (_ Command) EditNewLineBelow() (spec CommandSpec)

func (Command) EnableEditMode

func (_ Command) EnableEditMode() (spec CommandSpec)

func (Command) Exit

func (_ Command) Exit() (spec CommandSpec)

func (Command) FocusNextViewInGroup

func (_ Command) FocusNextViewInGroup() (spec CommandSpec)

func (Command) FocusPrevViewInGroup

func (_ Command) FocusPrevViewInGroup() (spec CommandSpec)

func (Command) Foo

func (_ Command) Foo() (spec CommandSpec)

func (Command) InsertLastClip

func (_ Command) InsertLastClip() (spec CommandSpec)

func (Command) InsertNewline

func (_ Command) InsertNewline() (spec CommandSpec)

func (Command) InsertTab

func (_ Command) InsertTab() (spec CommandSpec)

func (Command) LineBegin

func (_ Command) LineBegin() (spec CommandSpec)

func (Command) LineEnd

func (_ Command) LineEnd() (spec CommandSpec)

func (Command) MoveDown

func (_ Command) MoveDown() (spec CommandSpec)

func (Command) MoveLeft

func (_ Command) MoveLeft() (spec CommandSpec)

func (Command) MoveRight

func (_ Command) MoveRight() (spec CommandSpec)

func (Command) MoveUp

func (_ Command) MoveUp() (spec CommandSpec)

func (Command) NewClipFromSelection

func (_ Command) NewClipFromSelection() (spec CommandSpec)

func (Command) NextDedentLine

func (_ Command) NextDedentLine() (spec CommandSpec)

func (Command) NextEmptyLine

func (_ Command) NextEmptyLine() (spec CommandSpec)

func (Command) NextLineWithRune

func (_ Command) NextLineWithRune() (spec CommandSpec)

func (Command) NextRune

func (_ Command) NextRune() (spec CommandSpec)

func (Command) NextViewGroupLayout

func (_ Command) NextViewGroupLayout() (spec CommandSpec)

func (Command) NextViewLayout

func (_ Command) NextViewLayout() (spec CommandSpec)

func (Command) PageDown

func (_ Command) PageDown() (spec CommandSpec)

func (Command) PageUp

func (_ Command) PageUp() (spec CommandSpec)

func (Command) PrevDedentLine

func (_ Command) PrevDedentLine() (spec CommandSpec)

func (Command) PrevEmptyLine

func (_ Command) PrevEmptyLine() (spec CommandSpec)

func (Command) PrevLineWithRune

func (_ Command) PrevLineWithRune() (spec CommandSpec)

func (Command) PrevRune

func (_ Command) PrevRune() (spec CommandSpec)

func (Command) PrevViewGroupLayout

func (_ Command) PrevViewGroupLayout() (spec CommandSpec)

func (Command) PrevViewLayout

func (_ Command) PrevViewLayout() (spec CommandSpec)

func (Command) RedoLatest

func (_ Command) RedoLatest() (spec CommandSpec)

func (Command) ScrollAbsOrEnd

func (_ Command) ScrollAbsOrEnd() (spec CommandSpec)

func (Command) ScrollAbsOrHome

func (_ Command) ScrollAbsOrHome() (spec CommandSpec)

func (Command) ScrollCursorToLower

func (_ Command) ScrollCursorToLower() (spec CommandSpec)

func (Command) ScrollCursorToMiddle

func (_ Command) ScrollCursorToMiddle() (spec CommandSpec)

func (Command) ScrollCursorToUpper

func (_ Command) ScrollCursorToUpper() (spec CommandSpec)

func (Command) ScrollHome

func (_ Command) ScrollHome() (spec CommandSpec)

func (Command) ShowCommandPalette

func (_ Command) ShowCommandPalette() (spec CommandSpec)

func (Command) ShowSearchDialog

func (_ Command) ShowSearchDialog() (spec CommandSpec)

func (Command) ShowViewSwitcher

func (_ Command) ShowViewSwitcher() (spec CommandSpec)

func (Command) SyncViewToFile

func (_ Command) SyncViewToFile() (spec CommandSpec)

func (Command) ToggleJournalHeight

func (_ Command) ToggleJournalHeight() (spec CommandSpec)

func (Command) ToggleMacroRecording

func (_ Command) ToggleMacroRecording() (spec CommandSpec)

func (Command) ToggleSelection

func (_ Command) ToggleSelection() (spec CommandSpec)

func (Command) Undo

func (_ Command) Undo() (spec CommandSpec)

func (Command) UndoDuration1

func (_ Command) UndoDuration1() (spec CommandSpec)

type CommandSpec

type CommandSpec struct {
	Name string
	Desc string
	Func Func
}

type Commands

type Commands = map[string]CommandSpec

type CompletionCandidate

type CompletionCandidate struct {
	Text             string
	Rank             float64
	MatchRuneOffsets []int
	Begin            Position
	End              Position
}

type CompletionConfig

type CompletionConfig struct {
	DelayMilliseconds int
}

type CompletionList

type CompletionList struct {
	Box        Box
	Candidates []CompletionCandidate
	Below      bool
	Moment     *Moment
	View       *View
	// contains filtered or unexported fields
}

func (*CompletionList) RenderFunc

func (c *CompletionList) RenderFunc() any

func (*CompletionList) StrokeSpecs

func (c *CompletionList) StrokeSpecs() any

type CompletionProcs

type CompletionProcs chan func()

type ConfigDir

type ConfigDir string

type ContextMode

type ContextMode struct {
	Number int
}

func (*ContextMode) StrokeSpecs

func (c *ContextMode) StrokeSpecs() any

type ContinueCompletion

type ContinueCompletion *int64

type ContinueMainLoop

type ContinueMainLoop func()

type CurrentModes

type CurrentModes func(args ...[]Mode) []Mode

type CurrentMoment

type CurrentMoment func() *Moment

type CurrentView

type CurrentView func(...*View) *View

type CurrentViewGroup

type CurrentViewGroup func(...*ViewGroup) *ViewGroup

type CursorShape

type CursorShape uint8
const (
	CursorBlock CursorShape = iota
	CursorBeam
)

type DebugConfig

type DebugConfig struct {
	Verbose bool
}

type Delete

type Delete func() (
	abort Abort,
)

type DeleteLine

type DeleteLine func()

type DeletePrevRune

type DeletePrevRune func()

type DeleteRune

type DeleteRune func()

type DeleteSelected

type DeleteSelected func(
	afterFunc AfterFunc,
)

type DeleteWithinPositionFuncs

type DeleteWithinPositionFuncs func(
	begin PositionFunc,
	end PositionFunc,
)

type DeleteWithinRange

type DeleteWithinRange func(
	r Range,
)

type Derive

type Derive func(inits ...any)

type DisableEditMode

type DisableEditMode func()
type DropLink func(left, right any)

type DropLinked

type DropLinked func(o any)

type DropLinkedOne

type DropLinkedOne func(o any)

type EditMode

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

func (*EditMode) StrokeSpecs

func (e *EditMode) StrokeSpecs() any

type EditModeConfig

type EditModeConfig struct {
	DisableSequence string
	SequenceCommand map[string]string
}

type Element

type Element interface {
	RenderFunc() any
}

func JournalUI

func JournalUI(
	getLines JournalLines,
	getHeight JournalHeight,
) (
	ret Element,
)

func OverlayUI

func OverlayUI(
	overlays []Overlay,
	views Views,
) (ret []Element)

func Root

func Root(
	scope Scope,
	width Width,
	height Height,
	getStyle GetStyle,
	getJournalHeight JournalHeight,
	uiConfig UIConfig,
) Element

func Status

func Status(
	scope Scope,
	box Box,
	cur CurrentView,
	getStyle GetStyle,
	style Style,
	curGroup CurrentViewGroup,
	groups ViewGroups,
	trigger Trigger,
) (
	ret Element,
)

func ViewArea

func ViewArea(
	viewGroupConfig ViewGroupConfig,
	groupLayoutIndex ViewGroupLayoutIndex,
	box Box,
	getStyle GetStyle,
	defaultStyle Style,
	views Views,
	viewGroups ViewGroups,
	linkedAll LinkedAll,
	screen Screen,
	curGroup CurrentViewGroup,
	shouldShowList ShouldShowViewList,
	j AppendJournal,
	cur CurrentView,
	scope Scope,
	config UIConfig,
) Element

type EmitEvent

type EmitEvent func(ScreenEvent)

type EmitKey

type EmitKey func(k tcell.Key)

type EmitRune

type EmitRune func(r rune)

type EnableEditMode

type EnableEditMode func()

type EvBufferCreated

type EvBufferCreated struct {
	Buffer *Buffer
	Moment *Moment
}

type EvBufferLanguageChanged

type EvBufferLanguageChanged struct {
	Buffer  *Buffer
	OldLang Language
	NewLang Language
}

type EvCollectCompletionCandidate

type EvCollectCompletionCandidate struct {
	Add    AddCompletionCandidate
	View   *View
	Moment *Moment
	State  ViewMomentState
}

type EvCollectLineHints

type EvCollectLineHints struct {
	Add AddLineHint
}

type EvCollectStatusSections

type EvCollectStatusSections struct {
	Add    AddStatusSection
	Styles []Style
}

type EvCurrentViewChanged

type EvCurrentViewChanged struct {
	View *View
}

type EvCursorMoved

type EvCursorMoved struct {
	View        *View
	Moment      *Moment
	OldPosition Position
	NewPosition Position
}

type EvExit

type EvExit struct{}

type EvKeyEventHandled

type EvKeyEventHandled struct {
}

type EvLoopBegin

type EvLoopBegin struct{}

type EvLoopEnd

type EvLoopEnd struct{}

type EvModesChanged

type EvModesChanged struct {
	Modes []Mode
}

type EvMomentSwitched

type EvMomentSwitched struct {
	View   *View
	Buffer *Buffer
	Old    *Moment
	New    *Moment
}

type EvViewRendered

type EvViewRendered struct {
	View   *View
	Moment *Moment
}

type ExecuteCommand

type ExecuteCommand struct {
	Name string
	Spec CommandSpec
	Cont KeyHandler
}

func (ExecuteCommand) IsKeyHandler

func (_ ExecuteCommand) IsKeyHandler()

type ExecuteFunc

type ExecuteFunc struct {
	Func func()
	Cont KeyHandler
}

func (ExecuteFunc) IsKeyHandler

func (_ ExecuteFunc) IsKeyHandler()

type Exit

type Exit func()

type ExpectingKey

type ExpectingKey struct {
	Key  rune
	Cont KeyHandler
}

func (ExpectingKey) IsKeyHandler

func (_ ExpectingKey) IsKeyHandler()

type FGColor

type FGColor Color

type FileInfo

type FileInfo struct {
	Name    string
	Size    int64
	ModTime time.Time
	IsDir   bool
}

type Fill

type Fill bool

type FormatterConfig

type FormatterConfig struct {
	DelaySeconds int
}

type FrameBuffer

type FrameBuffer struct {
	sync.RWMutex
	Cells  []*FrameBufferCell
	Left   int
	Top    int
	Width  int
	Height int
}

func NewFrameBuffer

func NewFrameBuffer(box Box) *FrameBuffer

func (*FrameBuffer) RenderFunc

func (f *FrameBuffer) RenderFunc() any

func (*FrameBuffer) SetContent

func (f *FrameBuffer) SetContent(x int, y int, mainc rune, combc []rune, style Style)

type FrameBufferCell

type FrameBufferCell struct {
	Rune  rune
	Style Style
}

type Func

type Func any

func ToggleMacroRecording

func ToggleMacroRecording(
	recording MacroRecording,
) Func

type GetConfig

type GetConfig func(target any) error

type GetLastKeyEvent

type GetLastKeyEvent func() KeyEvent

type GetLineHints

type GetLineHints func() ([]LineHint, int)

type GetMacroName

type GetMacroName func() string

type GetStrokeSpecs

type GetStrokeSpecs func() ([]StrokeSpec, bool)

type GetStyle

type GetStyle func(keys ...string) StyleFunc

type GoLexicalStainer

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

func (*GoLexicalStainer) AttrStyleFunc

func (s *GoLexicalStainer) AttrStyleFunc(attr string) StyleFunc

func (*GoLexicalStainer) Line

func (s *GoLexicalStainer) Line() any

type GoLexicalStainerCacheKey

type GoLexicalStainerCacheKey struct {
	MomentID
	LineNumber
}

type HandleKeyEvent

type HandleKeyEvent func(
	ev KeyEvent,
)

type HandleMouseEvent

type HandleMouseEvent func(
	ev MouseEvent,
)

type HandleScreenEvent

type HandleScreenEvent func(
	ev ScreenEvent,
)

type Height

type Height int

type HooksLock

type HooksLock struct {
	*sync.Mutex
}

type HooksMap

type HooksMap map[reflect.Type][]callback

type ID

type ID int64

type InitialJournalHeight

type InitialJournalHeight int

type InsertAtPositionFunc

type InsertAtPositionFunc func(
	str string,
	fn PositionFunc,
)

type InsertLastClip

type InsertLastClip func()

type JournalHeight

type JournalHeight func(...int) int

type JournalLines

type JournalLines func() []string

type KeyEvent

type KeyEvent = *tcell.EventKey

type KeyHandler

type KeyHandler interface {
	IsKeyHandler()
}

type KeyHandlerHint

type KeyHandlerHint struct {
	Hint []string
	Cont KeyHandler
}

func (KeyHandlerHint) IsKeyHandler

func (_ KeyHandlerHint) IsKeyHandler()

type KeyStrokeHandler

type KeyStrokeHandler interface {
	StrokeSpecs() any
}

type LSPCall

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

func (*LSPCall) Then

func (c *LSPCall) Then(fn func(*LSPCall))

func (*LSPCall) Unmarshal

func (c *LSPCall) Unmarshal(target any) error

type LSPEndpoint

type LSPEndpoint struct {
	*sync.Mutex
	*sync.Cond

	Language Language
	RW       io.ReadWriter
	OnErr    func(error)
	OnLog    func(format string, args ...any)
	// contains filtered or unexported fields
}

func NewLSPEndpoint

func NewLSPEndpoint(
	rw io.ReadWriter,
	lang Language,
	onErr func(error),
	onLog func(format string, args ...any),
) *LSPEndpoint

func (*LSPEndpoint) Notify

func (l *LSPEndpoint) Notify(method string, params M)

func (*LSPEndpoint) Req

func (l *LSPEndpoint) Req(method string, params M) *LSPCall

type LSPMessageType

type LSPMessageType uint8
const (
	LSPError LSPMessageType = iota + 1
	LSPWarning
	LSPInfo
	LSPLog
)

func (LSPMessageType) String

func (i LSPMessageType) String() string

type Language

type Language int
const (
	LanguageUnknown Language = iota
	LanguageGo
)

func LanguageFromPath

func LanguageFromPath(path string) Language

func (Language) String

func (i Language) String() string

type LanguageServerProtocolConfig

type LanguageServerProtocolConfig struct {
	Enable bool
}

type LanguageStainers

type LanguageStainers map[Language]func() Stainer

func (LanguageStainers) IsReducer

func (_ LanguageStainers) IsReducer()

type Layout

type Layout func(
	box Box,
) (
	max int,
	split func(n int) []ZBox,
)

func (Layout) BinarySplit

func (l Layout) BinarySplit(box Box) (int, func(int) []ZBox)

func (Layout) HorizontalSplit

func (_ Layout) HorizontalSplit(box Box) (int, func(int) []ZBox)

func (Layout) Stacked

func (_ Layout) Stacked(box Box) (int, func(int) []ZBox)

func (Layout) VerticalSplit

func (_ Layout) VerticalSplit(box Box) (int, func(int) []ZBox)

type Line

type Line struct {
	Cells                 []Cell
	DisplayWidth          int
	AllSpace              bool
	NonSpaceDisplayOffset *int
	// contains filtered or unexported fields
}

func (*Line) Runes

func (l *Line) Runes() []rune

type LineBegin

type LineBegin func()

type LineEnd

type LineEnd func()

type LineHint

type LineHint struct {
	Moment *Moment
	Line   int
	Hints  []string
	// contains filtered or unexported fields
}

type LineInitProcs

type LineInitProcs chan []*Line

type LineNumber

type LineNumber int

type Linebreak

type Linebreak string
type Link func(left, right any)

type LinkedAll

type LinkedAll func(o, target any) int

type LinkedOne

type LinkedOne func(o, target any) int

type M

type M = map[string]any

type MacroRecording

type MacroRecording bool

type Mode

type Mode any

type Moment

type Moment struct {
	T0 time.Time

	ID       MomentID
	Previous *Moment
	Change   Change

	FileInfo FileInfo
	// contains filtered or unexported fields
}

func NewMoment

func NewMoment(prev *Moment) *Moment

func (*Moment) ByteOffsetToPosition

func (m *Moment) ByteOffsetToPosition(offset int) (pos Position)

func (*Moment) GetBytes

func (m *Moment) GetBytes() []byte

func (*Moment) GetCStringContent

func (m *Moment) GetCStringContent() *C.char

func (*Moment) GetContent

func (m *Moment) GetContent() string

func (*Moment) GetLine

func (m *Moment) GetLine(i int) *Line

func (*Moment) GetLowerContent

func (m *Moment) GetLowerContent() string

func (*Moment) GetParser

func (m *Moment) GetParser(scope Scope) *treesitter.Parser

func (*Moment) GetSyntaxAttr

func (m *Moment) GetSyntaxAttr(scope Scope, lineNum int, runeOffset int) string

func (*Moment) NumLines

func (m *Moment) NumLines() int

type MomentID

type MomentID int64

type MouseConfig

type MouseConfig struct {
	ScrollLines int
}

type MouseEvent

type MouseEvent = *tcell.EventMouse

type Move

type Move struct {
	RelLine int
	RelRune int
	AbsLine *int
	AbsCol  *int
}

type MoveCursor

type MoveCursor func(
	move Move,
)

type NewBufferFromBytes

type NewBufferFromBytes func(
	bs []byte,
) (
	buffer *Buffer,
	err error,
)

type NewBufferFromFile

type NewBufferFromFile func(
	path string,
) (
	buffer *Buffer,
	err error,
)

type NewBuffersFromPath

type NewBuffersFromPath func(
	path string,
) (
	buffers []*Buffer,
	err error,
)

type NewClipFromSelection

type NewClipFromSelection func()

type NewGoLexicalStainer

type NewGoLexicalStainer func() *GoLexicalStainer

type NewMomentFromBytes

type NewMomentFromBytes func(
	bs []byte,
) (
	moment *Moment,
	linebreak Linebreak,
	err error,
)

type NewMomentFromFile

type NewMomentFromFile func(
	path string,
) (
	moment *Moment,
	linebreak Linebreak,
	err error,
)

type NewMomentsFromPath

type NewMomentsFromPath func(
	path string,
) (
	moments []*Moment,
	linebreaks []Linebreak,
	paths []string,
	err error,
)

type NewViewFromBuffer

type NewViewFromBuffer func(
	buffer *Buffer,
) (
	view *View,
	err error,
)

type NextDedentLine

type NextDedentLine func()

type NextEmptyLine

type NextEmptyLine func()

type NoopStainer

type NoopStainer struct{}

func (NoopStainer) Line

func (_ NoopStainer) Line() dyn

type OffsetStyleFunc

type OffsetStyleFunc func(int) StyleFunc

type On

type On func(cb any)

type OnNext

type OnNext func(cb any)

type OnStartup

type OnStartup func()

func (OnStartup) IsReducer

func (_ OnStartup) IsReducer()

type Op

type Op uint8
const (
	OpInsert Op = iota
	OpDelete
)

type Overlay

type Overlay struct {
	ID               ID
	Element          Element
	KeyStrokeHandler KeyStrokeHandler
}

type OverlayObject

type OverlayObject any

type PageDown

type PageDown func()

type PageUp

type PageUp func()

type Point

type Point [2]int

type PosCursor

type PosCursor PositionFunc

type PosLineBegin

type PosLineBegin PositionFunc

type PosLineEnd

type PosLineEnd PositionFunc

type PosNextLineBegin

type PosNextLineBegin PositionFunc

type PosNextRune

type PosNextRune PositionFunc

type PosPrevLineEnd

type PosPrevLineEnd PositionFunc

type PosPrevRune

type PosPrevRune PositionFunc

type PosWordBegin

type PosWordBegin PositionFunc

type PosWordEnd

type PosWordEnd PositionFunc

type Position

type Position struct {
	Line int
	Cell int
}

func (Position) Before

func (p Position) Before(p2 Position) bool

type PositionFunc

type PositionFunc func() Position

PositionFunc returns a Position value. Assuming current view is not null and current cursor is valid

type PredictKey

type PredictKey struct {
	Func func(rune) bool
	Cont KeyHandler
}

func (PredictKey) IsKeyHandler

func (_ PredictKey) IsKeyHandler()

type PrevDedentLine

type PrevDedentLine func()

type PrevEmptyLine

type PrevEmptyLine func()

type Provide

type Provide struct{}

func (Provide) ApplyChange

func (_ Provide) ApplyChange(
	config BufferConfig,
	link Link,
	linkedOne LinkedOne,
) ApplyChange

func (Provide) BufferConfig

func (_ Provide) BufferConfig(
	getConfig GetConfig,
) BufferConfig

func (Provide) CalculateLineHeights

func (_ Provide) CalculateLineHeights(
	getHints GetLineHints,
) CalculateLineHeights

func (Provide) CalculateSumLineHeight

func (_ Provide) CalculateSumLineHeight(
	calculate CalculateLineHeights,
) CalculateSumLineHeight

func (Provide) ChangeText

func (_ Provide) ChangeText(
	cur CurrentView,
	deleteSelected DeleteSelected,
) ChangeText

func (Provide) ChangeToWordEnd

func (_ Provide) ChangeToWordEnd(
	cur CurrentView,
	enable EnableEditMode,
	del DeleteWithinPositionFuncs,
	begin PosCursor,
	end PosWordEnd,
) ChangeToWordEnd

func (Provide) CloseOverlay

func (_ Provide) CloseOverlay(
	run RunInMainLoop,
) CloseOverlay

func (Provide) CloseView

func (_ Provide) CloseView(
	cur CurrentView,
	views Views,
	derive Derive,
	dropLinked DropLinked,
) CloseView

func (Provide) CollectWords

func (_ Provide) CollectWords(
	on On,
) OnStartup

func (Provide) Commands

func (_ Provide) Commands() Commands

func (Provide) Completion

func (_ Provide) Completion(
	on On,
	run RunInMainLoop,
) OnStartup

func (Provide) CompletionConfig

func (_ Provide) CompletionConfig(
	get GetConfig,
) CompletionConfig

func (Provide) CompletionProcs

func (_ Provide) CompletionProcs() (
	p CompletionProcs,
)

func (Provide) Config

func (_ Provide) Config() (
	get GetConfig,
	dir ConfigDir,
)

func (Provide) ContextNumber

func (_ Provide) ContextNumber(
	getModes CurrentModes,
) (
	with WithContextNumber,
	set SetContextNumber,
)

func (Provide) ContextStatus

func (_ Provide) ContextStatus(
	on On,
) OnStartup

func (Provide) ContinueCompletion

func (_ Provide) ContinueCompletion() ContinueCompletion

func (Provide) CurrentMoment

func (_ Provide) CurrentMoment(
	v CurrentView,
) CurrentMoment

func (Provide) CurrentView

func (_ Provide) CurrentView(
	link Link,
	linkedOne LinkedOne,
	j AppendJournal,
	trigger Trigger,
) CurrentView

func (Provide) CurrentViewFilePathStatus

func (_ Provide) CurrentViewFilePathStatus(
	on On,
) OnStartup

func (Provide) CurrentViewGroupAccessor

func (_ Provide) CurrentViewGroupAccessor(
	link Link,
	linkedOne LinkedOne,
) CurrentViewGroup

func (Provide) CursorStatus

func (_ Provide) CursorStatus(
	on On,
) OnStartup

func (Provide) DebugConfig

func (_ Provide) DebugConfig(
	get GetConfig,
) (
	debugConfig DebugConfig,
)

func (Provide) DefaultColors

func (_ Provide) DefaultColors() Colors

func (Provide) DefaultLanguageStainers

func (_ Provide) DefaultLanguageStainers(
	newGo NewGoLexicalStainer,
) LanguageStainers

func (Provide) DefaultMacroRecordingState

func (_ Provide) DefaultMacroRecordingState() MacroRecording

func (Provide) DefaultOverlays

func (_ Provide) DefaultOverlays() []Overlay

func (Provide) DefaultStyle

func (_ Provide) DefaultStyle(
	config StyleConfig,
) Style

func (Provide) DefaultSyntaxStyles

func (_ Provide) DefaultSyntaxStyles(
	colors Colors,
) SyntaxStyles

func (Provide) DefaultViewGroups

func (_ Provide) DefaultViewGroups(
	config ViewGroupConfig,
	current CurrentViewGroup,
) ViewGroups

func (Provide) DefaultViews

func (_ Provide) DefaultViews() Views

func (Provide) Delete

func (_ Provide) Delete(
	cur CurrentView,
	deleteSelected DeleteSelected,
) Delete

func (Provide) DeleteLine

func (_ Provide) DeleteLine(
	v CurrentView,
	m CurrentMoment,
	del DeleteWithinPositionFuncs,
	lineBegin LineBegin,
	posPrevLineEnd PosPrevLineEnd,
	posLineEnd PosLineEnd,
	posLineBegin PosLineBegin,
	posNextLineBegin PosNextLineBegin,
) DeleteLine

func (Provide) DeletePrevRune

func (_ Provide) DeletePrevRune(
	del DeleteWithinPositionFuncs,
	begin PosPrevRune,
	end PosCursor,
) DeletePrevRune

func (Provide) DeleteRune

func (_ Provide) DeleteRune(
	del DeleteWithinPositionFuncs,
	begin PosCursor,
	end PosNextRune,
) DeleteRune

func (Provide) DeleteSelected

func (_ Provide) DeleteSelected(
	cur CurrentView,
	scope Scope,
	deleteRagne DeleteWithinRange,
) DeleteSelected

func (Provide) DeleteWithinPositionFuncs

func (_ Provide) DeleteWithinPositionFuncs(
	cur CurrentView,
	deleteRange DeleteWithinRange,
) DeleteWithinPositionFuncs

func (Provide) DeleteWithinRange

func (_ Provide) DeleteWithinRange(
	v CurrentView,
	m CurrentMoment,
	scope Scope,
	moveCursor MoveCursor,
	apply ApplyChange,
) DeleteWithinRange

func (Provide) DisableEditMode

func (_ Provide) DisableEditMode(
	cur CurrentModes,
	screen Screen,
) DisableEditMode

func (Provide) EditModeConfig

func (_ Provide) EditModeConfig(
	getConfig GetConfig,
) EditModeConfig

func (Provide) EnableEditMode

func (_ Provide) EnableEditMode(
	cur CurrentModes,
	screen Screen,
) EnableEditMode

func (Provide) Exit

func (_ Provide) Exit(
	trigger Trigger,
) (
	exit Exit,
	sigExit SigExit,
)

func (Provide) FormatterConfig

func (_ Provide) FormatterConfig(
	get GetConfig,
) FormatterConfig

func (Provide) FormatterGo

func (_ Provide) FormatterGo(
	on On,
	j AppendJournal,
	run RunInMainLoop,
	config FormatterConfig,
) OnStartup

func (Provide) GetStyle

func (_ Provide) GetStyle(
	config StyleConfig,
) GetStyle

func (Provide) HandleKeyEvent

func (_ Provide) HandleKeyEvent(
	reset ResetStrokeSpecs,
	set SetStrokeSpecs,
	get GetStrokeSpecs,
	scope Scope,
	setEv SetLastKeyEvent,
	commands Commands,
	recording MacroRecording,
	record RecordMacroKey,
	trigger Trigger,
) HandleKeyEvent

func (Provide) HandleMouseEvent

func (_ Provide) HandleMouseEvent(
	mouseConfig MouseConfig,
	moveCursor MoveCursor,
) HandleMouseEvent

func (Provide) HandleScreenEvent

func (_ Provide) HandleScreenEvent(
	derive Derive,
	handleMouse HandleMouseEvent,
	handleKey HandleKeyEvent,
) HandleScreenEvent

func (Provide) Hook

func (_ Provide) Hook(
	scope Scope,
	l HooksLock,
	m HooksMap,
) (
	on On,
	onNext OnNext,
	trigger Trigger,
)

func (Provide) HookVars

func (_ Provide) HookVars() (
	l HooksLock,
	m HooksMap,
)

func (Provide) InsertAtPositionFunc

func (_ Provide) InsertAtPositionFunc(
	v CurrentView,
	m CurrentMoment,
	scope Scope,
	moveCursor MoveCursor,
	apply ApplyChange,
) InsertAtPositionFunc

func (Provide) InsertLastClip

func (_ Provide) InsertLastClip(
	cur CurrentView,
	linkedOne LinkedOne,
	insert InsertAtPositionFunc,
	posCursor PosCursor,
) InsertLastClip

func (Provide) Journal

func (_ Provide) Journal(
	derive Derive,
	uiConfig UIConfig,
	cont ContinueMainLoop,
) (
	appendJournal AppendJournal,
	get JournalLines,
	accessHeight JournalHeight,
	initialjournalheight InitialJournalHeight,
)

func (Provide) KeyEventHooks

func (_ Provide) KeyEventHooks(
	on On,
) OnStartup

func (Provide) KeyLogging

func (_ Provide) KeyLogging() (
	set SetLastKeyEvent,
	get GetLastKeyEvent,
)

func (Provide) KeyMacro

func (_ Provide) KeyMacro(
	derive Derive,
) (
	getName GetMacroName,
	start StartMacroRecord,
	stop StopMacroRecord,
	record RecordMacroKey,
)

func (Provide) KeyMacroStatus

func (_ Provide) KeyMacroStatus(
	on On,
) OnStartup

func (Provide) LSP

func (_ Provide) LSP(
	on On,
	j AppendJournal,
	getConfig GetConfig,
) OnStartup

func (Provide) LayoutStatus

func (_ Provide) LayoutStatus(
	on On,
) OnStartup

func (Provide) LineBegin

func (_ Provide) LineBegin(
	cur CurrentView,
	moveCursor MoveCursor,
	scrollToCursor ScrollToCursor,
) LineBegin

func (Provide) LineEnd

func (_ Provide) LineEnd(
	cur CurrentView,
	moveCursor MoveCursor,
	scrollToCursor ScrollToCursor,
) LineEnd

func (Provide) LineHints

func (_ Provide) LineHints(
	on On,
) (
	GetLineHints,
	OnStartup,
)

func (Provide) LineInitProcs

func (_ Provide) LineInitProcs() LineInitProcs

func (Provide) LinkFuncs

func (_ Provide) LinkFuncs() (
	link Link,
	linkedOne LinkedOne,
	linkedAll LinkedAll,
	dropLink DropLink,
	drop DropLinked,
	dropOne DropLinkedOne,
)

func (Provide) Loop

func (_ Provide) Loop() (
	cont ContinueMainLoop,
	renderTimer RenderTimer,
	resetRenderTimer ResetRenderTimer,
)

func (Provide) ModeStatus

func (_ Provide) ModeStatus(
	on On,
) OnStartup

func (Provide) ModesAccessor

func (_ Provide) ModesAccessor(
	derive Derive,
	trigger Trigger,
	l modesLock,
	ptr *[]Mode,
) (
	fn CurrentModes,
)

func (Provide) ModesVars

func (_ Provide) ModesVars() (
	l modesLock,
	p *[]Mode,
)

func (Provide) MouseConfig

func (_ Provide) MouseConfig(
	getConfig GetConfig,
) MouseConfig

func (Provide) MoveCursor

func (_ Provide) MoveCursor(
	cur CurrentView,
	withN WithContextNumber,
	trigger Trigger,
	scrollToCursor ScrollToCursor,
) MoveCursor

func (Provide) NewBufferFromBytes

func (_ Provide) NewBufferFromBytes(
	link Link,
	trigger Trigger,
	newMoment NewMomentFromBytes,
) NewBufferFromBytes

func (Provide) NewBufferFromFile

func (_ Provide) NewBufferFromFile(
	scope Scope,
	link Link,
	trigger Trigger,
	newMoment NewMomentFromFile,
) NewBufferFromFile

func (Provide) NewBuffersFromPath

func (_ Provide) NewBuffersFromPath(
	scope Scope,
	link Link,
	newMoment NewMomentsFromPath,
) NewBuffersFromPath

func (Provide) NewClipFromSelection

func (_ Provide) NewClipFromSelection(
	cur CurrentView,
	link Link,
) NewClipFromSelection

func (Provide) NewGoLexicalStainer

func (_ Provide) NewGoLexicalStainer(
	syntaxStyles SyntaxStyles,
) NewGoLexicalStainer

func (Provide) NewMomentFromBytes

func (_ Provide) NewMomentFromBytes(
	config BufferConfig,
	initProcs LineInitProcs,
) NewMomentFromBytes

func (Provide) NewMomentFromFile

func (_ Provide) NewMomentFromFile(
	newMoment NewMomentFromBytes,
) NewMomentFromFile

func (Provide) NewMomentsFromPath

func (_ Provide) NewMomentsFromPath(
	newMoment NewMomentFromFile,
) NewMomentsFromPath

func (Provide) NewViewFromBuffer

func (_ Provide) NewViewFromBuffer(
	width Width,
	height Height,
	views Views,
	_ ViewGroups,
	curGroup CurrentViewGroup,
	link Link,
	cur CurrentView,
	linkedOne LinkedOne,
	trigger Trigger,
	languageStainers LanguageStainers,
) NewViewFromBuffer

func (Provide) NextDedentLine

func (_ Provide) NextDedentLine(
	cur CurrentView,
	scrollToCursor ScrollToCursor,
	moveCursor MoveCursor,
) NextDedentLine

func (Provide) NextEmptyLine

func (_ Provide) NextEmptyLine(
	cur CurrentView,
	moveCursor MoveCursor,
	scrollToCursor ScrollToCursor,
) NextEmptyLine

func (Provide) OnStartup

func (_ Provide) OnStartup() OnStartup

func (Provide) PageDown

func (_ Provide) PageDown(
	cur CurrentView,
	config ScrollConfig,
	moveCursor MoveCursor,
	calLineHeights CalculateLineHeights,
) PageDown

func (Provide) PageUp

func (_ Provide) PageUp(
	cur CurrentView,
	config ScrollConfig,
	moveCursor MoveCursor,
	calLineHeights CalculateLineHeights,
) PageUp

func (Provide) PosCursor

func (_ Provide) PosCursor(
	cur CurrentView,
) PosCursor

func (Provide) PosLineBegin

func (_ Provide) PosLineBegin(
	cur CurrentView,
) PosLineBegin

func (Provide) PosLineEnd

func (_ Provide) PosLineEnd(
	cur CurrentView,
) PosLineEnd

func (Provide) PosNextLineBegin

func (_ Provide) PosNextLineBegin(
	cur CurrentView,
) PosNextLineBegin

func (Provide) PosNextRune

func (_ Provide) PosNextRune(
	cur CurrentView,
) PosNextRune

func (Provide) PosPrevLineEnd

func (_ Provide) PosPrevLineEnd(
	cur CurrentView,
) PosPrevLineEnd

func (Provide) PosPrevRune

func (_ Provide) PosPrevRune(
	cur CurrentView,
) PosPrevRune

func (Provide) PosWordBegin

func (_ Provide) PosWordBegin(
	cur CurrentView,
) PosWordBegin

func (Provide) PosWordEnd

func (_ Provide) PosWordEnd(
	cur CurrentView,
) PosWordEnd

func (Provide) PrevDedentLine

func (_ Provide) PrevDedentLine(
	cur CurrentView,
	moveCursor MoveCursor,
	scrollToCursor ScrollToCursor,
) PrevDedentLine

func (Provide) PrevEmptyLine

func (_ Provide) PrevEmptyLine(
	cur CurrentView,
	moveCursor MoveCursor,
	scrollToCursor ScrollToCursor,
) PrevEmptyLine

func (Provide) PushOverlay

func (_ Provide) PushOverlay(
	run RunInMainLoop,
) PushOverlay

func (Provide) ReplaceWithinRange

func (_ Provide) ReplaceWithinRange(
	v CurrentView,
	m CurrentMoment,
	scope Scope,
	moveCursor MoveCursor,
	apply ApplyChange,
) ReplaceWithinRange

func (Provide) Screen

func (_ Provide) Screen(
	on On,
) Screen

func (Provide) ScreenSize

func (_ Provide) ScreenSize(
	screen Screen,
) (
	width Width,
	height Height,
)

func (Provide) ScrollAbsOrEnd

func (_ Provide) ScrollAbsOrEnd(
	withN WithContextNumber,
	moveCursor MoveCursor,
	end ScrollEnd,
) ScrollAbsOrEnd

func (Provide) ScrollAbsOrHome

func (_ Provide) ScrollAbsOrHome(
	withN WithContextNumber,
	moveCursor MoveCursor,
	home ScrollHome,
) ScrollAbsOrHome

func (Provide) ScrollConfig

func (_ Provide) ScrollConfig(
	getConfig GetConfig,
) ScrollConfig

func (Provide) ScrollCursorToLower

func (_ Provide) ScrollCursorToLower(
	cur CurrentView,
	config ScrollConfig,
	scope Scope,
) ScrollCursorToLower

func (Provide) ScrollCursorToMiddle

func (_ Provide) ScrollCursorToMiddle(
	cur CurrentView,
	config ScrollConfig,
	scope Scope,
) ScrollCursorToMiddle

func (Provide) ScrollCursorToUpper

func (_ Provide) ScrollCursorToUpper(
	cur CurrentView,
	config ScrollConfig,
	scope Scope,
) ScrollCursorToUpper

func (Provide) ScrollEnd

func (_ Provide) ScrollEnd(
	cur CurrentView,
	scrollToCursor ScrollToCursor,
	moveCursor MoveCursor,
) ScrollEnd

func (Provide) ScrollHome

func (_ Provide) ScrollHome(
	scrollToCursor ScrollToCursor,
	moveCursor MoveCursor,
) ScrollHome

func (Provide) ScrollToCursor

func (_ Provide) ScrollToCursor(
	cur CurrentView,
	scope Scope,
	config ScrollConfig,
) ScrollToCursor

func (Provide) ShouldShowViewListState

func (_ Provide) ShouldShowViewListState() (
	s ShouldShowViewListState,
	get ShouldShowViewList,
)

func (Provide) ShowCommandPalette

func (_ Provide) ShowCommandPalette(
	screen Screen,
	commands Commands,
	run RunInMainLoop,
	pushOverlay PushOverlay,
) ShowCommandPalette

func (Provide) ShowFileChooser

func (_ Provide) ShowFileChooser(
	scope Scope,
	pushOverlay PushOverlay,
	closeOverlay CloseOverlay,
) ShowFileChooser

func (Provide) ShowMessage

func (_ Provide) ShowMessage(
	pushOverlay PushOverlay,
) ShowMessage

func (Provide) ShowViewListFlag

func (_ Provide) ShowViewListFlag(
	on On,
	config UIConfig,
	run RunInMainLoop,
	p ShouldShowViewListState,
) OnStartup

func (Provide) ShowViewSwitcher

func (_ Provide) ShowViewSwitcher(
	scope Scope,
	pushOverlay PushOverlay,
	closeOverlay CloseOverlay,
) ShowViewSwitcher

func (Provide) StrokeSpecs

func (_ Provide) StrokeSpecs(
	curModes CurrentModes,
	overlays []Overlay,
	scope Scope,
	set SetStrokeSpecs,
	get GetStrokeSpecs,
) (
	reset ResetStrokeSpecs,
)

func (Provide) StrokeSpecsAccessor

func (_ Provide) StrokeSpecsAccessor() (
	get GetStrokeSpecs,
	set SetStrokeSpecs,
)

func (Provide) StyleConfig

func (_ Provide) StyleConfig(
	getConfig GetConfig,
) StyleConfig

func (Provide) SyncBufferMomentToFile

func (_ Provide) SyncBufferMomentToFile(
	linkedAll LinkedAll,
) SyncBufferMomentToFile

func (Provide) ToggleSelection

func (_ Provide) ToggleSelection(
	cur CurrentView,
) ToggleSelection

func (Provide) UIConfig

func (_ Provide) UIConfig(
	get GetConfig,
) UIConfig

func (Provide) UndoConfig

func (_ Provide) UndoConfig(
	getConfig GetConfig,
) UndoConfig

func (Provide) ViewEvents

func (_ Provide) ViewEvents(
	on On,
	j AppendJournal,
	config DebugConfig,
) OnStartup

func (Provide) ViewGroupConfig

func (_ Provide) ViewGroupConfig(
	getConfig GetConfig,
	idx ViewGroupLayoutIndex,
) (
	config ViewGroupConfig,
)

func (Provide) ViewGroupLayoutIndex

func (_ Provide) ViewGroupLayoutIndex() (
	fn ViewGroupLayoutIndex,
)

func (Provide) ViewRenderProcs

func (_ Provide) ViewRenderProcs() (
	ch ViewRenderProcs,
)

type PushOverlay

type PushOverlay func(
	obj OverlayObject,
) (
	id ID,
)

type RandomStainer

type RandomStainer struct{}

func (RandomStainer) Line

func (_ RandomStainer) Line() dyn

type Range

type Range struct {
	Begin Position
	End   Position
}

func (Range) Contains

func (r Range) Contains(p Position) bool

type ReadMode

type ReadMode struct{}

func (ReadMode) StrokeSpecs

func (_ ReadMode) StrokeSpecs() any

type RecordMacroKey

type RecordMacroKey func(KeyEvent)

type RenderTimer

type RenderTimer struct {
	*time.Timer
}

type ReplaceWithinRange

type ReplaceWithinRange func(
	r Range,
	text string,
) (
	newMoment *Moment,
)

type ResetRenderTimer

type ResetRenderTimer func()

type ResetStrokeSpecs

type ResetStrokeSpecs func() []StrokeSpec

type RunInMainLoop

type RunInMainLoop func(fn any)

type RuneCategory

type RuneCategory uint8
const (
	RuneCategoryIdentifier RuneCategory = iota + 1
	RuneCategorySpace
	RuneCategoryOther = 255
)

type Scope

type Scope = dscope.Scope

func NewGlobal

func NewGlobal(fns ...any) Scope

type Screen

type Screen interface {
	tcell.Screen
	SetCursorShape(CursorShape)
}

type ScreenEvent

type ScreenEvent = tcell.Event

type ScrollAbsOrEnd

type ScrollAbsOrEnd func()

type ScrollAbsOrHome

type ScrollAbsOrHome func()

type ScrollConfig

type ScrollConfig struct {
	PaddingTop    int
	PaddingBottom int
}

type ScrollCursorToLower

type ScrollCursorToLower func()

type ScrollCursorToMiddle

type ScrollCursorToMiddle func()

type ScrollCursorToUpper

type ScrollCursorToUpper func()

type ScrollEnd

type ScrollEnd func()

type ScrollHome

type ScrollHome func()

type ScrollToCursor

type ScrollToCursor func()

type Segment

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

func (*Segment) Sum

func (s *Segment) Sum() uint64

type Segments

type Segments []*Segment

func (Segments) Len

func (s Segments) Len() (l int)

func (Segments) Sub

func (s Segments) Sub(start int, end int) Segments

type SelectionDialog

type SelectionDialog struct {
	Title string

	OnClose  func(scope Scope)
	OnSelect func(scope Scope, id ID)
	OnUpdate func(scope Scope, runes []rune) (
		ids []ID,
		maxLen int,
		initialIDIndex int,
	)
	CandidateElement func(scope Scope, id ID) Element
	// contains filtered or unexported fields
}

func (*SelectionDialog) RenderFunc

func (d *SelectionDialog) RenderFunc() any

func (*SelectionDialog) StrokeSpecs

func (d *SelectionDialog) StrokeSpecs() any

type Selections

type Selections []Range

type SetContent

type SetContent func(x int, y int, mainc rune, combc []rune, style Style)

type SetContextNumber

type SetContextNumber func(int)

type SetLastKeyEvent

type SetLastKeyEvent func(KeyEvent)

type SetStrokeSpecs

type SetStrokeSpecs func([]StrokeSpec, bool)

type ShouldShowViewList

type ShouldShowViewList func() bool

type ShouldShowViewListState

type ShouldShowViewListState *int64

type ShowCommandPalette

type ShowCommandPalette func()

type ShowFileChooser

type ShowFileChooser func(
	cb func(string),
)

type ShowMessage

type ShowMessage func(
	lines []string,
)

type ShowViewSwitcher

type ShowViewSwitcher func()

type SigExit

type SigExit chan struct{}

type Stainer

type Stainer interface {
	Line() dyn
}

type StartMacroRecord

type StartMacroRecord func(name string)

type StatusSection

type StatusSection struct {
	Title string
	Lines [][]any
}

type StopMacroRecord

type StopMacroRecord func() (name string, events []KeyEvent)

type StrokeSpec

type StrokeSpec struct {
	Sequence    []string
	Predict     any
	Func        any
	Command     CommandSpec
	CommandName string
	Hints       []string
}

func NextLineWithRune

func NextLineWithRune() []StrokeSpec

func NextRune

func NextRune() []StrokeSpec

func PrevLineWithRune

func PrevLineWithRune() []StrokeSpec

func PrevRune

func PrevRune() []StrokeSpec

func (StrokeSpec) Clone

func (s StrokeSpec) Clone() StrokeSpec

type Style

type Style = tcell.Style

type StyleConfig

type StyleConfig map[string]StyleSpec

type StyleFunc

type StyleFunc func(style Style) Style

func SetBG

func SetBG(color Color) StyleFunc

func SetBold

func SetBold(bold bool) StyleFunc

func SetFG

func SetFG(color Color) StyleFunc

func SetUnderline

func SetUnderline(underline bool) StyleFunc

func (StyleFunc) And

func (s StyleFunc) And(f2 StyleFunc) StyleFunc

func (StyleFunc) SetBG

func (s StyleFunc) SetBG(color Color) StyleFunc

func (StyleFunc) SetBold

func (s StyleFunc) SetBold(bold bool) StyleFunc

func (StyleFunc) SetFG

func (s StyleFunc) SetFG(color Color) StyleFunc

func (StyleFunc) SetUnderline

func (s StyleFunc) SetUnderline(underline bool) StyleFunc

type StyleSpec

type StyleSpec struct {
	FG        *int32
	BG        *int32
	Bold      *bool
	Underline *bool
}

func (StyleSpec) ToFunc

func (s StyleSpec) ToFunc() StyleFunc

type SyncBufferMomentToFile

type SyncBufferMomentToFile func(
	buffer *Buffer,
	moment *Moment,
) (
	err error,
)

type SyntaxStyles

type SyntaxStyles struct {
	Keyword StyleFunc
	Type    StyleFunc
	Literal StyleFunc
	Builtin StyleFunc
	Comment StyleFunc
}

type SystemMode

type SystemMode struct{}

func (SystemMode) StrokeSpecs

func (_ SystemMode) StrokeSpecs() any

type TcellScreen

type TcellScreen struct {
	tcell.Screen
}

func (TcellScreen) SetCursorShape

func (t TcellScreen) SetCursorShape(shape CursorShape)

type ToggleSelection

type ToggleSelection func()

type Trigger

type Trigger func(ev any)

type UIConfig

type UIConfig struct {
	StatusWidth        int
	JournalHeight      int
	MaxOutlineDistance int
	ViewList           struct {
		HideTimeoutSeconds int
		MarginLeft         int
		Width              int
	}
}

type UIDesc

type UIDesc struct {
	InitFuncs []any
}

func NewUIDesc

func NewUIDesc(specs []any) UIDesc

func (UIDesc) IterSpecs

func (u UIDesc) IterSpecs(scope Scope, cb func(any))

type Underline

type Underline bool

type UndoConfig

type UndoConfig struct {
	DurationMS1 time.Duration
}

type View

type View struct {
	sync.RWMutex

	ID     ViewID
	Buffer *Buffer

	Stainer Stainer

	Box        Box
	ContentBox Box

	ViewMomentState

	FrameBuffer     *FrameBuffer
	FrameBufferArgs ViewUIArgs

	//TODO eviction
	MomentStates map[*Moment]ViewMomentState
	// contains filtered or unexported fields
}

func (*View) GetMoment

func (v *View) GetMoment() (m *Moment)

func (*View) RenderFunc

func (view *View) RenderFunc() any

type ViewGroup

type ViewGroup struct {
	ID ViewGroupID
	ViewGroupSpec
	LayoutIndex int
}

func (*ViewGroup) GetViews

func (g *ViewGroup) GetViews(scope Scope) []*View

func (*ViewGroup) RenderFunc

func (g *ViewGroup) RenderFunc() any

type ViewGroupConfig

type ViewGroupConfig struct {
	Groups      []ViewGroupSpec
	Layouts     []string
	LayoutIndex int
}

type ViewGroupID

type ViewGroupID int64

type ViewGroupLayoutIndex

type ViewGroupLayoutIndex func(i ...int) int

type ViewGroupSpec

type ViewGroupSpec struct {
	SortKeys []string
	Layouts  []string
}

type ViewGroups

type ViewGroups []*ViewGroup

type ViewID

type ViewID int64

type ViewMomentState

type ViewMomentState struct {
	ViewportLine    int
	ViewportCol     int
	CursorLine      int
	CursorCol       int
	SelectionAnchor *Position
	PreferCursorCol int
}

type ViewRenderProcs

type ViewRenderProcs chan func()

type ViewSortFunc

type ViewSortFunc = func(*View) int

type ViewSortKey

type ViewSortKey struct{}

func (ViewSortKey) ID

func (_ ViewSortKey) ID(view *View) int

type ViewUIArgs

type ViewUIArgs struct {
	MomentID     MomentID
	Width        int
	Height       int
	IsFocus      bool
	HintsVersion int
	ViewMomentState
}

type Views

type Views map[ViewID]*View

type WidgetDialog

type WidgetDialog struct {
	OnKey   any
	Element Element
}

func (WidgetDialog) RenderFunc

func (w WidgetDialog) RenderFunc() any

func (WidgetDialog) StrokeSpecs

func (w WidgetDialog) StrokeSpecs() any

type Width

type Width int

type WithContextNumber

type WithContextNumber func(fn func(int))

type ZBox

type ZBox struct {
	Box
	Z int
}

Jump to

Keyboard shortcuts

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