Raxol.UI.Components.Input.MultiLineInput.TextHelper (Raxol v2.0.1)
View SourceText manipulation helper functions for MultiLineInput component.
Summary
Functions
Calculates new cursor position.
Deletes the current selection and returns the updated state.
Handles backspace when no selection exists.
Handles delete when no selection exists.
Inserts a character at the cursor position.
Replaces text in a range with new text.
Splits text into lines based on width and wrap mode.
Functions
@spec calculate_new_position( Raxol.UI.Components.Input.MultiLineInput.t(), {integer(), integer()} ) :: {integer(), integer()}
@spec calculate_new_position( Raxol.UI.Components.Input.MultiLineInput.t(), String.t(), {integer(), integer()} ) :: {integer(), integer()}
Calculates new cursor position.
Can be used for:
- Calculating position after text changes (2 args)
- Calculating position after text insertion (3 args)
@spec delete_selection(Raxol.UI.Components.Input.MultiLineInput.t()) :: Raxol.UI.Components.Input.MultiLineInput.t()
Deletes the current selection and returns the updated state.
@spec handle_backspace_no_selection(Raxol.UI.Components.Input.MultiLineInput.t()) :: Raxol.UI.Components.Input.MultiLineInput.t()
Handles backspace when no selection exists.
@spec handle_delete_no_selection(Raxol.UI.Components.Input.MultiLineInput.t()) :: Raxol.UI.Components.Input.MultiLineInput.t()
Handles delete when no selection exists.
@spec insert_char(Raxol.UI.Components.Input.MultiLineInput.t(), integer()) :: Raxol.UI.Components.Input.MultiLineInput.t()
Inserts a character at the cursor position.
@spec replace_text_range( Raxol.UI.Components.Input.MultiLineInput.t(), {integer(), integer()}, {integer(), integer()}, String.t() ) :: Raxol.UI.Components.Input.MultiLineInput.t()
Replaces text in a range with new text.
Splits text into lines based on width and wrap mode.