widget.textbox
local textbox = require "widget.textbox"
NEWLINE
(field) NEWLINE: integer
Indicates on a widget.styledtext that a new line follows.
__index
(field) __index: core.object
Base class providing OOP functionality for Lua. All classes in Pragtical inherit from Object.
active
(field) active: boolean
Whether the embedded TextView has keyboard focus
animations
(field) animations: widget.animation[]
background_color
(field) background_color: renderer.color
Array of bytes that represents a color used by the rendering functions.
border
(field) border: widget.border
Represents the border of a widget.
capture_text_input
(field) capture_text_input: boolean?
Receive text input while floating without taking focus
captured_button
(field) captured_button: ('left'|'right')?
captured_widget
(field) captured_widget: widget
Widget that captured mouse events
child_active
(field) child_active: widget|nil
A base widget
childs
(field) childs: table<integer, widget>
clickable
(field) clickable: boolean
context
(field) context: 'application'|'session'
current_scale
(field) current_scale: number
cursor
(field) cursor: string
defer_draw
(field) defer_draw: boolean
draggable
(field) draggable: boolean
dragged
(field) dragged: boolean
explicit_update
(field) explicit_update: boolean
floating
(field) floating: boolean
Whether the view uses floating placement
floating_closing
(field) floating_closing: boolean?
Whether input is disabled while a closing slide runs
floating_destination
(field) floating_destination: (core.view.position)?
Settled position retained during a slide
floating_gesture
(field) floating_gesture: (core.view.floating_gesture)?
Active pointer drag or resize
floating_options
(field) floating_options: (core.view.floating_options)?
Placement ownership and input policy
floating_position
(field) floating_position: (core.view.position)?
Persistent interpolation state for a slide
floating_previous_focus
(field) floating_previous_focus: (core.view)?
Focus target to restore when hiding
floating_transition
(field) floating_transition: (core.view.floating_transition)?
Active slide and callback
floating_visible
(field) floating_visible: boolean?
Whether the view is registered, including closing slides
font
(field) font: string|renderer.font|widget.fontreference
Represents a reference to a font stored elsewhere.
foreground_color
(field) foreground_color: renderer.color
Array of bytes that represents a color used by the rendering functions.
h_scrollbar
(field) h_scrollbar: widget.scrollbar
has_focus
(field) has_focus: boolean
hover_border
(field) hover_border: unknown
hovered_child
(field) hovered_child: widget?
Child that last received hover motion
hovered_scrollbar
(field) hovered_scrollbar: boolean
input_text
(field) input_text: boolean
this widget is for text input
is_scrolling
(field) is_scrolling: boolean
label
(field) label: string|table<integer, string|integer|renderer.color|renderer.font|widget.colorreference...(+1)>
mouse
(field) mouse: widget.position
Represents the position of a widget.
mouse_is_hovering
(field) mouse_is_hovering: boolean
mouse_is_pressed
(field) mouse_is_pressed: boolean
mouse_press
(field) mouse_press: { button: 'left'|'right', child: widget? }?
mouse_selecting
(field) mouse_selecting: unknown
name
(field) name: string
next_zindex
(field) next_zindex: integer
parent
(field) parent: widget|nil
A base widget
password
(field) password: boolean
perform_update_size_position
(field) perform_update_size_position: boolean
placeholder
(field) placeholder: string
position
(field) position: widget.position
Represents the position of a widget.
prev_height
(field) prev_height: number?
prev_size
(field) prev_size: widget.position
Represents the position of a widget.
prev_view
(field) prev_view: unknown
prev_width
(field) prev_width: number?
render_background
(field) render_background: boolean
scroll
(field) scroll: core.view.scroll
scrollable
(field) scrollable: boolean
set_focus
(field) set_focus: any
size
(field) size: widget.position
Modifying this property directly is not advised, use set_size() instead.
skip_scroll_ctrl
(field) skip_scroll_ctrl: boolean
By default is set to true to allow ctrl+wheel or cmd+wheel on mac to scale the interface, you can set it to false on your parent widget to allow manually intercepting ctrl+wheel.
super
(field) super: widget
A base widget
textview
(field) textview: widget.textbox.TextView
tooltip
(field) tooltip: (string|table<integer, string|integer|renderer.color|renderer.font|widget.colorreference...(+1)>)?
tooltip_command
(field) tooltip_command: string?
type_name
(field) type_name: string
updated
(field) updated: boolean
v_scrollbar
(field) v_scrollbar: widget.scrollbar
visible
(field) visible: boolean
zindex
(field) zindex: integer
widget.textbox.SingleLineDoc
__index
(field) __index: core.object
Base class providing OOP functionality for Lua. All classes in Pragtical inherit from Object.
abs_filename
(field) abs_filename: any
binary
(field) binary: boolean
bom
(field) bom: string?
cache
(field) cache: table
change_id
(field) change_id: integer
clean_change_id
(field) clean_change_id: integer
clean_lines
(field) clean_lines: table
crlf
(field) crlf: boolean
edit_depth
(field) edit_depth: integer
edit_start
(field) edit_start: unknown
encoding
(field) encoding: string?
filename
(field) filename: any
highlighter
(field) highlighter: unknown
last_selection
(field) last_selection: number
lines
(field) lines: table
new_file
(field) new_file: any
next_change_id
(field) next_change_id: integer
overwrite
(field) overwrite: boolean
redo_stack
(field) redo_stack: table
replay_change_id
(field) replay_change_id: unknown
replaying
(field) replaying: unknown
search_selections
(field) search_selections: table
selections
(field) selections: table
suggested_extension
(field) suggested_extension: string?
Extension hint for an untitled document.
super
(field) super: core.doc
syntax
(field) syntax: core.syntax.syntax
A language syntax definition used by syntax plugins and tokenizers.
undo_stack
(field) undo_stack: table
__call
(method) core.object:__call(...any)
-> obj: core.object
Metamethod allowing class to be called like a constructor.
Enables syntax: local obj = MyClass(args) instead of MyClass:new(args)
Automatically creates instance and calls new() with provided arguments.
@return obj: core.object — The new instance of the class
__tostring
(method) core.doc:__tostring()
-> string
add_search_selection
(method) core.doc:add_search_selection(line1: any, col1: any, line2: any, col2: any)
add_selection
(method) core.doc:add_selection(line1: any, col1: any, line2: any, col2: any, swap: any)
clean
(method) core.doc:clean()
clear_cache
(method) core.doc:clear_cache(l: any, n: any)
clear_search_selections
(method) core.doc:clear_search_selections()
clear_undo_redo
(method) core.doc:clear_undo_redo()
delete_to
(method) core.doc:delete_to(...any)
delete_to_cursor
(method) core.doc:delete_to_cursor(idx: any, ...any)
extend
(method) core.object:extend()
-> cls: core.object
Create a new class that inherits from this one.
Returns a new class with this class as its parent.
Example: local MyClass = Object:extend()
@return cls: core.object — The new class table
extends
(method) core.object:extends(T: any)
-> extends: boolean
Check if object inherits from the given type (inheritance-aware).
Use this to check class hierarchy.
Example: view:extends(View) returns true for View and all subclasses
@param T: any — Class to check inheritance from
@return extends: boolean — True if object is T or inherits from T
get_change_id
(method) core.doc:get_change_id()
-> integer
Return the text state's identity, restored by undo/redo and never reused for a different edit after undoing back past a saved state.
get_char
(method) core.doc:get_char(line: any, col: any)
-> string
get_indent_info
(method) core.doc:get_indent_info()
-> "hard"|"soft"
2. number
3. boolean
get_indent_string
(method) core.doc:get_indent_string(col: any)
-> string
2. string
get_line_indent
(method) core.doc:get_line_indent(line: any, rnd_up: any)
-> unknown
2. string
3. integer|nil
returns the size of the original indent, and the indent in your config format, rounded either up or down
get_name
(method) core.doc:get_name()
-> unknown
get_non_word_chars
(method) core.doc:get_non_word_chars(symbol: boolean)
-> string
Get a string of characters not belonging to a word taking into account current subsyntax.
Note: when setting symbol param to true the characters property
symbol_non_word_chars will be searched, if false non_word_chars. In both
cases will fallback to config.non_word_chars when not found.
@param symbol: boolean — Indicates if non word characters are for a symbol
get_selection
(method) core.doc:get_selection(sort: any)
-> integer
2. integer
3. integer
4. integer
5. boolean
Cursor section. Cursor indices are only valid during a get_selections() call. Cursors will always be iterated in order from top to bottom. Through normal operation curors can never swap positions; only merge or split, or change their position in cursor order.
get_selection_idx
(method) core.doc:get_selection_idx(idx: integer, sort?: boolean)
-> integer
2. integer
3. integer
4. integer
5. boolean?
Get the selection specified by idx
@param idx: integer — the index of the selection to retrieve
@param sort?: boolean — whether to sort the selection returned
@return: integer — line1, col1, line2, col2, was the selection sorted
@return: integer — line1, col1, line2, col2, was the selection sorted
@return: integer — line1, col1, line2, col2, was the selection sorted
@return: integer — line1, col1, line2, col2, was the selection sorted
@return: boolean? — line1, col1, line2, col2, was the selection sorted
get_selection_text
(method) core.doc:get_selection_text(limit: any)
-> string
get_selections
(method) core.doc:get_selections(sort_intra: any, idx_reverse: any)
-> function
2. table
3. number
If idx_reverse is true, it'll reverse iterate. If nil, or false, regular iterate. If a number, runs for exactly that iteration.
get_symbol_pattern
(method) core.doc:get_symbol_pattern()
-> string
Get the lua pattern used to match symbols taking into account current subsyntax.
get_text
(method) core.doc:get_text(line1: integer, col1: integer, line2: integer, col2: integer, inclusive?: boolean)
-> string
Returns the content of the doc between two positions. The positions will be sanitized and sorted. The character at the "end" position is not included by default. See: core.doc.sanitize_position
@param inclusive?: boolean — Whether or not to return the character at the last position
get_utf8_line
(method) core.doc:get_utf8_line(idx: integer)
-> string
Always returns a valid utf8 line even if the file contains binary data.
has_any_selection
(method) core.doc:has_any_selection()
-> boolean
has_selection
(method) core.doc:has_selection()
-> boolean
ime_text_editing
(method) core.doc:ime_text_editing(text: any, start: any, length: any, idx: any)
indent_text
(method) core.doc:indent_text(unindent: any, line1: any, col1: any, line2: any, col2: any)
-> unknown
2. integer|unknown
3. unknown
4. integer|unknown
un/indents text; behaviour varies based on selection and un/indent.
- if there's a selection, it will stay static around the text for both indenting and unindenting.
- if you are in the beginning whitespace of a line, and are indenting, the cursor will insert the exactly appropriate amount of spaces, and jump the cursor to the beginning of first non whitespace characters
- if you are not in the beginning whitespace of a line, and you indent, it inserts the appropriate whitespace, as if you typed them normally.
- if you are unindenting, the cursor will jump to the start of the line, and remove the appropriate amount of spaces (or a tab).
insert
(method) widget.textbox.SingleLineDoc:insert(line: any, col: any, text: any)
is
(method) core.object:is(T: any)
-> is_exact: boolean
Check if object is exactly of the given type (no inheritance check).
Use this for strict type matching.
Example: view:is(DocView) returns true only if view is a DocView, not a subclass
@param T: any — Class to check against
@return is_exact: boolean — True if object is exactly type T
is_class_of
(method) core.object:is_class_of(T: any)
-> is_instance: boolean
Check if the given object is exactly an instance of this class.
Inverse of is() - checks if T is an instance of self.
Example: DocView:is_class_of(obj) checks if obj is exactly a DocView
@param T: any — Object to check
@return is_instance: boolean — True if T is exactly an instance of this class
is_dirty
(method) core.doc:is_dirty()
-> boolean
is_extended_by
(method) core.object:is_extended_by(T: any)
-> is_extended: boolean
Check if the given object/class inherits from this class.
Inverse of extends() - checks if T is a subclass of self.
Example: View:is_extended_by(DocView) checks if DocView inherits from View
@param T: any — Object or class to check
@return is_extended: boolean — True if T inherits from this class
is_search_selection
(method) core.doc:is_search_selection(line1: any, col1: any, line2: any, col2: any)
-> boolean
load
(method) core.doc:load(filename: any)
merge_cursors
(method) core.doc:merge_cursors(idx: any)
move_to
(method) core.doc:move_to(...any)
move_to_cursor
(method) core.doc:move_to_cursor(idx: any, ...any)
needs_encoding_conversion
(method) core.doc:needs_encoding_conversion()
-> boolean
new
(method) core.doc:new(filename: any, abs_filename: any, new_file: any)
on_close
(method) core.doc:on_close()
For plugins to get notified when a document is closed
on_text_change
(method) core.doc:on_text_change(type: any)
For plugins to add custom actions of document change
position_offset
(method) core.doc:position_offset(line: any, col: any, ...any)
raw_insert
(method) core.doc:raw_insert(line: any, col: any, text: any, undo_stack: any, time: any)
raw_remove
(method) core.doc:raw_remove(line1: any, col1: any, line2: any, col2: any, undo_stack: any, time: any)
redo
(method) core.doc:redo()
reload
(method) core.doc:reload()
remove
(method) core.doc:remove(line1: any, col1: any, line2: any, col2: any)
remove_selection
(method) core.doc:remove_selection(idx: any)
replace
(method) core.doc:replace(fn: any)
-> table
replace_cursor
(method) core.doc:replace_cursor(idx: any, line1: any, col1: any, line2: any, col2: any, fn: any)
-> unknown
reset
(method) widget.textbox.SingleLineDoc:reset()
reset_syntax
(method) core.doc:reset_syntax()
sanitize_position
(method) core.doc:sanitize_position(line: any, col: any)
-> integer
2. number
sanitize_selection
(method) core.doc:sanitize_selection()
save
(method) core.doc:save(filename: any, abs_filename: any)
select_to
(method) core.doc:select_to(...any)
select_to_cursor
(method) core.doc:select_to_cursor(idx: any, ...any)
set_filename
(method) core.doc:set_filename(filename: any, abs_filename: any)
set_selection
(method) core.doc:set_selection(line1: any, col1: any, line2: any, col2: any, swap: any)
set_selections
(method) core.doc:set_selections(idx: any, line1: any, col1: any, line2: any, col2: any, swap: any, rm: any)
set_suggested_extension
(method) core.doc:set_suggested_extension(extension?: string)
Set the extension suggested for an untitled document. A leading period is optional. Empty or path-like values clear the hint.
text_input
(method) core.doc:text_input(text: any, idx: any)
undo
(method) core.doc:undo()
widget.textbox.SingleLineHighlighter
Customized Highlighter to disable the coroutine.
get_line
(method) widget.textbox.SingleLineHighlighter:get_line(idx: any)
-> table
start
(method) widget.textbox.SingleLineHighlighter:start()
widget.textbox.TextView
__index
(field) __index: core.object
Base class providing OOP functionality for Lua. All classes in Pragtical inherit from Object.
cache_font
(field) cache_font: renderer.font
cache_font_size
(field) cache_font_size: number
cache_indent_size
(field) cache_indent_size: integer
capture_text_input
(field) capture_text_input: boolean?
Receive text input while floating without taking focus
context
(field) context: string
current_scale
(field) current_scale: number
cursor
(field) cursor: string
disable_save
(field) disable_save: boolean
doc
(field) doc: core.doc
floating
(field) floating: boolean
Whether the view uses floating placement
floating_closing
(field) floating_closing: boolean?
Whether input is disabled while a closing slide runs
floating_destination
(field) floating_destination: (core.view.position)?
Settled position retained during a slide
floating_gesture
(field) floating_gesture: (core.view.floating_gesture)?
Active pointer drag or resize
floating_options
(field) floating_options: (core.view.floating_options)?
Placement ownership and input policy
floating_position
(field) floating_position: (core.view.position)?
Persistent interpolation state for a slide
floating_previous_focus
(field) floating_previous_focus: (core.view)?
Focus target to restore when hiding
floating_transition
(field) floating_transition: (core.view.floating_transition)?
Active slide and callback
floating_visible
(field) floating_visible: boolean?
Whether the view is registered, including closing slides
font
(field) font: string
gutter_text_brightness
(field) gutter_text_brightness: integer
gutter_width
(field) gutter_width: integer
h_scrollbar
(field) h_scrollbar: core.scrollbar
Scrollable viewport indicator with draggable thumb. Supports both vertical and horizontal orientation with configurable alignment. Uses a "normal" coordinate system internally that treats all scrollbars as vertical-end-aligned, then transforms to the actual orientation/alignment.
hide_lines_gutter
(field) hide_lines_gutter: boolean
hovered_scrollbar
(field) hovered_scrollbar: boolean
hovering_gutter
(field) hovering_gutter: boolean
ime_selection
(field) ime_selection: core.docview.ime_selection
ime_status
(field) ime_status: boolean
label
(field) label: string
last_col1
(field) last_col1: integer
last_col2
(field) last_col2: integer
last_line1
(field) last_line1: integer
last_line2
(field) last_line2: integer
last_x_offset
(field) last_x_offset: core.docview.position
mouse_selecting
(field) mouse_selecting: table?
name
(field) name: string
parent
(field) parent: core.doc
position
(field) position: core.view.position
scroll
(field) scroll: core.view.scroll
scrollable
(field) scrollable: boolean
size
(field) size: core.view.position
subparent
(field) subparent: any
super
(field) super: core.docview
View for editing documents with syntax highlighting and text editing. Extends View to provide text editing capabilities including selection, scrolling, IME support, and rendering with syntax highlighting.
translate
(field) translate: table
v_scrollbar
(field) v_scrollbar: core.scrollbar
Scrollable viewport indicator with draggable thumb. Supports both vertical and horizontal orientation with configurable alignment. Uses a "normal" coordinate system internally that treats all scrollbars as vertical-end-aligned, then transforms to the actual orientation/alignment.
visual_lines
(field) visual_lines: table
visual_lines_change_id
(field) visual_lines_change_id: integer
visual_lines_dirty
(field) visual_lines_dirty: boolean
visual_lines_doc_lines
(field) visual_lines_doc_lines: table
visual_lines_invalid_from
(field) visual_lines_invalid_from: integer?
from_state
function core.docview.from_state(state: table)
-> core.docview|unknown
@return: core.docview|unknown
__call
(method) core.object:__call(...any)
-> obj: core.object
Metamethod allowing class to be called like a constructor.
Enables syntax: local obj = MyClass(args) instead of MyClass:new(args)
Automatically creates instance and calls new() with provided arguments.
@return obj: core.object — The new instance of the class
__tostring
(method) core.docview:__tostring()
-> string
bring_to_front
(method) core.view:bring_to_front()
-> view: core.view
Raise a shown floating view and its owned popups above the other floating views.
@return view: core.view — This view, for chaining
clamp_scroll_position
(method) core.view:clamp_scroll_position()
Clamp scroll position to valid range (0 to max scrollable size). Called automatically by update(). Override get_scrollable_size() to customize.
draw
(method) widget.textbox.TextView:draw()
Overwrite this function just to disable the core.push_clip_rect
draw_background
(method) core.view:draw_background(color: renderer.color)
Draw a solid background color for the entire view. Commonly called at the start of draw() methods.
@param color: renderer.color — Array of bytes that represents a color used by the rendering functions.
draw_caret
(method) core.docview:draw_caret(x: number, y: number, line: integer, col: integer)
Draw the caret at a position.
@param x: number — Screen x coordinate
@param y: number — Screen y coordinate
@param line: integer — Line number (for overwrite mode char width)
@param col: integer — Column number (for overwrite mode char width)
draw_ime_decoration
(method) core.docview:draw_ime_decoration(line1: integer, col1: integer, line2: integer, col2: integer)
Draw IME composition decoration (underline and selection).
@param line1: integer — Start line
@param col1: integer — Start column
@param line2: integer — End line
@param col2: integer — End column
draw_line_body
(method) core.docview:draw_line_body(line: integer, x: number, y: number)
-> height: integer
Draw a complete line including highlight and selections.
@param line: integer — Line number
@param x: number — Screen x coordinate
@param y: number — Screen y coordinate
@return height: integer — Line height
draw_line_gutter
(method) widget.textbox.TextView:draw_line_gutter(idx: integer, x: number, y: number)
draw_line_highlight
(method) widget.textbox.TextView:draw_line_highlight()
draw_line_text
(method) widget.textbox.TextView:draw_line_text(line: integer, x: number, y: number)
-> integer
draw_overlay
(method) core.docview:draw_overlay()
Draw overlay elements (carets, IME decoration). Called after main text to draw on top.
draw_scrollbar
(method) core.view:draw_scrollbar()
Draw the view's scrollbars. Commonly called at the end of draw() methods.
each_visible_line
(method) core.docview:each_visible_line()
-> fun():integer?, integer?, integer?
Iterate visible rows as virtual offset plus real document position.
ensure_line_visible
(method) core.docview:ensure_line_visible(line: integer)
-> line: integer
Ensure a document line is visible in this view. Plugins that hide lines can override this to reveal the requested line.
@return line: integer
extend
(method) core.object:extend()
-> cls: core.object
Create a new class that inherits from this one.
Returns a new class with this class as its parent.
Example: local MyClass = Object:extend()
@return cls: core.object — The new class table
extends
(method) core.object:extends(T: any)
-> extends: boolean
Check if object inherits from the given type (inheritance-aware).
Use this to check class hierarchy.
Example: view:extends(View) returns true for View and all subclasses
@param T: any — Class to check inheritance from
@return extends: boolean — True if object is T or inherits from T
get_col_x_offset
(method) widget.textbox.TextView:get_col_x_offset(line: integer, col: integer)
-> number
get_content_bounds
(method) core.view:get_content_bounds()
-> x1: number
2. y1: number
3. x2: number
4. y2: number
Get the content bounds in content coordinates (accounting for scroll).
@return x1: number — Left edge
@return y1: number — Top edge
@return x2: number — Right edge
@return y2: number — Bottom edge
get_content_offset
(method) core.view:get_content_offset()
-> x: number
2. y: number
Get the top-left corner of content area in screen coordinates. Accounts for scroll offset. Use for drawing content at correct position.
@return x: number — Screen x coordinate
@return y: number — Screen y coordinate
get_filename
(method) core.docview:get_filename()
-> filename: string
Get the full filename path for display (with home directory encoded).
@return filename: string — Full path or name with asterisk if modified
get_floating_bounds
(method) core.view:get_floating_bounds()
-> x: number
2. y: number
3. w: number
4. h: number
Get the popup's outer rectangle in screen coordinates, including borders. Override together with set_floating_bounds() for composite views.
@return x: number — Screen x coordinate
@return y: number — Screen y coordinate
@return w: number — Outer width in pixels
@return h: number — Outer height in pixels
get_floating_drag_region
(method) core.view:get_floating_drag_region()
-> x: number?
2. y: number?
3. w: number?
4. h: number?
Get the screen rectangle where a floating view can be dragged. Override to restrict dragging to a header; defaults to the full popup bounds.
@return x: number? — Screen x coordinate, or nil to disable dragging
@return y: number? — Screen y coordinate
@return w: number? — Region width
@return h: number? — Region height
get_focus_target
(method) core.view:get_focus_target()
-> target: (core.view)?
Get the view that should receive focus when this view is shown or clicked. Override for composites whose keyboard focus belongs to a descendant.
@return target: (core.view)? — View to focus, or nil to preserve the current focus
get_font
(method) core.docview:get_font()
-> font: renderer.font
Get the font used for rendering text.
@return font: renderer.font — The code font
get_gutter_width
(method) widget.textbox.TextView:get_gutter_width()
-> integer
get_h_scrollable_size
(method) core.docview:get_h_scrollable_size()
-> width: number
Get the scrollable width (infinite for horizontal scrolling).
@return width: number — Always returns math.huge
get_hidden_lines
(method) core.docview:get_hidden_lines()
-> hidden_lines: table<integer, boolean>?
Return plugin-provided hidden document lines.
@return hidden_lines: table<integer, boolean>?
get_line_height
(method) widget.textbox.TextView:get_line_height()
-> integer
get_line_screen_position
(method) core.docview:get_line_screen_position(line: integer, col?: integer)
-> x: number
2. y: number
Get the screen position of a line (and optionally column).
@param line: integer — Line number
@param col?: integer — Optional column number
@return x: number — Screen x coordinate
@return y: number — Screen y coordinate
get_line_text_y_offset
(method) core.docview:get_line_text_y_offset()
-> offset: number
Get the vertical offset for centering text within a line.
@return offset: number — Y offset to center text in line height
get_line_visual_height
(method) core.docview:get_line_visual_height(line: integer)
-> height: number
Get the visual height occupied by a real document line. Wrapped lines may span more than one row.
@param line: integer — Real document line
@return height: number
get_line_wraps
(method) core.docview:get_line_wraps(line: integer)
-> starts: integer[]?
Return visual row start columns for a document line.
@return starts: integer[]?
get_module
(method) core.view:get_module()
-> path: string?
Returns the module path of this view.
This method resolves the Lua module name that loaded the concrete view
class (for example "core.view").
If the view class cannot be associated with any loaded module, nil
is returned.
@return path: string?
get_name
(method) widget.textbox.TextView:get_name()
-> string
get_scrollable_size
(method) widget.textbox.TextView:get_scrollable_size()
-> integer
get_state
(method) core.docview:get_state()
-> table
get_text
(method) widget.textbox.TextView:get_text()
-> string
get_visible_cols_range
(method) core.docview:get_visible_cols_range(line: integer, extra_cols?: integer)
-> col1: integer
2. col2: integer
3. ucol1: integer
4. ucol2: integer
Get an estimated range of visible columns. It is an estimate because fonts and their fallbacks may not be monospaced or may differ in size. This function provides a way of optimization on really long lines for plugins that perform drawing operations on them.
It is good practice to set the extra_cols parameter to a value that leaves
room for the differences in font sizes.
@param extra_cols?: integer — Amount of columns to deduce on col1 and include on col2 (default: 100)
@return col1: integer
@return col2: integer
@return ucol1: integer
@return ucol2: integer
get_visible_line_range
(method) core.docview:get_visible_line_range()
-> minline: integer
2. maxline: integer
Get the range of visible lines in the current viewport.
@return minline: integer — First visible line
@return maxline: integer — Last visible line
get_visual_line_col_from_x
(method) core.docview:get_visual_line_col_from_x(row: integer, x: number)
-> col: integer
Resolve a visual row-local horizontal offset to a document column.
@param row: integer — Visual row
@param x: number — Horizontal offset from text origin
@return col: integer
get_visual_lines
(method) core.docview:get_visual_lines()
-> table
get_x_offset_col
(method) widget.textbox.TextView:get_x_offset_col(line: integer, x: number)
-> integer
has_variable_visual_lines
(method) core.docview:has_variable_visual_lines()
-> boolean
Return whether this view needs a materialized visual-line model. Views with wraps or other row expansions should override this.
hide_floating
(method) core.view:hide_floating(options?: core.view.floating_transition)
-> view: core.view
Hide the floating view, close owned popups, cancel input, and restore focus. A closing slide delays removal while the view immediately stops receiving input. Disabled transitions remove the view and run the completion callback immediately.
@param options?: core.view.floating_transition — Optional closing slide (to) and callback
@return view: core.view — This view, for chaining
hit_test
(method) core.view:hit_test(x: number, y: number)
-> inside: boolean
Check whether a screen point lies inside the view's outer rectangle. Override for custom shapes or composites with additional hit regions.
@param x: number — Screen x coordinate
@param y: number — Screen y coordinate
@return inside: boolean — Whether the view contains the point
invalidate_visual_lines
(method) core.docview:invalidate_visual_lines(from_line?: integer)
Mark the visual-line model dirty.
@param from_line?: integer — First line that changed (reserved for incremental rebuilds)
is
(method) core.object:is(T: any)
-> is_exact: boolean
Check if object is exactly of the given type (no inheritance check).
Use this for strict type matching.
Example: view:is(DocView) returns true only if view is a DocView, not a subclass
@param T: any — Class to check against
@return is_exact: boolean — True if object is exactly type T
is_class_of
(method) core.object:is_class_of(T: any)
-> is_instance: boolean
Check if the given object is exactly an instance of this class.
Inverse of is() - checks if T is an instance of self.
Example: DocView:is_class_of(obj) checks if obj is exactly a DocView
@param T: any — Object to check
@return is_instance: boolean — True if T is exactly an instance of this class
is_extended_by
(method) core.object:is_extended_by(T: any)
-> is_extended: boolean
Check if the given object/class inherits from this class.
Inverse of extends() - checks if T is a subclass of self.
Example: View:is_extended_by(DocView) checks if DocView inherits from View
@param T: any — Object or class to check
@return is_extended: boolean — True if T inherits from this class
is_floating_owner_visible
(method) core.view:is_floating_owner_visible()
-> visible: boolean?
Check whether floating popups owned by this view should remain visible. Docked owners must be active in their node; container children follow their parent. Override for composites with their own visibility rules.
@return visible: boolean? — Falsy when the owner is hidden or its tab is inactive
is_line_visible
(method) core.docview:is_line_visible(line: integer)
-> boolean
Return whether a document line contributes visual rows.
mouse_selection
(method) core.docview:mouse_selection(doc: core.doc, snap_type: string, line1: integer, col1: integer, line2: integer, col2: integer)
-> line1: integer
2. col1: integer
3. line2: integer
4. col2: integer
Adjust selection based on snap type (word, line).
@param doc: core.doc — Document
@param snap_type: string — Snap type: "word" or "lines"
@param line1: integer — Start line
@param col1: integer — Start column
@param line2: integer — End line
@param col2: integer — End column
@return line1: integer — Adjusted start line
@return col1: integer — Adjusted start column
@return line2: integer — Adjusted end line
@return col2: integer — Adjusted end column
move_towards
(method) core.view:move_towards(t: table, k: string|number, dest: number, rate?: number, name?: string)
Smoothly animate a value towards a destination. Use this for animations instead of direct assignment.
@param t: table — Table containing the value
@param k: string|number — Key in table
@param dest: number — Target value
@param rate?: number — Animation speed (0-1, default 0.5, higher = faster)
@param name?: string — Transition name (for config.disabled_transitions)
new
(method) widget.textbox.TextView:new(parent: core.doc, subparent: any)
@param parent: core.doc
offset_from_position
(method) core.docview:offset_from_position(line: integer, col?: integer)
-> offset: integer
Convert a real document position to its composed visual line offset.
@param line: integer — Real document line
@param col?: integer — Optional column
@return offset: integer — Visual line index (1-based)
on_file_dropped
(method) core.view:on_file_dropped(filename: string, x: number, y: number)
-> consumed: boolean
Handle file drop events (drag and drop from OS). Override to handle dropped files. Return true to consume event.
@param filename: string — Absolute path to dropped file
@param x: number — Screen x where file was dropped
@param y: number — Screen y where file was dropped
@return consumed: boolean — True to consume event, false to propagate
on_floating_dismiss
(method) core.view:on_floating_dismiss(reason: "escape"|"focuslost"|"outside")
Handle a dismissal requested by Escape, an outside click, or window focus loss. The default implementation hides the view immediately; override for custom handling.
reason:
| "escape"
| "outside"
| "focuslost"
@param reason: "escape"|"focuslost"|"outside" — Event that requested dismissal
on_floating_visibility_changed
(method) core.view:on_floating_visibility_changed(visible: boolean)
Called when showing a floating view or completing its removal. Override to synchronize widget visibility or clear popup controller state.
@param visible: boolean — True on show, false when removal completes
on_ime_text_editing
(method) core.docview:on_ime_text_editing(text: string, start: integer, length: integer)
Handle IME text composition events. Updates IME decoration and scrolls to keep composition visible.
@param text: string — Composition text
@param start: integer — Selection start within composition
@param length: integer — Selection length within composition
on_key_pressed
(method) core.view:on_key_pressed(stroke: string, ...any)
-> consumed: boolean?
Handle a floating view's keyboard input before command dispatch. Override and return true to consume the normalized key binding.
@param stroke: string — Normalized key binding, such as "ctrl+return"
@param: any — Additional arguments forwarded by the keyboard handler
@return consumed: boolean? — Whether the event was handled
on_mouse_capture_lost
(method) core.view:on_mouse_capture_lost()
Cancel pointer gestures when RootView releases mouse capture without a click. Clears floating dragging, text selection, scrollbar dragging, and hover state. Override to clear any additional subclass gesture state.
on_mouse_left
(method) core.docview:on_mouse_left()
Handle mouse leaving the view area. Clears hover state that would otherwise remain until the next mouse move inside the DocView.
on_mouse_moved
(method) core.docview:on_mouse_moved(x: number, y: number, ...any)
Handle mouse movement for cursor changes and text selection. Updates cursor icon, gutter hover state, and extends selection if dragging.
@param x: number — Screen x coordinate
@param y: number — Screen y coordinate
on_mouse_pressed
(method) core.docview:on_mouse_pressed(button: 'left'|'right', x: number, y: number, clicks: integer)
-> handled: boolean?
Handle mouse press for text selection and gutter clicks. Supports single/double click, shift-selection, and gutter line selection.
button:
| 'left'
| 'right'
@param x: number — Screen x coordinate
@param y: number — Screen y coordinate
@param clicks: integer — Number of clicks
@return handled: boolean? — True if event was handled
on_mouse_released
(method) core.docview:on_mouse_released(...any)
Handle mouse release to end text selection.
on_mouse_wheel
(method) core.view:on_mouse_wheel(y: number, x: number)
-> consumed: boolean?
Handle mouse wheel scroll events. Override for custom scroll behavior. Base implementation does nothing.
@param y: number — Vertical scroll delta; positive is "up"
@param x: number — Horizontal scroll delta; positive is "left"
@return consumed: boolean? — True to consume event
on_scale_change
(method) core.view:on_scale_change(new_scale: number, prev_scale: number)
Called when DPI scale changes (display moved, zoom changed, etc.). Override to adjust sizes, padding, or other scale-dependent values.
@param new_scale: number — New scale factor (e.g., 1.0, 1.5, 2.0)
@param prev_scale: number — Previous scale factor
on_text_input
(method) core.docview:on_text_input(text: string)
Handle text input from keyboard.
@param text: string — Input text
on_touch_moved
(method) core.view:on_touch_moved(x: number, y: number, dx: number, dy: number, i: number)
Handle touch move events (touchscreen/trackpad gestures). Override for touch-specific behavior. Base implementation handles scrolling.
@param x: number — Current touch x coordinate
@param y: number — Current touch y coordinate
@param dx: number — Delta x since last position
@param dy: number — Delta y since last position
@param i: number — Touch finger/pointer index
owns_view
(method) core.view:owns_view(view?: core.view)
-> owned: boolean
Check whether a view is this view or belongs to it through a container or owner. Follows parent, subparent, and floating owner links while guarding against cycles.
@param view?: core.view — Candidate view
@return owned: boolean — Whether the candidate belongs to this view
position_from_offset
(method) core.docview:position_from_offset(offset: integer)
-> line: integer
2. col: integer
Convert a visual line offset (from get_visible_line_range) to a real document position. Plugins that iterate visible rows should call this to get the real line and column represented by each composed visual row.
@param offset: integer — Visual line index (1-based)
@return line: integer — Real document line
@return col: integer — Column where the visual row starts
rebuild_visual_lines
(method) core.docview:rebuild_visual_lines(from_line?: integer)
Rebuild the composed visual-line model.
@param from_line?: integer — First document line that may have changed
resolve_screen_position
(method) core.docview:resolve_screen_position(x: number, y: number)
-> line: integer
2. col: integer
Convert screen coordinates to document line/column.
@param x: number — Screen x coordinate
@param y: number — Screen y coordinate
@return line: integer — Line number
@return col: integer — Column number
scroll_to_line
(method) core.docview:scroll_to_line(line: integer, ignore_if_visible?: boolean, instant?: boolean)
Scroll to center a line in the viewport.
@param line: integer — Line number to scroll to
@param ignore_if_visible?: boolean — Don't scroll if line already visible
@param instant?: boolean — Jump immediately without animation
scroll_to_make_visible
(method) core.docview:scroll_to_make_visible(line: integer, col: integer, instant?: boolean)
Scroll to make a position visible with context padding. Ensures the position is visible with surrounding context lines.
@param line: integer — Line number
@param col: integer — Column number
@param instant?: boolean — Jump immediately without animation
scrollbar_dragging
(method) core.view:scrollbar_dragging()
-> dragging: boolean
Check if user is currently dragging either scrollbar.
@return dragging: boolean — True if scrollbar drag is in progress
scrollbar_hovering
(method) core.view:scrollbar_hovering()
-> hovering: boolean
Check if mouse is hovering over either scrollbar track.
@return hovering: boolean — True if mouse is over scrollbar
scrollbar_overlaps_point
(method) core.view:scrollbar_overlaps_point(x: number, y: number)
-> overlaps: boolean
Check if a screen point overlaps either scrollbar. Useful for determining cursor style or handling clicks.
@param x: number — Screen x coordinate
@param y: number — Screen y coordinate
@return overlaps: boolean — True if point is over vertical or horizontal scrollbar
set_floating
(method) core.view:set_floating(enabled: boolean, options?: core.view.floating_options)
-> view: core.view
Enable or disable floating placement and configure popup input and ownership. Call show_floating() to show the view after enabling this mode. Detach it from its node or parent container before showing. Disabling hides it.
@param enabled: boolean — Whether the view should use floating placement
@param options?: core.view.floating_options — Options merged with existing ones when enabling
@return view: core.view — This view, for chaining
set_floating_bounds
(method) core.view:set_floating_bounds(x: number, y: number, w: number, h: number)
Set the popup's outer rectangle when RootView places, drags, or resizes it. Override for composites that need to update child layout or account for borders.
@param x: number — Screen x coordinate
@param y: number — Screen y coordinate
@param w: number — Outer width in pixels
@param h: number — Outer height in pixels
set_text
(method) widget.textbox.TextView:set_text(text: any, select: any)
show_floating
(method) core.view:show_floating(options?: core.view.floating_transition)
-> view: core.view
Show or raise the view in RootView's floating layer and apply its focus policy. Requires a view detached from its node and parent container. Reopening cancels a pending close and its completion callback. Disabled transitions apply placement and run the completion callback immediately.
@param options?: core.view.floating_transition — Optional opening slide (from) and callback
@return view: core.view — This view, for chaining
supports_text_input
(method) core.docview:supports_text_input()
-> accepts: boolean
Check if this view accepts text input.
@return accepts: boolean — Always returns true for DocView
try_close
(method) core.docview:try_close(do_close: function)
Attempt to close the view, prompting to save if document is dirty. Shows "Unsaved Changes" dialog if this is the last view of a dirty document.
@param do_close: function — Callback to execute when close is confirmed
update
(method) widget.textbox.TextView:update()
update_floating
(method) core.view:update_floating()
Update anchor placement or advance an opening or closing slide. RootView calls this before update() for each shown floating view. Completes removal and invokes the transition callback when a slide finishes.
update_ime_location
(method) core.docview:update_ime_location()
Update IME composition window location. Sets the bounding box for the system IME composition window.
update_scrollbar
(method) core.view:update_scrollbar()
Update scrollbar positions and sizes. Called automatically by update(). Rarely needs to be called manually.
visual_line_count
(method) core.docview:visual_line_count()
-> count: integer
Get the total number of visual rows.
@return count: integer
visual_position_from_row
(method) core.docview:visual_position_from_row(row: integer)
-> line: integer
2. col: integer
Convert a visual row to a real document position.
@return line: integer
@return col: integer
visual_row_from_position
(method) core.docview:visual_row_from_position(line: integer, col?: integer)
-> row: integer
Convert a real document position to a visual row.
@return row: integer
visual_rows_for_line
(method) core.docview:visual_rows_for_line(line: integer)
-> first_row: integer?
2. row_count: integer
Get the first visual row and row count for a real document line.
@return first_row: integer?
@return row_count: integer
from_state
function core.view.from_state(state: table)
-> view: (core.view)?
Create and initialize a new view instance from a previously saved state.
This function is called when restoring workspace/session state. Implementations are responsible for:
- creating the view instance
- applying any persisted state
If loading the instance failed nil will be returned.
@return view: (core.view)?
__call
(method) core.object:__call(...any)
-> obj: core.object
Metamethod allowing class to be called like a constructor.
Enables syntax: local obj = MyClass(args) instead of MyClass:new(args)
Automatically creates instance and calls new() with provided arguments.
@return obj: core.object — The new instance of the class
__tostring
(method) widget:__tostring()
-> string
Useful for debugging.
activate
(method) widget.textbox:activate()
add_child
(method) widget:add_child(child: widget)
Add a child widget, automatically assign a zindex if non set and sorts them in reverse order for better events matching.
@param child: widget — A base widget
animate
(method) widget:animate(target?: table, properties: table<string, number>, options?: widget.animation.options)
Registers a new animation to be ran on the update cycle.
@param target?: table — If nil assumes properties belong to widget it self.
@param options?: widget.animation.options
bring_to_front
(method) core.view:bring_to_front()
-> view: core.view
Raise a shown floating view and its owned popups above the other floating views.
@return view: core.view — This view, for chaining
capture_mouse
(method) widget:capture_mouse(scrolling?: boolean, button?: 'left'|'right')
All mouse events will be directly sent to the widget even if mouse moves outside the widget region.
button:
| 'left'
| 'right'
@param scrolling?: boolean — Capture for scrolling
@param button?: 'left'|'right' — Defaults to left
centered
(method) widget:centered()
Center the widget horizontally and vertically to the screen or parent widget.
clamp_scroll_position
(method) core.view:clamp_scroll_position()
Clamp scroll position to valid range (0 to max scrollable size). Called automatically by update(). Override get_scrollable_size() to customize.
deactivate
(method) widget.textbox:deactivate()
destroy
(method) widget:destroy()
Hide the widget, release its floating placement, and recursively destroy its children.
destroy_childs
(method) widget:destroy_childs()
Recursively destroy all childs from the widget.
drag
(method) widget:drag(x: number, y: number)
Used internally when dragging is activated.
draw
(method) widget.textbox:draw()
-> boolean
draw_background
(method) core.view:draw_background(color: renderer.color)
Draw a solid background color for the entire view. Commonly called at the start of draw() methods.
@param color: renderer.color — Array of bytes that represents a color used by the rendering functions.
draw_border
(method) widget:draw_border(x?: number, y?: number, w?: number, h?: number)
Draw the widget configured border or custom one.
draw_scrollbar
(method) widget:draw_scrollbar()
draw_styled_text
(method) widget:draw_styled_text(text: table<integer, string|integer|renderer.color|renderer.font|widget.colorreference...(+1)>, x: integer, y: integer, only_calc?: boolean, start_idx?: integer, end_idx?: integer)
-> width: integer
2. height: integer
Render or calculate the size of the specified range of elements in a styled text elemet.
@param text: table<integer, string|integer|renderer.color|renderer.font|widget.colorreference...(+1)>
@return width: integer
@return height: integer
draw_text_multiline
(method) widget:draw_text_multiline(font: string|renderer.font|widget.fontreference, text: string, x: integer, y: integer, color: renderer.color, only_calc: boolean)
-> resx: integer
2. resy: integer
3. width: integer
4. height: integer
Taken from the logview and modified it a tiny bit. TODO: something similar should be on pragtical core.
@param font: string|renderer.font|widget.fontreference — Represents a reference to a font stored elsewhere.
@param color: renderer.color — Array of bytes that represents a color used by the rendering functions.
@return resx: integer
@return resy: integer
@return width: integer
@return height: integer
extend
(method) core.object:extend()
-> cls: core.object
Create a new class that inherits from this one.
Returns a new class with this class as its parent.
Example: local MyClass = Object:extend()
@return cls: core.object — The new class table
extends
(method) core.object:extends(T: any)
-> extends: boolean
Check if object inherits from the given type (inheritance-aware).
Use this to check class hierarchy.
Example: view:extends(View) returns true for View and all subclasses
@param T: any — Class to check inheritance from
@return extends: boolean — True if object is T or inherits from T
get_bottom
(method) widget:get_bottom()
-> number
Get the bottom y coordinate relative to parent
get_content_bounds
(method) core.view:get_content_bounds()
-> x1: number
2. y1: number
3. x2: number
4. y2: number
Get the content bounds in content coordinates (accounting for scroll).
@return x1: number — Left edge
@return y1: number — Top edge
@return x2: number — Right edge
@return y2: number — Bottom edge
get_content_offset
(method) widget:get_content_offset()
-> x: number
2. y: number
Get the content origin while preserving fractional layout coordinates. Snap only the scroll displacement so descendants move by whole pixels together without shifting their borders relative to the parent's viewport.
@return x: number — Screen x coordinate after horizontal scrolling
@return y: number — Screen y coordinate after vertical scrolling
get_floating_bounds
(method) widget:get_floating_bounds()
-> x: number
2. y: number
3. w: number
4. h: number
Get the widget's outer screen rectangle, including its border.
@return x: number — Outer screen x coordinate
@return y: number — Outer screen y coordinate
@return w: number — Width including the border
@return h: number — Height including the border
get_floating_drag_region
(method) core.view:get_floating_drag_region()
-> x: number?
2. y: number?
3. w: number?
4. h: number?
Get the screen rectangle where a floating view can be dragged. Override to restrict dragging to a header; defaults to the full popup bounds.
@return x: number? — Screen x coordinate, or nil to disable dragging
@return y: number? — Screen y coordinate
@return w: number? — Region width
@return h: number? — Region height
get_focus_target
(method) widget:get_focus_target()
-> target: core.view
Focus the active child or its TextView, falling back to this widget's input or itself.
@return target: core.view — View that should receive keyboard focus
get_font
(method) widget:get_font(font?: string|renderer.font|widget.fontreference)
-> renderer.font
Get the real renderer.font associated with a widget.font.
@param font?: string|renderer.font|widget.fontreference — Represents a reference to a font stored elsewhere.
@return: renderer.font
get_h_scrollable_size
(method) widget:get_h_scrollable_size()
-> number
Calculates the x scrollable size taking into account the right most widget or the size of the widget it self if greater.
get_height
(method) widget:get_height()
-> number
Get height including borders.
get_module
(method) core.view:get_module()
-> path: string?
Returns the module path of this view.
This method resolves the Lua module name that loaded the concrete view
class (for example "core.view").
If the view class cannot be associated with any loaded module, nil
is returned.
@return path: string?
get_name
(method) widget:get_name()
-> string
The name that is displayed on pragtical tabs.
get_password_mode
(method) widget.textbox:get_password_mode()
-> boolean
Get whether password display mode is enabled.
get_position
(method) widget:get_position()
-> widget.position
Get the relative position in relation to parent
@return: widget.position
get_real_height
(method) widget:get_real_height()
-> number
Overall height of the widget accounting all visible child widgets.
get_real_width
(method) widget:get_real_width()
-> number
Overall width of the widget accounting all visible child widgets.
get_right
(method) widget:get_right()
-> number
Get the right x coordinate relative to parent
get_scrollable_size
(method) widget:get_scrollable_size()
-> number
Calculates the y scrollable size taking into account the bottom most widget or the size of the widget it self if greater.
get_size
(method) widget:get_size()
-> widget.position
@return: widget.position
get_state
(method) core.view:get_state()
-> state: table?
Serialize this view into a persistable state table.
This method is called when the editor is saving workspace/session state. The returned table must contain only plain Lua data (no functions, userdata, metatables, or cyclic references).
Returning nil indicates that this view should NOT be restored when
reloading the workspace.
@return state: table?
get_text
(method) widget.textbox:get_text()
-> string
Get the text displayed on the textbox.
get_width
(method) widget:get_width()
-> number
Get width including borders.
hide
(method) widget:hide()
Hide the widget.
hide_animated
(method) widget:hide_animated(lock_x?: boolean, lock_y?: boolean, options?: widget.animation.options)
Perform an animated hide.
@param lock_x?: boolean — Do not resize width while animating
@param lock_y?: boolean — Do not resize height while animating
@param options?: widget.animation.options
hide_floating
(method) core.view:hide_floating(options?: core.view.floating_transition)
-> view: core.view
Hide the floating view, close owned popups, cancel input, and restore focus. A closing slide delays removal while the view immediately stops receiving input. Disabled transitions remove the view and run the completion callback immediately.
@param options?: core.view.floating_transition — Optional closing slide (to) and callback
@return view: core.view — This view, for chaining
hit_test
(method) widget:hit_test(x: number, y: number)
-> inside: boolean
Reuse widget hit testing for RootView's floating pointer routing.
@param x: number — Screen x coordinate
@param y: number — Screen y coordinate
@return inside: boolean — Whether the point lies over the widget
is
(method) core.object:is(T: any)
-> is_exact: boolean
Check if object is exactly of the given type (no inheritance check).
Use this for strict type matching.
Example: view:is(DocView) returns true only if view is a DocView, not a subclass
@param T: any — Class to check against
@return is_exact: boolean — True if object is exactly type T
is_class_of
(method) core.object:is_class_of(T: any)
-> is_instance: boolean
Check if the given object is exactly an instance of this class.
Inverse of is() - checks if T is an instance of self.
Example: DocView:is_class_of(obj) checks if obj is exactly a DocView
@param T: any — Object to check
@return is_instance: boolean — True if T is exactly an instance of this class
is_extended_by
(method) core.object:is_extended_by(T: any)
-> is_extended: boolean
Check if the given object/class inherits from this class.
Inverse of extends() - checks if T is a subclass of self.
Example: View:is_extended_by(DocView) checks if DocView inherits from View
@param T: any — Object or class to check
@return is_extended: boolean — True if T inherits from this class
is_floating_owner_visible
(method) core.view:is_floating_owner_visible()
-> visible: boolean?
Check whether floating popups owned by this view should remain visible. Docked owners must be active in their node; container children follow their parent. Override for composites with their own visibility rules.
@return visible: boolean? — Falsy when the owner is hidden or its tab is inactive
is_visible
(method) widget:is_visible()
-> boolean
Check if the widget is visible also recursing to the parent visibility.
mouse_on_top
(method) widget:mouse_on_top(x: number, y: number)
-> boolean
Check if the given mouse coordinate is hovering the widget
move_towards
(method) core.view:move_towards(t: table, k: string|number, dest: number, rate?: number, name?: string)
Smoothly animate a value towards a destination. Use this for animations instead of direct assignment.
@param t: table — Table containing the value
@param k: string|number — Key in table
@param dest: number — Target value
@param rate?: number — Animation speed (0-1, default 0.5, higher = faster)
@param name?: string — Transition name (for config.disabled_transitions)
new
(method) widget.textbox:new(parent: widget, text: boolean, placeholder: any, options: any)
@param parent: widget — A base widget
on_change
(method) widget:on_change(value: any)
Event emitted when the value of the widget changes. If applicable, child widgets should call this method when its value changes.
on_click
(method) widget:on_click(button: "left"|"right", x: number, y: number)
Click event emitted on a succesful on_mouse_pressed and on_mouse_released events combo.
button:
| "left"
| "right"
on_file_dropped
(method) widget:on_file_dropped(filename: string, x: number, y: number)
-> processed: boolean
Send file drop event to hovered child.
@return processed: boolean
on_floating_dismiss
(method) widget:on_floating_dismiss(reason: "escape"|"focuslost"|"outside")
Dismiss through the widget's normal hide lifecycle and subclass hooks.
reason:
| "escape"
| "outside"
| "focuslost"
@param reason: "escape"|"focuslost"|"outside" — Event requesting dismissal
on_floating_visibility_changed
(method) widget:on_floating_visibility_changed(visible: boolean)
Synchronize widget visibility with RootView, including owner-driven popup removal.
@param visible: boolean — Whether the floating widget remains shown
on_ime_text_editing
(method) core.view:on_ime_text_editing(text: string, start: number, length: number)
Handle IME (Input Method Editor) text composition events. Override for IME support in text editors. Called during composition.
@param text: string — Composition text being edited
@param start: number — Start position of selection within composition
@param length: number — Length of selection within composition
on_key_pressed
(method) core.view:on_key_pressed(stroke: string, ...any)
-> consumed: boolean?
Handle a floating view's keyboard input before command dispatch. Override and return true to consume the normalized key binding.
@param stroke: string — Normalized key binding, such as "ctrl+return"
@param: any — Additional arguments forwarded by the keyboard handler
@return consumed: boolean? — Whether the event was handled
on_mouse_capture_lost
(method) widget.textbox:on_mouse_capture_lost()
on_mouse_enter
(method) widget:on_mouse_enter(x: any, y: any, dx: any, dy: any)
Emitted once when the mouse hovers the widget.
on_mouse_leave
(method) widget:on_mouse_leave(x: any, y: any, dx: any, dy: any)
Emitted once when the mouse leaves the widget.
on_mouse_left
(method) widget:on_mouse_left()
on_mouse_moved
(method) widget.textbox:on_mouse_moved(x: number, y: number, dx: number, dy: number)
-> boolean
on_mouse_pressed
(method) widget.textbox:on_mouse_pressed(button: "left"|"right", x: number, y: number, clicks: integer)
-> boolean
on_mouse_released
(method) widget.textbox:on_mouse_released(button: "left"|"right", x: number, y: number)
-> boolean
on_mouse_wheel
(method) widget:on_mouse_wheel(y: number, x: number)
-> boolean
on_scale_change
(method) widget:on_scale_change(new_scale: number, prev_scale: number)
Can be overriden by widgets to listen for scale change events to apply any neccesary changes in sizes, padding, etc...
on_text_change
(method) widget.textbox:on_text_change(action: string, ...any)
Event fired on any text change event. insert arguments (see Doc:raw_insert): line, col, text, undo_stack, time remove arguments (see Doc:raw_remove): line1, col1, line2, col2, undo_stack, time
@param action: string — Can be "insert" or "remove",
on_text_input
(method) widget.textbox:on_text_input(text: string)
-> boolean
on_touch_moved
(method) core.view:on_touch_moved(x: number, y: number, dx: number, dy: number, i: number)
Handle touch move events (touchscreen/trackpad gestures). Override for touch-specific behavior. Base implementation handles scrolling.
@param x: number — Current touch x coordinate
@param y: number — Current touch y coordinate
@param dx: number — Delta x since last position
@param dy: number — Delta y since last position
@param i: number — Touch finger/pointer index
owns_view
(method) core.view:owns_view(view?: core.view)
-> owned: boolean
Check whether a view is this view or belongs to it through a container or owner. Follows parent, subparent, and floating owner links while guarding against cycles.
@param view?: core.view — Candidate view
@return owned: boolean — Whether the candidate belongs to this view
release_mouse
(method) widget:release_mouse(skip_cancel?: boolean)
Release this widget's capture and clear capture state on its ancestors.
@param skip_cancel?: boolean — Skip the cancellation callback when already handling capture loss
remove_child
(method) widget:remove_child(child: widget)
Remove a child widget.
@param child: widget — A base widget
run_animations
(method) widget:run_animations()
Runs all registered animations removing duplicated and finished ones.
schedule_update
(method) widget:schedule_update(delayed: any)
Schedule a core update and redraw. Since widgets try to not fire updates and draws to child widgets to reduce cpu consumption this function can be used when a re-update and re-draw is strictly needed.
scrollbar_dragging
(method) core.view:scrollbar_dragging()
-> dragging: boolean
Check if user is currently dragging either scrollbar.
@return dragging: boolean — True if scrollbar drag is in progress
scrollbar_hovering
(method) core.view:scrollbar_hovering()
-> hovering: boolean
Check if mouse is hovering over either scrollbar track.
@return hovering: boolean — True if mouse is over scrollbar
scrollbar_overlaps_point
(method) core.view:scrollbar_overlaps_point(x: number, y: number)
-> overlaps: boolean
Check if a screen point overlaps either scrollbar. Useful for determining cursor style or handling clicks.
@param x: number — Screen x coordinate
@param y: number — Screen y coordinate
@return overlaps: boolean — True if point is over vertical or horizontal scrollbar
set_border_width
(method) widget:set_border_width(width: integer)
Set the widget border size and appropriately re-set the widget size.
set_floating
(method) core.view:set_floating(enabled: boolean, options?: core.view.floating_options)
-> view: core.view
Enable or disable floating placement and configure popup input and ownership. Call show_floating() to show the view after enabling this mode. Detach it from its node or parent container before showing. Disabling hides it.
@param enabled: boolean — Whether the view should use floating placement
@param options?: core.view.floating_options — Options merged with existing ones when enabling
@return view: core.view — This view, for chaining
set_floating_bounds
(method) widget:set_floating_bounds(x: number, y: number, w: number, h: number)
Apply outer popup bounds using the widget's border-aware size and position setters. Pass dimensions unchanged: set_size() already accounts for the border.
@param x: number — Outer screen x coordinate
@param y: number — Outer screen y coordinate
@param w: number — Width including the border
@param h: number — Height including the border
set_label
(method) widget:set_label(text: string|table<integer, string|integer|renderer.color|renderer.font|widget.colorreference...(+1)>)
A text label for the widget, not all widgets support this.
@param text: string|table<integer, string|integer|renderer.color|renderer.font|widget.colorreference...(+1)>
set_password_mode
(method) widget.textbox:set_password_mode(enabled: boolean)
Enable or disable password display mode.
set_position
(method) widget:set_position(x?: integer, y?: integer)
Set the position of the widget and updates the child absolute coordinates
set_size
(method) widget.textbox:set_size(width: integer)
set_target_size
(method) widget:set_target_size(axis: string|'x'|'y', value: number)
-> boolean
Called by pragtical node system to properly resize the widget.
axis:
| 'x'
| 'y'
set_text
(method) widget.textbox:set_text(text: string, select?: boolean)
Set the text displayed on the textbox.
set_tooltip
(method) widget:set_tooltip(tooltip?: string|table<integer, string|integer|renderer.color|renderer.font|widget.colorreference...(+1)>, command?: string)
Text displayed when the widget is hovered. If a command name is also given its associated binding will be displayed as part of the tooltip.
@param tooltip?: string|table<integer, string|integer|renderer.color|renderer.font|widget.colorreference...(+1)>
show
(method) widget:show()
Show the widget.
show_animated
(method) widget:show_animated(lock_x?: boolean, lock_y?: boolean, options?: widget.animation.options)
Perform an animated show.
@param lock_x?: boolean — Do not resize width while animating
@param lock_y?: boolean — Do not resize height while animating
@param options?: widget.animation.options
show_floating
(method) core.view:show_floating(options?: core.view.floating_transition)
-> view: core.view
Show or raise the view in RootView's floating layer and apply its focus policy. Requires a view detached from its node and parent container. Reopening cancels a pending close and its completion callback. Disabled transitions apply placement and run the completion callback immediately.
@param options?: core.view.floating_transition — Optional opening slide (from) and callback
@return view: core.view — This view, for chaining
supports_text_input
(method) core.view:supports_text_input()
-> boolean
Whether this view accepts text input (enables IME). Override and return true for text editors and input fields.
swap_active_child
(method) widget:swap_active_child(child?: widget)
Replaces current active child with a new one and calls the activate/deactivate events of the child. This is especially used to send text input events to widgets with input_text support.
@param child?: widget — If nil deactivates current child
toggle_background
(method) widget:toggle_background(enable?: boolean)
When set to false the background rendering is disabled.
toggle_visible
(method) widget:toggle_visible(animated?: boolean, lock_x?: boolean, lock_y?: boolean, options?: widget.animation.options)
Toggle visibility of widget.
@param options?: widget.animation.options
try_close
(method) core.view:try_close(do_close: function)
Called when view is requested to close (e.g., tab close button).
Override to show confirmation dialogs for unsaved changes.
Example: core.command_view:enter("Save?", \{submit = do_close\})
@param do_close: function — Call this function to actually close the view
update
(method) widget.textbox:update()
-> boolean
update_floating
(method) core.view:update_floating()
Update anchor placement or advance an opening or closing slide. RootView calls this before update() for each shown floating view. Completes removal and invokes the transition callback when a slide finishes.
update_if_scaled
(method) widget:update_if_scaled()
Explicitly call the widget update procedure when the scale change even if the widget is not visible.
update_position
(method) widget:update_position(recursive?: boolean)
Called on the update function to be able to scroll the child widgets.
@param recursive?: boolean — Update descendants; defaults to true.
update_scrollbar
(method) core.view:update_scrollbar()
Update scrollbar positions and sizes. Called automatically by update(). Rarely needs to be called manually.
update_size_position
(method) widget:update_size_position()
Similar to update, but here you should perform expensive calculations that will get executed for a predefined period of time when a widget is initialized, scale has changed or a widget switched from hidden to visible.