Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZjtUa-0007vS-DF for pgadmin-hackers@arkaria.postgresql.org; Wed, 07 Oct 2015 18:31:08 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZjtUZ-0001uU-Qy for pgadmin-hackers@arkaria.postgresql.org; Wed, 07 Oct 2015 18:31:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZjtUZ-0001uK-Bo for pgadmin-hackers@postgresql.org; Wed, 07 Oct 2015 18:31:07 +0000 Received: from forward17h.cmail.yandex.net ([2a02:6b8:0:f35::a2]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZjtUV-00009j-0R for pgadmin-hackers@postgresql.org; Wed, 07 Oct 2015 18:31:06 +0000 Received: from smtp1h.mail.yandex.net (smtp1h.mail.yandex.net [IPv6:2a02:6b8:0:f05::115]) by forward17h.cmail.yandex.net (Yandex) with ESMTP id 37BF621952; Wed, 7 Oct 2015 21:31:00 +0300 (MSK) Received: from smtp1h.mail.yandex.net (localhost [127.0.0.1]) by smtp1h.mail.yandex.net (Yandex) with ESMTP id AC23F1341898; Wed, 7 Oct 2015 21:30:59 +0300 (MSK) Received: by smtp1h.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Ku9MhuUvxK-UxJCFZsv; Wed, 7 Oct 2015 21:30:59 +0300 (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1444242659; bh=YjFOhq6M//0HlIbPPvU7ro5UGvvojF30/25riz3LBgg=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type; b=PB+r3P/FZFhy/rNwZOLfuqaajD9vU1OBmfPXa5+Zb0k5e5RjZ7rGvMoUL/toFj3p8 lx3UUW/MgYm0PbiMt9OLGqpumt2tq+SBYuB0rJqngboi1r2Jqbk4Cv6MJe6FFea8ol 3MKvaVS7rm/rKrN3+gnIubrdvYqEJaJO2DZtRMpA= Authentication-Results: smtp1h.mail.yandex.net; dkim=pass header.i=@yandex.ru X-Yandex-ForeignMX: SE Message-ID: <561568BC.5070200@yandex.ru> Date: Wed, 07 Oct 2015 21:47:24 +0300 From: Nikolai Zhubr User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.1.5) Gecko/20091204 Thunderbird/3.0 MIME-Version: 1.0 To: pgadmin-hackers@postgresql.org, Dave Page Subject: [PATCH] Beautify line-ends handling yet more. Content-Type: multipart/mixed; boundary="------------050807040304020602060909" X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgadmin-hackers Precedence: bulk Sender: pgadmin-hackers-owner@postgresql.org This is a multi-part message in MIME format. --------------050807040304020602060909 Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit 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 --------------050807040304020602060909 Content-Type: text/x-patch; name="01eoldef.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="01eoldef.patch" 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) --------------050807040304020602060909 Content-Type: text/x-patch; name="02delifdef.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="02delifdef.patch" 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(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(); } } --------------050807040304020602060909 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers --------------050807040304020602060909--