From 127e4f1caf62558afbf7101bbdc977cc0ee2e100 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 13 Apr 2007 23:41:59 +0000 Subject: [PATCH] fix wxTextCtrl::SetSelection(-1, -1) to behave as documented (patch 1700000) [backport from HEAD] git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@45445 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 4 ++++ src/univ/textctrl.cpp | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index b64e5f61b6..bfd797a653 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -114,6 +114,10 @@ wxGTK: - Fix wxNO_BORDER style for wxRadioBox (David Hart) - Fix wxTextCtrl::GetLineText() for empty lines (Marcin Wojdyr) +wxUniv: + +- Fix wxTextCtrl::SetSelection(-1, -1) to behave as documented (Anders Larsen) + 2.8.3 ----- diff --git a/src/univ/textctrl.cpp b/src/univ/textctrl.cpp index ebb49dcc83..1fbc95a389 100644 --- a/src/univ/textctrl.cpp +++ b/src/univ/textctrl.cpp @@ -1434,8 +1434,12 @@ wxString wxTextCtrl::GetSelectionText() const void wxTextCtrl::SetSelection(wxTextPos from, wxTextPos to) { // selecting till -1 is the same as selecting to the end - if ( to == -1 && from != -1 ) + if ( to == -1 ) { + // and selecting (-1, -1) range is the same as selecting everything, by + // convention + if ( from == -1 ) + from = 0; to = GetLastPosition(); }