Fix copying text/plain to clipboard

svn path=/trunk/netsurf/; revision=11636
This commit is contained in:
John Mark Bell 2011-02-09 20:31:34 +00:00
parent f04cc9e9ec
commit 86c2948eb4
6 changed files with 23 additions and 10 deletions

View File

@ -246,7 +246,9 @@ bool ami_clipboard_copy(const char *text, size_t length, struct box *box,
if(text)
{
if (!ami_add_to_clipboard(text, length, box->space)) return false;
bool add_space = box != NULL ? box->space : false;
if (!ami_add_to_clipboard(text, length, add_space)) return false;
}
PopChunk(iffh);

View File

@ -876,14 +876,15 @@ gui_selection_traverse_handler(const char *text,
const char *space_text,
size_t space_length)
{
bool add_space = box != NULL ? box->space : false;
if (space_text) {
if (space_text != NULL && space_length > 0) {
if (!gui_add_to_clipboard(space_text, space_length, false)) {
return false;
}
}
if (!gui_add_to_clipboard(text, length, box->space))
if (!gui_add_to_clipboard(text, length, add_space))
return false;
return true;

View File

@ -72,9 +72,11 @@ static bool cocoa_clipboard_copy_handler(const char *text, size_t length, struct
void *handle, const char *whitespace_text,
size_t whitespace_length)
{
bool add_space = box != NULL ? box->space : false;
if (whitespace_text && !gui_add_to_clipboard( whitespace_text,
whitespace_length, false )) return false;
return gui_add_to_clipboard( text, length, box->space );
return gui_add_to_clipboard( text, length, add_space );
}
bool gui_commit_clipboard(void)

View File

@ -50,15 +50,18 @@ bool copy_handler(const char *text, size_t length, struct box *box,
void *handle, const char *whitespace_text,
size_t whitespace_length)
{
bool add_space = box != NULL ? box->space : false;
/* add any whitespace which precedes the text from this box */
if (whitespace_text) {
if (whitespace_text != NULL && whitespace_length > 0) {
if (!gui_add_to_clipboard(whitespace_text,
whitespace_length, false)) {
return false;
}
}
/* add the text from this box */
if (!gui_add_to_clipboard(text, length, box->space))
if (!gui_add_to_clipboard(text, length, add_space))
return false;
return true;

View File

@ -207,15 +207,18 @@ bool copy_handler(const char *text, size_t length, struct box *box,
void *handle, const char *whitespace_text,
size_t whitespace_length)
{
bool add_space = box != NULL ? box->space : false;
/* add any whitespace which precedes the text from this box */
if (whitespace_text) {
if (whitespace_text != NULL && whitespace_length > 0) {
if (!gui_add_to_clipboard(whitespace_text,
whitespace_length, false)) {
return false;
}
}
/* add the text from this box */
if (!gui_add_to_clipboard(text, length, box->space))
if (!gui_add_to_clipboard(text, length, add_space))
return false;
return true;

View File

@ -2488,13 +2488,15 @@ gui_selection_traverse_handler(const char *text,
const char *space_text,
size_t space_length)
{
if (space_text) {
bool add_space = box != NULL ? box->space : false;
if (space_text != NULL && space_length > 0) {
if (!gui_add_to_clipboard(space_text, space_length, false)) {
return false;
}
}
if (!gui_add_to_clipboard(text, length, box->space))
if (!gui_add_to_clipboard(text, length, add_space))
return false;
return true;