Hello Dave,

Attached are two more patches, mostly cosmetic:

*  Make a better guess of default line-end type based on platform type.
*  Get rid of #ifdef -- let wxTextBuffer::Translate do all the work.

Sending as attachments, let me know if inserting inline is preferred.

Tested on windows only, but I think should not break other platforms.


Thank you,
Nikolai

 Make a better guess of line-end type default based on platform type.

--- pgadmin/include/utils/sysSettings.h.orig	Mon Oct 05 18:16:13 2015
+++ pgadmin/include/utils/sysSettings.h	Wed Oct 07 20:09:59 2015
@@ -433,7 +433,17 @@
 	int GetLineEndingType() const
 	{
 		int i;
-		Read(wxT("LineEndingType"), &i, 2);
+		int defval = 2;
+#ifdef __WXMAC__
+		defval = 1; /* SC_EOL_CR in Scintilla.h */
+#else
+#ifdef __WXMSW__
+		defval = 0; /* SC_EOL_CRLF in Scintilla.h */
+#else
+		defval = 2; /* SC_EOL_LF in Scintilla.h */
+#endif
+#endif
+		Read(wxT("LineEndingType"), &i, defval);
 		return i;
 	}
 	void SetLineEndingType(const int newval)

 Instead of ifdef, let wxTextBuffer::Translate do conversions in all the 
 cases automatically.

--- pgadmin/frm/frmMain.cpp.orig	Wed Oct 07 15:07:06 2015
+++ pgadmin/frm/frmMain.cpp	Wed Oct 07 20:28:09 2015
@@ -659,11 +659,7 @@
 			{
 				text.Append(lv->GetText(row, col) + wxT("\t"));
 			}
-#ifdef __WXMSW__
-			text.Append(wxT("\r\n"));
-#else
 			text.Append(wxT("\n"));
-#endif
 			row = lv->GetNextSelected(row);
 		}
 		text = text.Trim();
@@ -673,13 +669,13 @@
 	ctlSQLBox *sb = dynamic_cast<ctlSQLBox *>(currentControl);
 	if (sb)
 	{
-		text = wxTextBuffer::Translate(sb->GetSelectedText());
+		text = sb->GetSelectedText();
 	}
 
 	// Set the clipboard text
 	if (text.Length() > 0 && wxTheClipboard->Open())
 	{
-		wxTheClipboard->SetData(new wxTextDataObject(text));
+		wxTheClipboard->SetData(new wxTextDataObject(wxTextBuffer::Translate(text)));
 		wxTheClipboard->Close();
 	}
 }

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers

Reply via email to