@@ -118,6 +118,20 @@ impl<T> Picker<T> {
118// - on input change:
118// - on input change:
119// - score all the names in relation to input
119// - score all the names in relation to input
121+fn inner_rect(area: Rect) -> Rect {
122+ let padding_vertical = area.height * 20 / 100;
123+ let padding_horizontal = area.width * 20 / 100;
125+ let area = Rect::new(
126+ area.x + padding_horizontal,
127+ area.y + padding_vertical,
128+ area.width - padding_horizontal * 2,
129+ area.height - padding_vertical * 2,
121impl<T: 'static> Component for Picker<T> {
135impl<T: 'static> Component for Picker<T> {
122 fn handle_event(&mut self, event: Event, cx: &mut Context) -> EventResult {
136 fn handle_event(&mut self, event: Event, cx: &mut Context) -> EventResult {
123 let key_event = match event {
137 let key_event = match event {
@@ -191,15 +205,7 @@ impl<T: 'static> Component for Picker<T> {
193 fn render(&self, area: Rect, surface: &mut Surface, cx: &mut Context) {
207 fn render(&self, area: Rect, surface: &mut Surface, cx: &mut Context) {
194− let padding_vertical = area.height * 20 / 100;
208+ let area = inner_rect(area);
195− let padding_horizontal = area.width * 20 / 100;
197− let area = Rect::new(
198− area.x + padding_horizontal,
199− area.y + padding_vertical,
200− area.width - padding_horizontal * 2,
201− area.height - padding_vertical * 2,
204 // -- Render the frame:
210 // -- Render the frame:
@@ -260,6 +266,15 @@ impl<T: 'static> Component for Picker<T> {
262 fn cursor_position(&self, area: Rect, editor: &Editor) -> Option<Position> {
268 fn cursor_position(&self, area: Rect, editor: &Editor) -> Option<Position> {
269+ // TODO: this is mostly duplicate code
270+ let area = inner_rect(area);
271+ let block = Block::default().borders(Borders::ALL);
272+ // calculate the inner area inside the box
273+ let inner = block.inner(area);
276+ let area = Rect::new(inner.x + 1, inner.y, inner.width - 1, 1);
263 self.prompt.cursor_position(area, editor)
278 self.prompt.cursor_position(area, editor)