pub struct Editor {
pub lines: Vec<String>,
pub cursor_row: usize,
pub cursor_col: usize,
pub mode: VimMode,
pub ex_buffer: String,
pub esc_armed: bool,
pub yank: Vec<String>,
pub pending_op: Option<char>,
}Fields§
§lines: Vec<String>§cursor_row: usize§cursor_col: usize§mode: VimMode§ex_buffer: String§esc_armed: boolTracks whether the previous keypress was Esc. Two Escs in
a row from any mode cancel the surrounding modal — same
shape SPEC §4 specifies for “close all modals.”
yank: Vec<String>Single-register yank buffer for yy / dd → p. Only
holds full lines; word-level yanks aren’t in PR-UI-7 scope.
Empty Vec means “nothing to paste.”
pending_op: Option<char>Tracks whether the previous Normal-mode key was d or y.
dd deletes the line, yy yanks it. The pending-op state
clears on any non-matching key so dx doesn’t leave the
editor in a half-operation.
Implementations§
Source§impl Editor
impl Editor
Sourcepub fn body(&self) -> String
pub fn body(&self) -> String
Final body for sending. Joins lines with \n; trailing
blank lines are stripped so a single newline at the bottom
doesn’t sneak past the operator’s intent.
pub fn is_empty(&self) -> bool
Sourcepub fn apply_key(&mut self, k: KeyEvent) -> EditorAction
pub fn apply_key(&mut self, k: KeyEvent) -> EditorAction
Apply a keypress and return what the surrounding modal
should do. Held under &mut self so tests can drive the
editor deterministically without a Terminal.
Trait Implementations§
impl Eq for Editor
impl StructuralPartialEq for Editor
Auto Trait Implementations§
impl Freeze for Editor
impl RefUnwindSafe for Editor
impl Send for Editor
impl Sync for Editor
impl Unpin for Editor
impl UnsafeUnpin for Editor
impl UnwindSafe for Editor
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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