Skip to content

PixelUI.TextBox

Extends: PixelUI.Widget

A text input widget supporting single and multi-line input. Features syntax highlighting, autocomplete, and find/replace.

Properties

NameTypeDescription
textstringCurrent text content
placeholderstringPlaceholder text shown when empty
onChangefun(self:PixelUI.TextBox,
maxLengthinteger?Maximum allowed text length
multilinebooleanWhether to support multiple lines
autocompletestring[]?Array of autocomplete suggestions
autocompleteMaxItemsinteger?Maximum suggestions shown in popup
autocompleteBgPixelUI.Color?Popup background color
autocompleteFgPixelUI.Color?Popup foreground color
autocompleteHighlightBgPixelUI.Color?Highlight background for the active suggestion
autocompleteHighlightFgPixelUI.Color?Highlight foreground for the active suggestion
autocompleteBorderPixelUI.BorderConfig?Optional border for the popup
autocompleteMaxWidthinteger?Maximum popup width in characters
autocompleteGhostColorPixelUI.Color?Ghost text color inside the editor
syntaxtable?Syntax highlighting configuration
scrollbarPixelUI.ScrollbarConfig?Optional scrollbar configuration

Methods

new

lua
new()

setOnCursorMove

lua
setOnCursorMove()

setScrollbar

lua
setScrollbar()

onFocusChanged

lua
onFocusChanged()

_applyMaxLength

lua
_applyMaxLength()

_syncTextFromLines

lua
_syncTextFromLines()

_setTextInternal

lua
_setTextInternal()

_indexToPosition

lua
_indexToPosition()

_moveCursorToIndex

lua
_moveCursorToIndex()

getCursorPosition

lua
getCursorPosition()

getLineCount

lua
getLineCount()

_getInnerMetrics

lua
_getInnerMetrics()

_getOverlayHeight

lua
_getOverlayHeight()

_computeLayoutMetrics

lua
_computeLayoutMetrics()

_getContentSize

lua
_getContentSize()

_ensureCursorVisible

lua
_ensureCursorVisible()

_notifyChange

lua
_notifyChange()

_notifyCursorChange

lua
_notifyCursorChange()

_hasSelection

lua
_hasSelection()

getSelectionLength

lua
getSelectionLength()

getSelectionText

lua
getSelectionText()

_getSelectionRange

lua
_getSelectionRange()

_collectRange

lua
_collectRange()

_clearSelection

lua
_clearSelection()

_removeRange

lua
_removeRange()

_insertAt

lua
_insertAt()

_deleteSelection

lua
_deleteSelection()

_replaceSelection

lua
_replaceSelection()

_insertTextAtCursor

lua
_insertTextAtCursor()

_insertCharacter

lua
_insertCharacter()

_insertNewline

lua
_insertNewline()

_insertTab

lua
_insertTab()

_deleteBackward

lua
_deleteBackward()

_deleteForward

lua
_deleteForward()

_setCursorPosition

lua
_setCursorPosition()

_moveCursorLeft

lua
_moveCursorLeft()

_moveCursorRight

lua
_moveCursorRight()

_moveCursorVertical

lua
_moveCursorVertical()

_moveCursorUp

lua
_moveCursorUp()

_moveCursorDown

lua
_moveCursorDown()

_moveCursorLineStart

lua
_moveCursorLineStart()

_moveCursorLineEnd

lua
_moveCursorLineEnd()

_moveCursorDocumentStart

lua
_moveCursorDocumentStart()

_moveCursorDocumentEnd

lua
_moveCursorDocumentEnd()

_selectAll

lua
_selectAll()

_scrollLines

lua
_scrollLines()

_scrollColumns

lua
_scrollColumns()

_cursorFromPoint

lua
_cursorFromPoint()

_computeSyntaxColors

lua
_computeSyntaxColors()

_buildLineSegments

lua
_buildLineSegments()

_drawSegments

lua
_drawSegments()

_drawFindOverlay

lua
_drawFindOverlay()

_hideAutocomplete

lua
_hideAutocomplete()

_isPointInAutocomplete

lua
_isPointInAutocomplete()

_autocompleteIndexFromPoint

lua
_autocompleteIndexFromPoint()

_drawDropdown

lua
_drawDropdown()

_updateAutocomplete

lua
_updateAutocomplete()

_computeAutocompleteGhost

lua
_computeAutocompleteGhost()

_acceptAutocomplete

lua
_acceptAutocomplete()

_moveAutocompleteSelection

lua
_moveAutocompleteSelection()

_toggleFindOverlay

lua
_toggleFindOverlay()

_closeFindOverlay

lua
_closeFindOverlay()

_toggleFindField

lua
_toggleFindField()

_editFindFieldText

lua
_editFindFieldText()

_handleOverlayBackspace

lua
_handleOverlayBackspace()

_updateFindMatches

lua
_updateFindMatches()

_selectMatch

lua
_selectMatch()

_gotoMatch

lua
_gotoMatch()

_gotoNextMatch

lua
_gotoNextMatch()

_gotoPreviousMatch

lua
_gotoPreviousMatch()

_replaceCurrentMatch

lua
_replaceCurrentMatch()

_replaceAll

lua
_replaceAll()

_handleEscape

lua
_handleEscape()

_handleKey

lua
_handleKey()

draw

lua
draw()

handleEvent

lua
handleEvent()

setText

lua
setText()

getText

lua
getText()

setOnChange

lua
setOnChange()

Released under the MIT License.