mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-27 08:50:02 +03:00
Fix copying text/plain to clipboard
svn path=/trunk/netsurf/; revision=11636
This commit is contained in:
parent
f04cc9e9ec
commit
86c2948eb4
@ -246,7 +246,9 @@ bool ami_clipboard_copy(const char *text, size_t length, struct box *box,
|
|||||||
|
|
||||||
if(text)
|
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);
|
PopChunk(iffh);
|
||||||
|
@ -876,14 +876,15 @@ gui_selection_traverse_handler(const char *text,
|
|||||||
const char *space_text,
|
const char *space_text,
|
||||||
size_t space_length)
|
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)) {
|
if (!gui_add_to_clipboard(space_text, space_length, false)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gui_add_to_clipboard(text, length, box->space))
|
if (!gui_add_to_clipboard(text, length, add_space))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -72,9 +72,11 @@ static bool cocoa_clipboard_copy_handler(const char *text, size_t length, struct
|
|||||||
void *handle, const char *whitespace_text,
|
void *handle, const char *whitespace_text,
|
||||||
size_t whitespace_length)
|
size_t whitespace_length)
|
||||||
{
|
{
|
||||||
|
bool add_space = box != NULL ? box->space : false;
|
||||||
|
|
||||||
if (whitespace_text && !gui_add_to_clipboard( whitespace_text,
|
if (whitespace_text && !gui_add_to_clipboard( whitespace_text,
|
||||||
whitespace_length, false )) return false;
|
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)
|
bool gui_commit_clipboard(void)
|
||||||
|
@ -50,15 +50,18 @@ bool copy_handler(const char *text, size_t length, struct box *box,
|
|||||||
void *handle, const char *whitespace_text,
|
void *handle, const char *whitespace_text,
|
||||||
size_t whitespace_length)
|
size_t whitespace_length)
|
||||||
{
|
{
|
||||||
|
bool add_space = box != NULL ? box->space : false;
|
||||||
|
|
||||||
/* add any whitespace which precedes the text from this box */
|
/* 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,
|
if (!gui_add_to_clipboard(whitespace_text,
|
||||||
whitespace_length, false)) {
|
whitespace_length, false)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add the text from this box */
|
/* 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 false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -207,15 +207,18 @@ bool copy_handler(const char *text, size_t length, struct box *box,
|
|||||||
void *handle, const char *whitespace_text,
|
void *handle, const char *whitespace_text,
|
||||||
size_t whitespace_length)
|
size_t whitespace_length)
|
||||||
{
|
{
|
||||||
|
bool add_space = box != NULL ? box->space : false;
|
||||||
|
|
||||||
/* add any whitespace which precedes the text from this box */
|
/* 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,
|
if (!gui_add_to_clipboard(whitespace_text,
|
||||||
whitespace_length, false)) {
|
whitespace_length, false)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add the text from this box */
|
/* 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 false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -2488,13 +2488,15 @@ gui_selection_traverse_handler(const char *text,
|
|||||||
const char *space_text,
|
const char *space_text,
|
||||||
size_t space_length)
|
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)) {
|
if (!gui_add_to_clipboard(space_text, space_length, false)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gui_add_to_clipboard(text, length, box->space))
|
if (!gui_add_to_clipboard(text, length, add_space))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user