aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c14
-rw-r--r--src/stdio-commands.c3
-rw-r--r--src/view.c8
3 files changed, 21 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index 33ab26f..29ef024 100644
--- a/src/main.c
+++ b/src/main.c
@@ -388,7 +388,21 @@ main(int argc, char **argv)
getchar();
#endif
+ /*
+ * FIXME: Gracefully handle SIGTERM.
+ * This however would require polling for the flag in Curses
+ * getch() loops.
+ * GTK already catches SIGTERM.
+ */
+#ifdef HAVE_SIGACTION
+ static const struct sigaction sigint = {
+ .sa_handler = teco_sigint_handler,
+ .sa_flags = 0 /* don't auto-restart syscalls */
+ };
+ sigaction(SIGINT, &sigint, NULL);
+#else
signal(SIGINT, teco_sigint_handler);
+#endif
/*
* Important for Unicode handling in curses and glib.
diff --git a/src/stdio-commands.c b/src/stdio-commands.c
index 123d0ea..c2a1c16 100644
--- a/src/stdio-commands.c
+++ b/src/stdio-commands.c
@@ -257,6 +257,9 @@ teco_state_print_string_done(teco_machine_main_t *ctx, teco_string_t str, GError
{
teco_int_t type;
+ if (ctx->flags.mode > TECO_MODE_NORMAL)
+ return &teco_state_start;
+
if (!teco_expressions_pop_num_calc(&type, TECO_MSG_USER, error))
return NULL;
if (type < TECO_MSG_USER || type > TECO_MSG_MAX) {
diff --git a/src/view.c b/src/view.c
index 25c134d..620c80a 100644
--- a/src/view.c
+++ b/src/view.c
@@ -234,8 +234,8 @@ teco_view_load_from_channel(teco_view_t *ctx, GIOChannel *channel,
*/
guint cp = teco_view_get_codepage(ctx);
if (cp == SC_CP_UTF8)
- teco_interface_ssm(SCI_RELEASELINECHARACTERINDEX,
- SC_LINECHARACTERINDEX_UTF32, 0);
+ teco_view_ssm(ctx, SCI_RELEASELINECHARACTERINDEX,
+ SC_LINECHARACTERINDEX_UTF32, 0);
teco_view_ssm(ctx, SCI_BEGINUNDOACTION, 0, 0);
if (clear) {
@@ -314,8 +314,8 @@ cleanup:
teco_view_ssm(ctx, SCI_ENDUNDOACTION, 0, 0);
if (cp == SC_CP_UTF8)
- teco_interface_ssm(SCI_ALLOCATELINECHARACTERINDEX,
- SC_LINECHARACTERINDEX_UTF32, 0);
+ teco_view_ssm(ctx, SCI_ALLOCATELINECHARACTERINDEX,
+ SC_LINECHARACTERINDEX_UTF32, 0);
return ret;
}