From 0410b0d640df5495cc6548e578e92b1b5f4a0e33 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 12 Feb 2012 17:56:25 +0000 Subject: Don't break the clipboard when copying 'nothing'. Don't touch clipboard contents when copying 'nothing'. svn path=/trunk/netsurf/; revision=13442 --- amiga/clipboard.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'amiga/clipboard.c') diff --git a/amiga/clipboard.c b/amiga/clipboard.c index 1d75051ca..2af7d81ac 100755 --- a/amiga/clipboard.c +++ b/amiga/clipboard.c @@ -1,5 +1,5 @@ /* - * Copyright 2008-2011 Chris Young + * Copyright 2008-2012 Chris Young * * This file is part of NetSurf, http://www.netsurf-browser.org/ * @@ -286,15 +286,17 @@ bool ami_clipboard_copy(const char *text, size_t length, struct box *box, bool gui_copy_to_clipboard(struct selection *s) { + bool success; + + if(s->defined == false) return false; if(!gui_empty_clipboard()) return false; - if (s->defined && selection_traverse(s, ami_clipboard_copy, NULL)) - { - gui_commit_clipboard(); - return true; - } + success = selection_traverse(s, ami_clipboard_copy, NULL); - return false; + /* commit regardless, otherwise we leave the clipboard in an unusable state */ + gui_commit_clipboard(); + + return success; } struct ami_text_selection *ami_selection_to_text(struct gui_window_2 *gwin) -- cgit v1.2.3