#![deny(dead_code)]
#![deny(unused)]
#![deny(unused_mut)]
#![deny(clippy::missing_safety_doc)]
#![deny(clippy::undocumented_unsafe_blocks)]
#![cfg_attr(not(test), deny(clippy::expect_used))]
#![cfg_attr(not(test), deny(clippy::unwrap_used))]
#![deny(clippy::question_mark_used)]
#![deny(clippy::needless_borrow)]
#![allow(bindings_with_variant_name)]
pub mod autocomplete;
pub mod components;
pub mod events;
pub mod fuzzy;
pub mod image;
pub mod keybindings;
pub mod kill_ring;
pub mod layout;
pub mod renderer;
pub mod terminal;
pub mod theme;
pub mod tui;
pub mod undo_stack;
pub mod utils;
pub mod word_navigation;
pub use crossterm::event::KeyEvent;
pub use events::{
Event,
Key,
Modifiers,
matches_key,
};
pub use keybindings::{
KeybindingsManager,
default_bindings,
};
pub use renderer::{
InputResult,
RenderError,
RenderStrategy,
Rendered,
Renderer,
};
pub use terminal::{
Terminal,
TestTerminal,
};
pub use tui::{
Anchor,
Overlay,
OverlayConstraints,
OverlayPosition,
TUI,
};
pub trait Component {
fn render(&self, width: u16) -> Result<Rendered, RenderError>;
fn render_rect(&self, rect: crate::layout::Rect) -> Result<Rendered, RenderError> {
self.render(rect.width)
}
fn handle_input(&mut self, _event: &events::Event) -> InputResult {
InputResult::Ignored
}
fn wants_key_release(&self) -> bool {
false
}
fn as_focusable(&self) -> Option<&dyn Focusable> {
None
}
fn as_focusable_mut(&mut self) -> Option<&mut dyn Focusable> {
None
}
}
pub trait Focusable: Component {
fn focused(&self) -> bool;
fn set_focused(&mut self, focused: bool);
}