Skip to content

Modern Tui TuiTextInput SelectionStart

Paul Squires edited this page Oct 19, 2026 · 6 revisions

Home › Terminal TUI Library › Input Widgets › TuiTextInput.SelectionStart

TuiTextInput.SelectionStart

Returns where the selection starts, or the cursor position if nothing is selected.

Syntax

TuiTextInput.SelectionStart( ) as int32

Description

The lower end of the selection in code units, or the cursor when nothing is selected. Selection is stored as a cursor plus an anchor, so it can run in either direction; Start and End sort them.

Example

#import "std/tui"
using tui

dim as TuiTextInputState st
TuiTextInputStateInit( st )
st.text = "hello world"
st.selAnchor = 6 : st.cursor = 11

dim as TuiTextInput box
box.state = @st
print box.SelectionStart( ), box.SelectionEnd( )        '' 6 11

st.selAnchor = 11 : st.cursor = 6                       '' selected backwards
print box.SelectionStart( ), box.SelectionEnd( )        '' 6 11 -- same span

See also

TuiTextInput TuiTextInput.SelectionEnd TuiTextArea TuiCheckbox
TuiTextInputState TuiTextInput.DeleteSelection TuiTextAreaState TuiRadioGroup
TuiTextInputStateInit TuiTextInput.Insert TuiTextAreaStateInit TuiSelect

Library: Terminal TUI Library
Category: Terminal TUI Library
Documented under: Input Widgets
Working examples: hello.tiko · form.tiko · dashboard.tiko


Home · Keyword Index

Clone this wiki locally