summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-01-14 23:11:35 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-01-14 23:11:35 +0000
commit9f95840a7fbe3de7efd199d5d1efef6211e5f5c8 (patch)
tree4e153f0b382427351efddb66d9f88ea6b51bd84c /gdk
parentcb939843bab035cd9beabaa537800b9cb16ab3e0 (diff)
downloadgtk+-9f95840a7fbe3de7efd199d5d1efef6211e5f5c8.tar.gz
Don't mangle sequences of consecutive \n or \r.
Mon Jan 14 17:14:13 2002 Owen Taylor <otaylor@redhat.com> * gdk/x11/gdkselection-x11.c (sanitize_utf8): Don't mangle sequences of consecutive \n or \r.
Diffstat (limited to 'gdk')
-rw-r--r--gdk/x11/gdkselection-x11.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gdk/x11/gdkselection-x11.c b/gdk/x11/gdkselection-x11.c
index 4cadfb63cf..893d475ce1 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);