diff options
| author | nyamatongwe <devnull@localhost> | 2006-04-04 23:45:23 +0000 |
|---|---|---|
| committer | nyamatongwe <devnull@localhost> | 2006-04-04 23:45:23 +0000 |
| commit | 165b14833468106a7f7b28677ac28204059d8d58 (patch) | |
| tree | 1791a8cea9560fffc825c771200cee8f506d235c | |
| parent | 55607b9fa2bdaf1397caabd9dbfa5e02794d2098 (diff) | |
| download | scintilla-mirror-165b14833468106a7f7b28677ac28204059d8d58.tar.gz | |
Patch from John Ehresman that transforms line ends when text is copied to
the clipboard for gtk 2 on win32, as well as gtk 1.
| -rw-r--r-- | gtk/ScintillaGTK.cxx | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index 897adf6ae..6e560decb 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -1516,6 +1516,20 @@ void ScintillaGTK::ReceivedDrop(GtkSelectionData *selection_data) { 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; @@ -1555,15 +1569,6 @@ void ScintillaGTK::GetSelection(GtkSelectionData *selection_data, guint info, Se #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); @@ -1617,10 +1622,11 @@ void ScintillaGTK::GetSelection(GtkSelectionData *selection_data, guint info, Se } delete []tmputf; +#endif /* Gtk >= 2 */ + #if PLAT_GTK_WIN32 - delete []tmpstr; + delete newline_normalized; #endif -#endif /* Gtk >= 2 */ } #ifdef USE_GTK_CLIPBOARD |
