degesch: mv input_insert{_c,}()

This commit is contained in:
Přemysl Eric Janouch 2015-11-15 00:59:11 +01:00
parent 2a97c01215
commit 465c2e4082
1 changed files with 15 additions and 15 deletions

View File

@ -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;