commit caeeb3d05a8078118879c5b31991a39ab6f26496
Author: Raniconduh <clagv.randomgames@gmail.com>
Date: Wed Jan 26 15:14:06 2022 +0000
diff --git a/include/io.h b/include/io.h
index 2fe9a8d..bd7eca0 100644
--- a/include/io.h
+++ b/include/io.h
@@ -2010 +2012 @@ enum colors {
};
enum keys {
- CTRL_P = 16,
CTRL_B = 2,
- CTRL_N = 14,
+ CTRL_C = 3,
CTRL_F = 6,
+ CTRL_N = 14,
+ CTRL_P = 16,
+ CTRL_Z = 26,
};
diff --git a/include/main.h b/include/main.h
index a3ea612..0ec4d6e 100644
--- a/include/main.h
+++ b/include/main.h
@@ -56 +56 @@
void help(void);
-void handle_winch(int);
+void sig_handler(int);
#endif /*_MAIN_H */
diff --git a/src/main.c b/src/main.c
index 27af63a..3207fde 100644
--- a/src/main.c
+++ b/src/main.c
@@ -497 +498 @@ int main(int argc, char ** argv) {
curses_init();
- signal(SIGWINCH, handle_winch);
+ signal(SIGWINCH, sig_handler);
+ signal(SIGCONT, sig_handler);
list_dir(cwd);
@@ -3556 +35612 @@ int main(int argc, char ** argv) {
last_f = LAST_F;
}
break;
+ case CTRL_Z:
+ terminate_curses();
+ // send self SIGSTOP -- restore shell feature
+ kill(getpid(), SIGSTOP);
+ break;
+ case CTRL_C:
case 'q':
goto done;
default:
@@ -39612 +40317 @@ void help(void) {
}
-void handle_winch(int signo) {
- if (signo == SIGWINCH) {
- endwin();
- refresh();
+void sig_handler(int signo) {
+ switch (signo) {
+ case SIGWINCH:
+ endwin();
+ refresh();
- last_f = first_f + LINES - 6;
- if (cursor > last_f) cursor = last_f;
+ last_f = first_f + LINES - 6;
+ if (cursor > last_f) cursor = last_f;
+ break;
+ case SIGCONT:
+ curses_init();
+ break;
}
}