diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2022-08-29 14:04:50 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2022-08-29 14:05:33 +0200 |
commit | 313a65180e13215711aa30e5c009065e5050065f (patch) | |
tree | d82dcb4baa7a4a2199ed9009a9af2d4f9acae3ae /xC.c | |
parent | 91db8e6e5477013ee034afd3d6bfa48faed5e2b8 (diff) | |
download | xK-313a65180e13215711aa30e5c009065e5050065f.tar.gz xK-313a65180e13215711aa30e5c009065e5050065f.tar.xz xK-313a65180e13215711aa30e5c009065e5050065f.zip |
xC: fix some corner cases around terminal handling
Diffstat (limited to 'xC.c')
-rw-r--r-- | xC.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -789,7 +789,7 @@ input_el__redisplay (void *input) static char * input_el__make_prompt (EditLine *editline) { - struct input_el *self; + struct input_el *self = NULL; el_get (editline, EL_CLIENTDATA, &self); if (!self->prompt) return ""; @@ -1058,8 +1058,13 @@ input_el_buffer_switch (void *input, input_buffer_t input_buffer) static void input_el_buffer_destroy (void *input, input_buffer_t input_buffer) { - (void) input; + struct input_el *self = input; struct input_el_buffer *buffer = input_buffer; + if (self->active && self->current == buffer) + { + el_wset (self->editline, EL_HIST, history, NULL); + self->current = NULL; + } history_wend (buffer->history); free (buffer->saved_line); @@ -4349,6 +4354,10 @@ buffer_print_read_marker (struct app_context *ctx, FILE *stream, int flush_opts) static void buffer_print_backlog (struct app_context *ctx, struct buffer *buffer) { + // Buffers can be activated, or their lines modified, as automatic actions. + if (ctx->terminal_suspended) + return; + // The prompt can take considerable time to redraw CALL (ctx->input, hide); @@ -11269,7 +11278,8 @@ handle_command_buffer (struct handler_args *a) else if (!strcasecmp_ascii (action, "clear")) { buffer_clear (a->buffer); - buffer_print_backlog (ctx, a->buffer); + if (a->buffer == ctx->current_buffer) + buffer_print_backlog (ctx, a->buffer); } else if (!strcasecmp_ascii (action, "move")) result = handle_buffer_move (ctx, a); |