alma 0.1.0

A Bevy-native modal text editor with Vim-style navigation.
Documentation
//! Cursor movement messages.

use crate::ecs::components::{buffer::ViewEntity, cursor::ByteIndex};
use bevy::prelude::Message;

/// Request to move the editor cursor to a byte index in the active buffer.
#[derive(Clone, Copy, Debug, Eq, Message, PartialEq)]
pub struct CursorMoveRequested {
    /// View entity whose cursor should move.
    pub target: ViewEntity,
    /// Requested UTF-8 byte index.
    pub byte_index: ByteIndex,
    /// Preferred character column to preserve for repeated vertical movement.
    pub desired_column: Option<usize>,
}

/// Notification that the editor cursor moved.
#[derive(Clone, Copy, Debug, Eq, Message, PartialEq)]
pub struct CursorMoved {
    /// View entity whose cursor moved.
    pub target: ViewEntity,
    /// Previous cursor byte index.
    pub previous_byte_index: ByteIndex,
    /// Current cursor byte index.
    pub current_byte_index: ByteIndex,
    /// Preferred character column after movement.
    pub desired_column: Option<usize>,
}