aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2014-09-30 16:26:55 +0200
committerMarc André Tanner <mat@brain-dump.org>2014-09-30 16:26:55 +0200
commita9c2a093fceec3a09eaffe29db157802af47dc59 (patch)
tree6854a4a70a0d09e37eb55e3c73fc869ffc56261b /vis.c
parentfb80e02464b06e81c2c7e68cd3323fa56c4b9a6d (diff)
downloadvis-a9c2a093fceec3a09eaffe29db157802af47dc59.tar.gz
vis-a9c2a093fceec3a09eaffe29db157802af47dc59.tar.xz
Allow to supend the editor via CTRL-Z
Diffstat (limited to 'vis.c')
-rw-r--r--vis.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/vis.c b/vis.c
index e6c670e..7b93eae 100644
--- a/vis.c
+++ b/vis.c
@@ -372,6 +372,8 @@ static TextObject *moves_linewise[] = {
};
/** functions to be called from keybindings */
+/* temporarily suspend the editor and return to the shell, type 'fg' to get back */
+static void suspend(const Arg *arg);
/* switch to mode indicated by arg->i */
static void switchmode(const Arg *arg);
/* set mark indicated by arg->i to current cursor position */
@@ -768,6 +770,11 @@ static size_t window_lines_bottom(const Arg *arg) {
/** key bindings functions of type: void (*func)(const Arg*) */
+static void suspend(const Arg *arg) {
+ endwin();
+ raise(SIGSTOP);
+}
+
static void repeat(const Arg *arg) {
action = action_prev;
action_do(&action);
@@ -1512,6 +1519,7 @@ static void setup() {
sigemptyset(&sa.sa_mask);
sa.sa_handler = sigwinch_handler;
sigaction(SIGWINCH, &sa, NULL);
+ sigaction(SIGCONT, &sa, NULL);
}
static bool keymatch(Key *key0, Key *key1) {