From 872d77075302a3f5b526045e07e0a5564d170e1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Mon, 15 Mar 2021 16:25:04 +0900 Subject: [PATCH] ui: Restrain diagnostic sidebar w/h based on available area. --- helix-term/src/ui/editor.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index fe4e3439..af1d8af8 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -362,12 +362,14 @@ impl EditorView { } let paragraph = Paragraph::new(lines).alignment(Alignment::Right); + let width = 80.min(viewport.width); + let height = 15.min(viewport.height); paragraph.render( Rect::new( - viewport.x + viewport.width - 80 - 1, + viewport.right() - width, viewport.y as u16 + 1, - 80, - 15, + width, + height, ), surface, );