[Gpa-commits] r812 - trunk/src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Feb 7 16:13:29 CET 2008


Author: marcus
Date: 2008-02-07 16:13:28 +0100 (Thu, 07 Feb 2008)
New Revision: 812

Modified:
   trunk/src/ChangeLog
   trunk/src/clipboard.c
Log:
2008-02-07  Marcus Brinkmann  <marcus at g10code.de>

	* clipboard.c (file_created_cb): Convert \r\n to \n.


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2008-02-07 12:00:54 UTC (rev 811)
+++ trunk/src/ChangeLog	2008-02-07 15:13:28 UTC (rev 812)
@@ -1,5 +1,7 @@
 2008-02-07  Marcus Brinkmann  <marcus at g10code.de>
 
+	* clipboard.c (file_created_cb): Convert \r\n to \n.
+
 	* clipboard.c (GTK_STOCK_SELECT_ALL) [!GTK_CHECK_VERSION(2,10,0):
 	New macro.
 	(clipboard_text_new): Fix last change.

Modified: trunk/src/clipboard.c
===================================================================
--- trunk/src/clipboard.c	2008-02-07 12:00:54 UTC (rev 811)
+++ trunk/src/clipboard.c	2008-02-07 15:13:28 UTC (rev 812)
@@ -278,7 +278,7 @@
   GpaClipboard *clipboard = data;
   gboolean suc;
   const gchar *end;
-  
+
   suc = g_utf8_validate (item->direct_out, item->direct_out_len, &end);
   if (! suc)
     {
@@ -291,7 +291,26 @@
       return;
     }
 
-  
+#ifdef G_OS_WIN32
+  {
+    /* On Windows 2000, we need to convert \r\n to \n in the output for
+       cut & paste to work properly (otherwise, extra newlines will be
+       inserted).  */
+    gchar *src;
+    gchar *dst;
+
+    src = item->direct_out;
+    dst = item->direct_out;
+    while (*src)
+      {
+	if (src[0] == '\r' && src[1] == '\n')
+	  src++;
+	*(dst++) = *(src++);
+      }
+    *dst = '\0';
+  }
+#endif
+
   gtk_text_buffer_set_text (clipboard->text_buffer,
 			    item->direct_out, item->direct_out_len);
 }



More information about the Gpa-commits mailing list