Document the public interface of the vim
crate (#4093)
This PR documents the public interface of the `vim` crate. Release Notes: - N/A --------- Co-authored-by: Conrad <conrad@zed.dev>
This commit is contained in:
parent
ed67363ea3
commit
4e4a1e0dd1
2 changed files with 27 additions and 8 deletions
|
@ -4,12 +4,14 @@ use workspace::{item::ItemHandle, ui::prelude::*, StatusItemView};
|
|||
|
||||
use crate::{state::Mode, Vim};
|
||||
|
||||
/// The ModeIndicator displays the current mode in the status bar.
|
||||
pub struct ModeIndicator {
|
||||
pub mode: Option<Mode>,
|
||||
pub(crate) mode: Option<Mode>,
|
||||
_subscriptions: Vec<Subscription>,
|
||||
}
|
||||
|
||||
impl ModeIndicator {
|
||||
/// Construct a new mode indicator in this window.
|
||||
pub fn new(cx: &mut ViewContext<Self>) -> Self {
|
||||
let _subscriptions = vec![
|
||||
cx.observe_global::<Vim>(|this, cx| this.update_mode(cx)),
|
||||
|
@ -37,13 +39,6 @@ impl ModeIndicator {
|
|||
self.mode = None;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_mode(&mut self, mode: Mode, cx: &mut ViewContext<Self>) {
|
||||
if self.mode != Some(mode) {
|
||||
self.mode = Some(mode);
|
||||
cx.notify();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Render for ModeIndicator {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue