on master help sign in
Stop Terminal::drop from overriding work of Terminal::restore. (#7931)

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.

commitea886773945a0c0856ab5866dde3a3fdd459ed1d authorDillard Robertson <32615829+dilr@users.noreply.github.com> dateMon 14 Aug 2023, 23:19 (3 years ago) parent2756f70
1 file changed−14
helix-tui/src/terminal.rs−14
helix-tui/src/terminal.rs−14
@@ -65,20 +65,6 @@ where
6565 viewport: Viewport,
6666}
6767
68−impl<B> Drop for Terminal<B>
69−where
70− B: Backend,
71−{
72− fn drop(&mut self) {
73− // Attempt to restore the cursor state
74− if self.cursor_kind == CursorKind::Hidden {
75− if let Err(err) = self.show_cursor(CursorKind::Block) {
76− eprintln!("Failed to show the cursor: {}", err);
77− }
78− }
79− }
80−}
81−
8268impl<B> Terminal<B>
8369where
8470 B: Backend,