Skip to content

Commit 6951ff2

Browse files
committed
Fix signature help text cutoff
1 parent 4827e99 commit 6951ff2

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

helix-term/src/handlers/signature_help.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ pub fn show_signature_help(
264264
active_signature,
265265
lsp_signature,
266266
signatures,
267+
editor.popup_border(),
267268
);
268269

269270
let mut popup = Popup::new(SignatureHelp::ID, contents)

helix-term/src/ui/lsp/signature_help.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ pub struct SignatureHelp {
2929
active_signature: usize,
3030
lsp_signature: Option<usize>,
3131
signatures: Vec<Signature>,
32+
popup_border: bool,
3233
}
3334

3435
impl SignatureHelp {
@@ -40,13 +41,15 @@ impl SignatureHelp {
4041
active_signature: usize,
4142
lsp_signature: Option<usize>,
4243
signatures: Vec<Signature>,
44+
popup_border: bool,
4345
) -> Self {
4446
Self {
4547
language,
4648
config_loader,
4749
active_signature,
4850
lsp_signature,
4951
signatures,
52+
popup_border,
5053
}
5154
}
5255

@@ -94,7 +97,11 @@ impl Component for SignatureHelp {
9497
}
9598

9699
fn render(&mut self, area: Rect, surface: &mut Buffer, cx: &mut Context) {
97-
let margin = Margin::all(1);
100+
let margin = if cx.editor.popup_border() {
101+
Margin::horizontal(1)
102+
} else {
103+
Margin::all(1)
104+
};
98105
let area = area.inner(margin);
99106

100107
let signature = self
@@ -156,9 +163,7 @@ impl Component for SignatureHelp {
156163
Some(doc) => Markdown::new(doc.clone(), Arc::clone(&self.config_loader)),
157164
};
158165
let sig_doc = sig_doc.parse(Some(&cx.editor.theme));
159-
let sig_doc_area = area
160-
.clip_top(sig_text_area.height + 2)
161-
.clip_bottom(u16::from(cx.editor.popup_border()));
166+
let sig_doc_area = area.clip_top(sig_text_area.height + 1);
162167
let sig_doc_para = Paragraph::new(&sig_doc)
163168
.wrap(Wrap { trim: false })
164169
.scroll((cx.scroll.unwrap_or_default() as u16, 0));
@@ -206,6 +211,9 @@ impl Component for SignatureHelp {
206211
0
207212
};
208213

209-
Some((width + PADDING + sig_index_width as u16, height + PADDING))
214+
Some((
215+
width + PADDING + sig_index_width as u16,
216+
height + PADDING * !self.popup_border as u16,
217+
))
210218
}
211219
}

0 commit comments

Comments
 (0)