X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/94af7d45eff65baa84c142b8238267217ba4617d..0d1cb8cb298ae68754575cb65695ff9567a36899:/src/common/textcmn.cpp?ds=sidebyside diff --git a/src/common/textcmn.cpp b/src/common/textcmn.cpp index bf4de031f1..6709d10e0b 100644 --- a/src/common/textcmn.cpp +++ b/src/common/textcmn.cpp @@ -6,7 +6,7 @@ // Created: 13.07.99 // RCS-ID: $Id$ // Copyright: (c) wxWindows team -// Licence: wxWindows license +// Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -173,7 +173,7 @@ bool wxTextCtrlBase::SaveFile(const wxString& filename) } #if wxUSE_FFILE - wxFFile file(filename, "w"); + wxFFile file(filename, _T("w")); if ( file.IsOpened() && file.Write(GetValue()) ) { // it's not modified any longer @@ -285,7 +285,7 @@ bool wxTextCtrlBase::EmulateKeyPress(const wxKeyEvent& event) { // the generic version is unused in wxMSW #ifndef __WIN32__ - wxChar ch; + wxChar ch = 0; int keycode = event.GetKeyCode(); switch ( keycode ) { @@ -327,13 +327,33 @@ bool wxTextCtrlBase::EmulateKeyPress(const wxKeyEvent& event) ch = _T('/'); break; + case WXK_DELETE: + case WXK_NUMPAD_DELETE: + // delete the character at cursor + { + const long pos = GetInsertionPoint(), + last = GetLastPosition(); + if ( pos < last ) + Remove(pos, pos + 1); + } + break; + + case WXK_BACK: + // delete the character before the cursor + { + const long pos = GetInsertionPoint(); + if ( pos > 0 ) + Remove(pos - 1, pos); + } + break; + default: - if ( keycode < 256 && keycode >= 0 && isprint(keycode) ) + if ( keycode < 256 && keycode >= 0 && wxIsprint(keycode) ) { // FIXME this is not going to work for non letters... if ( !event.ShiftDown() ) { - keycode = tolower(keycode); + keycode = wxTolower(keycode); } ch = (wxChar)keycode;