Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfixes panic when resizing #10507

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions helix-term/src/ui/lsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,8 @@ impl Component for SignatureHelp {

let sig = &self.signatures[self.active_signature];

if PADDING >= viewport.1 || PADDING >= viewport.0 {
return None;
}
let max_text_width = (viewport.0 - PADDING).min(120);
// Min width: 10, Max width: 120
let max_text_width = viewport.0.saturating_sub(PADDING).min(120).max(10);

let signature_text = crate::ui::markdown::highlighted_code_block(
sig.signature.as_str(),
Expand Down
17 changes: 14 additions & 3 deletions helix-term/src/ui/popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,20 @@ impl<T: Component> Popup<T> {
let width = child_size.0.min(viewport.width);
let height = child_size.1.min(viewport.height.saturating_sub(2)); // add some spacing in the viewport

let position = self
.position
.get_or_insert_with(|| editor.cursor().0.unwrap_or_default());
let position = if let Some(position) = self.position {
// check if the position is still inside the viewport
if position.row as u16 >= viewport.y
&& (position.row as u16) < (viewport.y + viewport.height)
&& position.col as u16 >= viewport.x
&& (position.col as u16) < (viewport.x + viewport.width)
{
position
} else {
editor.cursor().0.unwrap_or_default()
}
} else {
editor.cursor().0.unwrap_or_default()
};

// if there's a orientation preference, use that
// if we're on the top part of the screen, do below
Expand Down
Loading