From f39723f6510bf57c5d21d62d55be6eefb6305078 Mon Sep 17 00:00:00 2001 From: dequis Date: Thu, 17 Sep 2015 00:55:31 -0300 Subject: [PATCH] Fix FS#905, mangled text when pasted line length exceeds 400 http://bugs.irssi.org/index.php?do=details&task_id=905 Not using the patch from that ticket, the issue turned out to be that (dest - last_lf_pos) returned number of unichr, not bytes, so that's 4 times less than what the size parameter of memmove() should be. --- src/fe-text/gui-readline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fe-text/gui-readline.c b/src/fe-text/gui-readline.c index edc4c55d..ec61e317 100644 --- a/src/fe-text/gui-readline.c +++ b/src/fe-text/gui-readline.c @@ -237,7 +237,7 @@ static void paste_buffer_join_lines(GArray *buf) last_lf = FALSE; if (++line_len >= 400 && last_lf_pos != NULL) { memmove(last_lf_pos+1, last_lf_pos, - dest - last_lf_pos); + (dest - last_lf_pos) * sizeof(unichar)); *last_lf_pos = '\n'; last_lf_pos = NULL; line_len = 0; dest++;