tvi: suspending with ^z - neatvi - [fork] simple vi-type editor with UTF-8 supp… | |
git clone git://src.adamsgaard.dk/neatvi | |
Log | |
Files | |
Refs | |
README | |
--- | |
commit 0b29f0c4ffb2ed6a6e2d41d74f07a9824ab26502 | |
parent 51394946699311750dfd04dc04f756ccd6e05ab0 | |
Author: Ali Gholami Rudi <[email protected]> | |
Date: Sat, 30 May 2015 21:17:14 +0430 | |
vi: suspending with ^z | |
Diffstat: | |
M term.c | 8 ++++++++ | |
M vi.c | 5 +++++ | |
M vi.h | 1 + | |
3 files changed, 14 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/term.c b/term.c | |
t@@ -1,4 +1,5 @@ | |
#include <poll.h> | |
+#include <signal.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
t@@ -38,6 +39,13 @@ void term_done(void) | |
tcsetattr(0, 0, &termios); | |
} | |
+void term_suspend(void) | |
+{ | |
+ term_done(); | |
+ kill(getpid(), SIGSTOP); | |
+ term_init(); | |
+} | |
+ | |
void term_record(void) | |
{ | |
if (!term_sbuf) | |
diff --git a/vi.c b/vi.c | |
t@@ -975,6 +975,11 @@ static void vi(void) | |
break; | |
redraw = 1; | |
break; | |
+ case TK_CTL('z'): | |
+ term_pos(xrows, 0); | |
+ term_suspend(); | |
+ redraw = 1; | |
+ break; | |
case 'u': | |
lbuf_undo(xb); | |
redraw = 1; | |
diff --git a/vi.h b/vi.h | |
t@@ -104,6 +104,7 @@ char *uc_lastline(char *s); | |
void term_init(void); | |
void term_done(void); | |
+void term_suspend(void); | |
void term_str(char *s); | |
void term_chr(int ch); | |
void term_pos(int r, int c); |