diff options
author | 2015-01-15 23:01:19 -0500 | |
---|---|---|
committer | 2015-01-15 23:01:19 -0500 | |
commit | 317bca1fd4cdc3fd4b61990a308526358a2fac7d (patch) | |
tree | 94ef07a8653c7ac17c72c2a3a53e74377c3fcdaf /src | |
parent | 14ee3e0bf143916f29b2fb05465b9e79707f4611 (diff) |
Added events for terminal suspend and resume.
Suspend can be prevented by an error handler, described in a new FAQ entry.
New `events.RESUME` replaces `events.FOCUS` for the terminal version.
Utilize these events to disable/enable bracketed paste and mouse modes.
Diffstat (limited to 'src')
-rw-r--r-- | src/termkey.patch | 18 | ||||
-rw-r--r-- | src/textadept.c | 7 |
2 files changed, 12 insertions, 13 deletions
diff --git a/src/termkey.patch b/src/termkey.patch index c519090e..5a9d4099 100644 --- a/src/termkey.patch +++ b/src/termkey.patch @@ -228,28 +228,26 @@ diff -r 49c8684413c0 termkey.c /* Some OSes have Ctrl-Y==VDSUSP */ #ifdef VDSUSP termios.c_cc[VDSUSP] = _POSIX_VDISABLE; -@@ -487,6 +496,8 @@ +@@ -487,6 +496,7 @@ tcsetattr(tk->fd, TCSANOW, &termios); } } -+ printf("\033[?1002h"), fflush(stdout); // enable mouse mode +#endif struct TermKeyDriverNode *p; for(p = tk->drivers; p; p = p->next) -@@ -512,8 +523,11 @@ +@@ -512,8 +522,10 @@ if(p->driver->stop_driver) (*p->driver->stop_driver)(tk, p->info); +#if !_WIN32 if(tk->restore_termios_valid) tcsetattr(tk->fd, TCSANOW, &tk->restore_termios); -+ printf("\033[?1002l"), fflush(stdout); // disable mouse mode +#endif tk->is_started = 0; -@@ -525,11 +539,18 @@ +@@ -525,11 +537,18 @@ return tk->is_started; } @@ -269,7 +267,7 @@ diff -r 49c8684413c0 termkey.c int termkey_get_flags(TermKey *tk) { return tk->flags; -@@ -1012,7 +1033,7 @@ +@@ -1012,7 +1031,7 @@ TermKeyResult termkey_waitkey(TermKey *tk, TermKeyKey *key) { @@ -278,7 +276,7 @@ diff -r 49c8684413c0 termkey.c errno = EBADF; return TERMKEY_RES_ERROR; } -@@ -1026,6 +1047,7 @@ +@@ -1026,6 +1045,7 @@ case TERMKEY_RES_ERROR: return ret; @@ -286,7 +284,7 @@ diff -r 49c8684413c0 termkey.c case TERMKEY_RES_NONE: ret = termkey_advisereadable(tk); if(ret == TERMKEY_RES_ERROR) -@@ -1064,6 +1086,7 @@ +@@ -1064,6 +1084,7 @@ return termkey_getkey_force(tk, key); } break; @@ -294,7 +292,7 @@ diff -r 49c8684413c0 termkey.c } } -@@ -1072,6 +1095,7 @@ +@@ -1072,6 +1093,7 @@ TermKeyResult termkey_advisereadable(TermKey *tk) { @@ -302,7 +300,7 @@ diff -r 49c8684413c0 termkey.c ssize_t len; if(tk->fd == -1) { -@@ -1109,6 +1133,9 @@ +@@ -1109,6 +1131,9 @@ tk->buffcount += len; return TERMKEY_RES_AGAIN; } diff --git a/src/textadept.c b/src/textadept.c index 1b1dad0e..37aa95f0 100644 --- a/src/textadept.c +++ b/src/textadept.c @@ -2387,10 +2387,11 @@ static void t_signal(int signal) { resizeterm(w.ws_row, w.ws_col), pane_resize(pane, LINES - 2, COLS, 1, 0); WINDOW *ce_win = scintilla_get_window(command_entry); wresize(ce_win, 1, COLS), mvwin(ce_win, LINES - 1 - getmaxy(ce_win), 0); - if (signal == SIGCONT) lL_event(lua, "focus", -1); + if (signal == SIGCONT) lL_event(lua, "resume", -1); lL_event(lua, "update_ui", -1); - refresh_all(); - } else endwin(), termkey_stop(ta_tk), kill(0, SIGSTOP); + } else if (!lL_event(lua, "suspend", -1)) + endwin(), termkey_stop(ta_tk), kill(0, SIGSTOP); + refresh_all(); } /** Replacement for `termkey_waitkey()` that handles asynchronous I/O. */ |