Skip to main content

Module input

Module input 

Source
Expand description

Input components for text editing in GPUI applications.

This module provides the state management and keybinding infrastructure for building text input components. It includes:

  • InputState: The core state model for text input, handling content, selection, cursor management, and edit history.
  • CursorBlink: Manages cursor blinking state for input components.
  • InputBindings: Configurable keybindings for input actions.
  • TextDirection: Bidirectional text support for RTL/LTR detection.

§Example

use gpuikit::input::{InputState, bind_input_keys};
// Initialize keybindings (typically in app initialization)
bind_input_keys(cx, None);

// Create an input state
let input = cx.new(|cx| InputState::new_singleline(cx));

Re-exports§

pub use bindings::INPUT_CONTEXT;
pub use bindings::InputBindings;
pub use bindings::bind_input_keys;

Modules§

bindings
Input keybinding configuration & actions that can be bound (Backspace, Copy, etc.).

Structs§

CursorBlink
Manages the blinking state of a text cursor.
ElementInputHandler
The canonical implementation of gpui::PlatformInputHandler. Call Window::handle_input with an instance during your element’s paint.
InputLineLayout
Layout information for a single logical line of text in an input.
InputState
Input is the state model for text input components. It handles:

Enums§

InputStateEvent
Events emitted by InputState when significant changes occur.
SubmitOn
Which keystroke fires InputStateEvent::Submit.
TextDirection
Text direction for bidirectional text support.

Traits§

EntityInputHandler
Implement this trait to allow views to handle textual input when implementing an editor, field, etc.

Functions§

detect_base_direction
Detects the base direction of text using the first strong directional character.