summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-11-14 12:22:50 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-11-14 17:54:52 +0100
commitf17a9467e8dcba7fc624373aa81f5b4997665c03 (patch)
tree92d002a372289babd69cbbd7c124f6b92f9a855a /vcl
parentf7ae9bd132d81412dea37874e5fbc7692781222c (diff)
don't select all new text if there was no old text
Change-Id: I087f396e4de196af57974e4462f2a4e7553a6293 Reviewed-on: https://gerrit.libreoffice.org/63370 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/control/fmtfield.cxx16
1 files changed, 7 insertions, 9 deletions
diff --git a/vcl/source/control/fmtfield.cxx b/vcl/source/control/fmtfield.cxx
index 5a6948e793a6..d443f2c1a8e3 100644
--- a/vcl/source/control/fmtfield.cxx
+++ b/vcl/source/control/fmtfield.cxx
@@ -483,16 +483,14 @@ void FormattedField::ImplSetTextImpl(const OUString& rNew, Selection const * pNe
if ((nNewLen > nCurrentLen) && (aSel.Max() == nCurrentLen))
{ // new text is longer and the cursor is behind the last char
if (aSel.Min() == 0)
- { // the whole text was selected -> select the new text on the whole, too
- aSel.Max() = nNewLen;
+ {
if (!nCurrentLen)
- { // there wasn't really a previous selection (as there was no previous text), we're setting a new one -> check the selection options
- SelectionOptions nSelOptions = GetSettings().GetStyleSettings().GetSelectionOptions();
- if (nSelOptions & SelectionOptions::ShowFirst)
- { // selection should be from right to left -> swap min and max
- aSel.Min() = aSel.Max();
- aSel.Max() = 0;
- }
+ { // there wasn't really a previous selection (as there was no previous text)
+ aSel.Max() = 0;
+ }
+ else
+ { // the whole text was selected -> select the new text on the whole, too
+ aSel.Max() = nNewLen;
}
}
else if (aSel.Max() == aSel.Min())