[Libreoffice-commits] core.git: vcl/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Nov 14 16:55:17 UTC 2018
vcl/source/control/fmtfield.cxx | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
New commits:
commit f17a9467e8dcba7fc624373aa81f5b4997665c03
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Nov 14 12:22:50 2018 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Nov 14 17:54:52 2018 +0100
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 at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
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())
More information about the Libreoffice-commits
mailing list