| Scenario | Screenshot | | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | short patch | <img width="1096" height="533" alt="short patch" src="https://github.com/user-attachments/assets/8a883429-0965-4c0b-9002-217b3759b557" /> | | short command | <img width="1096" height="533" alt="short command" src="https://github.com/user-attachments/assets/901abde8-2494-4e86-b98a-7cabaf87ca9c" /> | | long patch | <img width="1129" height="892" alt="long patch" src="https://github.com/user-attachments/assets/fa799a29-a0d6-48e6-b2ef-10302a7916d3" /> | | long command | <img width="1096" height="892" alt="long command" src="https://github.com/user-attachments/assets/11ddf79b-98cb-4b60-ac22-49dfa7779343" /> | | viewing complete patch | <img width="1129" height="892" alt="viewing complete patch" src="https://github.com/user-attachments/assets/81666958-af94-420e-aa66-b60d0a42b9db" /> |
44 lines
1.3 KiB
Rust
44 lines
1.3 KiB
Rust
use crate::bottom_pane::ApprovalRequest;
|
|
use crate::render::renderable::Renderable;
|
|
use crossterm::event::KeyEvent;
|
|
use ratatui::layout::Rect;
|
|
|
|
use super::CancellationEvent;
|
|
|
|
/// Trait implemented by every view that can be shown in the bottom pane.
|
|
pub(crate) trait BottomPaneView: Renderable {
|
|
/// Handle a key event while the view is active. A redraw is always
|
|
/// scheduled after this call.
|
|
fn handle_key_event(&mut self, _key_event: KeyEvent) {}
|
|
|
|
/// Return `true` if the view has finished and should be removed.
|
|
fn is_complete(&self) -> bool {
|
|
false
|
|
}
|
|
|
|
/// Handle Ctrl-C while this view is active.
|
|
fn on_ctrl_c(&mut self) -> CancellationEvent {
|
|
CancellationEvent::NotHandled
|
|
}
|
|
|
|
/// Optional paste handler. Return true if the view modified its state and
|
|
/// needs a redraw.
|
|
fn handle_paste(&mut self, _pasted: String) -> bool {
|
|
false
|
|
}
|
|
|
|
/// Cursor position when this view is active.
|
|
fn cursor_pos(&self, _area: Rect) -> Option<(u16, u16)> {
|
|
None
|
|
}
|
|
|
|
/// Try to handle approval request; return the original value if not
|
|
/// consumed.
|
|
fn try_consume_approval_request(
|
|
&mut self,
|
|
request: ApprovalRequest,
|
|
) -> Option<ApprovalRequest> {
|
|
Some(request)
|
|
}
|
|
}
|