Skip to content

Commit

Permalink
Fix signature help panic when too large
Browse files Browse the repository at this point in the history
When signature help is too large it may cause a panic when it is too
large, now I just make the hover do an intersection with surface to make
sure it never overflow.
  • Loading branch information
pickfire committed Sep 29, 2022
1 parent c4aec0a commit 5013aab
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion helix-term/src/ui/lsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ impl Component for SignatureHelp {
let (_, sig_text_height) = crate::ui::text::required_size(&sig_text, area.width);
let sig_text_area = area.clip_top(1).with_height(sig_text_height);
let sig_text_para = Paragraph::new(sig_text).wrap(Wrap { trim: false });
sig_text_para.render(sig_text_area.inner(&margin), surface);
let sig_text_para = sig_text_area.inner(&margin).intersection(surface.area);
sig_text_para.render(sig_text_para, surface);

if self.signature_doc.is_none() {
return;
Expand Down

0 comments on commit 5013aab

Please sign in to comment.