pub enum Message {
Show 46 variants
CharacterInput(char),
Backspace,
Delete,
Enter,
Tab,
ArrowKey(ArrowDirection, bool),
MouseClick(Point),
MouseDrag(Point),
MouseHover(Point),
MouseRelease,
Copy,
Paste(String),
DeleteSelection,
Tick,
PageUp,
PageDown,
Home(bool),
End(bool),
CtrlHome,
CtrlEnd,
GotoPosition(usize, usize),
Scrolled(Viewport),
HorizontalScrolled(Viewport),
Undo,
Redo,
OpenSearch,
OpenSearchReplace,
CloseSearch,
SearchQueryChanged(String),
ReplaceQueryChanged(String),
ToggleCaseSensitive,
FindNext,
FindPrevious,
ReplaceNext,
ReplaceAll,
SearchDialogTab,
SearchDialogShiftTab,
FocusNavigationTab,
FocusNavigationShiftTab,
CanvasFocusGained,
CanvasFocusLost,
JumpClick(Point),
ImeOpened,
ImePreedit(String, Option<Range<usize>>),
ImeCommit(String),
ImeClosed,
}Expand description
Messages emitted by the code editor
Variants§
CharacterInput(char)
Character typed
Backspace
Backspace pressed
Delete
Delete pressed
Enter
Enter pressed
Tab
Tab pressed (inserts 4 spaces)
ArrowKey(ArrowDirection, bool)
Arrow key pressed (direction, shift_pressed)
MouseClick(Point)
Mouse clicked at position
MouseDrag(Point)
Mouse drag for selection
MouseHover(Point)
Mouse moved within the editor without dragging
MouseRelease
Mouse released
Copy
Copy selected text (Ctrl+C)
Paste(String)
Paste text from clipboard (Ctrl+V)
DeleteSelection
Delete selected text (Shift+Delete)
Tick
Request redraw for cursor blink
PageUp
Page Up pressed
PageDown
Page Down pressed
Home(bool)
Home key pressed (move to start of line, shift_pressed)
End(bool)
End key pressed (move to end of line, shift_pressed)
CtrlHome
Ctrl+Home pressed (move to start of document)
CtrlEnd
Ctrl+End pressed (move to end of document)
GotoPosition(usize, usize)
Go to an explicit logical position (line, column), both 0-based.
Scrolled(Viewport)
Viewport scrolled - track scroll position
HorizontalScrolled(Viewport)
Horizontal scrollbar scrolled (only when wrap is disabled)
Undo
Undo last operation (Ctrl+Z)
Redo
Redo last undone operation (Ctrl+Y)
OpenSearch
Open search dialog (Ctrl+F)
OpenSearchReplace
Open search and replace dialog (Ctrl+H)
CloseSearch
Close search dialog (Escape)
SearchQueryChanged(String)
Search query text changed
ReplaceQueryChanged(String)
Replace text changed
ToggleCaseSensitive
Toggle case sensitivity
FindNext
Find next match (F3)
FindPrevious
Find previous match (Shift+F3)
ReplaceNext
Replace current match
ReplaceAll
Replace all matches
SearchDialogTab
Tab pressed in search dialog (cycle forward)
SearchDialogShiftTab
Shift+Tab pressed in search dialog (cycle backward)
Tab pressed for focus navigation (when search dialog is not open)
Shift+Tab pressed for focus navigation (when search dialog is not open)
CanvasFocusGained
Canvas gained focus (mouse click)
CanvasFocusLost
Canvas lost focus (external widget interaction)
JumpClick(Point)
Triggered when the user performs a Ctrl+Click (or Cmd+Click on macOS) on the editor content, intending to jump to the definition of the symbol under the cursor.
ImeOpened
IME input method opened
ImePreedit(String, Option<Range<usize>>)
IME pre-edit update (content, selection range)
ImeCommit(String)
IME commit text
ImeClosed
IME input method closed
Trait Implementations§
Source§impl Program<Message> for CodeEditor
impl Program<Message> for CodeEditor
Source§fn draw(
&self,
_state: &Self::State,
renderer: &Renderer,
_theme: &Theme,
bounds: Rectangle,
_cursor: Cursor,
) -> Vec<Geometry> ⓘ
fn draw( &self, _state: &Self::State, renderer: &Renderer, _theme: &Theme, bounds: Rectangle, _cursor: Cursor, ) -> Vec<Geometry> ⓘ
Renders the code editor’s visual elements on the canvas, including text layout, syntax highlighting, cursor positioning, and other graphical aspects.
§Arguments
state- The current state of the canvasrenderer- The renderer used for drawingtheme- The theme for stylingbounds- The rectangle bounds of the canvascursor- The mouse cursor position
§Returns
A vector of Geometry objects representing the drawn elements
Source§fn update(
&self,
_state: &mut Self::State,
event: &Event,
bounds: Rectangle,
cursor: Cursor,
) -> Option<Action<Message>>
fn update( &self, _state: &mut Self::State, event: &Event, bounds: Rectangle, cursor: Cursor, ) -> Option<Action<Message>>
Handles Canvas trait events, specifically keyboard input events and focus management for the code editor widget.
§Arguments
_state- The mutable state of the canvas (unused in this implementation)event- The input event to handle, such as keyboard pressesbounds- The rectangle bounds of the canvas widgetcursor- The current mouse cursor position and status
§Returns
An optional Action<Message> to perform, such as sending a message or redrawing the canvas
Source§fn mouse_interaction(
&self,
_state: &Self::State,
_bounds: Rectangle,
_cursor: Cursor,
) -> Interaction
fn mouse_interaction( &self, _state: &Self::State, _bounds: Rectangle, _cursor: Cursor, ) -> Interaction
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnsafeUnpin for Message
impl UnwindSafe for Message
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Application.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more