~rcr/rirc

b0f118812f36ec7dbaedc131a4b7a0fbc52e0d61 — Richard Robbins 12 days ago 717c779 dev
fix pasting of control characters to input
1 files changed, 13 insertions(+), 4 deletions(-)

M src/components/input.c
M src/components/input.c => src/components/input.c +13 -4
@@ 2,6 2,7 @@

#include "src/utils/utils.h"

#include <ctype.h>
#include <errno.h>
#include <string.h>



@@ 82,13 83,21 @@ input_delete_forw(struct input *inp)
int
input_insert(struct input *inp, const char *c, size_t count)
{
	size_t i = count;
	if (input_text_isfull(inp))
		return 0;

	while (!input_text_isfull(inp) && count--) {

		if (iscntrl(*c))
			inp->text[inp->head++] = ' ';

	while (!input_text_isfull(inp) && i--) {
		inp->text[inp->head++] = *c++;
		if (isprint(*c))
			inp->text[inp->head++] = *c;

		c++;
	}

	return (i != count);
	return 1;
}

int