Skip to main content

NavigationExt

Trait NavigationExt 

Source
pub trait NavigationExt {
    // Required methods
    fn enter_hint_mode(&self) -> Result<()>;
    fn exit_nav_mode(&self) -> Result<()>;
    fn register_focusable(&self, region: PluginFocusable) -> Result<u64>;
    fn unregister_focusable(&self, id: u64) -> Result<()>;
}
Expand description

Navigation extension trait for plugin contexts

Provides navigation-related operations that plugins can perform, such as entering/exiting navigation modes and registering focusable regions.

This trait is automatically implemented for PluginContext when the navigation feature is enabled.

Required Methods§

Source

fn enter_hint_mode(&self) -> Result<()>

Enter hint mode to display navigation hints

This triggers the hint mode UI, displaying labels for all focusable elements in the terminal (URLs, file paths, registered regions, etc.).

§Example
ctx.enter_hint_mode()?;
Source

fn exit_nav_mode(&self) -> Result<()>

Exit navigation mode and return to normal mode

Clears all hint labels and returns input handling to normal mode.

§Example
ctx.exit_nav_mode()?;
Source

fn register_focusable(&self, region: PluginFocusable) -> Result<u64>

Register a custom focusable region

Allows plugins to register custom navigation targets that will appear in hint mode alongside auto-detected URLs, file paths, etc.

Returns a unique ID for this focusable that can be used to unregister it later.

§Arguments
  • region - The focusable region to register
§Returns

Unique ID for this focusable region

§Example
let id = ctx.register_focusable(PluginFocusable {
    x: 10,
    y: 5,
    width: 20,
    height: 1,
    label: "Click me".to_string(),
    action: PluginFocusableAction::Custom("my_action".to_string()),
})?;
Source

fn unregister_focusable(&self, id: u64) -> Result<()>

Unregister a previously registered focusable region

Removes a focusable region from the navigation system using its ID.

§Arguments
  • id - The ID returned from register_focusable
§Example
ctx.unregister_focusable(focusable_id)?;

Implementors§