summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--degesch.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/degesch.c b/degesch.c
index 3b1bc9a..a2d6ece 100644
--- a/degesch.c
+++ b/degesch.c
@@ -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);