(Benno Schulenberg, minor tweaks by DLR and Nick Warne)
- Make suspension clear the screen and put the cursor on the
last line before displaying anything, as Pico does. Changes
- to do_suspend() and do_continue(). (DLR)
+ to do_suspend(), do_continue(), and terminal_init(). (DLR)
- browser.c:
do_browser()
- Reference NANO_GOTODIR_(ALT|F)?KEY instead of
/* Restore the terminal to its previous state. */
terminal_init();
- /* Update the screen. */
+ /* Turn the cursor back on for sure. */
+ curs_set(1);
+
+ /* Redraw the contents of the windows that need it. */
+ blank_statusbar();
total_refresh();
#endif
}
* interpretation of the flow control characters too. */
void terminal_init(void)
{
- cbreak();
- nonl();
- noecho();
- disable_extended_io();
- disable_signals();
- if (!ISSET(PRESERVE))
- disable_flow_control();
+ static struct termios newterm;
+ static bool newterm_set = FALSE;
+
+ /* Slang curses emulation brain damage, part 2: Slang doesn't
+ * implement some of these curses calls properly, so there's no way
+ * to properly reinitialize the terminal using them. We have to
+ * save the termios state on the first call and restore it on
+ * subsequent calls. */
+ if (!newterm_set) {
+ cbreak();
+ nonl();
+ noecho();
+ disable_extended_io();
+ disable_signals();
+ if (!ISSET(PRESERVE))
+ disable_flow_control();
+
+ tcgetattr(0, &newterm);
+ newterm_set = TRUE;
+ } else
+ tcsetattr(0, TCSANOW, &newterm);
}
/* Read in a character, interpret it as a shortcut or toggle if
#ifdef USE_SLANG
/* Slang support. */
#include <slcurses.h>
-/* Slang curses emulation brain damage, part 2: Slang doesn't define the
+/* Slang curses emulation brain damage, part 3: Slang doesn't define the
* curses equivalents of the Insert or Delete keys. */
#define KEY_DC SL_KEY_DELETE
#define KEY_IC SL_KEY_IC
void total_redraw(void)
{
#ifdef USE_SLANG
- /* Slang curses emulation brain damage, part 3: Slang doesn't define
+ /* Slang curses emulation brain damage, part 4: Slang doesn't define
* curscr. */
SLsmg_touch_screen();
SLsmg_refresh();