pub struct CopyModeState {Show 14 fields
pub active: bool,
pub cursor_col: usize,
pub cursor_absolute_line: usize,
pub visual_mode: VisualMode,
pub selection_anchor: Option<(usize, usize)>,
pub count: Option<usize>,
pub pending_operator: Option<PendingOperator>,
pub marks: HashMap<char, Mark>,
pub cols: usize,
pub rows: usize,
pub scrollback_len: usize,
pub search_query: String,
pub search_direction: SearchDirection,
pub is_searching: bool,
/* private fields */
}Expand description
Copy mode state machine.
Uses absolute line indexing:
- Line 0 = oldest scrollback line
- Line
scrollback_len - 1= newest scrollback line - Line
scrollback_len= top of visible screen (at scroll_offset=0) - Line
scrollback_len + rows - 1= bottom of visible screen
Fields§
§active: boolWhether copy mode is active
cursor_col: usizeCursor column position
cursor_absolute_line: usizeCursor absolute line position
visual_mode: VisualModeCurrent visual selection mode
selection_anchor: Option<(usize, usize)>Selection anchor point (absolute_line, col) - set when entering visual mode
count: Option<usize>Count prefix for motions (e.g., 5j moves down 5 lines)
pending_operator: Option<PendingOperator>Pending operator waiting for a motion
marks: HashMap<char, Mark>Named marks (a-z)
cols: usizeTerminal columns
rows: usizeTerminal rows
scrollback_len: usizeScrollback buffer length
search_query: StringCurrent search query
search_direction: SearchDirectionSearch direction
is_searching: boolWhether search input mode is active
Implementations§
Source§impl CopyModeState
impl CopyModeState
Sourcepub fn enter(
&mut self,
cursor_col: usize,
cursor_row: usize,
cols: usize,
rows: usize,
scrollback_len: usize,
)
pub fn enter( &mut self, cursor_col: usize, cursor_row: usize, cols: usize, rows: usize, scrollback_len: usize, )
Enter copy mode at the given cursor position
Sourcepub fn push_count_digit(&mut self, digit: u8)
pub fn push_count_digit(&mut self, digit: u8)
Push a digit to the count prefix
Sourcepub fn effective_count(&mut self) -> usize
pub fn effective_count(&mut self) -> usize
Get the effective count (defaults to 1 if no count set)
Sourcepub fn move_right(&mut self)
pub fn move_right(&mut self)
Move cursor right by count
Sourcepub fn move_to_line_start(&mut self)
pub fn move_to_line_start(&mut self)
Move cursor to start of line
Sourcepub fn move_to_line_end(&mut self)
pub fn move_to_line_end(&mut self)
Move cursor to end of line
Sourcepub fn move_to_first_non_blank(&mut self, line_text: &str)
pub fn move_to_first_non_blank(&mut self, line_text: &str)
Move cursor to first non-blank character on the line
Sourcepub fn move_word_forward(&mut self, line_text: &str, word_chars: &str)
pub fn move_word_forward(&mut self, line_text: &str, word_chars: &str)
Move forward to start of next word
Sourcepub fn move_word_backward(&mut self, line_text: &str, word_chars: &str)
pub fn move_word_backward(&mut self, line_text: &str, word_chars: &str)
Move backward to start of previous word
Sourcepub fn move_word_end(&mut self, line_text: &str, word_chars: &str)
pub fn move_word_end(&mut self, line_text: &str, word_chars: &str)
Move forward to end of current/next word
Sourcepub fn move_big_word_forward(&mut self, line_text: &str)
pub fn move_big_word_forward(&mut self, line_text: &str)
Move forward to start of next WORD (whitespace-delimited)
Sourcepub fn move_big_word_backward(&mut self, line_text: &str)
pub fn move_big_word_backward(&mut self, line_text: &str)
Move backward to start of previous WORD (whitespace-delimited)
Sourcepub fn move_big_word_end(&mut self, line_text: &str)
pub fn move_big_word_end(&mut self, line_text: &str)
Move forward to end of current/next WORD (whitespace-delimited)
Sourcepub fn half_page_up(&mut self)
pub fn half_page_up(&mut self)
Move half page up
Sourcepub fn half_page_down(&mut self)
pub fn half_page_down(&mut self)
Move half page down
Sourcepub fn goto_bottom(&mut self)
pub fn goto_bottom(&mut self)
Go to bottom of buffer (last line)
Sourcepub fn toggle_visual_char(&mut self)
pub fn toggle_visual_char(&mut self)
Toggle character-wise visual mode
Sourcepub fn toggle_visual_line(&mut self)
pub fn toggle_visual_line(&mut self)
Toggle line-wise visual mode
Sourcepub fn toggle_visual_block(&mut self)
pub fn toggle_visual_block(&mut self)
Toggle block/rectangular visual mode
Sourcepub fn compute_selection(&self, scroll_offset: usize) -> Option<Selection>
pub fn compute_selection(&self, scroll_offset: usize) -> Option<Selection>
Compute a Selection from the current visual mode state.
The selection coordinates are in screen-relative terms
(row = line - viewport_top) for rendering.
scroll_offset is the current viewport scroll position.
Sourcepub fn goto_mark(&mut self, name: char) -> bool
pub fn goto_mark(&mut self, name: char) -> bool
Jump to a named mark, returning true if the mark exists
Sourcepub fn start_search(&mut self, direction: SearchDirection)
pub fn start_search(&mut self, direction: SearchDirection)
Start search input mode
Sourcepub fn search_input(&mut self, ch: char)
pub fn search_input(&mut self, ch: char)
Add a character to the search query
Sourcepub fn search_backspace(&mut self)
pub fn search_backspace(&mut self)
Remove the last character from the search query
Sourcepub fn cancel_search(&mut self)
pub fn cancel_search(&mut self)
Cancel search mode without executing
Sourcepub fn screen_cursor_pos(&self, scroll_offset: usize) -> Option<(usize, usize)>
pub fn screen_cursor_pos(&self, scroll_offset: usize) -> Option<(usize, usize)>
Get the cursor position in screen coordinates, if visible.
Returns (col, row) where row is relative to the viewport top.
Returns None if the cursor is outside the visible viewport.
Sourcepub fn required_scroll_offset(&self, current_offset: usize) -> Option<usize>
pub fn required_scroll_offset(&self, current_offset: usize) -> Option<usize>
Calculate the scroll offset needed to make the cursor visible.
Returns Some(new_offset) if scrolling is needed, None if cursor is already visible.
Sourcepub fn update_dimensions(
&mut self,
cols: usize,
rows: usize,
scrollback_len: usize,
)
pub fn update_dimensions( &mut self, cols: usize, rows: usize, scrollback_len: usize, )
Update the scrollback length (call when terminal state changes)
Sourcepub fn status_text(&self) -> String
pub fn status_text(&self) -> String
Get a status line description of the current mode
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CopyModeState
impl RefUnwindSafe for CopyModeState
impl Send for CopyModeState
impl Sync for CopyModeState
impl Unpin for CopyModeState
impl UnsafeUnpin for CopyModeState
impl UnwindSafe for CopyModeState
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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<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 moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().