nimterm/widgets/input
This page is generated from the module’s exported API and ## documentation comments.
Editable text input widget with UTF-8-safe cursor movement.
InputWidget
Section titled “InputWidget”InputWidget = ref object of Widget text*: string cursor*: int prefix*: string continuationPrefix*: string style*: Style prefixStyle*: Style cursorStyle*: Style cursorBarStyle*: Style paddingLeft*: int paddingRight*: int paddingTop*: int paddingBottom*: int scrollOffset*: int yankText*: stringProcedures
Section titled “Procedures”newInput
Section titled “newInput”proc newInput(prefix = "> "; continuationPrefix = " "; style = defaultStyle(); cursorStyle = defaultCursorStyle(); cursorBarStyle = defaultCursorStyle(); prefixStyle = defaultStyle()): InputWidget {.raises: [], tags: [], forbids: [].}Returns: InputWidget.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
prefix |
inferred |
"> " |
continuationPrefix |
inferred |
" " |
style |
inferred |
defaultStyle() |
cursorStyle |
inferred |
defaultCursorStyle() |
cursorBarStyle |
inferred |
defaultCursorStyle() |
prefixStyle |
inferred |
defaultStyle() |
proc clear(widget: InputWidget) {.raises: [], tags: [], forbids: [].}Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
widget |
InputWidget |
setText
Section titled “setText”proc setText(widget: InputWidget; text: string) {.raises: [], tags: [], forbids: [].}Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
widget |
InputWidget |
|
text |
string |
insert
Section titled “insert”proc insert(widget: InputWidget; piece: string) {.raises: [], tags: [], forbids: [].}Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
widget |
InputWidget |
|
piece |
string |
proc undo(widget: InputWidget) {.raises: [], tags: [], forbids: [].}Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
widget |
InputWidget |
proc yank(widget: InputWidget) {.raises: [], tags: [], forbids: [].}Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
widget |
InputWidget |
visualLineCount
Section titled “visualLineCount”proc visualLineCount(widget: InputWidget; contentWidth: int): int {.raises: [], tags: [], forbids: [].}Returns: int.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
widget |
InputWidget |
|
contentWidth |
int |
Methods
Section titled “Methods”focusable
Section titled “focusable”method focusable(widget: InputWidget): bool {.raises: [], tags: [], forbids: [].}Returns: bool.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
widget |
InputWidget |
handle
Section titled “handle”method handle(widget: InputWidget; event: UiEvent): EventResponse {.raises: [], tags: [], forbids: [].}Returns: EventResponse.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
widget |
InputWidget |
|
event |
UiEvent |
measure
Section titled “measure”method measure(widget: InputWidget; constraints: Constraints): Size {. raises: [], tags: [], forbids: [].}Returns: Size.
Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
widget |
InputWidget |
|
constraints |
Constraints |
method paint(widget: InputWidget; canvas: var Canvas) {.raises: [], tags: [], forbids: [].}Arguments
Section titled “Arguments”| Name | Type | Default |
|---|---|---|
widget |
InputWidget |
|
canvas |
var Canvas |