summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-07-09 12:44:30 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-07-10 10:35:15 +0200
commitb5809f3272f8e0cc5c9b6540e475d6109e7dc3ec (patch)
tree6bd40c618c051db294b658e503d87cdde7ddb9a5
parent6f496fee3ca649144621fcf15e4906fde9fbb9fc (diff)
normalize both ends
Change-Id: Id03df7f678d0bb568c0c672b12cad12f943e32a4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98442 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--include/vcl/weld.hxx1
-rw-r--r--vcl/source/app/salvtables.cxx8
2 files changed, 7 insertions, 2 deletions
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 73f27cd9a517..e0f274b50c04 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -2018,6 +2018,7 @@ protected:
public:
virtual void set_text(const OUString& rText) = 0;
virtual OUString get_text() const = 0;
+ // if nStartPos or nEndPos is -1 the max available text pos will be used
virtual void select_region(int nStartPos, int nEndPos) = 0;
virtual bool get_selection_bounds(int& rStartPos, int& rEndPos) = 0;
virtual void replace_selection(const OUString& rText) = 0;
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index e30bbd057c71..e69afccb08cd 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -3051,7 +3051,9 @@ void SalInstanceEntry::set_max_length(int nChars)
void SalInstanceEntry::select_region(int nStartPos, int nEndPos)
{
disable_notify_events();
- m_xEntry->SetSelection(Selection(nStartPos, nEndPos < 0 ? SELECTION_MAX : nEndPos));
+ long nStart = nStartPos < 0 ? SELECTION_MAX : nStartPos;
+ long nEnd = nEndPos < 0 ? SELECTION_MAX : nEndPos;
+ m_xEntry->SetSelection(Selection(nStart, nEnd));
enable_notify_events();
}
@@ -5471,7 +5473,9 @@ public:
virtual void select_region(int nStartPos, int nEndPos) override
{
disable_notify_events();
- m_xTextView->SetSelection(Selection(nStartPos, nEndPos < 0 ? SELECTION_MAX : nEndPos));
+ long nStart = nStartPos < 0 ? SELECTION_MAX : nStartPos;
+ long nEnd = nEndPos < 0 ? SELECTION_MAX : nEndPos;
+ m_xTextView->SetSelection(Selection(nStart, nEnd));
enable_notify_events();
}