[gnumeric] Clipboard: Skip MS HTML clipboard headers.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Clipboard: Skip MS HTML clipboard headers.
- Date: Fri, 25 Jun 2010 13:30:00 +0000 (UTC)
commit 5f5041601b8d7760de18864c876a004f96b5871b
Author: Morten Welinder <terra gnome org>
Date: Fri Jun 25 09:29:33 2010 -0400
Clipboard: Skip MS HTML clipboard headers.
ChangeLog | 5 +++++
NEWS | 1 +
src/gui-clipboard.c | 28 ++++++++++++++++++++++++++--
3 files changed, 32 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d59f599..b6e1c0b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-06-25 Morten Welinder <terra gnome org>
+
+ * src/gui-clipboard.c (table_content_received): Skip headers for
+ MS HTML Format.
+
2010-06-25 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/Makefile.am (undo.[ch]): added
diff --git a/NEWS b/NEWS
index 896b9f2..4b84365 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,7 @@ Morten:
* Improve function syntax tooltips.
* Fix excessive memory use problem with xlsx. [#622365]
* Make BackSpace work as Delete on pane. [#622599]
+ * Improve handling of MS-style HTML in clipboard.
--------------------------------------------------------------------------
Gnumeric 1.10.6
diff --git a/src/gui-clipboard.c b/src/gui-clipboard.c
index e7c5b22..b57dd73 100644
--- a/src/gui-clipboard.c
+++ b/src/gui-clipboard.c
@@ -415,9 +415,33 @@ table_content_received (GtkClipboard *clipboard, GtkSelectionData *sel,
sel->length);
} else if (sel->target == gdk_atom_intern (HTML_ATOM_NAME_UNIX, FALSE) ||
sel->target == gdk_atom_intern (HTML_ATOM_NAME_WINDOWS, FALSE)) {
+ char *data = sel->data;
+ size_t length = sel->length;
+
+ if (sel->target == gdk_atom_intern (HTML_ATOM_NAME_WINDOWS, FALSE)) {
+ /* See bug 143084 */
+ size_t i = 0;
+ while (i + 9 < length) {
+ if (memcmp (data + i, "<!DOCTYPE", 9) == 0) {
+ if (debug_clipboard ())
+ g_printerr ("Skipping %d bytes of headers.\n", i);
+ data += i;
+ length -= i;
+ break;
+ }
+ while (i < length) {
+ if (data[i] == '\n' || data[i] == '\r') {
+ while (i < length && g_ascii_isspace (data[i]))
+ i++;
+ break;
+ }
+ i++;
+ }
+ }
+ }
+
content = table_cellregion_read (wbc, "Gnumeric_html:html",
- pt, sel->data,
- sel->length);
+ pt, data, length);
} else if ((sel->target == gdk_atom_intern ( BIFF8_ATOM_NAME, FALSE)) ||
(sel->target == gdk_atom_intern ( BIFF8_ATOM_NAME_CITRIX, FALSE)) ||
(sel->target == gdk_atom_intern ( BIFF5_ATOM_NAME, FALSE)) ||
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]