diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2015-05-07 18:39:43 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2015-05-07 18:39:43 +0200 |
commit | a15a48ac25289e97d057abc15f358d128d6a6434 (patch) | |
tree | 7a49c027edcb49a3c0133a8a2b2a22a506eff0f0 /degesch.c | |
parent | 5271bfb1eec2d6c283bc3f0d3a85cad471c26b3a (diff) | |
download | xK-a15a48ac25289e97d057abc15f358d128d6a6434.tar.gz xK-a15a48ac25289e97d057abc15f358d128d6a6434.tar.xz xK-a15a48ac25289e97d057abc15f358d128d6a6434.zip |
degesch: a bit of cleanup
Diffstat (limited to 'degesch.c')
-rw-r--r-- | degesch.c | 35 |
1 files changed, 18 insertions, 17 deletions
@@ -1548,14 +1548,15 @@ log_message_attributed (void *user_data, const char *quote, const char *fmt, va_list ap) { FILE *stream = stderr; + struct app_context *ctx = g_ctx; - input_hide (&g_ctx->input); + input_hide (&ctx->input); - print_attributed (g_ctx, stream, (intptr_t) user_data, "%s", quote); - vprint_attributed (g_ctx, stream, (intptr_t) user_data, fmt, ap); + print_attributed (ctx, stream, (intptr_t) user_data, "%s", quote); + vprint_attributed (ctx, stream, (intptr_t) user_data, fmt, ap); fputs ("\n", stream); - input_show (&g_ctx->input); + input_show (&ctx->input); } static void @@ -5414,40 +5415,40 @@ on_readline_return (int count, int key) (void) count; (void) key; - struct input *self = &g_ctx->input; + struct app_context *ctx = g_ctx; // Let readline pass the line to our input handler rl_done = 1; // Hide the line, don't redisplay it - input_hide (self); - input_restore (self); + input_hide (&ctx->input); + input_restore (&ctx->input); return 0; } static void on_readline_input (char *line) { - struct input *self = &g_ctx->input; + struct app_context *ctx = g_ctx; if (line) { if (*line) add_history (line); - process_input (g_ctx, line); + process_input (ctx, line); free (line); } else { - input_hide (self); - input_restore (self); - input_ding (self); + input_hide (&ctx->input); + input_restore (&ctx->input); + input_ding (&ctx->input); } - if (self->active) + if (ctx->input.active) // Readline automatically redisplays it - self->prompt_shown = 1; + ctx->input.prompt_shown = 1; } static void @@ -5610,7 +5611,7 @@ static unsigned char on_editline_return (EditLine *editline, int key) { (void) key; - struct input *self = &g_ctx->input; + struct app_context *ctx = g_ctx; const LineInfoW *info = el_wline (editline); int len = info->lastchar - info->buffer; @@ -5624,7 +5625,7 @@ on_editline_return (EditLine *editline, int key) if (*line) { HistEventW ev; - history_w (self->current->history, &ev, H_ENTER, line); + history_w (ctx->input.current->history, &ev, H_ENTER, line); print_debug ("history: %d %ls", ev.num, ev.str); } free (line); @@ -5634,7 +5635,7 @@ on_editline_return (EditLine *editline, int key) char copy[info_mb->lastchar - info_mb->buffer + 1]; memcpy (copy, info_mb->buffer, sizeof copy - 1); copy[sizeof copy - 1] = '\0'; - process_input (g_ctx, copy); + process_input (ctx, copy); el_cursor (editline, len - point); el_wdeletestr (editline, len); |