mcwig

package module
v0.0.0-...-6612a3b Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2025 License: Apache-2.0 Imports: 33 Imported by: 0

README

McWig (temporary name)

Hi! Welcome to my text editor page. McWig is a modal, Vim-like text editor written in Go. I use it as my daily driver, btw.

Note: McWig currently supports only .go files. Do not edit files that are not backed up. McWig is still in an early stage of development and may damage your files.

Features
  • LSP autocomplete, goto definition, hover info
  • Tree-sitter support
  • Color themes (borrowed from the Helix text editor)
  • Lots of bugs
  • Macro support
  • Something like Emacs org-mode: Open test.txt, place the cursor at line 15, and press "Ctrl-C Ctrl-C".

This project was written as a "speed run" — not for speed in terms of time, but rather as an exercise to explore the text editor problem space without overthinking or planning ahead. It’s a quick and "dirty" implementation, so to speak.


Running

make setup-runtime
make build-run

Keybindings

Most common Vim keybindings are implemented, providing minimal but enough (for me) support for daily source code editing. See config/config.go for all implemented keybindings.

To get started:

Key Description
Tab Next element in popup
Shift-Tab Prev element in popup
Space + f Find files in Git project
Space + b Buffers
Space + s + s Fuzzy text search
Ctrl-W + V Split window
Space + ` Toggle file
Space + / Search text in project

Plans

I plan to turn this "toy project" into a stable, fully-featured Vim-like text editor.


Documentation

Overview

Movement and window related funcs

Index

Constants

This section is empty.

Variables

View Source
var LastSearchPattern string

Functions

func ApplyBg

func ApplyBg(color string, style tcell.Style) tcell.Style

func ApplyTheme

func ApplyTheme(name string)

func BufferReloadFile

func BufferReloadFile(buf *Buffer) error

func CmdAppendLine

func CmdAppendLine(ctx Context)

func CmdAutocompleteTrigger

func CmdAutocompleteTrigger(ctx Context)

func CmdBackwardChar

func CmdBackwardChar(ctx Context) func(Context)

func CmdBackwardWord

func CmdBackwardWord(ctx Context)

func CmdBufferCycle

func CmdBufferCycle(ctx Context)

Cycle between last two buffers in jump list

func CmdChangeBefore

func CmdChangeBefore(_ Context) func(Context)

func CmdChangeEndOfLine

func CmdChangeEndOfLine(ctx Context)

func CmdChangeInsideBlock

func CmdChangeInsideBlock(ctx Context)

func CmdChangeLine

func CmdChangeLine(ctx Context)

func CmdChangeTo

func CmdChangeTo(_ Context) func(Context)

func CmdChangeWORD

func CmdChangeWORD(ctx Context)

func CmdChangeWord

func CmdChangeWord(ctx Context)

func CmdCursorBeginningOfTheLine

func CmdCursorBeginningOfTheLine(ctx Context)

func CmdCursorCenter

func CmdCursorCenter(ctx Context)

func CmdCursorFirstNonBlank

func CmdCursorFirstNonBlank(ctx Context)

func CmdCursorLeft

func CmdCursorLeft(ctx Context)

func CmdCursorLineDown

func CmdCursorLineDown(ctx Context)

func CmdCursorLineUp

func CmdCursorLineUp(ctx Context)

func CmdCursorRight

func CmdCursorRight(ctx Context)

func CmdDeleteBefore

func CmdDeleteBefore(ctx Context) func(Context)

func CmdDeleteCharBackward

func CmdDeleteCharBackward(ctx Context)

func CmdDeleteCharForward

func CmdDeleteCharForward(ctx Context)

func CmdDeleteEndOfLine

func CmdDeleteEndOfLine(ctx Context)

func CmdDeleteLine

func CmdDeleteLine(ctx Context)

func CmdDeleteTo

func CmdDeleteTo(_ Context) func(Context)

func CmdDeleteWord

func CmdDeleteWord(ctx Context)

func CmdEnsureCursorVisible

func CmdEnsureCursorVisible(ctx Context)

func CmdEnterInsertMode

func CmdEnterInsertMode(ctx Context)

func CmdEnterInsertModeAppend

func CmdEnterInsertModeAppend(ctx Context)

func CmdExit

func CmdExit(ctx Context)

func CmdExitInsertMode

func CmdExitInsertMode(ctx Context)

func CmdForwardBeforeChar

func CmdForwardBeforeChar(_ Context) func(Context)

func CmdForwardToChar

func CmdForwardToChar(_ Context) func(Context)

func CmdForwardWord

func CmdForwardWord(ctx Context)

func CmdGotoLine0

func CmdGotoLine0(ctx Context)

func CmdGotoLineEnd

func CmdGotoLineEnd(ctx Context)

func CmdGotoLineEndOfFile

func CmdGotoLineEndOfFile(ctx Context)

func CmdIndentOrComplete

func CmdIndentOrComplete(ctx Context)

func CmdJoinNextLine

func CmdJoinNextLine(ctx Context)

func CmdJumpBack

func CmdJumpBack(ctx Context)

func CmdJumpForward

func CmdJumpForward(ctx Context)

func CmdKillBuffer

func CmdKillBuffer(ctx Context)

func CmdLineOpenAbove

func CmdLineOpenAbove(ctx Context)

func CmdLineOpenBelow

func CmdLineOpenBelow(ctx Context)

func CmdMacroPlay

func CmdMacroPlay(ctx Context) func(Context)

func CmdMacroRecord

func CmdMacroRecord(ctx Context) func(Context)

func CmdMacroRepeat

func CmdMacroRepeat(ctx Context)

func CmdNewBuffer

func CmdNewBuffer(ctx Context)

func CmdNormalMode

func CmdNormalMode(ctx Context)

func CmdRedo

func CmdRedo(ctx Context)

func CmdReplaceChar

func CmdReplaceChar(ctx Context) func(Context)

func CmdSaveFile

func CmdSaveFile(ctx Context)

func CmdScrollDown

func CmdScrollDown(ctx Context)

func CmdScrollUp

func CmdScrollUp(ctx Context)

func CmdSearchNext

func CmdSearchNext(ctx Context)

func CmdSearchPrev

func CmdSearchPrev(ctx Context)

func CmdSelectionChange

func CmdSelectionChange(ctx Context)

func CmdSelectionDelete

func CmdSelectionDelete(ctx Context)

func CmdToggleComment

func CmdToggleComment(ctx Context)

TODO: implement correct toggle comment logic: check if all lines are commented - then uncomment. else, append comment to each uncommted line.

func CmdUndo

func CmdUndo(ctx Context)

func CmdVisualLineMode

func CmdVisualLineMode(ctx Context)

func CmdVisualMode

func CmdVisualMode(ctx Context)

func CmdWindowClose

func CmdWindowClose(ctx Context)

func CmdWindowCloseAndKillBuffer

func CmdWindowCloseAndKillBuffer(ctx Context)

func CmdWindowNext

func CmdWindowNext(ctx Context)

func CmdWindowToggleLayout

func CmdWindowToggleLayout(ctx Context)

func CmdWindowVSplit

func CmdWindowVSplit(ctx Context)

func CmdYank

func CmdYank(ctx Context)

func CmdYankEol

func CmdYankEol(ctx Context)

func CmdYankPut

func CmdYankPut(ctx Context)

func CmdYankPutBefore

func CmdYankPutBefore(ctx Context)

func Color

func Color(color string) tcell.Style

func CursorChClass

func CursorChClass(buf *Buffer) chClass

func CursorChar

func CursorChar(buf *Buffer) rune

Return char under the cursor.

func CursorDec

func CursorDec(buf *Buffer) (moved bool)

func CursorInc

func CursorInc(buf *Buffer) (moved bool)

func CursorNumByLine

func CursorNumByLine(buf *Buffer, lookie *Element[Line]) int

func HandleInsertKey

func HandleInsertKey(ctx Context, ev *tcell.EventKey)

func HighlighterAdaptEditInput

func HighlighterAdaptEditInput(event EventTextChange) (r sitter.EditInput)

func HighlighterEditTree

func HighlighterEditTree(event EventTextChange)

func HighlighterGo

func HighlighterGo(e *Editor)

TODO: this must exit on editor close use context cancel()

func HighlighterInitBuffer

func HighlighterInitBuffer(e *Editor, buf *Buffer)

func IndentGetNumber

func IndentGetNumber(line []rune, indentUnit []rune) int

Get number if "indents" in provided line Indent unit can be \t, or any number of spaces. eg. 2 or 4.

func MergeStyles

func MergeStyles(base tcell.Style, color string) tcell.Style

func NodeToColor

func NodeToColor(node *Element[TreeSitterRangeNode]) tcell.Style

func SearchNext

func SearchNext(ctx Context, pattern string)

Move cursor to the next search pattern match

func SearchPrev

func SearchPrev(ctx Context, pattern string)

func SelectionCursorInRange

func SelectionCursorInRange(sel *Selection, c Cursor) bool

func SelectionDelete

func SelectionDelete(ctx Context)

func SelectionStart

func SelectionStart(buf *Buffer)

func SelectionStop

func SelectionStop(buf *Buffer)

func SelectionToString

func SelectionToString(buf *Buffer, sel *Selection) string

func SnippetProcessString

func SnippetProcessString(s string) (str string, cursorPos int)

func TextDelete

func TextDelete(buf *Buffer, selection *Selection)

func TextInsert

func TextInsert(buf *Buffer, line *Element[Line], pos int, text string)

func TextObjectBlock

func TextObjectBlock(buf *Buffer, ch rune, include bool) (found bool, sel *Selection, cur Cursor)

Returns selection inside '(', '{', '[' as "Selection" range. This implementation is simple and does not check if open/close symbols are "balanced".

func TextObjectWord

func TextObjectWord(buf *Buffer, bigword bool) (start, end int)

func WithSelection

func WithSelection(fn func(Context)) func(Context)

Types

type AutocompleteFn

type AutocompleteFn func(Context) bool

type Buffer

type Buffer struct {
	FilePath     string
	ScrollOffset int
	Lines        List[Line]
	Cursor       Cursor
	Selection    *Selection
	Driver       Driver
	IndentCh     []rune
	Tx           *Transaction
	UndoRedo     *UndoRedo
	Highlighter  *Highlighter
	// contains filtered or unexported fields
}

func BufferReadFile

func BufferReadFile(path string) (*Buffer, error)

func NewBuffer

func NewBuffer() *Buffer

func (*Buffer) Append

func (b *Buffer) Append(s string)

func (*Buffer) GetName

func (b *Buffer) GetName() string

func (*Buffer) GetRootRir

func (buf *Buffer) GetRootRir() string

func (*Buffer) Mode

func (b *Buffer) Mode() Mode

func (*Buffer) ResetLines

func (b *Buffer) ResetLines()

Remove all lines

func (*Buffer) Save

func (b *Buffer) Save() error

func (*Buffer) SetMode

func (buf *Buffer) SetMode(m Mode)

func (*Buffer) String

func (b *Buffer) String() string

func (*Buffer) TxEnd

func (b *Buffer) TxEnd()

func (*Buffer) TxStart

func (b *Buffer) TxStart() (started bool)

type CompletionItems

type CompletionItems struct {
	IsIncomplete bool `json:"isIncomplete"`
	Items        []struct {
		Label         string `json:"label"`
		Kind          int    `json:"kind"`
		Detail        string `json:"detail"`
		Documentation struct {
			Kind  string `json:"kind"`
			Value string `json:"value"`
		} `json:"documentation"`
		Preselect        bool   `json:"preselect,omitempty"`
		SortText         string `json:"sortText"`
		FilterText       string `json:"filterText,omitempty"`
		InsertTextFormat int    `json:"insertTextFormat"`
		TextEdit         struct {
			NewText string `json:"newText"`
			Insert  struct {
				Start struct {
					Line      int `json:"line"`
					Character int `json:"character"`
				} `json:"start"`
				End struct {
					Line      int `json:"line"`
					Character int `json:"character"`
				} `json:"end"`
			} `json:"insert"`
			Replace struct {
				Start struct {
					Line      int `json:"line"`
					Character int `json:"character"`
				} `json:"start"`
				End struct {
					Line      int `json:"line"`
					Character int `json:"character"`
				} `json:"end"`
			} `json:"replace"`
		} `json:"textEdit"`
		AdditionalTextEdits []struct {
			Range struct {
				Start struct {
					Line      int `json:"line"`
					Character int `json:"character"`
				} `json:"start"`
				End struct {
					Line      int `json:"line"`
					Character int `json:"character"`
				} `json:"end"`
			} `json:"range"`
			NewText string `json:"newText"`
		} `json:"additionalTextEdits,omitempty"`
	} `json:"items"`
}

type Context

type Context struct {
	Editor *Editor
	Buf    *Buffer
	Count  uint32
	Char   string
}

type Cursor

type Cursor struct {
	Line                 int
	Char                 int
	PreserveCharPosition int
}

type Driver

type Driver interface {
	// Execute thing under cursor: line or seleciton
	Exec(*Editor, *Buffer, *Element[Line])
	// Execute whole buffer
	ExecBuffer()
}

Driver represents anything that can run selected text. it can be sql connection, or rest client.

type EditDiff

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

type Editor

type Editor struct {
	View    View
	Keys    *KeyHandler
	Buffers []*Buffer
	Windows []*Window

	UiComponents        []UiComponent
	ExitCh              chan int
	RedrawCh            chan int
	ScreenSyncCh        chan int
	Layout              Layout
	Yanks               List[yank]
	Projects            ProjectManager
	Message             string // display in echo area
	Lsp                 *LspManager
	Events              *EventsManager
	AutocompleteTrigger AutocompleteFn
	// contains filtered or unexported fields
}
var EditorInst *Editor

func NewEditor

func NewEditor(
	view View,
	keys *KeyHandler,
) *Editor

func (*Editor) ActiveBuffer

func (e *Editor) ActiveBuffer() *Buffer

Returns active window buffer

func (*Editor) ActiveWindow

func (e *Editor) ActiveWindow() *Window

func (*Editor) BufferFindByFilePath

func (e *Editor) BufferFindByFilePath(fp string, create bool) *Buffer

Find or create new buffer by its full file path

func (*Editor) EchoMessage

func (e *Editor) EchoMessage(msg string)

func (*Editor) EnsureBufferIsVisible

func (e *Editor) EnsureBufferIsVisible(b *Buffer)

func (*Editor) HandleInput

func (e *Editor) HandleInput(ev *tcell.EventKey)

func (*Editor) LogError

func (e *Editor) LogError(err error, echo ...bool)

func (*Editor) LogMessage

func (e *Editor) LogMessage(msg string)

func (*Editor) NewContext

func (e *Editor) NewContext() Context

func (*Editor) OpenFile

func (e *Editor) OpenFile(path string) *Buffer

func (*Editor) PopUi

func (e *Editor) PopUi()

func (*Editor) PushUi

func (e *Editor) PushUi(c UiComponent)

func (*Editor) Redraw

func (e *Editor) Redraw()

func (*Editor) RuntimeDir

func (e *Editor) RuntimeDir(elems ...string) string

func (*Editor) ScreenSync

func (e *Editor) ScreenSync()

func (*Editor) SetActiveWindow

func (e *Editor) SetActiveWindow(w *Window)

type Element

type Element[T any] struct {
	Value T
	// contains filtered or unexported fields
}

func CursorLine

func CursorLine(buf *Buffer) *Element[Line]

func CursorLineByNum

func CursorLineByNum(buf *Buffer, num int) *Element[Line]

func (*Element[T]) Next

func (e *Element[T]) Next() *Element[T]

func (*Element[T]) Prev

func (e *Element[T]) Prev() *Element[T]

type Event

type Event struct {
	Msg any
	Wg  *sync.WaitGroup
}

type EventBufferModeChange

type EventBufferModeChange struct {
	Buf     *Buffer
	OldMode Mode
	NewMode Mode
}

type EventTextChange

type EventTextChange struct {
	Buf     *Buffer
	Start   Position
	End     Position
	NewEnd  Position
	Text    string
	OldText string
}

type EventsManager

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

func NewEventsManager

func NewEventsManager() *EventsManager

func (*EventsManager) Broadcast

func (e *EventsManager) Broadcast(msg any)

this is very quick and dirty implementation. we need sync processing to not mess up lsp and treesitter. TODO: rewrite.

func (*EventsManager) Subscribe

func (e *EventsManager) Subscribe() <-chan Event

func (*EventsManager) Unsubscribe

func (e *EventsManager) Unsubscribe(ch <-chan Event)

type Highlighter

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

func (*Highlighter) Build

func (h *Highlighter) Build()

func (*Highlighter) Highlights

func (h *Highlighter) Highlights(lineStart, lineEnd uint32)

Get syntax highlights for document range TODO: this must return array of nodes

func (*Highlighter) RootNode

func (h *Highlighter) RootNode() *Element[TreeSitterRangeNode]

type Jump

type Jump struct {
	FilePath string
	Cursor   Cursor
}

Jumps

type Jumps

type Jumps struct {
	List List[Jump]
	// contains filtered or unexported fields
}

func (*Jumps) JumpBack

func (j *Jumps) JumpBack()

func (*Jumps) JumpForward

func (j *Jumps) JumpForward()

func (*Jumps) Push

func (j *Jumps) Push(b *Buffer)

type KeyFallbackFn

type KeyFallbackFn func(ctx Context, ev *tcell.EventKey)

type KeyHandler

type KeyHandler struct {
	Macros *MacrosManager
	// contains filtered or unexported fields
}

func NewKeyHandler

func NewKeyHandler(mkeymap ModeKeyMap) *KeyHandler

func (*KeyHandler) Fallback

func (k *KeyHandler) Fallback(fn func(ctx Context, ev *tcell.EventKey))

func (*KeyHandler) GetCount

func (k *KeyHandler) GetCount() int

func (*KeyHandler) GetFallback

func (k *KeyHandler) GetFallback() KeyFallbackFn

func (*KeyHandler) HandleKey

func (k *KeyHandler) HandleKey(editor *Editor, ev *tcell.EventKey, mode Mode)

func (*KeyHandler) Map

func (k *KeyHandler) Map(editor *Editor, mode Mode, newMappings KeyMap)

Map/merge keymap by selected mode

func (*KeyHandler) StartMacroRecording

func (k *KeyHandler) StartMacroRecording(reg string)

func (*KeyHandler) StopMacroRecording

func (k *KeyHandler) StopMacroRecording()

type KeyMap

type KeyMap map[string]any

type Layout

type Layout int
const (
	LayoutHorizontal Layout = 0
	LayoutVertical   Layout = 1
)

type Line

type Line []rune

func (Line) Bytes

func (l Line) Bytes() int

func (Line) IsEmpty

func (l Line) IsEmpty() bool

func (Line) Range

func (l Line) Range(from, to int) []rune

func (Line) String

func (l Line) String() string

type List

type List[T any] struct {
	Len int
	// contains filtered or unexported fields
}

the zero value is ready to use.

func FromSlice

func FromSlice[T any](slice []T) List[T]

Constructs a new List[T] from the given slice, returns the List[T].

func (*List[T]) First

func (l *List[T]) First() *Element[T]

func (*List[T]) Last

func (l *List[T]) Last() *Element[T]

func (*List[T]) PushBack

func (l *List[T]) PushBack(v T) *Element[T]

func (*List[T]) PushFront

func (l *List[T]) PushFront(v T) *Element[T]

func (*List[T]) Remove

func (l *List[T]) Remove(e *Element[T]) T

type LspManager

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

func NewLspManager

func NewLspManager(e *Editor) *LspManager

func (*LspManager) Completion

func (l *LspManager) Completion(buf *Buffer) (res CompletionItems)

func (*LspManager) Definition

func (l *LspManager) Definition(buf *Buffer, cursor Cursor) (filePath string, cur Cursor)

func (*LspManager) Diagnostics

func (m *LspManager) Diagnostics(buf *Buffer, lineNum int) []protocol.Diagnostic

TODO: return copy of diagnostics

func (*LspManager) DidChange

func (l *LspManager) DidChange(event EventTextChange)

func (*LspManager) DidClose

func (l *LspManager) DidClose(buf *Buffer)

func (*LspManager) DidOpen

func (l *LspManager) DidOpen(buf *Buffer)

func (*LspManager) Hover

func (l *LspManager) Hover(buf *Buffer, cursor Cursor) (sign string)

func (*LspManager) Signature

func (l *LspManager) Signature(buf *Buffer, cursor Cursor) (sign string)

type LspServerConfig

type LspServerConfig struct {
	Cmd []string
}

func LspConfigByFileName

func LspConfigByFileName(file string) (conf LspServerConfig, found bool)

type MacrosManager

type MacrosManager struct {
	Register string
	// contains filtered or unexported fields
}

func NewMacrosManager

func NewMacrosManager(keyHandler *KeyHandler) *MacrosManager

func (*MacrosManager) Play

func (m *MacrosManager) Play(reg string)

func (*MacrosManager) Push

func (m *MacrosManager) Push(ev *tcell.EventKey)

func (*MacrosManager) Recording

func (m *MacrosManager) Recording() bool

func (*MacrosManager) Reset

func (m *MacrosManager) Reset()

func (*MacrosManager) Start

func (m *MacrosManager) Start(reg string)

func (*MacrosManager) StartRepeatRecording

func (m *MacrosManager) StartRepeatRecording()

func (*MacrosManager) Stop

func (m *MacrosManager) Stop()

func (*MacrosManager) StopRepeatRecording

func (m *MacrosManager) StopRepeatRecording()

type Mode

type Mode int
const (
	MODE_NORMAL      Mode = 0
	MODE_INSERT      Mode = 1
	MODE_VISUAL      Mode = 2
	MODE_VISUAL_LINE Mode = 3
)

func (Mode) String

func (m Mode) String() string

type ModeKeyMap

type ModeKeyMap map[Mode]KeyMap

type Position

type Position struct {
	Line int
	Char int
}

type ProjectManager

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

func NewProjectManager

func NewProjectManager() ProjectManager

func (ProjectManager) Dir

func (p ProjectManager) Dir(buf *Buffer) (dir string)

Returns Dir of current buffer or working directory if buffer has no valid file path.

func (ProjectManager) FindRoot

func (p ProjectManager) FindRoot(buf *Buffer) (root string, err error)

Find project root by file path. Project root must have .git directory in it. otherwise "working directory" will be returned.

func (ProjectManager) GetRoot

func (p ProjectManager) GetRoot() (root string)

TODO: this must be also base on git dir

type Range

type Range struct {
	Start Position
	End   Position
}

type RenderPlane

type RenderPlane int
const (
	PlaneWin    RenderPlane = 0
	PlaneEditor RenderPlane = 1
)

type Selection

type Selection struct {
	Start Cursor
	End   Cursor
}

func SelectionNormalize

func SelectionNormalize(sel *Selection) Selection

type Stack

type Stack[T any] struct {
	// contains filtered or unexported fields
}

func (*Stack[T]) IsEmpty

func (s *Stack[T]) IsEmpty() bool

func (*Stack[T]) Pop

func (s *Stack[T]) Pop() (T, bool)

func (*Stack[T]) Push

func (s *Stack[T]) Push(element T)

type Style

type Style struct {
	Fg        string
	Bg        string
	Underline struct {
		Color string
		Style string
	}
	Modifiers []string
}

type Theme

type Theme struct {
	Colors  map[string]Style
	Palette map[string]string
}

type Transaction

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

func NewTx

func NewTx(b *Buffer) *Transaction

func (*Transaction) End

func (tx *Transaction) End()

func (*Transaction) Start

func (tx *Transaction) Start()

type TreeSitterNodeCursor

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

func NewColorNodeCursor

func NewColorNodeCursor(rootNode *Element[TreeSitterRangeNode]) *TreeSitterNodeCursor

func (*TreeSitterNodeCursor) Seek

func (c *TreeSitterNodeCursor) Seek(line, ch uint32) (node *Element[TreeSitterRangeNode], found bool)

type TreeSitterRangeNode

type TreeSitterRangeNode struct {
	NodeName  string
	StartLine uint32
	StartChar uint32
	EndLine   uint32
	EndChar   uint32
}

type UiComponent

type UiComponent interface {
	Mode() Mode
	Keymap() *KeyHandler
	Render(view View)
	Plane() RenderPlane
}

type UndoRedo

type UndoRedo struct {
	Buf      *Buffer
	History  []EditDiff
	Position int
}

func NewUndoRedo

func NewUndoRedo(buf *Buffer) *UndoRedo

func (*UndoRedo) Push

func (u *UndoRedo) Push(edits EditDiff)

func (*UndoRedo) Redo

func (u *UndoRedo) Redo()

func (*UndoRedo) Undo

func (u *UndoRedo) Undo()

type View

type View interface {
	SetContent(x, y int, str string, st tcell.Style)
	Size() (width, height int)
	Resize(x, y, width, height int)
}

type Window

type Window struct {
	Jumps *Jumps
	// contains filtered or unexported fields
}

func CreateWindow

func CreateWindow() *Window

func (*Window) Buffer

func (win *Window) Buffer() *Buffer

func (*Window) ShowBuffer

func (win *Window) ShowBuffer(buf *Buffer)

Show buffer. No history.

func (*Window) VisitBuffer

func (win *Window) VisitBuffer(buf *Buffer, cursor ...Cursor)

Jump to buffer and location. Records jump history.

type Yanks

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

Directories

Path Synopsis
drivers

Jump to

Keyboard shortcuts

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