aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-03-15 07:25:04 +0000
committerBlaž Hrastnik2021-03-15 07:25:04 +0000
commit872d77075302a3f5b526045e07e0a5564d170e1b (patch)
tree5e490a8a6b994e683af0a0dc8f54b69d3858f85f /helix-term/src/ui
parent87e3cd3df283a6da055488bbea60637713bd1f35 (diff)
ui: Restrain diagnostic sidebar w/h based on available area.
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r--helix-term/src/ui/editor.rs8
1 files 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,
);