From 3f6921229b9761748e22066663b0fa0777ff850b Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Tue, 24 Jul 2012 02:03:37 +0200 Subject: [PATCH] Correct pasting text within existing text, courtesy of jacob1 --- src/interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/interface.c b/src/interface.c index 8c494b793..42a1fac17 100644 --- a/src/interface.c +++ b/src/interface.c @@ -447,7 +447,7 @@ void ui_edit_process(int mx, int my, int mb, ui_edit *ed) int pl = strlen(paste); if ((textwidth(str)+textwidth(paste) > ed->w-14 && !ed->multiline) || (pl+strlen(ed->str)>255) || (float)(((textwidth(str)+textwidth(paste))/(ed->w-14)*12) > ed->h && ed->multiline)) break; - memmove(ed->str+ed->cursor+pl, ed->str+ed->cursor, l+pl-ed->cursor); + memmove(ed->str+ed->cursor+pl, ed->str+ed->cursor, l-ed->cursor+1); memcpy(ed->str+ed->cursor,paste,pl); ed->cursor += pl; break;