commit b5e66d05cbecb37688be6b4b46b757ec05e8dac5
parent 3ce7e9dcace44ec60bbd08a18b5cc4111c796a72
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date: Fri, 9 Jun 2006 16:57:41 +0000
make the changed suspend/continue routines work properly under slang
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3650 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
4 files changed, 29 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -150,7 +150,7 @@ CVS code -
(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
diff --git a/src/nano.c b/src/nano.c
@@ -1027,7 +1027,11 @@ RETSIGTYPE do_continue(int signal)
/* 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
}
@@ -1228,13 +1232,27 @@ void enable_flow_control(void)
* 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
diff --git a/src/nano.h b/src/nano.h
@@ -64,7 +64,7 @@
#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
diff --git a/src/winio.c b/src/winio.c
@@ -2976,7 +2976,7 @@ void edit_update(update_type location)
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();