Vuo  2.3.2
Macros | Typedefs | Functions | Variables
VuoTextEdit.h File Reference

Description

Implementation of stb_textedit functions.

Definition in file VuoTextEdit.h.

Go to the source code of this file.

Macros

#define STB_TEXTEDIT_CHARTYPE   uint64_t
 The type of a single character. More...
 
#define COMMAND_HI   ((((uint64_t)VuoModifierKey_Command) << 32))
 Convert VuoModifierKey_Command to high 32 bits of 64 unsigned int. More...
 
#define CONTROL_HI   ((((uint64_t)VuoModifierKey_Control) << 32))
 Convert Control to high 32 bits of 64 unsigned int. More...
 
#define OPTION_HI   ((((uint64_t)VuoModifierKey_Option) << 32))
 Convert VuoModifierKey_Option to high 32 bits of 64 unsigned int. More...
 
#define SHIFT_HI   ((((uint64_t)VuoModifierKey_Shift) << 32))
 Convert VuoModifierKey_Shift to high 32 bits of 64 unsigned int. More...
 
#define KEYCODE_COPY   0x3
 The keycode to recognize as a "Copy" event. More...
 
#define KEYCODE_PASTE   0x16
 The keycode to recognize as a "Paste" event. More...
 
#define KEYCODE_CUT   0x18
 The keycode to recognize as a "Cut" event. More...
 
#define KEYCODE_ESC   0x1b
 The keycode to recognize as a "Escape" event. More...
 
#define KEYCODE_TAB   0x9
 The keycode to recognize as Tab More...
 
#define KEYCODE_RETURN   0xD
 The keycode to recognize as Return (above right shift key) More...
 
#define KEYCODE_ENTER   0x3
 The keycode to recognize as Enter (fn-return, or button on the bottom-right of an extended keyboard) More...
 
#define STB_TEXTEDIT_K_LEFT   0x0001C
 Keyboard input to move cursor left. More...
 
#define STB_TEXTEDIT_K_RIGHT   0x0001D
 Keyboard input to move cursor right. More...
 
#define STB_TEXTEDIT_K_UP   0x0001E
 Keyboard input to move cursor up. More...
 
#define STB_TEXTEDIT_K_DOWN   0x0001F
 Keyboard input to move cursor down. More...
 
#define STB_TEXTEDIT_K_LINESTART   (COMMAND_HI | STB_TEXTEDIT_K_LEFT)
 Keyboard input to move cursor to start of line. More...
 
#define STB_TEXTEDIT_K_LINESTART2   0x1
 Keyboard input to move cursor to start of line (home key) More...
 
#define STB_TEXTEDIT_K_LINEEND   (COMMAND_HI | STB_TEXTEDIT_K_RIGHT)
 Keyboard input to move cursor to end of line. More...
 
#define STB_TEXTEDIT_K_LINEEND2   0x4
 Keyboard input to move cursor to end of line (end key) More...
 
#define STB_TEXTEDIT_K_TEXTSTART   (COMMAND_HI | STB_TEXTEDIT_K_UP)
 Keyboard input to move cursor to start of text. More...
 
#define STB_TEXTEDIT_K_TEXTSTART2   (CONTROL_HI | 0x41)
 Keyboard input to move cursor to start of text (Control+A) More...
 
#define STB_TEXTEDIT_K_TEXTEND   (COMMAND_HI | STB_TEXTEDIT_K_DOWN)
 Keyboard input to move cursor to end of text. More...
 
#define STB_TEXTEDIT_K_TEXTEND2   (CONTROL_HI | 0x45)
 Keyboard input to move cursor to end of text. More...
 
#define STB_TEXTEDIT_K_DELETE   0x7f
 Keyboard input to delete selection or character under cursor. More...
 
#define STB_TEXTEDIT_K_BACKSPACE   0x00008
 Keyboard input to delete selection or character left of cursor. More...
 
#define STB_TEXTEDIT_K_UNDO   (COMMAND_HI | 0x1A)
 Keyboard input to perform undo. More...
 
#define STB_TEXTEDIT_K_REDO   (COMMAND_HI | 0x19)
 Keyboard input to perform redo. More...
 
#define STB_TEXTEDIT_K_REDO2   ((COMMAND_HI | SHIFT_HI) | 0x1A)
 Keyboard input to perform redo. More...
 
#define STB_TEXTEDIT_K_WORDLEFT   (OPTION_HI | STB_TEXTEDIT_K_LEFT)
 Keyboard input to move cursor left one word. More...
 
#define STB_TEXTEDIT_K_WORDRIGHT   (OPTION_HI | STB_TEXTEDIT_K_RIGHT)
 Keyboard input to move cursor right one word. More...
 
#define STB_TEXTEDIT_K_DELETEWORD   (OPTION_HI | STB_TEXTEDIT_K_BACKSPACE)
 Keyboard input to delete the characters to the left of the cursor up to the first whitespace. More...
 
#define STB_TEXTEDIT_K_DELETEWORDRIGHT   (OPTION_HI | STB_TEXTEDIT_K_DELETE)
 Keyboard input to delete the characters to the right of the cursor up to the first whitespace. More...
 
#define STB_TEXTEDIT_K_DELETELINE   (COMMAND_HI | STB_TEXTEDIT_K_BACKSPACE)
 Keyboard input to delete the characters to the left of the cursor up to the first line break. More...
 
#define STB_TEXTEDIT_K_DELETELINERIGHT   (COMMAND_HI | STB_TEXTEDIT_K_DELETE)
 Keyboard input to delete the characters to the right of the cursor up to the first line break. More...
 
#define STB_TEXTEDIT_K_SHIFT   SHIFT_HI
 Keyboard input to signify shift modifier. More...
 
#define STB_TEXTEDIT_K_SELECTALL   (COMMAND_HI | 0x1)
 Keyboard input to select all text. More...
 
#define STB_TEXTEDIT_GETWIDTH_NEWLINE   0
 The width of a newline character. More...
 
#define STB_TEXTEDIT_IS_SPACE(x)   VuoTextEdit_isSeparator(((uint32_t)x))
 Tests if a UTF32 value is considered whitespace. More...
 
#define STB_TEXTEDIT_IS_SEPARATOR(x)   VuoTextEdit_isSeparator(((uint32_t)x))
 Tests if a UTF32 value is considered a word separator. More...
 

Typedefs

typedef VuoText STB_TEXTEDIT_STRING
 The type of object representing a string being edited, typically this is a wrapper object with other data you need. More...
 

Functions

static STB_TEXTEDIT_CHARTYPE VuoTextEdit_combineKeyAndModifier (uint32_t utf32, VuoModifierKey modifiers)
 Pack a UTF32 char and VuoModifierKey into a Uint64. More...
 
static STB_TEXTEDIT_CHARTYPEVuoTextEdit_makeCharArrayWithVuoText (VuoText text, size_t *length)
 Convert a VuoText string to an array of STB_TEXTEDIT_CHARTYPE. More...
 
static int STB_TEXTEDIT_STRINGLEN (const STB_TEXTEDIT_STRING *obj)
 The length of the string. More...
 
static bool VuoTextEdit_isNewLine (uint32_t utf32_char)
 Tests if a UTF32 value is considered a new line character. More...
 
static bool VuoTextEdit_isWhiteSpace (uint32_t utf32_char)
 Tests if a UTF32 value is considered white space. More...
 
static bool VuoTextEdit_isSeparator (uint32_t utf32_char)
 Tests if a UTF32 value is considered a word separator. More...
 
static void stb_textedit_prep_selection_at_cursor (STB_TexteditState *state)
 Forward declaration stb_textedit_prep_selection_at_cursor. More...
 
static void VuoTextEdit_selectFromCursorToSeparator (STB_TEXTEDIT_STRING *str, STB_TexteditState *state, bool(*separatorFunc)(uint32_t))
 Selects the all text to the left and right of cursor up to any character matched by separatorFunc. More...
 
static void VuoTextEdit_copy (STB_TEXTEDIT_STRING *str, STB_TexteditState *state)
 Copy the current text selection to the clipboard. More...
 
static int stb_textedit_cut (STB_TEXTEDIT_STRING *str, STB_TexteditState *state)
 Forward declaration of cut function. More...
 
static int VuoTextEdit_cut (STB_TEXTEDIT_STRING *str, STB_TexteditState *state)
 Perform a text cut operation (copy selected characters to clipboard and delete). More...
 
static int stb_textedit_paste (STB_TEXTEDIT_STRING *str, STB_TexteditState *state, STB_TEXTEDIT_CHARTYPE const *ctext, int len)
 Forward declaration of stb_textedit_paste. More...
 
static STB_TEXTEDIT_CHARTYPE STB_TEXTEDIT_GETCHAR (const STB_TEXTEDIT_STRING *obj, int idx)
 returns the i'th character of obj, 0-based More...
 
static int stb_textedit_linecount (STB_TEXTEDIT_STRING *str)
 Return the number of new line characters in a string. More...
 
static VuoText VuoTextEdit_truncateLines (VuoText text, VuoInteger maxLines)
 Remove any text past maxLines. More...
 
static void VuoTextEdit_paste (STB_TEXTEDIT_STRING *str, STB_TexteditState *state)
 Perform a text paste operation (copy text from clipboard to current cursor position). More...
 
static int stb_text_locate_coord (STB_TexteditState *state, float x, float y)
 Overrides stb_textedit implementation. More...
 
static void stb_textedit_find_charpos (StbFindState *find, STB_TEXTEDIT_STRING *str, int n, STB_TexteditState *state)
 Find the x/y location of a character, and remember info about the previous row in case we get a move-up event (for page up, we'll have to rescan). More...
 
static int VuoTextEdit_findLineIndex (int charIndex, STB_TexteditState *state)
 Given a character index, find the line it resides in. More...
 
static uint32_t STB_TEXTEDIT_KEYTOTEXT (STB_TEXTEDIT_CHARTYPE key)
 maps a keyboard input to an insertable character (return type is int, 0 means not valid to insert) More...
 
static float STB_TEXTEDIT_GETWIDTH (STB_TEXTEDIT_STRING *obj, int n, int i, STB_TexteditState *state)
 Returns the pixel delta from the xpos of the i'th character to the xpos of the i+1'th char for a line of characters starting at character n (i.e. More...
 
static void STB_TEXTEDIT_LAYOUTROW (StbTexteditRow *r, STB_TEXTEDIT_STRING *obj, int line_start_idx, STB_TexteditState *state)
 Lay out the text in rows. More...
 
static void STB_TEXTEDIT_DELETECHARS (STB_TEXTEDIT_STRING *obj, int pos, int n)
 Delete n characters starting at i. More...
 
static bool STB_TEXTEDIT_INSERTCHARS (STB_TEXTEDIT_STRING *obj, int pos, const STB_TEXTEDIT_CHARTYPE *new_text, int new_text_len)
 insert n characters at i (pointed to by STB_TEXTEDIT_CHARTYPE*) More...
 

Variables

static char STB_TEXTEDIT_NEWLINE = '\n'
 The character representing a newline. See also VuoTextEdit_isNewLine. More...
 

Macro Definition Documentation

◆ COMMAND_HI

#define COMMAND_HI   ((((uint64_t)VuoModifierKey_Command) << 32))

Convert VuoModifierKey_Command to high 32 bits of 64 unsigned int.

Definition at line 28 of file VuoTextEdit.h.

◆ CONTROL_HI

#define CONTROL_HI   ((((uint64_t)VuoModifierKey_Control) << 32))

Convert Control to high 32 bits of 64 unsigned int.

Definition at line 29 of file VuoTextEdit.h.

◆ KEYCODE_COPY

#define KEYCODE_COPY   0x3

The keycode to recognize as a "Copy" event.

Definition at line 33 of file VuoTextEdit.h.

◆ KEYCODE_CUT

#define KEYCODE_CUT   0x18

The keycode to recognize as a "Cut" event.

Definition at line 35 of file VuoTextEdit.h.

◆ KEYCODE_ENTER

#define KEYCODE_ENTER   0x3

The keycode to recognize as Enter (fn-return, or button on the bottom-right of an extended keyboard)

Definition at line 39 of file VuoTextEdit.h.

◆ KEYCODE_ESC

#define KEYCODE_ESC   0x1b

The keycode to recognize as a "Escape" event.

Definition at line 36 of file VuoTextEdit.h.

◆ KEYCODE_PASTE

#define KEYCODE_PASTE   0x16

The keycode to recognize as a "Paste" event.

Definition at line 34 of file VuoTextEdit.h.

◆ KEYCODE_RETURN

#define KEYCODE_RETURN   0xD

The keycode to recognize as Return (above right shift key)

Definition at line 38 of file VuoTextEdit.h.

◆ KEYCODE_TAB

#define KEYCODE_TAB   0x9

The keycode to recognize as Tab

Definition at line 37 of file VuoTextEdit.h.

◆ OPTION_HI

#define OPTION_HI   ((((uint64_t)VuoModifierKey_Option) << 32))

Convert VuoModifierKey_Option to high 32 bits of 64 unsigned int.

Definition at line 30 of file VuoTextEdit.h.

◆ SHIFT_HI

#define SHIFT_HI   ((((uint64_t)VuoModifierKey_Shift) << 32))

Convert VuoModifierKey_Shift to high 32 bits of 64 unsigned int.

Definition at line 31 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_CHARTYPE

#define STB_TEXTEDIT_CHARTYPE   uint64_t

The type of a single character.

Definition at line 18 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_GETWIDTH_NEWLINE

#define STB_TEXTEDIT_GETWIDTH_NEWLINE   0

The width of a newline character.

Definition at line 71 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_IS_SEPARATOR

#define STB_TEXTEDIT_IS_SEPARATOR (   x)    VuoTextEdit_isSeparator(((uint32_t)x))

Tests if a UTF32 value is considered a word separator.

Definition at line 377 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_IS_SPACE

#define STB_TEXTEDIT_IS_SPACE (   x)    VuoTextEdit_isSeparator(((uint32_t)x))

Tests if a UTF32 value is considered whitespace.

Definition at line 374 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_K_BACKSPACE

#define STB_TEXTEDIT_K_BACKSPACE   0x00008

Keyboard input to delete selection or character left of cursor.

Definition at line 57 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_K_DELETE

#define STB_TEXTEDIT_K_DELETE   0x7f

Keyboard input to delete selection or character under cursor.

Definition at line 56 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_K_DELETELINE

#define STB_TEXTEDIT_K_DELETELINE   (COMMAND_HI | STB_TEXTEDIT_K_BACKSPACE)

Keyboard input to delete the characters to the left of the cursor up to the first line break.

Definition at line 65 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_K_DELETELINERIGHT

#define STB_TEXTEDIT_K_DELETELINERIGHT   (COMMAND_HI | STB_TEXTEDIT_K_DELETE)

Keyboard input to delete the characters to the right of the cursor up to the first line break.

Definition at line 66 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_K_DELETEWORD

#define STB_TEXTEDIT_K_DELETEWORD   (OPTION_HI | STB_TEXTEDIT_K_BACKSPACE)

Keyboard input to delete the characters to the left of the cursor up to the first whitespace.

Definition at line 63 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_K_DELETEWORDRIGHT

#define STB_TEXTEDIT_K_DELETEWORDRIGHT   (OPTION_HI | STB_TEXTEDIT_K_DELETE)

Keyboard input to delete the characters to the right of the cursor up to the first whitespace.

Definition at line 64 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_K_DOWN

#define STB_TEXTEDIT_K_DOWN   0x0001F

Keyboard input to move cursor down.

Definition at line 47 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_K_LEFT

#define STB_TEXTEDIT_K_LEFT   0x0001C

Keyboard input to move cursor left.

Definition at line 44 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_K_LINEEND

#define STB_TEXTEDIT_K_LINEEND   (COMMAND_HI | STB_TEXTEDIT_K_RIGHT)

Keyboard input to move cursor to end of line.

Definition at line 50 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_K_LINEEND2

#define STB_TEXTEDIT_K_LINEEND2   0x4

Keyboard input to move cursor to end of line (end key)

Definition at line 51 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_K_LINESTART

#define STB_TEXTEDIT_K_LINESTART   (COMMAND_HI | STB_TEXTEDIT_K_LEFT)

Keyboard input to move cursor to start of line.

Definition at line 48 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_K_LINESTART2

#define STB_TEXTEDIT_K_LINESTART2   0x1

Keyboard input to move cursor to start of line (home key)

Definition at line 49 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_K_REDO

#define STB_TEXTEDIT_K_REDO   (COMMAND_HI | 0x19)

Keyboard input to perform redo.

Definition at line 59 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_K_REDO2

#define STB_TEXTEDIT_K_REDO2   ((COMMAND_HI | SHIFT_HI) | 0x1A)

Keyboard input to perform redo.

Definition at line 60 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_K_RIGHT

#define STB_TEXTEDIT_K_RIGHT   0x0001D

Keyboard input to move cursor right.

Definition at line 45 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_K_SELECTALL

#define STB_TEXTEDIT_K_SELECTALL   (COMMAND_HI | 0x1)

Keyboard input to select all text.

Definition at line 68 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_K_SHIFT

#define STB_TEXTEDIT_K_SHIFT   SHIFT_HI

Keyboard input to signify shift modifier.

Definition at line 67 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_K_TEXTEND

#define STB_TEXTEDIT_K_TEXTEND   (COMMAND_HI | STB_TEXTEDIT_K_DOWN)

Keyboard input to move cursor to end of text.

Definition at line 54 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_K_TEXTEND2

#define STB_TEXTEDIT_K_TEXTEND2   (CONTROL_HI | 0x45)

Keyboard input to move cursor to end of text.

Definition at line 55 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_K_TEXTSTART

#define STB_TEXTEDIT_K_TEXTSTART   (COMMAND_HI | STB_TEXTEDIT_K_UP)

Keyboard input to move cursor to start of text.

Definition at line 52 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_K_TEXTSTART2

#define STB_TEXTEDIT_K_TEXTSTART2   (CONTROL_HI | 0x41)

Keyboard input to move cursor to start of text (Control+A)

Definition at line 53 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_K_UNDO

#define STB_TEXTEDIT_K_UNDO   (COMMAND_HI | 0x1A)

Keyboard input to perform undo.

Definition at line 58 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_K_UP

#define STB_TEXTEDIT_K_UP   0x0001E

Keyboard input to move cursor up.

Definition at line 46 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_K_WORDLEFT

#define STB_TEXTEDIT_K_WORDLEFT   (OPTION_HI | STB_TEXTEDIT_K_LEFT)

Keyboard input to move cursor left one word.

Definition at line 61 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_K_WORDRIGHT

#define STB_TEXTEDIT_K_WORDRIGHT   (OPTION_HI | STB_TEXTEDIT_K_RIGHT)

Keyboard input to move cursor right one word.

Definition at line 62 of file VuoTextEdit.h.

Typedef Documentation

◆ STB_TEXTEDIT_STRING

The type of object representing a string being edited, typically this is a wrapper object with other data you need.

Definition at line 76 of file VuoTextEdit.h.

Function Documentation

◆ stb_text_locate_coord()

static int stb_text_locate_coord ( STB_TexteditState *  state,
float  x,
float  y 
)
static

Overrides stb_textedit implementation.

Definition at line 318 of file VuoTextEdit.h.

◆ stb_textedit_cut()

static int stb_textedit_cut ( STB_TEXTEDIT_STRING str,
STB_TexteditState *  state 
)
static

Forward declaration of cut function.

◆ STB_TEXTEDIT_DELETECHARS()

static void STB_TEXTEDIT_DELETECHARS ( STB_TEXTEDIT_STRING obj,
int  pos,
int  n 
)
static

Delete n characters starting at i.

Definition at line 410 of file VuoTextEdit.h.

◆ stb_textedit_find_charpos()

static void stb_textedit_find_charpos ( StbFindState *  find,
STB_TEXTEDIT_STRING str,
int  n,
STB_TexteditState *  state 
)
static

Find the x/y location of a character, and remember info about the previous row in case we get a move-up event (for page up, we'll have to rescan).

Definition at line 330 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_GETCHAR()

static STB_TEXTEDIT_CHARTYPE STB_TEXTEDIT_GETCHAR ( const STB_TEXTEDIT_STRING obj,
int  idx 
)
static

returns the i'th character of obj, 0-based

Definition at line 241 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_GETWIDTH()

static float STB_TEXTEDIT_GETWIDTH ( STB_TEXTEDIT_STRING obj,
int  n,
int  i,
STB_TexteditState *  state 
)
static

Returns the pixel delta from the xpos of the i'th character to the xpos of the i+1'th char for a line of characters starting at character n (i.e.

accounts for kerning with previous char)

Definition at line 386 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_INSERTCHARS()

static bool STB_TEXTEDIT_INSERTCHARS ( STB_TEXTEDIT_STRING obj,
int  pos,
const STB_TEXTEDIT_CHARTYPE new_text,
int  new_text_len 
)
static

insert n characters at i (pointed to by STB_TEXTEDIT_CHARTYPE*)

Definition at line 421 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_KEYTOTEXT()

static uint32_t STB_TEXTEDIT_KEYTOTEXT ( STB_TEXTEDIT_CHARTYPE  key)
static

maps a keyboard input to an insertable character (return type is int, 0 means not valid to insert)

Definition at line 359 of file VuoTextEdit.h.

◆ STB_TEXTEDIT_LAYOUTROW()

static void STB_TEXTEDIT_LAYOUTROW ( StbTexteditRow *  r,
STB_TEXTEDIT_STRING obj,
int  line_start_idx,
STB_TexteditState *  state 
)
static

Lay out the text in rows.

Definition at line 395 of file VuoTextEdit.h.

◆ stb_textedit_linecount()

static int stb_textedit_linecount ( STB_TEXTEDIT_STRING str)
static

Return the number of new line characters in a string.

Note that this may not match textData->lineCount because textData only counts lines that have a non-whitespace character present (or is followed by another line).

Definition at line 261 of file VuoTextEdit.h.

◆ stb_textedit_paste()

static int stb_textedit_paste ( STB_TEXTEDIT_STRING str,
STB_TexteditState *  state,
STB_TEXTEDIT_CHARTYPE const *  ctext,
int  len 
)
static

Forward declaration of stb_textedit_paste.

◆ stb_textedit_prep_selection_at_cursor()

static void stb_textedit_prep_selection_at_cursor ( STB_TexteditState *  state)
static

Forward declaration stb_textedit_prep_selection_at_cursor.

◆ STB_TEXTEDIT_STRINGLEN()

static int STB_TEXTEDIT_STRINGLEN ( const STB_TEXTEDIT_STRING obj)
static

The length of the string.

Definition at line 103 of file VuoTextEdit.h.

◆ VuoTextEdit_combineKeyAndModifier()

static STB_TEXTEDIT_CHARTYPE VuoTextEdit_combineKeyAndModifier ( uint32_t  utf32,
VuoModifierKey  modifiers 
)
static

Pack a UTF32 char and VuoModifierKey into a Uint64.

Definition at line 81 of file VuoTextEdit.h.

◆ VuoTextEdit_copy()

static void VuoTextEdit_copy ( STB_TEXTEDIT_STRING str,
STB_TexteditState *  state 
)
static

Copy the current text selection to the clipboard.

Definition at line 205 of file VuoTextEdit.h.

◆ VuoTextEdit_cut()

static int VuoTextEdit_cut ( STB_TEXTEDIT_STRING str,
STB_TexteditState *  state 
)
static

Perform a text cut operation (copy selected characters to clipboard and delete).

Definition at line 222 of file VuoTextEdit.h.

◆ VuoTextEdit_findLineIndex()

static int VuoTextEdit_findLineIndex ( int  charIndex,
STB_TexteditState *  state 
)
static

Given a character index, find the line it resides in.

Definition at line 348 of file VuoTextEdit.h.

◆ VuoTextEdit_isNewLine()

static bool VuoTextEdit_isNewLine ( uint32_t  utf32_char)
static

Tests if a UTF32 value is considered a new line character.

Definition at line 111 of file VuoTextEdit.h.

◆ VuoTextEdit_isSeparator()

static bool VuoTextEdit_isSeparator ( uint32_t  utf32_char)
static

Tests if a UTF32 value is considered a word separator.

Used to calculate movement stops (ex: alt+left). Separators: /()"'-:,.;<>~!#$%^&*|+=[]{}`~?

Definition at line 132 of file VuoTextEdit.h.

◆ VuoTextEdit_isWhiteSpace()

static bool VuoTextEdit_isWhiteSpace ( uint32_t  utf32_char)
static

Tests if a UTF32 value is considered white space.

Definition at line 119 of file VuoTextEdit.h.

◆ VuoTextEdit_makeCharArrayWithVuoText()

static STB_TEXTEDIT_CHARTYPE* VuoTextEdit_makeCharArrayWithVuoText ( VuoText  text,
size_t *  length 
)
static

Convert a VuoText string to an array of STB_TEXTEDIT_CHARTYPE.

The length of the resulting array is stored in length. No modifier keys are encoded.

Definition at line 90 of file VuoTextEdit.h.

◆ VuoTextEdit_paste()

static void VuoTextEdit_paste ( STB_TEXTEDIT_STRING str,
STB_TexteditState *  state 
)
static

Perform a text paste operation (copy text from clipboard to current cursor position).

Definition at line 299 of file VuoTextEdit.h.

◆ VuoTextEdit_selectFromCursorToSeparator()

static void VuoTextEdit_selectFromCursorToSeparator ( STB_TEXTEDIT_STRING str,
STB_TexteditState *  state,
bool(*)(uint32_t)  separatorFunc 
)
static

Selects the all text to the left and right of cursor up to any character matched by separatorFunc.

Definition at line 165 of file VuoTextEdit.h.

◆ VuoTextEdit_truncateLines()

static VuoText VuoTextEdit_truncateLines ( VuoText  text,
VuoInteger  maxLines 
)
static

Remove any text past maxLines.

Definition at line 275 of file VuoTextEdit.h.

Variable Documentation

◆ STB_TEXTEDIT_NEWLINE

char STB_TEXTEDIT_NEWLINE = '\n'
static

The character representing a newline. See also VuoTextEdit_isNewLine.

Definition at line 42 of file VuoTextEdit.h.