From 9f95840a7fbe3de7efd199d5d1efef6211e5f5c8 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Mon, 14 Jan 2002 23:11:35 +0000 Subject: [PATCH] Don't mangle sequences of consecutive \n or \r. Mon Jan 14 17:14:13 2002 Owen Taylor * gdk/x11/gdkselection-x11.c (sanitize_utf8): Don't mangle sequences of consecutive \n or \r. --- ChangeLog | 5 +++++ ChangeLog.pre-2-0 | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-2 | 5 +++++ ChangeLog.pre-2-4 | 5 +++++ ChangeLog.pre-2-6 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ gdk/x11/gdkselection-x11.c | 8 ++++---- 8 files changed, 39 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6af1b6edb..4564055db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Jan 14 17:14:13 2002 Owen Taylor + + * gdk/x11/gdkselection-x11.c (sanitize_utf8): Don't + mangle sequences of consecutive \n or \r. + Mon Jan 14 17:42:28 2002 Jonathan Blandford * gtk/gtktreeview.c (gtk_tree_view_stop_editing): allow cancel to diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 6af1b6edb..4564055db 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,8 @@ +Mon Jan 14 17:14:13 2002 Owen Taylor + + * gdk/x11/gdkselection-x11.c (sanitize_utf8): Don't + mangle sequences of consecutive \n or \r. + Mon Jan 14 17:42:28 2002 Jonathan Blandford * gtk/gtktreeview.c (gtk_tree_view_stop_editing): allow cancel to diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 6af1b6edb..4564055db 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +Mon Jan 14 17:14:13 2002 Owen Taylor + + * gdk/x11/gdkselection-x11.c (sanitize_utf8): Don't + mangle sequences of consecutive \n or \r. + Mon Jan 14 17:42:28 2002 Jonathan Blandford * gtk/gtktreeview.c (gtk_tree_view_stop_editing): allow cancel to diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 6af1b6edb..4564055db 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,8 @@ +Mon Jan 14 17:14:13 2002 Owen Taylor + + * gdk/x11/gdkselection-x11.c (sanitize_utf8): Don't + mangle sequences of consecutive \n or \r. + Mon Jan 14 17:42:28 2002 Jonathan Blandford * gtk/gtktreeview.c (gtk_tree_view_stop_editing): allow cancel to diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 6af1b6edb..4564055db 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +Mon Jan 14 17:14:13 2002 Owen Taylor + + * gdk/x11/gdkselection-x11.c (sanitize_utf8): Don't + mangle sequences of consecutive \n or \r. + Mon Jan 14 17:42:28 2002 Jonathan Blandford * gtk/gtktreeview.c (gtk_tree_view_stop_editing): allow cancel to diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 6af1b6edb..4564055db 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +Mon Jan 14 17:14:13 2002 Owen Taylor + + * gdk/x11/gdkselection-x11.c (sanitize_utf8): Don't + mangle sequences of consecutive \n or \r. + Mon Jan 14 17:42:28 2002 Jonathan Blandford * gtk/gtktreeview.c (gtk_tree_view_stop_editing): allow cancel to diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 6af1b6edb..4564055db 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +Mon Jan 14 17:14:13 2002 Owen Taylor + + * gdk/x11/gdkselection-x11.c (sanitize_utf8): Don't + mangle sequences of consecutive \n or \r. + Mon Jan 14 17:42:28 2002 Jonathan Blandford * gtk/gtktreeview.c (gtk_tree_view_stop_editing): allow cancel to diff --git a/gdk/x11/gdkselection-x11.c b/gdk/x11/gdkselection-x11.c index 4cadfb63c..893d475ce 100644 --- a/gdk/x11/gdkselection-x11.c +++ b/gdk/x11/gdkselection-x11.c @@ -528,7 +528,7 @@ gdk_string_to_compound_text (const gchar *str, * routines for COMPOUND_TEXT only enforce this in one direction, * causing cut-and-paste of \r and \r\n separated text to fail. * This routine strips out all non-allowed C0 and C1 characters - * from the input string and also canonicalizes \r, \r\n, and \n\r to \n + * from the input string and also canonicalizes \r, and \r\n to \n */ static gchar * sanitize_utf8 (const gchar *src) @@ -539,10 +539,10 @@ sanitize_utf8 (const gchar *src) while (*p) { - if (*p == '\r' || *p == '\n') + if (*p == '\r') { p++; - if (*p == '\r' || *p == '\n') + if (*p == '\n') p++; g_string_append_c (result, '\n'); @@ -553,7 +553,7 @@ sanitize_utf8 (const gchar *src) char buf[7]; gint buflen; - if (!((ch < 0x20 && ch != '\t') || (ch >= 0x7f && ch < 0xa0))) + if (!((ch < 0x20 && ch != '\t' && ch != '\n') || (ch >= 0x7f && ch < 0xa0))) { buflen = g_unichar_to_utf8 (ch, buf); g_string_append_len (result, buf, buflen); -- 2.43.2