diff --git a/app/src/input/input.rs b/app/src/input/input.rs index aab7fc88..f58fb0d0 100644 --- a/app/src/input/input.rs +++ b/app/src/input/input.rs @@ -16,7 +16,7 @@ impl<'a> Input<'a> { } impl<'a> Widget for Input<'a> { - fn render(self, _: Rect, buf: &mut Buffer) { + fn render(self, win: Rect, buf: &mut Buffer) { let input = &self.cx.input; let area = self.cx.area(&input.position); @@ -43,8 +43,11 @@ impl<'a> Widget for Input<'a> { .render(area, buf); if let Some(Range { start, end }) = input.selected() { + let x = win.width.min(area.x + 1 + start); + let y = win.height.min(area.y + 1); + buf.set_style( - Rect { x: area.x + 1 + start, y: area.y + 1, width: end - start, height: 1 }, + Rect { x, y, width: (end - start).min(win.width - x), height: 1.min(win.height - y) }, Style::new().bg(Color::Rgb(72, 77, 102)), ) }