public inbox for [email protected]
help / color / mirror / Atom feedFrom: Nikolai Zhubr <[email protected]>
To: [email protected]
To: Dave Page <[email protected]>
Subject: [PATCH] Beautify line-ends handling yet more.
Date: Wed, 07 Oct 2015 21:47:24 +0300
Message-ID: <[email protected]> (raw)
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgadmin-hackers>
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
--
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
Attachments:
[text/x-patch] 01eoldef.patch (643B, 2-01eoldef.patch)
download | inline diff:
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)
[text/x-patch] 02delifdef.patch (900B, 3-02delifdef.patch)
download | inline diff:
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();
}
}
view thread (6+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: [PATCH] Beautify line-ends handling yet more.
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox