X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1e9bafca0f56de34638d4c3fef8cf74fe9351193..0dd9b9e2be1809f484b6447ad9525fa5b404ad95:/src/stc/stc.cpp.in diff --git a/src/stc/stc.cpp.in b/src/stc/stc.cpp.in index b99563fede..b20db627fa 100644 --- a/src/stc/stc.cpp.in +++ b/src/stc/stc.cpp.in @@ -15,15 +15,29 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#if wxUSE_STC + +#include "wx/stc/stc.h" +#include "wx/stc/private.h" + +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif // WX_PRECOMP + #include -#include "wx/wx.h" #include "wx/tokenzr.h" #include "wx/mstream.h" #include "wx/image.h" #include "wx/file.h" -#include "wx/stc/stc.h" #include "ScintillaWX.h" //---------------------------------------------------------------------- @@ -158,9 +172,7 @@ bool wxStyledTextCtrl::Create(wxWindow *parent, long style, const wxString& name) { -#ifdef __WXMAC__ style |= wxVSCROLL | wxHSCROLL; -#endif if (!wxControl::Create(parent, id, pos, size, style | wxWANTS_CHARS | wxCLIP_CHILDREN, wxDefaultValidator, name)) @@ -179,7 +191,7 @@ bool wxStyledTextCtrl::Create(wxWindow *parent, SetCodePage(wxSTC_CP_UTF8); #endif - SetBestFittingSize(size); + SetInitialSize(size); // Reduces flicker on GTK+/X11 SetBackgroundStyle(wxBG_STYLE_CUSTOM); @@ -756,6 +768,13 @@ void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) { #endif bool skip = ((ctrl || alt) && ! (ctrl && alt)); +#if wxUSE_UNICODE + // apparently if we don't do this, Unicode keys pressed after non-char + // ASCII ones (e.g. Enter, Tab) are not taken into account (patch 1615989) + if (m_lastKeyDownConsumed && evt.GetUnicodeKey() > 255) + m_lastKeyDownConsumed = false; +#endif + if (!m_lastKeyDownConsumed && !skip) { #if wxUSE_UNICODE int key = evt.GetUnicodeKey(); @@ -854,12 +873,7 @@ static void SetEventText(wxStyledTextEvent& evt, const char* text, size_t length) { if(!text) return; - // The unicode conversion MUST have a null byte to terminate the - // string so move it into a buffer first and give it one. - wxMemoryBuffer buf(length+1); - buf.AppendData((void*)text, length); - buf.AppendByte(0); - evt.SetText(stc2wx(buf)); + evt.SetText(stc2wx(text, length)); } @@ -937,10 +951,18 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) { evt.SetEventType(wxEVT_STC_PAINTED); break; + case SCN_AUTOCSELECTION: + evt.SetEventType(wxEVT_STC_AUTOCOMP_SELECTION); + evt.SetListType(scn.listType); + SetEventText(evt, scn.text, strlen(scn.text)); + evt.SetPosition(scn.lParam); + break; + case SCN_USERLISTSELECTION: evt.SetEventType(wxEVT_STC_USERLISTSELECTION); evt.SetListType(scn.listType); SetEventText(evt, scn.text, strlen(scn.text)); + evt.SetPosition(scn.lParam); break; case SCN_URIDROPPED: @@ -975,11 +997,7 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) { case SCN_CALLTIPCLICK: evt.SetEventType(wxEVT_STC_CALLTIP_CLICK); break; - - case SCN_AUTOCSELECTION: - evt.SetEventType(wxEVT_STC_AUTOCOMP_SELECTION); - break; - + default: return; } @@ -1056,11 +1074,4 @@ wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent& event): //---------------------------------------------------------------------- //---------------------------------------------------------------------- - - - - - - - - +#endif // wxUSE_STC