Skip to content

Commit

Permalink
move popup when cursor line changes
Browse files Browse the repository at this point in the history
Co-authored-by: Ben Fekih, Hichem" <[email protected]>
  • Loading branch information
pascalkuthe and karthago1 committed Apr 25, 2024
1 parent 9573b7d commit 7197986
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions helix-term/src/ui/popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,15 @@ impl<T: Component> Popup<T> {
}

fn render_info(&mut self, viewport: Rect, editor: &Editor) -> RenderInfo {
let position = self
let mut position = editor.cursor().0.unwrap_or_default();
if let Some(old_position) = self
.position
.get_or_insert_with(|| editor.cursor().0.unwrap_or_default());
.filter(|old_position| old_position.row == position.row)
{
position = old_position;
} else {
self.position = Some(position);
}

let is_menu = self
.contents
Expand Down

0 comments on commit 7197986

Please sign in to comment.