Text tool: Fix issue 487 (pasting from clipboard 'resurrects' older long string) and fix a mouse cursor dropping.

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@2009 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2012-09-25 22:27:02 +00:00
parent 1efe6ec5be
commit 69f24bc69f

View File

@ -103,9 +103,8 @@ int Prepend_string(char* dest, char* src, int max)
sizes = max - sized; sizes = max - sized;
} }
memmove(dest+sizes, dest, sized); memmove(dest+sizes, dest, sized+1);
memcpy(dest, src, sizes); memcpy(dest, src, sizes);
return sizes; return sizes;
} }
@ -595,8 +594,9 @@ byte Readline_ex(word x_pos,word y_pos,char * str,byte visible_size,byte max_siz
{ {
int nb_added; int nb_added;
char* data = getClipboard(); char* data = getClipboard();
if (data == NULL) continue; // No clipboard data if (data == NULL)
Cleanup_string(data, input_type); continue; // No clipboard data
Cleanup_string(data, input_type);
// Insert it at the cursor position // Insert it at the cursor position
nb_added = Prepend_string(str + position, data, max_size - position); nb_added = Prepend_string(str + position, data, max_size - position);
while (nb_added) while (nb_added)
@ -611,6 +611,7 @@ byte Readline_ex(word x_pos,word y_pos,char * str,byte visible_size,byte max_siz
nb_added--; nb_added--;
} }
free(data); free(data);
Hide_cursor();
goto affichage; goto affichage;
} }