// void unix_save_screen(int); /* ux_screen.c */
// void unix_do_scrollback(void); /* ux_screen.c */
void unix_resize_display(void); /* ux_screen.c */
+void unix_suspend_program(void); /* ux_screen.c */
void unix_get_terminal_size(void); /* ux_init.c */
case MOD_CTRL ^ 'U': c = ZC_DEL_TO_BOL; break;
case MOD_CTRL ^ 'W': c = ZC_DEL_WORD; break;
+ /* In raw mode we need to take care of this as well. */
+ case MOD_CTRL ^ 'Z':
+ unix_suspend_program();
+ continue;
+
/* use ^Q to immediately exit. */
case MOD_CTRL ^ 'Q': os_quit();
#include <stdlib.h>
#include <string.h>
+#include <signal.h>
+
#ifdef USE_NCURSES_H
#include <ncurses.h>
#else
}/* os_scroll_area */
-/**
- * Resize the display and redraw. Retain the old screen starting from the
- * top left. Call resize_screen, which may repaint more accurately.
- */
-void unix_resize_display(void)
+static void save_screen(void)
{
if ((saved_screen = newpad(h_screen_rows, h_screen_cols))
&& overwrite(stdscr, saved_screen) == ERR) {
getyx(stdscr, y, x);
wmove(saved_screen, y, x);
}
+}
- endwin();
- refresh();
- unix_get_terminal_size();
+static void resize_restore_screen(void)
+{
+ unix_get_terminal_size();
resize_screen();
- if (zmp != NULL) {
- restart_header();
- }
+ if (zmp != NULL)
+ restart_header();
if (saved_screen) {
delwin(saved_screen);
saved_screen = NULL;
}
+}
+
+
+
+/**
+ * Resize the display and redraw. Retain the old screen starting from the
+ * top left. Call resize_screen, which may repaint more accurately.
+ */
+void unix_resize_display(void)
+{
+ save_screen();
+ endwin();
+ refresh();
+ resize_restore_screen();
}/* unix_redraw_display */
+/**
+ * Suspend ourselves. Save the screen and raise SIGTSTP.
+ * Upon continuing restore the screen as in unix_resize_display; the terminal
+ * size may have changed while we were stopped.
+ */
+void unix_suspend_program(void)
+{
+ save_screen();
+ raise(SIGTSTP);
+ resize_restore_screen();
+}
/**
* Repaint a window.