Documentation ¶
Index ¶
- Variables
- func DebugLog(format string, a ...any)
- func IsSpace(s string) bool
- func RepeatString(s string, n int) string
- func StringLjustWidth(s string, width int) string
- type AbortAction
- type BaseHandler
- func (b *BaseHandler) ArrowDown(_ []rune)
- func (b *BaseHandler) ArrowLeft(_ []rune)
- func (b *BaseHandler) ArrowRight(_ []rune)
- func (b *BaseHandler) ArrowUp(_ []rune)
- func (b *BaseHandler) Backspace(_ []rune)
- func (b *BaseHandler) Backtab(_ []rune)
- func (b *BaseHandler) CtrlA(_ []rune)
- func (b *BaseHandler) CtrlB(_ []rune)
- func (b *BaseHandler) CtrlBackslash(_ []rune)
- func (b *BaseHandler) CtrlC(_ []rune)
- func (b *BaseHandler) CtrlCircumflex(_ []rune)
- func (b *BaseHandler) CtrlD(_ []rune)
- func (b *BaseHandler) CtrlE(_ []rune)
- func (b *BaseHandler) CtrlF(_ []rune)
- func (b *BaseHandler) CtrlG(_ []rune)
- func (b *BaseHandler) CtrlH(_ []rune)
- func (b *BaseHandler) CtrlI(_ []rune)
- func (b *BaseHandler) CtrlJ(_ []rune)
- func (b *BaseHandler) CtrlK(_ []rune)
- func (b *BaseHandler) CtrlL(_ []rune)
- func (b *BaseHandler) CtrlM(_ []rune)
- func (b *BaseHandler) CtrlN(_ []rune)
- func (b *BaseHandler) CtrlO(_ []rune)
- func (b *BaseHandler) CtrlP(_ []rune)
- func (b *BaseHandler) CtrlQ(_ []rune)
- func (b *BaseHandler) CtrlR(_ []rune)
- func (b *BaseHandler) CtrlS(_ []rune)
- func (b *BaseHandler) CtrlSpace(_ []rune)
- func (b *BaseHandler) CtrlSquareClose(_ []rune)
- func (b *BaseHandler) CtrlT(_ []rune)
- func (b *BaseHandler) CtrlU(_ []rune)
- func (b *BaseHandler) CtrlUnderscore(_ []rune)
- func (b *BaseHandler) CtrlV(_ []rune)
- func (b *BaseHandler) CtrlW(_ []rune)
- func (b *BaseHandler) CtrlX(_ []rune)
- func (b *BaseHandler) CtrlY(_ []rune)
- func (b *BaseHandler) CtrlZ(_ []rune)
- func (b *BaseHandler) DeleteAction(_ []rune)
- func (b *BaseHandler) End(_ []rune)
- func (b *BaseHandler) EscapeAction(_ []rune)
- func (b *BaseHandler) F1(_ []rune)
- func (b *BaseHandler) F10(_ []rune)
- func (b *BaseHandler) F11(_ []rune)
- func (b *BaseHandler) F12(_ []rune)
- func (b *BaseHandler) F13(_ []rune)
- func (b *BaseHandler) F14(_ []rune)
- func (b *BaseHandler) F15(_ []rune)
- func (b *BaseHandler) F16(_ []rune)
- func (b *BaseHandler) F17(_ []rune)
- func (b *BaseHandler) F18(_ []rune)
- func (b *BaseHandler) F19(_ []rune)
- func (b *BaseHandler) F2(_ []rune)
- func (b *BaseHandler) F20(_ []rune)
- func (b *BaseHandler) F3(_ []rune)
- func (b *BaseHandler) F4(_ []rune)
- func (b *BaseHandler) F5(_ []rune)
- func (b *BaseHandler) F6(_ []rune)
- func (b *BaseHandler) F7(_ []rune)
- func (b *BaseHandler) F8(_ []rune)
- func (b *BaseHandler) F9(_ []rune)
- func (b *BaseHandler) Handle(event Event)
- func (b *BaseHandler) Home(_ []rune)
- func (b *BaseHandler) InsertChar(data []rune)
- func (b *BaseHandler) PageDown(_ []rune)
- func (b *BaseHandler) PageUp(_ []rune)
- type BasePrompt
- type Char
- type Code
- type CodeFactory
- type CommandLine
- func (c *CommandLine) Close()
- func (c *CommandLine) GetLine() *Line
- func (c *CommandLine) GetRenderer() *Renderer
- func (c *CommandLine) IsReadingInput() bool
- func (c *CommandLine) Print(a ...any)
- func (c *CommandLine) Printf(format string, a ...any)
- func (c *CommandLine) Println(a ...any)
- func (c *CommandLine) ReadInput() (string, error)
- func (c *CommandLine) ReadRune() (rune, error)
- func (c *CommandLine) RequestRedraw()
- func (c *CommandLine) RunInExecutor(callback func())
- func (c *CommandLine) SetAbortFlag()
- func (c *CommandLine) SetAcceptFlag()
- func (c *CommandLine) SetExitFlag()
- func (c *CommandLine) SetOnAbort(action AbortAction)
- func (c *CommandLine) SetOnExit(action AbortAction)
- type CommandLineOption
- type Completion
- type Coordinate
- type Document
- func (d *Document) CharBeforeCursor() string
- func (d *Document) CurrentChar() string
- func (d *Document) CurrentLine() string
- func (d *Document) CurrentLineAfterCursor() string
- func (d *Document) CurrentLineBeforeCursor() string
- func (d *Document) CursorDownPosition() int
- func (d *Document) CursorPosition() int
- func (d *Document) CursorPositionCol() int
- func (d *Document) CursorPositionRow() int
- func (d *Document) CursorUpPosition() int
- func (d *Document) EmptyLineCountAtTheEnd() int
- func (d *Document) Equal(other *Document) bool
- func (d *Document) GetWordBeforeCursor() string
- func (d *Document) LeadingWhitespaceInCurrentLine() string
- func (d *Document) LineCount() int
- func (d *Document) OnFirstLine() bool
- func (d *Document) OnLastLine() bool
- func (d *Document) String() string
- func (d *Document) Text() string
- func (d *Document) TextAfterCursor() string
- func (d *Document) TextBeforeCursor() string
- type Event
- type EventBuffer
- type EventHandler
- type EventKey
- type EventMouse
- type EventType
- type FileHistory
- type History
- type InputStream
- type Line
- func (l *Line) AcceptComplete()
- func (l *Line) AcceptInput()
- func (l *Line) AutoDown()
- func (l *Line) AutoEnter()
- func (l *Line) AutoUp()
- func (l *Line) CancelComplete()
- func (l *Line) Complete() bool
- func (l *Line) CompleteAfterInsertText() bool
- func (l *Line) CompleteNext(count int)
- func (l *Line) CompletePrevious(count int)
- func (l *Line) CreateCode() Code
- func (l *Line) CursorDown()
- func (l *Line) CursorLeft()
- func (l *Line) CursorRight()
- func (l *Line) CursorToEndOfLine()
- func (l *Line) CursorToEndOfWord()
- func (l *Line) CursorToStartOfLine(afterWhitespace bool)
- func (l *Line) CursorUp()
- func (l *Line) CursorWordBack()
- func (l *Line) CursorWordForward()
- func (l *Line) Dblclick(location Location)
- func (l *Line) DeleteCharacterAfterCursor(count int) string
- func (l *Line) DeleteCharacterBeforeCursor(count int) string
- func (l *Line) DeleteCurrentLine() string
- func (l *Line) DeleteFromStartOfLine() string
- func (l *Line) DeleteUntilEndOfLine() string
- func (l *Line) DeleteWord() string
- func (l *Line) DeleteWordBeforeCursor() string
- func (l *Line) Document() *Document
- func (l *Line) End()
- func (l *Line) GetCursorPosition() int
- func (l *Line) GetRenderContext() *RenderContext
- func (l *Line) GotoMatchingBracket()
- func (l *Line) HasText() bool
- func (l *Line) HistoryBackward()
- func (l *Line) HistoryForward()
- func (l *Line) Home()
- func (l *Line) InsertLineAbove(copyMargin bool)
- func (l *Line) InsertLineBelow(copyMargin bool)
- func (l *Line) InsertText(data []rune, moveCursor bool)
- func (l *Line) IsAccept() bool
- func (l *Line) IsMultiline() bool
- func (l *Line) JoinNextLine()
- func (l *Line) ListCompletions()
- func (l *Line) MouseDown(info *MouseInfoOfInput)
- func (l *Line) MouseMove(location Location)
- func (l *Line) MouseUp(location Location)
- func (l *Line) Newline()
- func (l *Line) OverwriteText(data []rune, moveCursor bool)
- func (l *Line) SaveToUndoStack()
- func (l *Line) SetCursorPosition(v int)
- func (l *Line) StartComplete(gotoFirst bool)
- func (l *Line) SwapCharactersBeforeCursor()
- func (l *Line) ToMode(modes ...linemode.LineMode)
- func (l *Line) ToNormalMode()
- func (l *Line) TransformLines(start int, end int, transformCallback func(string) string)
- func (l *Line) TransformRegion(from int, to int, transformCallback func(string) string)
- func (l *Line) Undo()
- type Location
- type MemHistory
- type MouseInfoOfInput
- type PollEvent
- type Prompt
- type PromptFactory
- type RenderContext
- type Renderer
- type Schema
- type Screen
- func (s *Screen) CurrentHeight() int
- func (s *Screen) GetBuffer() map[int]map[int]*Char
- func (s *Screen) Output(offsetY int) (string, Coordinate)
- func (s *Screen) ReverseStyle(start Coordinate, end Coordinate)
- func (s *Screen) Width() int
- func (s *Screen) WriteRune(r rune, style *terminalcolor.ColorStyle, saveInputPos bool)
- func (s *Screen) WriteTokens(tokens []token.Token, saveInputPos bool)
- func (s *Screen) WriteTokensAtPos(x int, y int, tokens []token.Token)
- type TBaseEventHandler
- func (tb *TBaseEventHandler) ArrowDown(_ []rune)
- func (tb *TBaseEventHandler) ArrowLeft(_ []rune)
- func (tb *TBaseEventHandler) ArrowRight(_ []rune)
- func (tb *TBaseEventHandler) ArrowUp(_ []rune)
- func (tb *TBaseEventHandler) Backspace(_ []rune)
- func (tb *TBaseEventHandler) Backtab(_ []rune)
- func (tb *TBaseEventHandler) CtrlA(_ []rune)
- func (tb *TBaseEventHandler) CtrlB(_ []rune)
- func (tb *TBaseEventHandler) CtrlBackslash(_ []rune)
- func (tb *TBaseEventHandler) CtrlC(_ []rune)
- func (tb *TBaseEventHandler) CtrlCircumflex(_ []rune)
- func (tb *TBaseEventHandler) CtrlD(_ []rune)
- func (tb *TBaseEventHandler) CtrlE(_ []rune)
- func (tb *TBaseEventHandler) CtrlF(_ []rune)
- func (tb *TBaseEventHandler) CtrlG(_ []rune)
- func (tb *TBaseEventHandler) CtrlH(_ []rune)
- func (tb *TBaseEventHandler) CtrlI(_ []rune)
- func (tb *TBaseEventHandler) CtrlJ(_ []rune)
- func (tb *TBaseEventHandler) CtrlK(_ []rune)
- func (tb *TBaseEventHandler) CtrlL(_ []rune)
- func (tb *TBaseEventHandler) CtrlM(_ []rune)
- func (tb *TBaseEventHandler) CtrlN(_ []rune)
- func (tb *TBaseEventHandler) CtrlO(_ []rune)
- func (tb *TBaseEventHandler) CtrlP(_ []rune)
- func (tb *TBaseEventHandler) CtrlQ(_ []rune)
- func (tb *TBaseEventHandler) CtrlR(_ []rune)
- func (tb *TBaseEventHandler) CtrlS(_ []rune)
- func (tb *TBaseEventHandler) CtrlSpace(_ []rune)
- func (tb *TBaseEventHandler) CtrlSquareClose(_ []rune)
- func (tb *TBaseEventHandler) CtrlT(_ []rune)
- func (tb *TBaseEventHandler) CtrlU(_ []rune)
- func (tb *TBaseEventHandler) CtrlUnderscore(_ []rune)
- func (tb *TBaseEventHandler) CtrlV(_ []rune)
- func (tb *TBaseEventHandler) CtrlW(_ []rune)
- func (tb *TBaseEventHandler) CtrlX(_ []rune)
- func (tb *TBaseEventHandler) CtrlY(_ []rune)
- func (tb *TBaseEventHandler) CtrlZ(_ []rune)
- func (tb *TBaseEventHandler) DeleteAction(_ []rune)
- func (tb *TBaseEventHandler) End(_ []rune)
- func (tb *TBaseEventHandler) EscapeAction(_ []rune)
- func (tb *TBaseEventHandler) F1(_ []rune)
- func (tb *TBaseEventHandler) F10(_ []rune)
- func (tb *TBaseEventHandler) F11(_ []rune)
- func (tb *TBaseEventHandler) F12(_ []rune)
- func (tb *TBaseEventHandler) F13(_ []rune)
- func (tb *TBaseEventHandler) F14(_ []rune)
- func (tb *TBaseEventHandler) F15(_ []rune)
- func (tb *TBaseEventHandler) F16(_ []rune)
- func (tb *TBaseEventHandler) F17(_ []rune)
- func (tb *TBaseEventHandler) F18(_ []rune)
- func (tb *TBaseEventHandler) F19(_ []rune)
- func (tb *TBaseEventHandler) F2(_ []rune)
- func (tb *TBaseEventHandler) F20(_ []rune)
- func (tb *TBaseEventHandler) F3(_ []rune)
- func (tb *TBaseEventHandler) F4(_ []rune)
- func (tb *TBaseEventHandler) F5(_ []rune)
- func (tb *TBaseEventHandler) F6(_ []rune)
- func (tb *TBaseEventHandler) F7(_ []rune)
- func (tb *TBaseEventHandler) F8(_ []rune)
- func (tb *TBaseEventHandler) F9(_ []rune)
- func (tb *TBaseEventHandler) Handle(event Event)
- func (tb *TBaseEventHandler) HandleEventKey(ek *EventKey)
- func (tb *TBaseEventHandler) HandleEventMouse(em *EventMouse)
- func (tb *TBaseEventHandler) Home(_ []rune)
- func (tb *TBaseEventHandler) InsertChar(data []rune)
- func (tb *TBaseEventHandler) PageDown(_ []rune)
- func (tb *TBaseEventHandler) PageUp(_ []rune)
- type TCommandLine
- func (tc *TCommandLine) Close()
- func (tc *TCommandLine) GetLine() *Line
- func (tc *TCommandLine) GetRenderer() *TRenderer
- func (tc *TCommandLine) IsDblClick(ev *tcell.EventMouse) bool
- func (tc *TCommandLine) IsReadingInput() bool
- func (tc *TCommandLine) IsTripleClick(ev *tcell.EventMouse) bool
- func (tc *TCommandLine) Print(a ...any)
- func (tc *TCommandLine) Printf(format string, a ...any)
- func (tc *TCommandLine) Println(a ...any)
- func (tc *TCommandLine) ReadInput() (string, error)
- func (tc *TCommandLine) ReadRune() (rune, error)
- func (tc *TCommandLine) RequestRedraw()
- func (tc *TCommandLine) RunInExecutor(callback func())
- func (tc *TCommandLine) SetAbort()
- func (tc *TCommandLine) SetAccept()
- func (tc *TCommandLine) SetExit()
- func (tc *TCommandLine) SetOnAbort(action AbortAction)
- func (tc *TCommandLine) SetOnExit(action AbortAction)
- func (tc *TCommandLine) Write(p []byte) (int, error)
- type TRenderer
- func (tr *TRenderer) Clear()
- func (tr *TRenderer) Dblclick(coordinate Coordinate)
- func (tr *TRenderer) GetClosetLocation(coordinate Coordinate) (Location, bool)
- func (tr *TRenderer) GetMouseInfoOfInput(coordinate Coordinate) *MouseInfoOfInput
- func (tr *TRenderer) LineInInputArea(y int) bool
- func (tr *TRenderer) LineInTextArea(y int) bool
- func (tr *TRenderer) MouseDown(coordinate Coordinate)
- func (tr *TRenderer) MouseMove(coordinate Coordinate)
- func (tr *TRenderer) MouseUp(coordinate Coordinate)
- func (tr *TRenderer) Resize()
- func (tr *TRenderer) Show()
- func (tr *TRenderer) TriggerEventKey()
- func (tr *TRenderer) TriggerEventMouse()
- func (tr *TRenderer) TripeClick(coordinate Coordinate)
- func (tr *TRenderer) WheelDown(n int)
- func (tr *TRenderer) WheelUp(n int)
Constants ¶
This section is empty.
Variables ¶
var AbortError = errors.New("user abort")
AbortError 用户中断,一般是 Ctrl-C 触发 ExitError 用户停止,一般是 Ctrl-D 触发
var ExitError = errors.New("user exit")
Functions ¶
func RepeatString ¶ added in v0.0.5
RepeatString 将 n 个字符串 s 拼接在一起
func StringLjustWidth ¶ added in v0.0.4
StringLjustWidth 返回指定宽度左对齐的字符串,不够的右边补空格
Types ¶
type AbortAction ¶
type AbortAction string
const ( // AbortActionUnspecific 空值 AbortActionUnspecific AbortAction = "" // AbortActionIgnore 忽略此次操作 AbortActionIgnore AbortAction = "ignore" // AbortActionRetry 让用户重新输入 AbortActionRetry AbortAction = "retry" // AbortActionReturnError 返回错误,一般是 AbortError 或 ExitError AbortActionReturnError AbortAction = "return_error" // AbortActionReturnNone 返回空 AbortActionReturnNone AbortAction = "return_none" )
type BaseHandler ¶
type BaseHandler struct {
// contains filtered or unexported fields
}
func (*BaseHandler) ArrowDown ¶ added in v0.0.5
func (b *BaseHandler) ArrowDown(_ []rune)
func (*BaseHandler) ArrowLeft ¶ added in v0.0.5
func (b *BaseHandler) ArrowLeft(_ []rune)
func (*BaseHandler) ArrowRight ¶ added in v0.0.5
func (b *BaseHandler) ArrowRight(_ []rune)
func (*BaseHandler) ArrowUp ¶ added in v0.0.5
func (b *BaseHandler) ArrowUp(_ []rune)
func (*BaseHandler) Backspace ¶ added in v0.0.5
func (b *BaseHandler) Backspace(_ []rune)
func (*BaseHandler) Backtab ¶ added in v0.0.5
func (b *BaseHandler) Backtab(_ []rune)
func (*BaseHandler) CtrlA ¶ added in v0.0.5
func (b *BaseHandler) CtrlA(_ []rune)
func (*BaseHandler) CtrlB ¶ added in v0.0.5
func (b *BaseHandler) CtrlB(_ []rune)
func (*BaseHandler) CtrlBackslash ¶ added in v0.0.5
func (b *BaseHandler) CtrlBackslash(_ []rune)
func (*BaseHandler) CtrlC ¶ added in v0.0.5
func (b *BaseHandler) CtrlC(_ []rune)
func (*BaseHandler) CtrlCircumflex ¶ added in v0.0.5
func (b *BaseHandler) CtrlCircumflex(_ []rune)
func (*BaseHandler) CtrlD ¶ added in v0.0.5
func (b *BaseHandler) CtrlD(_ []rune)
func (*BaseHandler) CtrlE ¶ added in v0.0.5
func (b *BaseHandler) CtrlE(_ []rune)
func (*BaseHandler) CtrlF ¶ added in v0.0.5
func (b *BaseHandler) CtrlF(_ []rune)
func (*BaseHandler) CtrlG ¶ added in v0.0.5
func (b *BaseHandler) CtrlG(_ []rune)
func (*BaseHandler) CtrlH ¶ added in v0.0.5
func (b *BaseHandler) CtrlH(_ []rune)
func (*BaseHandler) CtrlI ¶ added in v0.0.5
func (b *BaseHandler) CtrlI(_ []rune)
func (*BaseHandler) CtrlJ ¶ added in v0.0.5
func (b *BaseHandler) CtrlJ(_ []rune)
func (*BaseHandler) CtrlK ¶ added in v0.0.5
func (b *BaseHandler) CtrlK(_ []rune)
func (*BaseHandler) CtrlL ¶ added in v0.0.5
func (b *BaseHandler) CtrlL(_ []rune)
func (*BaseHandler) CtrlM ¶ added in v0.0.5
func (b *BaseHandler) CtrlM(_ []rune)
func (*BaseHandler) CtrlN ¶ added in v0.0.5
func (b *BaseHandler) CtrlN(_ []rune)
func (*BaseHandler) CtrlO ¶ added in v0.0.5
func (b *BaseHandler) CtrlO(_ []rune)
func (*BaseHandler) CtrlP ¶ added in v0.0.5
func (b *BaseHandler) CtrlP(_ []rune)
func (*BaseHandler) CtrlQ ¶ added in v0.0.5
func (b *BaseHandler) CtrlQ(_ []rune)
func (*BaseHandler) CtrlR ¶ added in v0.0.5
func (b *BaseHandler) CtrlR(_ []rune)
func (*BaseHandler) CtrlS ¶ added in v0.0.5
func (b *BaseHandler) CtrlS(_ []rune)
func (*BaseHandler) CtrlSpace ¶ added in v0.0.5
func (b *BaseHandler) CtrlSpace(_ []rune)
func (*BaseHandler) CtrlSquareClose ¶ added in v0.0.5
func (b *BaseHandler) CtrlSquareClose(_ []rune)
func (*BaseHandler) CtrlT ¶ added in v0.0.5
func (b *BaseHandler) CtrlT(_ []rune)
func (*BaseHandler) CtrlU ¶ added in v0.0.5
func (b *BaseHandler) CtrlU(_ []rune)
func (*BaseHandler) CtrlUnderscore ¶ added in v0.0.5
func (b *BaseHandler) CtrlUnderscore(_ []rune)
func (*BaseHandler) CtrlV ¶ added in v0.0.5
func (b *BaseHandler) CtrlV(_ []rune)
func (*BaseHandler) CtrlW ¶ added in v0.0.5
func (b *BaseHandler) CtrlW(_ []rune)
func (*BaseHandler) CtrlX ¶ added in v0.0.5
func (b *BaseHandler) CtrlX(_ []rune)
func (*BaseHandler) CtrlY ¶ added in v0.0.5
func (b *BaseHandler) CtrlY(_ []rune)
func (*BaseHandler) CtrlZ ¶ added in v0.0.5
func (b *BaseHandler) CtrlZ(_ []rune)
func (*BaseHandler) DeleteAction ¶ added in v0.0.5
func (b *BaseHandler) DeleteAction(_ []rune)
func (*BaseHandler) End ¶ added in v0.0.5
func (b *BaseHandler) End(_ []rune)
func (*BaseHandler) EscapeAction ¶ added in v0.0.5
func (b *BaseHandler) EscapeAction(_ []rune)
func (*BaseHandler) F1 ¶ added in v0.0.5
func (b *BaseHandler) F1(_ []rune)
func (*BaseHandler) F10 ¶ added in v0.0.5
func (b *BaseHandler) F10(_ []rune)
func (*BaseHandler) F11 ¶ added in v0.0.5
func (b *BaseHandler) F11(_ []rune)
func (*BaseHandler) F12 ¶ added in v0.0.5
func (b *BaseHandler) F12(_ []rune)
func (*BaseHandler) F13 ¶ added in v0.0.5
func (b *BaseHandler) F13(_ []rune)
func (*BaseHandler) F14 ¶ added in v0.0.5
func (b *BaseHandler) F14(_ []rune)
func (*BaseHandler) F15 ¶ added in v0.0.5
func (b *BaseHandler) F15(_ []rune)
func (*BaseHandler) F16 ¶ added in v0.0.5
func (b *BaseHandler) F16(_ []rune)
func (*BaseHandler) F17 ¶ added in v0.0.5
func (b *BaseHandler) F17(_ []rune)
func (*BaseHandler) F18 ¶ added in v0.0.5
func (b *BaseHandler) F18(_ []rune)
func (*BaseHandler) F19 ¶ added in v0.0.5
func (b *BaseHandler) F19(_ []rune)
func (*BaseHandler) F2 ¶ added in v0.0.5
func (b *BaseHandler) F2(_ []rune)
func (*BaseHandler) F20 ¶ added in v0.0.5
func (b *BaseHandler) F20(_ []rune)
func (*BaseHandler) F3 ¶ added in v0.0.5
func (b *BaseHandler) F3(_ []rune)
func (*BaseHandler) F4 ¶ added in v0.0.5
func (b *BaseHandler) F4(_ []rune)
func (*BaseHandler) F5 ¶ added in v0.0.5
func (b *BaseHandler) F5(_ []rune)
func (*BaseHandler) F6 ¶ added in v0.0.5
func (b *BaseHandler) F6(_ []rune)
func (*BaseHandler) F7 ¶ added in v0.0.5
func (b *BaseHandler) F7(_ []rune)
func (*BaseHandler) F8 ¶ added in v0.0.5
func (b *BaseHandler) F8(_ []rune)
func (*BaseHandler) F9 ¶ added in v0.0.5
func (b *BaseHandler) F9(_ []rune)
func (*BaseHandler) Handle ¶
func (b *BaseHandler) Handle(event Event)
func (*BaseHandler) Home ¶ added in v0.0.5
func (b *BaseHandler) Home(_ []rune)
func (*BaseHandler) InsertChar ¶ added in v0.0.5
func (b *BaseHandler) InsertChar(data []rune)
func (*BaseHandler) PageDown ¶ added in v0.0.5
func (b *BaseHandler) PageDown(_ []rune)
func (*BaseHandler) PageUp ¶ added in v0.0.5
func (b *BaseHandler) PageUp(_ []rune)
type BasePrompt ¶ added in v0.0.6
type BasePrompt struct { }
func (*BasePrompt) GetPrompt ¶ added in v0.0.6
func (b *BasePrompt) GetPrompt() []token.Token
func (*BasePrompt) GetSecondLinePrefix ¶ added in v0.0.6
func (b *BasePrompt) GetSecondLinePrefix() []token.Token
type Code ¶
type Code interface { // GetTokens 返回分词后的 Token 列表 GetTokens() []token.Token // Complete 返回补全文本,可以直接添加在用户输入后,例如按一次 tab 便出现的补全 // 返回空字符串表示没有可直接添加的补全 Complete() string // GetCompletions 返回当前可选的补全列表,供用户选择,例如连按两次 tab 出现的补全列表 GetCompletions() []*Completion // ContinueInput 用户按下 Enter 键时调用, // 返回 true 时,会插入换行符 // 返回 false 时,表示用户本次输入完成, CommandLine.ReadInput(TCommandLine.ReadInput) 则会返回用户输入 ContinueInput() bool // CompleteAfterInsertText 返回 true 表示每次插入文本我们都获取一次补全 CompleteAfterInsertText() bool }
type CodeFactory ¶ added in v0.0.6
type CommandLine ¶
type CommandLine struct {
// contains filtered or unexported fields
}
func NewCommandLine ¶
func NewCommandLine(option *CommandLineOption) (*CommandLine, error)
NewCommandLine 传入配置,新建命令行对象
func (*CommandLine) GetLine ¶ added in v0.0.9
func (c *CommandLine) GetLine() *Line
GetLine 获取当前的 Line 对象,如果为 nil ,则 panic
func (*CommandLine) GetRenderer ¶ added in v0.0.9
func (c *CommandLine) GetRenderer() *Renderer
GetRenderer 获取当前的 Renderer 对象,如果为 nil ,则 panic
func (*CommandLine) IsReadingInput ¶ added in v0.0.9
func (c *CommandLine) IsReadingInput() bool
IsReadingInput 是否正在读取输入
func (*CommandLine) Printf ¶
func (c *CommandLine) Printf(format string, a ...any)
Printf 输出格式化字符串,类似 fmt.Printf
func (*CommandLine) Println ¶ added in v0.0.9
func (c *CommandLine) Println(a ...any)
Println 输出一行字符串,类似 fmt.Println
func (*CommandLine) ReadRune ¶ added in v0.0.11
func (c *CommandLine) ReadRune() (rune, error)
ReadRune 读取 rune ,不能与 ReadInput 同时调用
func (*CommandLine) RequestRedraw ¶ added in v0.0.6
func (c *CommandLine) RequestRedraw()
RequestRedraw 请求重绘( goroutine 安全)
func (*CommandLine) RunInExecutor ¶ added in v0.0.6
func (c *CommandLine) RunInExecutor(callback func())
RunInExecutor 运行后台任务
func (*CommandLine) SetAbortFlag ¶ added in v0.0.16
func (c *CommandLine) SetAbortFlag()
SetAbortFlag 设置中断标志
func (*CommandLine) SetAcceptFlag ¶ added in v0.0.16
func (c *CommandLine) SetAcceptFlag()
SetAcceptFlag 设置(本次输入)完成标志
func (*CommandLine) SetExitFlag ¶ added in v0.0.16
func (c *CommandLine) SetExitFlag()
SetExitFlag 设置停止标志
func (*CommandLine) SetOnAbort ¶ added in v0.0.6
func (c *CommandLine) SetOnAbort(action AbortAction)
SetOnAbort 设置用户中断时的动作
func (*CommandLine) SetOnExit ¶ added in v0.0.6
func (c *CommandLine) SetOnExit(action AbortAction)
SetOnExit 设置用户停止时的动作
type CommandLineOption ¶
type CommandLineOption struct { // Schema token 样式(主要是颜色、加粗等) Schema Schema // Handler 事件处理器 Handler EventHandler // History 输入历史存储 History History // CodeFactory Code 类工厂方法 CodeFactory CodeFactory // PromptFactory Prompt 类工厂方法 PromptFactory PromptFactory // OnExit 用户停止时动作(Ctrl-D) OnExit AbortAction // OnAbort 用户中断时动作(Ctrl-C) OnAbort AbortAction // 自动缩进,如果开启,新行的缩进会与上一行保持一致 AutoIndent bool // 开启 debug 日志 EnableDebug bool }
CommandLineOption 命令行选项
type Completion ¶
type Coordinate ¶
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
Document 一个不可修改的数据结构,用于保存文本和光标位置
func NewDocument ¶
NewDocument 新建 Document 对象
func (*Document) CharBeforeCursor ¶ added in v0.0.2
CharBeforeCursor 返回光标前(左)字符
func (*Document) CurrentChar ¶ added in v0.0.2
CurrentChar 返回光标处字符
func (*Document) CurrentLine ¶ added in v0.0.2
CurrentLine 返回光标所在行文本(不包括换行符)
func (*Document) CurrentLineAfterCursor ¶ added in v0.0.2
CurrentLineAfterCursor 返回光标到行尾的文本(不包括换行符)
func (*Document) CurrentLineBeforeCursor ¶ added in v0.0.2
CurrentLineBeforeCursor 返回行首到光标处的文本
func (*Document) CursorDownPosition ¶
CursorDownPosition 返回光标往下移动一行后位置。如果光标位于最后一行,返回 -1 。
func (*Document) CursorPosition ¶
CursorPosition 返回 Document 的光标位置
func (*Document) CursorPositionCol ¶
CursorPositionCol 返回光标所在的列号(从 0 开始计数)
func (*Document) CursorPositionRow ¶
CursorPositionRow 返回光标所在行号(从 0 开始计数)
func (*Document) CursorUpPosition ¶
CursorUpPosition 返回光标往上移动一行后位置。如果光标位于第一行,返回 -1 。
func (*Document) EmptyLineCountAtTheEnd ¶ added in v0.0.9
EmptyLineCountAtTheEnd 统计输入文本中底部空行数量
func (*Document) GetWordBeforeCursor ¶ added in v0.0.9
GetWordBeforeCursor 获取光标前的单词
func (*Document) LeadingWhitespaceInCurrentLine ¶ added in v0.0.2
LeadingWhitespaceInCurrentLine 返回当前行开始处的空白字符
func (*Document) OnFirstLine ¶ added in v0.0.2
OnFirstLine 光标是否在第一行
func (*Document) OnLastLine ¶ added in v0.0.2
OnLastLine 光标是否在最后一行
func (*Document) TextAfterCursor ¶ added in v0.0.2
TextAfterCursor 返回光标后(右)文本
func (*Document) TextBeforeCursor ¶ added in v0.0.2
TextBeforeCursor 返回光标前(左)文本
type EventBuffer ¶ added in v0.0.15
type EventBuffer struct {
// contains filtered or unexported fields
}
type EventHandler ¶ added in v0.0.9
type EventHandler interface {
Handle(event Event)
}
type EventKey ¶ added in v0.0.9
type EventKey struct {
// contains filtered or unexported fields
}
EventKey 代表键盘事件
func NewEventKey ¶ added in v0.0.9
func NewEventKey(eventType EventType, data []rune, cli *CommandLine, tcli *TCommandLine) *EventKey
func (*EventKey) GetCommandLine ¶ added in v0.0.9
func (ek *EventKey) GetCommandLine() *CommandLine
func (*EventKey) GetTCommandLine ¶ added in v0.0.9
func (ek *EventKey) GetTCommandLine() *TCommandLine
type EventMouse ¶ added in v0.0.9
type EventMouse struct {
// contains filtered or unexported fields
}
EventMouse 代表鼠标事件
func NewEventMouse ¶ added in v0.0.9
func NewEventMouse( eventType EventType, coordinate Coordinate, cli *CommandLine, tcli *TCommandLine, ) *EventMouse
func (*EventMouse) GetCommandLine ¶ added in v0.0.9
func (em *EventMouse) GetCommandLine() *CommandLine
func (*EventMouse) GetCoordinate ¶ added in v0.0.9
func (em *EventMouse) GetCoordinate() Coordinate
func (*EventMouse) GetTCommandLine ¶ added in v0.0.9
func (em *EventMouse) GetTCommandLine() *TCommandLine
func (*EventMouse) Type ¶ added in v0.0.9
func (em *EventMouse) Type() EventType
type EventType ¶ added in v0.0.9
type EventType int
const ( EventTypeCtrlA EventType = iota EventTypeCtrlB EventTypeCtrlC EventTypeCtrlD EventTypeCtrlE EventTypeCtrlF EventTypeCtrlG // EventTypeCtrlH Control-H (8) (Identical to '\b') EventTypeCtrlH // EventTypeCtrlI Control-I (9) (Identical to '\t') EventTypeCtrlI // EventTypeCtrlJ Control-J (10) (Identical to '\n') EventTypeCtrlJ EventTypeCtrlK // EventTypeCtrlL Control-L (Clear; form feed) EventTypeCtrlL // EventTypeCtrlM Control-M (13) (Identical to '\r') EventTypeCtrlM EventTypeCtrlN EventTypeCtrlO EventTypeCtrlP EventTypeCtrlQ EventTypeCtrlR EventTypeCtrlS EventTypeCtrlT EventTypeCtrlU EventTypeCtrlV EventTypeCtrlW EventTypeCtrlX EventTypeCtrlY EventTypeCtrlZ // EventTypeCtrlSpace Control-Space (Also for Ctrl-@) EventTypeCtrlSpace // EventTypeCtrlBackslash Both Control-\ and Ctrl-| EventTypeCtrlBackslash // EventTypeCtrlSquareClose Control-] EventTypeCtrlSquareClose // EventTypeCtrlCircumflex Control-^ EventTypeCtrlCircumflex // EventTypeCtrlUnderscore Control-underscore (Also for Ctrl-hypen.) EventTypeCtrlUnderscore // EventTypeBackspace (127) Backspace EventTypeBackspace EventTypeArrowUp EventTypeArrowDown EventTypeArrowRight EventTypeArrowLeft EventTypeHome EventTypeEnd EventTypeDeleteAction EventTypeShiftDelete EventTypePageUp EventTypePageDown EventTypeBacktab EventTypeF1 EventTypeF2 EventTypeF3 EventTypeF4 EventTypeF5 EventTypeF6 EventTypeF7 EventTypeF8 EventTypeF9 EventTypeF10 EventTypeF11 EventTypeF12 EventTypeF13 EventTypeF14 EventTypeF15 EventTypeF16 EventTypeF17 EventTypeF18 EventTypeF19 EventTypeF20 EventTypeEscape EventTypeInsertChar // EventTypeMouseWheelUp EventTypeMouseWheelDown 鼠标滚轮 EventTypeMouseWheelUp EventTypeMouseWheelDown // EventTypeMouseUp 松开鼠标左键 EventTypeMouseUp // EventTypeMouseDown 按下鼠标左键 EventTypeMouseDown // EventTypeMouseMove 按下鼠标左键并且移动 EventTypeMouseMove // EventTypeMouseDblclick 鼠标左键双击 EventTypeMouseDblclick // EventTypeMouseTripleClick 鼠标左键三击 EventTypeMouseTripleClick EventTypeTab = EventTypeCtrlI )
type FileHistory ¶
type FileHistory struct { MemHistory // contains filtered or unexported fields }
func NewFileHistory ¶
func NewFileHistory(filename string) *FileHistory
func (*FileHistory) Append ¶
func (fh *FileHistory) Append(s string)
type InputStream ¶
type InputStream struct {
// contains filtered or unexported fields
}
func NewInputStream ¶
func NewInputStream(handler EventHandler, cli *CommandLine) *InputStream
func (*InputStream) FeedData ¶ added in v0.0.8
func (is *InputStream) FeedData(data string)
func (*InputStream) FeedRunes ¶ added in v0.0.13
func (is *InputStream) FeedRunes(runes []rune)
func (*InputStream) FeedTimeout ¶ added in v0.0.9
func (is *InputStream) FeedTimeout() bool
FeedTimeout 超时通知,主要用来快速触发 Esc 事件 返回值表示是否有事件触发
因为 ANSI 转义序列都是 Esc 开头 导致无法区分 Esc 和其他的快捷键,只能等待后续字符,再做判断 因此按下 Esc 后不会有事件触发,现在通过超时来快速识别 Esc 键
func (*InputStream) Reset ¶ added in v0.0.9
func (is *InputStream) Reset()
type Line ¶
type Line struct {
// contains filtered or unexported fields
}
func (*Line) AcceptComplete ¶ added in v0.0.9
func (l *Line) AcceptComplete()
AcceptComplete 接受当前选中的补全
func (*Line) AcceptInput ¶ added in v0.0.9
func (l *Line) AcceptInput()
AcceptInput 确定用户输入(一般是用户按下 Enter)
func (*Line) AutoDown ¶
func (l *Line) AutoDown()
AutoDown 根据不同的情况,触发不同的效果,如下 如果在补全状态下,会移动到下一个补全 如果光标不在第一行,移动光标到下一行 否则切换到下一个历史输入
func (*Line) AutoUp ¶
func (l *Line) AutoUp()
AutoUp 根据不同的情况,触发不同的效果,如下 如果在补全状态下,会移动到上一个补全 如果光标不在第一行,移动光标到上一行 否则切换到上一个历史输入
func (*Line) CompleteAfterInsertText ¶ added in v0.0.9
CompleteAfterInsertText 返回 true 表示每次插入文本我们都获取一次补全
func (*Line) CompletePrevious ¶
CompletePrevious 选择上面第 count 个补全
func (*Line) CreateCode ¶ added in v0.0.8
func (*Line) CursorDown ¶
func (l *Line) CursorDown()
func (*Line) CursorLeft ¶
func (l *Line) CursorLeft()
func (*Line) CursorRight ¶
func (l *Line) CursorRight()
func (*Line) CursorToEndOfWord ¶
func (l *Line) CursorToEndOfWord()
CursorToEndOfWord 向右移动光标到单词的最后一个字符的左边
func (*Line) CursorToStartOfLine ¶
CursorToStartOfLine 移动光标到当前行的行首 afterWhitespace 为 true ,则是将光标移动到当前行第一个非空字符处
func (*Line) DeleteCharacterAfterCursor ¶
DeleteCharacterAfterCursor 删除光标后面指定数量的字符并返回删除的字符
func (*Line) DeleteCharacterBeforeCursor ¶
func (*Line) DeleteCurrentLine ¶
DeleteCurrentLine 删除当前行,返回删除的文本
func (*Line) DeleteFromStartOfLine ¶
DeleteFromStartOfLine 删除从行首到光标处的字符,返回删除的文本
func (*Line) DeleteUntilEndOfLine ¶
DeleteUntilEndOfLine 删除从光标到行尾处的字符,返回删除的文本
func (*Line) DeleteWordBeforeCursor ¶
DeleteWordBeforeCursor 删除光标前的单词,返回删除的单词
func (*Line) GetCursorPosition ¶
func (*Line) GetRenderContext ¶
func (l *Line) GetRenderContext() *RenderContext
GetRenderContext 返回渲染上下文信息
func (*Line) GotoMatchingBracket ¶
func (l *Line) GotoMatchingBracket()
GotoMatchingBracket 跳转到匹配 [ ( { < 的括号
func (*Line) InsertLineAbove ¶
InsertLineAbove 在当前行的上方插入一个空行, copyMargin 表示新行前面是否要保持同样的空格
func (*Line) InsertLineBelow ¶
InsertLineBelow 在当前行的下方插入一个空行, copyMargin 表示新行前面是否要保持同样的空格
func (*Line) InsertText ¶
InsertText 在 cursorPosition 的位置插入 data moveCursor 表示插入后是否移动光标
func (*Line) IsMultiline ¶
func (*Line) MouseDown ¶ added in v0.0.9
func (l *Line) MouseDown(info *MouseInfoOfInput)
func (*Line) OverwriteText ¶
OverwriteText 覆盖光标位置到行尾最多 len(data) 长度数据, moveCursor 表示插入后是否移动光标
func (*Line) SaveToUndoStack ¶
func (l *Line) SaveToUndoStack()
SaveToUndoStack 保存当前信息(文本和光标位置),支持 undo 操作
func (*Line) SetCursorPosition ¶
func (*Line) SwapCharactersBeforeCursor ¶
func (l *Line) SwapCharactersBeforeCursor()
SwapCharactersBeforeCursor 交换光标前两个字符
func (*Line) ToNormalMode ¶ added in v0.0.6
func (l *Line) ToNormalMode()
func (*Line) TransformLines ¶ added in v0.0.6
TransformLines 转换指定行文本,索引支持负数,会忽略超出范围的部分
例如想让某几行转成大写: TransformLines(5, 10, strings.ToUpper)
func (*Line) TransformRegion ¶ added in v0.0.8
TransformRegion 转换指定索引区域文本,索引支持负数,会忽略超出范围的部分
type MemHistory ¶
type MemHistory struct {
// contains filtered or unexported fields
}
func NewMemHistory ¶
func NewMemHistory() *MemHistory
func (*MemHistory) Append ¶
func (m *MemHistory) Append(s string)
func (*MemHistory) GetAll ¶
func (m *MemHistory) GetAll() []string
func (*MemHistory) GetAt ¶
func (m *MemHistory) GetAt(index int) string
func (*MemHistory) Length ¶
func (m *MemHistory) Length() int
type MouseInfoOfInput ¶ added in v0.0.9
type MouseInfoOfInput struct {
// contains filtered or unexported fields
}
MouseInfoOfInput 在当前输入中的一些鼠标信息
type PromptFactory ¶ added in v0.0.6
type RenderContext ¶
type RenderContext struct {
// contains filtered or unexported fields
}
type Schema ¶
type Schema map[token.TokenType]*terminalcolor.ColorStyle
func (Schema) StyleForSelection ¶ added in v0.0.17
func (s Schema) StyleForSelection(origStyle *terminalcolor.ColorStyle) *terminalcolor.ColorStyle
func (Schema) StyleForToken ¶
func (s Schema) StyleForToken(tokenType token.TokenType) *terminalcolor.ColorStyle
type Screen ¶
type Screen struct {
// contains filtered or unexported fields
}
Screen 以坐标维度缓冲输出字符
func (*Screen) CurrentHeight ¶ added in v0.0.6
func (*Screen) ReverseStyle ¶ added in v0.0.16
func (s *Screen) ReverseStyle(start Coordinate, end Coordinate)
func (*Screen) WriteRune ¶ added in v0.0.6
func (s *Screen) WriteRune(r rune, style *terminalcolor.ColorStyle, saveInputPos bool)
func (*Screen) WriteTokens ¶
WriteTokens 写入 Token 数组, saveInputPos: 是否保存输入位置 对于用户输入的内容才会保存输入位置,以便确定光标的位置,想补全列表就不属于输入
type TBaseEventHandler ¶ added in v0.0.9
type TBaseEventHandler struct {
// contains filtered or unexported fields
}
func (*TBaseEventHandler) ArrowDown ¶ added in v0.0.9
func (tb *TBaseEventHandler) ArrowDown(_ []rune)
func (*TBaseEventHandler) ArrowLeft ¶ added in v0.0.9
func (tb *TBaseEventHandler) ArrowLeft(_ []rune)
func (*TBaseEventHandler) ArrowRight ¶ added in v0.0.9
func (tb *TBaseEventHandler) ArrowRight(_ []rune)
func (*TBaseEventHandler) ArrowUp ¶ added in v0.0.9
func (tb *TBaseEventHandler) ArrowUp(_ []rune)
func (*TBaseEventHandler) Backspace ¶ added in v0.0.9
func (tb *TBaseEventHandler) Backspace(_ []rune)
func (*TBaseEventHandler) Backtab ¶ added in v0.0.9
func (tb *TBaseEventHandler) Backtab(_ []rune)
func (*TBaseEventHandler) CtrlA ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlA(_ []rune)
func (*TBaseEventHandler) CtrlB ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlB(_ []rune)
func (*TBaseEventHandler) CtrlBackslash ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlBackslash(_ []rune)
func (*TBaseEventHandler) CtrlC ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlC(_ []rune)
func (*TBaseEventHandler) CtrlCircumflex ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlCircumflex(_ []rune)
func (*TBaseEventHandler) CtrlD ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlD(_ []rune)
func (*TBaseEventHandler) CtrlE ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlE(_ []rune)
func (*TBaseEventHandler) CtrlF ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlF(_ []rune)
func (*TBaseEventHandler) CtrlG ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlG(_ []rune)
func (*TBaseEventHandler) CtrlH ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlH(_ []rune)
func (*TBaseEventHandler) CtrlI ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlI(_ []rune)
func (*TBaseEventHandler) CtrlJ ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlJ(_ []rune)
func (*TBaseEventHandler) CtrlK ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlK(_ []rune)
func (*TBaseEventHandler) CtrlL ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlL(_ []rune)
func (*TBaseEventHandler) CtrlM ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlM(_ []rune)
func (*TBaseEventHandler) CtrlN ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlN(_ []rune)
func (*TBaseEventHandler) CtrlO ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlO(_ []rune)
func (*TBaseEventHandler) CtrlP ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlP(_ []rune)
func (*TBaseEventHandler) CtrlQ ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlQ(_ []rune)
func (*TBaseEventHandler) CtrlR ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlR(_ []rune)
func (*TBaseEventHandler) CtrlS ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlS(_ []rune)
func (*TBaseEventHandler) CtrlSpace ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlSpace(_ []rune)
func (*TBaseEventHandler) CtrlSquareClose ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlSquareClose(_ []rune)
func (*TBaseEventHandler) CtrlT ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlT(_ []rune)
func (*TBaseEventHandler) CtrlU ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlU(_ []rune)
func (*TBaseEventHandler) CtrlUnderscore ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlUnderscore(_ []rune)
func (*TBaseEventHandler) CtrlV ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlV(_ []rune)
func (*TBaseEventHandler) CtrlW ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlW(_ []rune)
func (*TBaseEventHandler) CtrlX ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlX(_ []rune)
func (*TBaseEventHandler) CtrlY ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlY(_ []rune)
func (*TBaseEventHandler) CtrlZ ¶ added in v0.0.9
func (tb *TBaseEventHandler) CtrlZ(_ []rune)
func (*TBaseEventHandler) DeleteAction ¶ added in v0.0.9
func (tb *TBaseEventHandler) DeleteAction(_ []rune)
func (*TBaseEventHandler) End ¶ added in v0.0.9
func (tb *TBaseEventHandler) End(_ []rune)
func (*TBaseEventHandler) EscapeAction ¶ added in v0.0.9
func (tb *TBaseEventHandler) EscapeAction(_ []rune)
func (*TBaseEventHandler) F1 ¶ added in v0.0.9
func (tb *TBaseEventHandler) F1(_ []rune)
func (*TBaseEventHandler) F10 ¶ added in v0.0.9
func (tb *TBaseEventHandler) F10(_ []rune)
func (*TBaseEventHandler) F11 ¶ added in v0.0.9
func (tb *TBaseEventHandler) F11(_ []rune)
func (*TBaseEventHandler) F12 ¶ added in v0.0.9
func (tb *TBaseEventHandler) F12(_ []rune)
func (*TBaseEventHandler) F13 ¶ added in v0.0.9
func (tb *TBaseEventHandler) F13(_ []rune)
func (*TBaseEventHandler) F14 ¶ added in v0.0.9
func (tb *TBaseEventHandler) F14(_ []rune)
func (*TBaseEventHandler) F15 ¶ added in v0.0.9
func (tb *TBaseEventHandler) F15(_ []rune)
func (*TBaseEventHandler) F16 ¶ added in v0.0.9
func (tb *TBaseEventHandler) F16(_ []rune)
func (*TBaseEventHandler) F17 ¶ added in v0.0.9
func (tb *TBaseEventHandler) F17(_ []rune)
func (*TBaseEventHandler) F18 ¶ added in v0.0.9
func (tb *TBaseEventHandler) F18(_ []rune)
func (*TBaseEventHandler) F19 ¶ added in v0.0.9
func (tb *TBaseEventHandler) F19(_ []rune)
func (*TBaseEventHandler) F2 ¶ added in v0.0.9
func (tb *TBaseEventHandler) F2(_ []rune)
func (*TBaseEventHandler) F20 ¶ added in v0.0.9
func (tb *TBaseEventHandler) F20(_ []rune)
func (*TBaseEventHandler) F3 ¶ added in v0.0.9
func (tb *TBaseEventHandler) F3(_ []rune)
func (*TBaseEventHandler) F4 ¶ added in v0.0.9
func (tb *TBaseEventHandler) F4(_ []rune)
func (*TBaseEventHandler) F5 ¶ added in v0.0.9
func (tb *TBaseEventHandler) F5(_ []rune)
func (*TBaseEventHandler) F6 ¶ added in v0.0.9
func (tb *TBaseEventHandler) F6(_ []rune)
func (*TBaseEventHandler) F7 ¶ added in v0.0.9
func (tb *TBaseEventHandler) F7(_ []rune)
func (*TBaseEventHandler) F8 ¶ added in v0.0.9
func (tb *TBaseEventHandler) F8(_ []rune)
func (*TBaseEventHandler) F9 ¶ added in v0.0.9
func (tb *TBaseEventHandler) F9(_ []rune)
func (*TBaseEventHandler) Handle ¶ added in v0.0.9
func (tb *TBaseEventHandler) Handle(event Event)
func (*TBaseEventHandler) HandleEventKey ¶ added in v0.0.9
func (tb *TBaseEventHandler) HandleEventKey(ek *EventKey)
func (*TBaseEventHandler) HandleEventMouse ¶ added in v0.0.9
func (tb *TBaseEventHandler) HandleEventMouse(em *EventMouse)
func (*TBaseEventHandler) Home ¶ added in v0.0.9
func (tb *TBaseEventHandler) Home(_ []rune)
func (*TBaseEventHandler) InsertChar ¶ added in v0.0.9
func (tb *TBaseEventHandler) InsertChar(data []rune)
func (*TBaseEventHandler) PageDown ¶ added in v0.0.9
func (tb *TBaseEventHandler) PageDown(_ []rune)
func (*TBaseEventHandler) PageUp ¶ added in v0.0.9
func (tb *TBaseEventHandler) PageUp(_ []rune)
type TCommandLine ¶ added in v0.0.9
type TCommandLine struct {
// contains filtered or unexported fields
}
func NewTCommandLine ¶ added in v0.0.9
func NewTCommandLine(option *CommandLineOption) (*TCommandLine, error)
NewTCommandLine 新建命令行对象
func (*TCommandLine) GetLine ¶ added in v0.0.9
func (tc *TCommandLine) GetLine() *Line
GetLine 获取当前的 Line 对象,如果为 nil ,则 panic
func (*TCommandLine) GetRenderer ¶ added in v0.0.9
func (tc *TCommandLine) GetRenderer() *TRenderer
GetRenderer 获取当前的 TRenderer 对象,如果为 nil ,则 panic
func (*TCommandLine) IsDblClick ¶ added in v0.0.9
func (tc *TCommandLine) IsDblClick(ev *tcell.EventMouse) bool
func (*TCommandLine) IsReadingInput ¶ added in v0.0.9
func (tc *TCommandLine) IsReadingInput() bool
func (*TCommandLine) IsTripleClick ¶ added in v0.0.9
func (tc *TCommandLine) IsTripleClick(ev *tcell.EventMouse) bool
func (*TCommandLine) Print ¶ added in v0.0.9
func (tc *TCommandLine) Print(a ...any)
func (*TCommandLine) Printf ¶ added in v0.0.9
func (tc *TCommandLine) Printf(format string, a ...any)
func (*TCommandLine) Println ¶ added in v0.0.9
func (tc *TCommandLine) Println(a ...any)
func (*TCommandLine) ReadInput ¶ added in v0.0.9
func (tc *TCommandLine) ReadInput() (string, error)
ReadInput 读取当前输入
func (*TCommandLine) ReadRune ¶ added in v0.0.12
func (tc *TCommandLine) ReadRune() (rune, error)
ReadRune 读取 rune ,不能与 ReadInput 同时调用
func (*TCommandLine) RequestRedraw ¶ added in v0.0.9
func (tc *TCommandLine) RequestRedraw()
RequestRedraw 请求重绘( goroutine 安全)
func (*TCommandLine) RunInExecutor ¶ added in v0.0.9
func (tc *TCommandLine) RunInExecutor(callback func())
RunInExecutor 运行后台任务
func (*TCommandLine) SetAbort ¶ added in v0.0.9
func (tc *TCommandLine) SetAbort()
func (*TCommandLine) SetAccept ¶ added in v0.0.9
func (tc *TCommandLine) SetAccept()
func (*TCommandLine) SetExit ¶ added in v0.0.9
func (tc *TCommandLine) SetExit()
func (*TCommandLine) SetOnAbort ¶ added in v0.0.9
func (tc *TCommandLine) SetOnAbort(action AbortAction)
func (*TCommandLine) SetOnExit ¶ added in v0.0.9
func (tc *TCommandLine) SetOnExit(action AbortAction)
type TRenderer ¶ added in v0.0.9
type TRenderer struct {
// contains filtered or unexported fields
}
func (*TRenderer) Dblclick ¶ added in v0.0.9
func (tr *TRenderer) Dblclick(coordinate Coordinate)
Dblclick 鼠标双击
func (*TRenderer) GetClosetLocation ¶ added in v0.0.9
func (tr *TRenderer) GetClosetLocation(coordinate Coordinate) (Location, bool)
GetClosetLocation 返回跟坐标最接近的行列,返回的布尔值表示是否找到
func (*TRenderer) GetMouseInfoOfInput ¶ added in v0.0.9
func (tr *TRenderer) GetMouseInfoOfInput(coordinate Coordinate) *MouseInfoOfInput
func (*TRenderer) LineInInputArea ¶ added in v0.0.9
LineInInputArea InInputArea 判断坐标 y 所在行是否在当前输入区域内
func (*TRenderer) LineInTextArea ¶ added in v0.0.9
LineInTextArea 判断坐标 y 所在行是否在文本区域内
func (*TRenderer) MouseDown ¶ added in v0.0.9
func (tr *TRenderer) MouseDown(coordinate Coordinate)
MouseDown 鼠标(左键)按下
func (*TRenderer) MouseMove ¶ added in v0.0.9
func (tr *TRenderer) MouseMove(coordinate Coordinate)
func (*TRenderer) MouseUp ¶ added in v0.0.9
func (tr *TRenderer) MouseUp(coordinate Coordinate)
func (*TRenderer) TriggerEventKey ¶ added in v0.0.9
func (tr *TRenderer) TriggerEventKey()
TriggerEventKey 键盘事件触发
func (*TRenderer) TriggerEventMouse ¶ added in v0.0.9
func (tr *TRenderer) TriggerEventMouse()
TriggerEventMouse 鼠标事件触发
func (*TRenderer) TripeClick ¶ added in v0.0.9
func (tr *TRenderer) TripeClick(coordinate Coordinate)
TripeClick 鼠标三击