Attached is a patch that transforms line ends when text is copied to the clipboard for gtk 2 on win32, as well as gtk 1. I pulled the transformation out into a common block to be shared by both versions.

John
Index: external/scintilla/gtk/ScintillaGTK.cxx
===================================================================
RCS file: /home/cvs/src/ide/external/scintilla/gtk/ScintillaGTK.cxx,v
retrieving revision 1.47
diff -u -p -r1.47 ScintillaGTK.cxx
--- external/scintilla/gtk/ScintillaGTK.cxx     28 Mar 2006 08:24:42 -0000      
1.47
+++ external/scintilla/gtk/ScintillaGTK.cxx     29 Mar 2006 17:21:06 -0000
@@ -1510,6 +1510,20 @@ void ScintillaGTK::ReceivedDrop(GtkSelec
 
 
 void ScintillaGTK::GetSelection(GtkSelectionData *selection_data, guint info, 
SelectionText *text) {
+#if PLAT_GTK_WIN32
+       // Many native win32 programs require \n line endings, so make a copy 
of 
+       // the clip text now with newlines converted.  Use { } to hide symbols
+       // from code below
+       SelectionText *newline_normalized = NULL;
+       {
+               int tmpstr_len;
+               char *tmpstr = Document::TransformLineEnds(&tmpstr_len, 
text->s, text->len, SC_EOL_LF);
+               newline_normalized = new SelectionText();
+               newline_normalized->Set(tmpstr, tmpstr_len, SC_CP_UTF8, 0, 
text->rectangular);
+               text = newline_normalized;
+       }
+#endif
+
 #if GTK_MAJOR_VERSION >= 2
        // Convert text to utf8 if it isn't already
        SelectionText *converted = 0;
@@ -1549,15 +1563,6 @@ void ScintillaGTK::GetSelection(GtkSelec
 #else /* Gtk 1 */
        char *selBuffer = text->s;
 
-#if PLAT_GTK_WIN32
-
-       // Many native win32 programs require \n line endings,
-        // so make a copy of the clip text now with newlines converted
-
-       int new_len;
-       char *tmpstr = Document::TransformLineEnds(&new_len, selBuffer, 
text->len, SC_EOL_LF);
-       selBuffer = tmpstr;
-#endif
        char *tmputf = 0;
        if ((info == TARGET_UTF8_STRING) || (info == TARGET_STRING)) {
                int len = strlen(selBuffer);
@@ -1611,10 +1616,11 @@ void ScintillaGTK::GetSelection(GtkSelec
        }
 
        delete []tmputf;
+#endif /* Gtk >= 2 */
+
 #if PLAT_GTK_WIN32
-       delete []tmpstr;
+       delete newline_normalized;
 #endif
-#endif /* Gtk >= 2 */
 }
 
 #ifdef USE_GTK_CLIPBOARD
_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest

Reply via email to