aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui/popup.rs
diff options
context:
space:
mode:
authorNathan Vegdahl2021-07-02 02:37:28 +0000
committerNathan Vegdahl2021-07-02 02:37:28 +0000
commit2224a1527ec9592f16131b0aa3923fc3d37592e7 (patch)
tree2a08b053cb32cef9dc1db5895778d419ebaebb5b /helix-term/src/ui/popup.rs
parente725957704274b1ec814a34ddf6f75faf35358e7 (diff)
parent9f62ad0715240156b512dfc7c584d2d0df05a664 (diff)
Merge branch 'master' into great_line_ending_and_cursor_range_cleanup
Diffstat (limited to 'helix-term/src/ui/popup.rs')
-rw-r--r--helix-term/src/ui/popup.rs12
1 files changed, 3 insertions, 9 deletions
diff --git a/helix-term/src/ui/popup.rs b/helix-term/src/ui/popup.rs
index af72735c..29ffb4ad 100644
--- a/helix-term/src/ui/popup.rs
+++ b/helix-term/src/ui/popup.rs
@@ -2,13 +2,8 @@ use crate::compositor::{Component, Compositor, Context, EventResult};
use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
use tui::buffer::Buffer as Surface;
-use std::borrow::Cow;
-
use helix_core::Position;
-use helix_view::{
- graphics::{Color, Rect, Style},
- Editor,
-};
+use helix_view::graphics::Rect;
// TODO: share logic with Menu, it's essentially Popup(render_fn), but render fn needs to return
// a width/height hint. maybe Popup(Box<Component>)
@@ -57,7 +52,7 @@ impl<T: Component> Component for Popup<T> {
fn handle_event(&mut self, event: Event, cx: &mut Context) -> EventResult {
let key = match event {
Event::Key(event) => event,
- Event::Resize(width, height) => {
+ Event::Resize(_, _) => {
// TODO: calculate inner area, call component's handle_event with that area
return EventResult::Ignored;
}
@@ -99,7 +94,7 @@ impl<T: Component> Component for Popup<T> {
// tab/enter/ctrl-k or whatever will confirm the selection/ ctrl-n/ctrl-p for scroll.
}
- fn required_size(&mut self, viewport: (u16, u16)) -> Option<(u16, u16)> {
+ fn required_size(&mut self, _viewport: (u16, u16)) -> Option<(u16, u16)> {
let (width, height) = self
.contents
.required_size((120, 26)) // max width, max height
@@ -135,7 +130,6 @@ impl<T: Component> Component for Popup<T> {
rel_y += 1 // position below point
}
- let area = Rect::new(rel_x, rel_y, width, height);
// clip to viewport
let area = viewport.intersection(Rect::new(rel_x, rel_y, width, height));