mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-31 03:39:57 +02:00
Correct pasting text within existing text, courtesy of jacob1
This commit is contained in:
@@ -447,7 +447,7 @@ void ui_edit_process(int mx, int my, int mb, ui_edit *ed)
|
|||||||
int pl = strlen(paste);
|
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))
|
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;
|
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);
|
memcpy(ed->str+ed->cursor,paste,pl);
|
||||||
ed->cursor += pl;
|
ed->cursor += pl;
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user