Move Push- and PopChunk out of the selection_traversal function

This commit is contained in:
Chris Young 2012-08-03 18:15:16 +01:00
parent 36d3056526
commit 18db6826f1
1 changed files with 31 additions and 52 deletions

View File

@ -198,21 +198,11 @@ bool gui_add_to_clipboard(const char *text, size_t length, bool space)
These only seem to be called from desktop/textinput.c in this specific order, if they
are added elsewhere this might need a rewrite. */
if(!(PushChunk(iffh,0,ID_CHRS,IFFSIZE_UNKNOWN)))
{
if(text)
{
if(!ami_add_to_clipboard(text, length, space)) return false;
}
PopChunk(iffh);
}
else
{
PopChunk(iffh);
return false;
}
return true;
}
@ -220,32 +210,32 @@ bool ami_add_to_clipboard(const char *text, size_t length, bool space)
{
char *buffer;
if(nsoption_bool(utf8_clipboard) || ami_utf8_clipboard)
{
if(!(PushChunk(iffh,0,ID_CHRS,IFFSIZE_UNKNOWN))) {
if(nsoption_bool(utf8_clipboard) || ami_utf8_clipboard) {
WriteChunkBytes(iffh,text,length);
}
else
{
} else {
buffer = ami_utf8_easy(text);
if(buffer)
{
if(buffer) {
char *p;
p = buffer;
while(*p != '\0')
{
while(*p != '\0') {
if(*p == 0xa0) *p = 0x20;
p++;
}
WriteChunkBytes(iffh, buffer, strlen(buffer));
ami_utf8_free(buffer);
}
}
if(space) WriteChunkBytes(iffh," ",1);
PopChunk(iffh);
} else {
PopChunk(iffh);
return false;
}
return true;
}
@ -259,8 +249,6 @@ bool gui_commit_clipboard(void)
bool ami_clipboard_copy(const char *text, size_t length, struct box *box,
void *handle, const char *whitespace_text,size_t whitespace_length)
{
if(!(PushChunk(iffh,0,ID_CHRS,IFFSIZE_UNKNOWN)))
{
if (whitespace_text)
{
@ -273,15 +261,6 @@ bool ami_clipboard_copy(const char *text, size_t length, struct box *box,
if (!ami_add_to_clipboard(text, length, add_space)) return false;
}
PopChunk(iffh);
}
else
{
PopChunk(iffh);
return false;
}
return true;
}