DVUI

TextLayoutWidget

Fields

#
wd:WidgetData
WidgetData
corners:[4]?Rect
[4]?Rect
corners_min_size:[4]?Size
[4]?Size
corners_last_seen:?u8
?u8
insert_pt:Point
Point
current_line_height:f32
f32
current_line_ascent:f32
f32
current_line_ascent_recorded:f32
f32
line_ascents_idx:usize
usize
line_ascents:[]LineAscent
[]LineAscent
line_ascents_new:std.ArrayList(LineAscent)
std.ArrayList(LineAscent)
prevClip:Rect.Physical
Rect.Physical
kerning:?bool
?bool
break_lines:bool
bool
current_line_width:f32
f32
touch_edit_just_focused:bool
bool
cursor_pt:?Point
?Point
cursor_event:?dvui.Event.EventTypes
?dvui.Event.EventTypes
click_pt:?Point
?Point
click_event:?dvui.Event.EventTypes
?dvui.Event.EventTypes
click_num:u8
u8
click_num_pt:dvui.Point.Physical
dvui.Point.Physical
line:usize
usize
bytes_seen:usize
usize
first_byte_in_line:usize
usize
selection:*Selection

might point to selection_store

sel_move:union(enum) { none: void, // mouse down to move cursor and dragging to select mouse: struct { down_pt: ?Point = null, // point we got the mouse down (frame 1) byte: ?usize = null, // byte index of pt (find on frame 1, keep while captured) drag_pt: ?Point = null, // point of current mouse drag }, // second click or touch selects word at pointer // third click selects line at pointer expand_pt: struct { pt: ?Point = null, bytes: [2]usize = .{ 0, 0 }, // start and end of original selection while dragging select: bool = true, // false - move cursor, true - change selection dragging: bool = false, done: bool = false, // finished our work this frame? which: enum { word, line, home, end, }, last: [2]usize = .{ 0, 0 }, // index of last 2 space/newline we've seen }, // moving left/right by characters char_left_right: struct { count: i8 = 0, select: bool = true, // false - move cursor, true - change selection buf: [20]u8 = @splat(0), // only used when count < 0 }, // moving cursor up/down // - this can be pipelined, so we might get more count on the same frame 2 // we are adjusting for the previous count cursor_updown: struct { count: i8 = 0, // positive is down (get this on frame 1, set pt once we see the cursor) pt: ?Point = null, // get this on frame 2 select: bool = true, // false - move cursor, true - change selection }, // moving left/right by words word_left_right: struct { count: i8 = 0, select: bool = true, // false - move cursor, true - change selection scratch_kind: enum { punc, // space, newline, or ascii puncutation word, } = .punc, // indexes of the last starts of words (only used when count < 0) word_start_idx: [5]usize = .{ 0, 0, 0, 0, 0 }, }, }

For simplicity we only handle a single kind of selection change per frame

sel_start_r:Rect
Rect
sel_start_r_new:?Rect
?Rect
sel_end_r:Rect
Rect
sel_end_r_new:?Rect
?Rect
sel_pts:[2]?Point
[2]?Point
cursor_seen:bool
bool
cursor_rect:Rect

SAFETY: Set in textAddEx

scroll_to_cursor:bool
bool
scroll_to_cursor_next_frame:bool
bool
add_text_done:bool
bool
copy_sel:?Selection
?Selection
copy_slice:?[]u8
?[]u8
touch_editing:bool
bool
te_first:bool
bool
te_show_draggables:bool
bool
te_show_context_menu:bool
bool
te_focus_on_touchdown:bool
bool
focus_at_start:bool
bool
te_floating:FloatingWidget

SAFETY: Set in touchEditing

cache_layout:bool
bool
cache_layout_bytes:?bytesNeededReturn
?bytesNeededReturn
cache_layout_bytes_seen:usize
usize
byte_height_ready:?ByteHeight
?ByteHeight
byte_heights:[]ByteHeight
[]ByteHeight
byte_heights_new:std.ArrayList(ByteHeight)
std.ArrayList(ByteHeight)
byte_height_after_idx:?usize
?usize
byte_height_edit_idx:?usize
?usize
textrun_parent_prev:?dvui.Id
?dvui.Id
textrun_anchor:?TextRunSelectionInfo
?TextRunSelectionInfo
textrun_focus:?TextRunSelectionInfo
?TextRunSelectionInfo
textrun_cursor:?TextRunSelectionInfo
?TextRunSelectionInfo
textrun_last:?TextRunSelectionInfo
?TextRunSelectionInfo
newline:bool
bool

Types

#

Functions

#
init

It's expected to call this when self is undefined

textRunCreateEmpty

Creates an empty text run

Constants

#
word_breaks

This is used for word selection - 2 clicks and ctrl+left/right - everything

Variables

#
defaults

When break_lines is true, you can't get both a min width and min height,