类型 TextareaMovement

API 文档由 Go 源码生成,内容为英文。

type TextareaMovement uint8

TextareaMovement is a way of moving the caret of a wrapping Textarea that depends on how its text is laid out in rows.

常量

const (
	TextareaMoveNone TextareaMovement = iota
	// TextareaMoveUp and TextareaMoveDown go one row, to the place nearest the
	// column the caret had when the run of vertical moves began.
	TextareaMoveUp
	TextareaMoveDown
	// TextareaMoveLineStart and TextareaMoveLineEnd go to the ends of the
	// visual row, not of the line up to a newline.
	TextareaMoveLineStart
	TextareaMoveLineEnd
	// TextareaMovePageUp and TextareaMovePageDown go a box of rows.
	TextareaMovePageUp
	TextareaMovePageDown
	TextareaMoveTextStart
	TextareaMoveTextEnd
)

构造函数

TextareaMovementForKey#

func TextareaMovementForKey(key ui.Key, modifiers ui.Modifiers) (movement TextareaMovement, extend bool)

TextareaMovementForKey says which movement a key asks for in a multiline editor, and whether it extends the selection (Shift). Home and End, Cmd+Left and Cmd+Right are the ends of a row; Cmd+Up and Cmd+Down, Ctrl+Home and Ctrl+End the ends of the text. Left, Right and the editing keys stay with the text system. Pass the key event of the focused textarea to it, then the result to TextareaLayout.Move, then the new offset to the editor.