pub struct EditorPanel { /* private fields */ }Implementations§
Source§impl EditorPanel
impl EditorPanel
Source§impl EditorPanel
impl EditorPanel
pub fn from_str(s: &str) -> Self
pub fn from_path(path: &Path) -> Result<Self>
pub fn selections(&self) -> &Selections
pub fn top_line(&self) -> usize
pub fn left_col(&self) -> usize
pub fn save(&mut self) -> Result<()>
Sourcepub fn buffer_find_all(&self, query: &SearchQuery) -> Vec<Selection>
pub fn buffer_find_all(&self, query: &SearchQuery) -> Vec<Selection>
Every match in the buffer.
The app asks through here rather than reaching into self.buffer: a
panel’s internals are not application state, which is the same rule
RenderContext enforces pointing the other way.
ponytail: this scans the whole buffer, which is ~10 ms on a 50k-line
file — fine for answering Enter, too slow to run on every keystroke.
An incremental search box scans the viewport first and completes off
the render thread; see typ-buffer/tests/perf.rs.
Sourcepub fn select_range(&mut self, selection: Selection)
pub fn select_range(&mut self, selection: Selection)
Select a range and scroll it into view.
Sourcepub fn replace_all(&mut self, query: &SearchQuery, replacement: &str) -> usize
pub fn replace_all(&mut self, query: &SearchQuery, replacement: &str) -> usize
Replace every match, as one undo step. Returns how many.
Trait Implementations§
Source§impl Panel for EditorPanel
impl Panel for EditorPanel
Source§fn handle_key(&mut self, _chord: KeyChord) -> Vec<PanelEvent>
fn handle_key(&mut self, _chord: KeyChord) -> Vec<PanelEvent>
The editor has no raw-key behavior left.
Every key that does anything here is a keymap row resolving to an
Action, which is the invariant the whole milestone exists to establish:
a primitive reachable only from a key handler is invisible to the
command palette and to the vim layer. The M1-era arms that used to live
here were the last thing violating it.
Source§fn name(&self) -> &'static str
fn name(&self) -> &'static str
fn render(&mut self, area: Rect, buf: &mut Buffer, ctx: &RenderContext<'_>)
Source§fn apply_action(&mut self, action: Action) -> Option<Vec<PanelEvent>>
fn apply_action(&mut self, action: Action) -> Option<Vec<PanelEvent>>
Source§fn cursor_position(&self, panel_area: Rect) -> Option<(u16, u16)>
fn cursor_position(&self, panel_area: Rect) -> Option<(u16, u16)>
None hides it. Read moreSource§fn handle_mouse(
&mut self,
event: MouseEvent,
panel_area: Rect,
) -> Vec<PanelEvent>
fn handle_mouse( &mut self, event: MouseEvent, panel_area: Rect, ) -> Vec<PanelEvent>
panel_area is supplied so the panel can translate to local coordinates.Source§fn handle_scroll(&mut self, delta: i32, _panel_area: Rect) -> Vec<PanelEvent>
fn handle_scroll(&mut self, delta: i32, _panel_area: Rect) -> Vec<PanelEvent>
Source§fn needs_close_confirmation(&self) -> Option<String>
fn needs_close_confirmation(&self) -> Option<String>
Some(message) blocks closing until confirmed.fn as_any(&self) -> &dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Source§fn tick(&mut self) -> Vec<PanelEvent>
fn tick(&mut self) -> Vec<PanelEvent>
Source§fn captures_escape(&self) -> bool
fn captures_escape(&self) -> bool
Auto Trait Implementations§
impl Freeze for EditorPanel
impl RefUnwindSafe for EditorPanel
impl Send for EditorPanel
impl Sync for EditorPanel
impl Unpin for EditorPanel
impl UnsafeUnpin for EditorPanel
impl UnwindSafe for EditorPanel
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> 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