From 465c2e4082ab80860f8770efaee80c60da93c82f Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Sun, 15 Nov 2015 00:59:11 +0100 Subject: degesch: mv input_insert{_c,}() --- degesch.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/degesch.c b/degesch.c index 723ef2b..fb95019 100644 --- a/degesch.c +++ b/degesch.c @@ -253,14 +253,15 @@ input_bind_control (struct input *self, char key, const char *function_name) input_bind (self, keyseq, function_name); } -static void -input_insert_c (struct input *self, int c) +static bool +input_insert (struct input *self, const char *s) { - char s[2] = { c, 0 }; rl_insert_text (s); - if (self->prompt_shown > 0) rl_redisplay (); + + // GNU Readline, contrary to Editline, doesn't care about validity + return true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -566,14 +567,13 @@ input_erase (struct input *self) input_redisplay (self); } -static void -input_insert_c (struct input *self, int c) +static bool +input_insert (struct input *self, const char *s) { - char s[2] = { c, 0 }; - el_insertstr (self->editline, s); - + bool success = !el_insertstr (self->editline, s); if (self->prompt_shown > 0) input_redisplay (self); + return success; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -9866,14 +9866,14 @@ process_mirc_escape (const struct pollfd *fd, struct app_context *ctx) goto error; switch (ctx->char_buf[0]) { - case 'b': input_insert_c (&ctx->input, '\x02'); break; - case 'c': input_insert_c (&ctx->input, '\x03'); break; + case 'b': input_insert (&ctx->input, "\x02"); break; + case 'c': input_insert (&ctx->input, "\x03"); break; case 'i': - case ']': input_insert_c (&ctx->input, '\x1d'); break; + case ']': input_insert (&ctx->input, "\x1d"); break; case 'u': - case '_': input_insert_c (&ctx->input, '\x1f'); break; - case 'v': input_insert_c (&ctx->input, '\x16'); break; - case 'o': input_insert_c (&ctx->input, '\x0f'); break; + case '_': input_insert (&ctx->input, "\x1f"); break; + case 'v': input_insert (&ctx->input, "\x16"); break; + case 'o': input_insert (&ctx->input, "\x0f"); break; default: goto error; -- cgit v1.2.3-70-g09d2