diff options
Diffstat (limited to 'gtk/selection.c')
-rw-r--r-- | gtk/selection.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gtk/selection.c b/gtk/selection.c index 68ab88f71..3ffd0db91 100644 --- a/gtk/selection.c +++ b/gtk/selection.c @@ -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; |