Skip to content

Commit

Permalink
optimize competion preview pos
Browse files Browse the repository at this point in the history
  • Loading branch information
cossonleo committed May 30, 2022
1 parent 924443d commit 6d73220
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions helix-term/src/ui/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,16 @@ impl Component for Completion {
height = rel_height.min(height);
}
Rect::new(x, y, width, height)
} else if popup_x > 30 {
let mut height = area.height.saturating_sub(popup_y);
let mut width = popup_x;
if let Some((rel_width, rel_height)) = markdown_doc.required_size((width, height)) {
width = rel_width.min(width);
height = rel_height.min(height);
}
let x = popup_x - width;
let y = popup_y;
Rect::new(x, y, width, height)
} else {
let half = area.height / 2;
let height = 15.min(half);
Expand Down

0 comments on commit 6d73220

Please sign in to comment.