Skip to content

Commit

Permalink
Stop Terminal::drop from overriding work of Terminal::restore. (#7931)
Browse files Browse the repository at this point in the history
When Application::run is exiting, either Terminal::restore or
Terminal::force_restore will be called depending
on if a panic occured or not.
Both of these functions will reset the cursor to terminal's default.

After this is done, Terminal::drop will be called.
If terminal.cursor_kind == Hidden, then
the cursor will be reset to a CursorKind::Block,
undoing the work of restore or force_restore.

This commit just removes the drop implementation,
as its job is already better handled in restore and force_restore.
  • Loading branch information
dilr authored Aug 15, 2023
1 parent 2756f70 commit ea88677
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions helix-tui/src/terminal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,6 @@ where
viewport: Viewport,
}

impl<B> Drop for Terminal<B>
where
B: Backend,
{
fn drop(&mut self) {
// Attempt to restore the cursor state
if self.cursor_kind == CursorKind::Hidden {
if let Err(err) = self.show_cursor(CursorKind::Block) {
eprintln!("Failed to show the cursor: {}", err);
}
}
}
}

impl<B> Terminal<B>
where
B: Backend,
Expand Down

0 comments on commit ea88677

Please sign in to comment.