docs
Loading...
Searching...
No Matches
Editor.h
Go to the documentation of this file.
1///
2/// Copyright (C) 2026 Ultralight, Inc. All rights reserved.
3/// A license is required for commercial use. https://ultralig.ht
4///
5#pragma once
6// X11's headers define None as a macro, which would break the None enumerators.
7#pragma push_macro("None")
8#undef None
10#include <Ultralight/String.h>
11#include <Ultralight/Geometry.h>
12#include <Ultralight/Color.h>
13
14namespace ultralight {
15
16///
17/// The editing commands you can run with Editor::Execute().
18///
19/// Most commands act on editable text (a text field or an editable region). Copy, SelectAll, and
20/// the selection commands (the AndModifySelection forms, SelectWord, SelectLine, SelectParagraph,
21/// and Unselect) also work on a selection in regular page content.
22///
23/// Every caret motion has an AndModifySelection form that extends the selection instead of moving
24/// the caret (the Shift-key behavior).
25///
26enum class EditorCommand : uint8_t {
27 // Clipboard, selection, and history commands (the Edit-menu set).
28 Cut = 0, ///< Cut the selection to the clipboard.
29 Copy, ///< Copy the selection to the clipboard.
30 Paste, ///< Paste the clipboard's contents.
31 PasteAsPlainText, ///< Paste the clipboard's text without its formatting.
32 SelectAll, ///< Select all the text (or the whole page).
33 Undo, ///< Undo the last edit.
34 Redo, ///< Redo the last undone edit.
35
36 // Caret motions.
37 MoveLeft, ///< Move the caret one character left.
38 MoveRight, ///< Move the caret one character right.
39 MoveUp, ///< Move the caret one line up.
40 MoveDown, ///< Move the caret one line down.
41 MoveWordLeft, ///< Move the caret one word left.
42 MoveWordRight, ///< Move the caret one word right.
43 MoveToBeginningOfLine, ///< Move the caret to the start of the line.
44 MoveToEndOfLine, ///< Move the caret to the end of the line.
45 MoveToBeginningOfParagraph, ///< Move the caret to the start of the paragraph.
46 MoveToEndOfParagraph, ///< Move the caret to the end of the paragraph.
47 MoveToBeginningOfDocument, ///< Move the caret to the start of the text.
48 MoveToEndOfDocument, ///< Move the caret to the end of the text.
49 MovePageUp, ///< Move the caret one page up.
50 MovePageDown, ///< Move the caret one page down.
51
52 // Selection-extending forms of each caret motion.
53 MoveLeftAndModifySelection, ///< Select one character left.
54 MoveRightAndModifySelection, ///< Select one character right.
55 MoveUpAndModifySelection, ///< Select one line up.
56 MoveDownAndModifySelection, ///< Select one line down.
57 MoveWordLeftAndModifySelection, ///< Select one word left.
58 MoveWordRightAndModifySelection, ///< Select one word right.
59 MoveToBeginningOfLineAndModifySelection, ///< Select to line start.
60 MoveToEndOfLineAndModifySelection, ///< Select to line end.
61 MoveToBeginningOfParagraphAndModifySelection, ///< Select to paragraph start.
62 MoveToEndOfParagraphAndModifySelection, ///< Select to paragraph end.
64 MoveToEndOfDocumentAndModifySelection, ///< Select to text end.
65 MovePageUpAndModifySelection, ///< Select one page up.
66 MovePageDownAndModifySelection, ///< Select one page down.
67
68 // Selection commands.
69 SelectWord, ///< Select the word at the caret.
70 SelectLine, ///< Select the line at the caret.
71 SelectParagraph, ///< Select the paragraph at the caret.
72 Unselect, ///< Clear the selection (no caret remains).
73
74 // Deletion commands.
75 DeleteBackward, ///< Delete the selection or the previous character.
76 DeleteForward, ///< Delete the selection or the next character.
77 DeleteWordBackward, ///< Delete the word before the caret.
78 DeleteWordForward, ///< Delete the word after the caret.
79 DeleteToBeginningOfLine, ///< Delete to the start of the line.
80 DeleteToEndOfLine, ///< Delete to the end of the line.
81
82 // Insertion commands.
83 InsertNewline, ///< Insert a new paragraph (the Enter key).
84 InsertLineBreak, ///< Insert a line break in the paragraph (Shift+Enter).
85 InsertTab, ///< Insert a tab.
86 InsertBacktab, ///< Insert a backtab (Shift+Tab).
87};
88
89///
90/// The kind of element that holds keyboard focus (see EditableState).
91///
92enum class EditableType : uint8_t {
93 None = 0, ///< No element holds keyboard focus.
94 Text, ///< A single-line text field.
95 Password, ///< A password field.
96 TextArea, ///< A multi-line text area.
97 ContentEditable, ///< An editable (contenteditable) region.
98 Other, ///< A focused element that is not a text-editing target (eg, a select).
99};
100
101///
102/// The focused element's inputmode hint (what kind of virtual keyboard the page asks for).
103///
104/// @see <https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode>
105///
117
118///
119/// The focused element's enterkeyhint (what label or icon the Enter key should present).
120///
121/// @see <https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/enterkeyhint>
122///
133
134///
135/// The conditions that decide whether an input method should be active.
136///
137/// Reported through EditorListener::OnChangeEditableState(). An input method or on-screen keyboard
138/// should be active when both `view_has_focus` and `is_mutable` are true.
139///
140/// @note This is reported when focus moves, not when the focused element moves or resizes. To
141/// follow the caret, use Editor::GetCaretBounds().
142///
143/// @see EditorListener::OnChangeEditableState()
144///
146 ///
147 /// The kind of element that holds keyboard focus.
148 ///
150
151 ///
152 /// Whether or not the focused element accepts typed text (false for a read-only or disabled text
153 /// control, and always false when `type` is None or Other).
154 ///
155 bool is_mutable = false;
156
157 ///
158 /// Whether or not the View itself has input focus (see View::Focus() and View::Unfocus()).
159 ///
160 bool view_has_focus = false;
161
162 ///
163 /// The focused element's inputmode hint.
164 ///
166
167 ///
168 /// The focused element's enterkeyhint.
169 ///
171
172 ///
173 /// The focused element's bounds in viewport CSS pixels (the same space as
174 /// View::FireMouseEvent()). All-zero when no element has focus.
175 ///
176 Rect bounds = { 0.0f, 0.0f, 0.0f, 0.0f };
177};
178
179///
180/// A range of characters within a composition's text (see CompositionSegment and
181/// Editor::SetComposition()).
182///
184 ///
185 /// The starting offset of the range, in UTF-16 code units.
186 ///
187 uint32_t start = 0;
188
189 ///
190 /// The ending offset of the range (exclusive), in UTF-16 code units.
191 ///
192 uint32_t end = 0;
193};
194
195///
196/// Styling for one segment of a composition's text (see Editor::SetComposition()).
197///
198/// An OS input method usually reports one segment per clause of the in-progress text, with
199/// the clause the user is actively converting marked `thick`.
200///
202 ///
203 /// The range of composition text this segment styles.
204 ///
206
207 ///
208 /// The underline color. Leave unset to draw the underline in the text's own color.
209 ///
211
212 ///
213 /// A highlight fill drawn behind the segment's text. Leave unset for no fill.
214 ///
216
217 ///
218 /// Whether the underline is drawn thick (the convention for the active clause).
219 ///
220 bool thick = false;
221};
222
223///
224/// Text-editing interface for a View.
225///
226/// The editor executes editing commands and manages composition state for the focused element in a
227/// View.
228///
229/// Standard keyboard shortcuts like Ctrl+C and Ctrl+V run automatically when you forward key events
230/// to a View. You use the editor to connect native UI controls like Edit menus and on-screen
231/// keyboards directly to the page, and to relay text from an OS input method.
232///
233/// This example updates native Edit menu items before display and runs the command the user picks:
234///
235/// ```
236/// void UpdateEditMenu() {
237/// Editor* editor = view->editor();
238/// SetMenuItemEnabled("Cut", editor->CanExecute(EditorCommand::Cut));
239/// SetMenuItemEnabled("Copy", editor->CanExecute(EditorCommand::Copy));
240/// SetMenuItemEnabled("Paste", editor->CanExecute(EditorCommand::Paste));
241/// }
242///
243/// void OnEditMenuCommand(EditorCommand command) {
244/// view->editor()->Execute(command);
245/// }
246/// ```
247///
248/// ## Running Commands
249///
250/// Call View::editor() to obtain the View's Editor instance. Commands target the focused element in
251/// the active frame.
252///
253/// Calling Execute() runs an EditorCommand on that element. It returns `false` when the command
254/// can't run, such as copying without an active selection or undoing with an empty history.
255///
256/// Call CanExecute() to test whether a command would succeed right now, which lets you enable or
257/// disable native menu items before presenting them.
258///
259/// @note ViewConfig::clipboard_read_policy restricts clipboard reads attempted by page scripts,
260/// but it doesn't restrict pastes executed through Execute().
261///
262/// ## Inserting Text
263///
264/// Call InsertText() to insert text at the caret, such as when forwarding input from an on-screen
265/// keyboard. The text replaces any active selection, exactly as if the user typed it.
266///
267/// This callback forwards tapped keys to the focused element:
268///
269/// ```
270/// void OnScreenKeyTapped(const String& key_text) {
271/// view->editor()->InsertText(key_text);
272/// }
273/// ```
274///
275/// ## Supporting Input Methods
276///
277/// AppCore windows run the OS input method automatically for their panels. When you host a View
278/// directly, you implement EditorListener and pass it to View::set_editor_listener() to coordinate
279/// the input method with the page.
280///
281/// ### Activating the Input Method
282///
283/// In EditorListener::OnChangeEditableState(), turn on the OS input method only while both
284/// `view_has_focus` and `is_mutable` are `true` in EditableState (turn it off whenever either
285/// property is `false`).
286///
287/// ### Composing Text
288///
289/// Pass in-progress composition text from the OS to SetComposition(). The initial call starts the
290/// composition and replaces any active selection on the page-- later calls replace the previous
291/// in-progress text.
292///
293/// ### Placing the Candidate Window
294///
295/// Implement EditorListener::OnUpdateComposition() to reposition the candidate window whenever the
296/// composition updates.
297///
298/// Query GetCompositionCharacterBounds() at index 0 to anchor the candidate window to the
299/// composition's first character, or GetCaretBounds() when no composition is active. Anchoring to
300/// the first character prevents the candidate window from jumping as candidate words change length.
301///
302/// Both methods return rectangles in viewport CSS pixels. Multiply their coordinates by
303/// View::device_scale() to convert them to device pixels.
304///
305/// ### Ending a Composition
306///
307/// Call the matching editor method when the input method completes or cancels:
308///
309/// - **CommitComposition() applies final text.** If no composition is active, it inserts the text
310/// at the caret.
311/// - **FinishComposition() keeps the in-progress text as final text.** Call this when the input
312/// method closes without committing (such as when focus moves away mid-composition).
313/// - **CancelComposition() removes the in-progress text.** Call this when the input method cancels
314/// without producing text.
315///
316/// When the page terminates an active composition on its own (such as during navigation or when a
317/// click focuses a different element), the library calls EditorListener::OnDiscardComposition().
318/// The page keeps the in-progress text as final text, so cancel the OS input method without
319/// recommitting or inserting the text again.
320///
321/// ### Inspecting Surrounding Text
322///
323/// OS input methods sometimes inspect or replace text surrounding the caret, such as when showing
324/// an accent palette.
325///
326/// Call GetSelectionOffsets() to locate the selection. The editor's offset methods measure
327/// character positions in UTF-16 code units from the start of the focused editable element,
328/// matching the DOM `selectionStart` and `selectionEnd` properties.
329///
330/// @see View::editor(), EditorListener, EditableState, EditorCommand
331///
333 public:
334 ///
335 /// Run an editing command.
336 ///
337 /// @param command The command to run.
338 ///
339 /// @return Returns whether the command ran (false whenever CanExecute() would return false).
340 ///
341 virtual bool Execute(EditorCommand command) = 0;
342
343 ///
344 /// Whether or not a command would do anything right now.
345 ///
346 /// You can use this to grey out items in a native menu.
347 ///
348 /// @param command The command to check.
349 ///
350 /// @return Returns true if Execute() would run the command.
351 ///
352 [[nodiscard]] virtual bool CanExecute(EditorCommand command) const = 0;
353
354 ///
355 /// Insert text at the caret, replacing the selection (the same as typing it).
356 ///
357 /// @param text The text to insert.
358 ///
359 /// @return Returns whether the text was inserted (false when there's no editable text to insert
360 /// into).
361 ///
362 virtual bool InsertText(const String& text) = 0;
363
364 ///
365 /// Get the bounds of the caret.
366 ///
367 /// The rect is in viewport CSS pixels (the same space as View::FireMouseEvent()). Multiply by
368 /// View::device_scale() for device pixels.
369 ///
370 /// @return Returns the caret bounds (an empty rect when there's no caret in editable text).
371 ///
372 /// @note This updates any pending layout first-- query it when you need it (eg, when opening a
373 /// menu) rather than every frame.
374 ///
375 [[nodiscard]] virtual Rect GetCaretBounds() = 0;
376
377 ///
378 /// Set or update the in-progress text of an input method's composition.
379 ///
380 /// The first call starts a composition and replaces the selection. Later calls replace the
381 /// previous in-progress text.
382 ///
383 /// @param text The full in-progress text. Pass an empty string to remove it (the same
384 /// as CancelComposition()).
385 ///
386 /// @param segments Underline styles for parts of the text (eg, one per clause). Pass a
387 /// nullptr to underline all of it.
388 ///
389 /// @param num_segments The number of entries in `segments`.
390 ///
391 /// @param selection The caret or selection within `text`, in UTF-16 code units.
392 ///
393 /// @return Returns whether the composition was applied (false when there's no editable text).
394 ///
395 /// @note During a composition, the page gets the standard composition events. Every keydown
396 /// reports key code 229 (the same as in a browser).
397 ///
398 virtual bool SetComposition(const String& text, const CompositionSegment* segments,
399 size_t num_segments, const CompositionRange& selection) = 0;
400
401 ///
402 /// Replace the active composition with the input method's final text.
403 ///
404 /// With no active composition, this inserts `text` at the caret.
405 ///
406 /// @param text The final text.
407 ///
408 /// @return Returns whether the text was inserted (false when there's no editable text).
409 ///
410 virtual bool CommitComposition(const String& text) = 0;
411
412 ///
413 /// Keep the active composition's in-progress text as final text.
414 ///
415 /// Call this when the input method closes without committing or cancelling (eg, focus moves away
416 /// mid-composition).
417 ///
418 /// @return Returns whether a composition was finished (false when none was active).
419 ///
420 virtual bool FinishComposition() = 0;
421
422 ///
423 /// Cancel the active composition and remove its text.
424 ///
425 /// @return Returns whether a composition was cancelled (false when none was active).
426 ///
427 virtual bool CancelComposition() = 0;
428
429 ///
430 /// Whether or not a composition is active.
431 ///
432 [[nodiscard]] virtual bool HasComposition() const = 0;
433
434 ///
435 /// Get the bounds of the active composition's text, in viewport CSS pixels.
436 ///
437 /// You can use this as the area a candidate window shouldn't cover.
438 ///
439 /// @return Returns the bounds (all-zero when no composition is active).
440 ///
441 [[nodiscard]] virtual Rect GetCompositionBounds() = 0;
442
443 ///
444 /// Get the length of the active composition's text, in UTF-16 code units (0 when none is active).
445 ///
446 [[nodiscard]] virtual uint32_t GetCompositionCharacterCount() = 0;
447
448 ///
449 /// Get the bounds of one character of the active composition's text, in viewport CSS pixels.
450 ///
451 /// You can use this to place a candidate window. Anchor it on the composition's first character
452 /// (index 0) so it doesn't move as the candidates change.
453 ///
454 /// @param index The character's offset within the composition's text, in UTF-16 code units.
455 ///
456 /// @return Returns the character's bounds (all-zero when `index` is out of range or no
457 /// composition is active).
458 ///
459 [[nodiscard]] virtual Rect GetCompositionCharacterBounds(uint32_t index) = 0;
460
461 ///
462 /// Get the selection's offsets within the focused element's text.
463 ///
464 /// The offset methods (this, GetTextInRange(), ReplaceTextInRange(), and
465 /// GetCompositionOffsets()) use UTF-16 code units into the text of the focused text field or
466 /// editable region. For `<input>` and `<textarea>`, they match the element's `selectionStart` and
467 /// `selectionEnd`.
468 ///
469 /// @param start Set to the selection's start.
470 ///
471 /// @param end Set to the selection's end (the same as `start` for a caret).
472 ///
473 /// @return Returns whether the offsets were set (false when the focused element isn't editable
474 /// text, or the selection is outside it).
475 ///
476 [[nodiscard]] virtual bool GetSelectionOffsets(uint32_t& start, uint32_t& end) = 0;
477
478 ///
479 /// Get part of the focused element's text (see GetSelectionOffsets() for the offsets).
480 ///
481 /// Offsets past the end of the text are clamped to it.
482 ///
483 /// @param start The start offset.
484 ///
485 /// @param end The end offset (exclusive).
486 ///
487 /// @return Returns the text in the range (empty when the focused element isn't editable text).
488 ///
489 /// @warning This reads password fields too, so treat the result as sensitive.
490 ///
491 [[nodiscard]] virtual String GetTextInRange(uint32_t start, uint32_t end) = 0;
492
493 ///
494 /// Replace part of the focused element's text (see GetSelectionOffsets() for the offsets).
495 ///
496 /// This edits the same way typing does. The edit is one undo step, and the caret ends up after
497 /// the new text. You can use this for an input method's replacement ranges (eg, the macOS accent
498 /// picker replaces the character it targets).
499 ///
500 /// Offsets past the end of the text are clamped to it.
501 ///
502 /// @param start The start offset.
503 ///
504 /// @param end The end offset (exclusive).
505 ///
506 /// @param text The new text (an empty string deletes the range).
507 ///
508 /// @return Returns whether the text was replaced (false when the focused element isn't editable
509 /// text, or `start` is greater than `end`).
510 ///
511 /// @note An active composition is cancelled first, and the offsets apply to the text left after
512 /// that.
513 ///
514 virtual bool ReplaceTextInRange(uint32_t start, uint32_t end, const String& text) = 0;
515
516 ///
517 /// Get the active composition's offsets within the focused element's text (see
518 /// GetSelectionOffsets() for the offsets).
519 ///
520 /// You can use this to report the input method's marked range.
521 ///
522 /// @param start Set to the composition's start.
523 ///
524 /// @param end Set to the composition's end (exclusive).
525 ///
526 /// @return Returns whether the offsets were set (false when no composition is active in the
527 /// focused element).
528 ///
529 [[nodiscard]] virtual bool GetCompositionOffsets(uint32_t& start, uint32_t& end) = 0;
530
531 protected:
532 virtual ~Editor() = default;
533};
534
535} // namespace ultralight
536
537#pragma pop_macro("None")
#define UExport
Definition Exports.h:22
An RGBA color value in a certain color space (with CSS parsing helpers).
Definition Color.h:69
Text-editing interface for a View.
Definition Editor.h:332
virtual bool CommitComposition(const String &text)=0
Replace the active composition with the input method's final text.
virtual bool CancelComposition()=0
Cancel the active composition and remove its text.
virtual bool ReplaceTextInRange(uint32_t start, uint32_t end, const String &text)=0
Replace part of the focused element's text (see GetSelectionOffsets() for the offsets).
virtual bool GetCompositionOffsets(uint32_t &start, uint32_t &end)=0
Get the active composition's offsets within the focused element's text (see GetSelectionOffsets() for...
virtual bool CanExecute(EditorCommand command) const =0
Whether or not a command would do anything right now.
virtual Rect GetCompositionBounds()=0
Get the bounds of the active composition's text, in viewport CSS pixels.
virtual Rect GetCompositionCharacterBounds(uint32_t index)=0
Get the bounds of one character of the active composition's text, in viewport CSS pixels.
virtual bool HasComposition() const =0
Whether or not a composition is active.
virtual bool SetComposition(const String &text, const CompositionSegment *segments, size_t num_segments, const CompositionRange &selection)=0
Set or update the in-progress text of an input method's composition.
virtual Rect GetCaretBounds()=0
Get the bounds of the caret.
virtual bool InsertText(const String &text)=0
Insert text at the caret, replacing the selection (the same as typing it).
virtual uint32_t GetCompositionCharacterCount()=0
Get the length of the active composition's text, in UTF-16 code units (0 when none is active).
virtual bool GetSelectionOffsets(uint32_t &start, uint32_t &end)=0
Get the selection's offsets within the focused element's text.
virtual bool FinishComposition()=0
Keep the active composition's in-progress text as final text.
virtual String GetTextInRange(uint32_t start, uint32_t end)=0
Get part of the focused element's text (see GetSelectionOffsets() for the offsets).
virtual bool Execute(EditorCommand command)=0
Run an editing command.
virtual ~Editor()=default
Unicode string container with conversions for UTF-8, UTF-16, and UTF-32.
Definition String.h:31
Root namespace for every public Ultralight type, function, and enumeration.
InputMode
The focused element's inputmode hint (what kind of virtual keyboard the page asks for).
Definition Editor.h:106
@ Url
Definition Editor.h:111
@ Search
Definition Editor.h:115
@ Unspecified
Definition Editor.h:107
@ Numeric
Definition Editor.h:113
@ Decimal
Definition Editor.h:114
@ Telephone
Definition Editor.h:110
@ Email
Definition Editor.h:112
EnterKeyHint
The focused element's enterkeyhint (what label or icon the Enter key should present).
Definition Editor.h:123
@ Next
Definition Editor.h:128
@ Go
Definition Editor.h:127
@ Unspecified
Definition Editor.h:124
@ Send
Definition Editor.h:131
@ Previous
Definition Editor.h:129
@ Enter
Definition Editor.h:125
@ Done
Definition Editor.h:126
EditableType
The kind of element that holds keyboard focus (see EditableState).
Definition Editor.h:92
@ TextArea
A multi-line text area.
Definition Editor.h:96
@ ContentEditable
An editable (contenteditable) region.
Definition Editor.h:97
@ Other
A focused element that is not a text-editing target (eg, a select).
Definition Editor.h:98
@ None
No element holds keyboard focus.
Definition Editor.h:93
@ Password
A password field.
Definition Editor.h:95
@ None
Definition Anchor.h:36
EditorCommand
The editing commands you can run with Editor::Execute().
Definition Editor.h:26
@ MoveWordLeft
Move the caret one word left.
Definition Editor.h:41
@ DeleteToBeginningOfLine
Delete to the start of the line.
Definition Editor.h:79
@ MoveToBeginningOfParagraph
Move the caret to the start of the paragraph.
Definition Editor.h:45
@ MoveToEndOfDocument
Move the caret to the end of the text.
Definition Editor.h:48
@ Undo
Undo the last edit.
Definition Editor.h:33
@ MovePageUpAndModifySelection
Select one page up.
Definition Editor.h:65
@ PasteAsPlainText
Paste the clipboard's text without its formatting.
Definition Editor.h:31
@ MoveToBeginningOfLine
Move the caret to the start of the line.
Definition Editor.h:43
@ Paste
Paste the clipboard's contents.
Definition Editor.h:30
@ MoveWordRightAndModifySelection
Select one word right.
Definition Editor.h:58
@ MovePageUp
Move the caret one page up.
Definition Editor.h:49
@ InsertBacktab
Insert a backtab (Shift+Tab).
Definition Editor.h:86
@ DeleteWordForward
Delete the word after the caret.
Definition Editor.h:78
@ Unselect
Clear the selection (no caret remains).
Definition Editor.h:72
@ MoveWordLeftAndModifySelection
Select one word left.
Definition Editor.h:57
@ MoveUpAndModifySelection
Select one line up.
Definition Editor.h:55
@ Redo
Redo the last undone edit.
Definition Editor.h:34
@ Copy
Copy the selection to the clipboard.
Definition Editor.h:29
@ MoveDownAndModifySelection
Select one line down.
Definition Editor.h:56
@ InsertLineBreak
Insert a line break in the paragraph (Shift+Enter).
Definition Editor.h:84
@ SelectLine
Select the line at the caret.
Definition Editor.h:70
@ MoveToEndOfLineAndModifySelection
Select to line end.
Definition Editor.h:60
@ DeleteWordBackward
Delete the word before the caret.
Definition Editor.h:77
@ SelectAll
Select all the text (or the whole page).
Definition Editor.h:32
@ DeleteToEndOfLine
Delete to the end of the line.
Definition Editor.h:80
@ DeleteForward
Delete the selection or the next character.
Definition Editor.h:76
@ MoveRight
Move the caret one character right.
Definition Editor.h:38
@ MovePageDownAndModifySelection
Select one page down.
Definition Editor.h:66
@ InsertNewline
Insert a new paragraph (the Enter key).
Definition Editor.h:83
@ InsertTab
Insert a tab.
Definition Editor.h:85
@ MoveDown
Move the caret one line down.
Definition Editor.h:40
@ SelectParagraph
Select the paragraph at the caret.
Definition Editor.h:71
@ MoveRightAndModifySelection
Select one character right.
Definition Editor.h:54
@ MoveToEndOfParagraph
Move the caret to the end of the paragraph.
Definition Editor.h:46
@ SelectWord
Select the word at the caret.
Definition Editor.h:69
@ MoveToBeginningOfDocumentAndModifySelection
Select to text start.
Definition Editor.h:63
@ MoveUp
Move the caret one line up.
Definition Editor.h:39
@ MoveToEndOfDocumentAndModifySelection
Select to text end.
Definition Editor.h:64
@ MoveToEndOfParagraphAndModifySelection
Select to paragraph end.
Definition Editor.h:62
@ MoveToBeginningOfDocument
Move the caret to the start of the text.
Definition Editor.h:47
@ MoveWordRight
Move the caret one word right.
Definition Editor.h:42
@ MoveToEndOfLine
Move the caret to the end of the line.
Definition Editor.h:44
@ MoveLeftAndModifySelection
Select one character left.
Definition Editor.h:53
@ MoveLeft
Move the caret one character left.
Definition Editor.h:37
@ MoveToBeginningOfLineAndModifySelection
Select to line start.
Definition Editor.h:59
@ Cut
Cut the selection to the clipboard.
Definition Editor.h:28
@ DeleteBackward
Delete the selection or the previous character.
Definition Editor.h:75
@ MoveToBeginningOfParagraphAndModifySelection
Select to paragraph start.
Definition Editor.h:61
@ MovePageDown
Move the caret one page down.
Definition Editor.h:50
A range of characters within a composition's text (see CompositionSegment and Editor::SetComposition(...
Definition Editor.h:183
uint32_t end
The ending offset of the range (exclusive), in UTF-16 code units.
Definition Editor.h:192
uint32_t start
The starting offset of the range, in UTF-16 code units.
Definition Editor.h:187
Styling for one segment of a composition's text (see Editor::SetComposition()).
Definition Editor.h:201
CompositionRange range
The range of composition text this segment styles.
Definition Editor.h:205
Color background_color
A highlight fill drawn behind the segment's text.
Definition Editor.h:215
Color underline_color
The underline color.
Definition Editor.h:210
bool thick
Whether the underline is drawn thick (the convention for the active clause).
Definition Editor.h:220
The conditions that decide whether an input method should be active.
Definition Editor.h:145
bool view_has_focus
Whether or not the View itself has input focus (see View::Focus() and View::Unfocus()).
Definition Editor.h:160
bool is_mutable
Whether or not the focused element accepts typed text (false for a read-only or disabled text control...
Definition Editor.h:155
EditableType type
The kind of element that holds keyboard focus.
Definition Editor.h:149
InputMode input_mode
The focused element's inputmode hint.
Definition Editor.h:165
EnterKeyHint enter_key_hint
The focused element's enterkeyhint.
Definition Editor.h:170
Rect bounds
The focused element's bounds in viewport CSS pixels (the same space as View::FireMouseEvent()).
Definition Editor.h:176
Float Rectangle Helper.
Definition Geometry.h:416