diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2015-11-15 00:59:11 +0100 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2015-11-15 01:07:09 +0100 |
commit | 465c2e4082ab80860f8770efaee80c60da93c82f (patch) | |
tree | a359efd414f66e7b2d771670c76835c0ef3e2b6b /degesch.c | |
parent | 2a97c0121591dbfd3a11790e386619c2e3299e52 (diff) | |
download | xK-465c2e4082ab80860f8770efaee80c60da93c82f.tar.gz xK-465c2e4082ab80860f8770efaee80c60da93c82f.tar.xz xK-465c2e4082ab80860f8770efaee80c60da93c82f.zip |
degesch: mv input_insert{_c,}()
Diffstat (limited to 'degesch.c')
-rw-r--r-- | degesch.c | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -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; |