[Libreoffice-commits] core.git: starmath/source
Marcos Paulo de Souza
marcos.souza.org at gmail.com
Tue Sep 3 05:32:46 PDT 2013
starmath/source/edit.cxx | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
New commits:
commit 9e9693b91acb747cf53f819099a78f7ed4de9f40
Author: Marcos Paulo de Souza <marcos.souza.org at gmail.com>
Date: Tue Sep 3 09:09:19 2013 -0300
fdo#68877: Select "<?>" as Elements window do
Elements Dock needs to have the same behavior of Elements window. After insert some symbol, if
this symbol have some placeholder, select the first placehold to user put some data.
This increases usability of Elements Dock.
Change-Id: Idc57cc6817d94f698632eb938600a55c8f9afbd8
Reviewed-on: https://gerrit.libreoffice.org/5780
Reviewed-by: Thomas Arnhold <thomas at arnhold.org>
Tested-by: Thomas Arnhold <thomas at arnhold.org>
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index 5ccdd75..ce3dd4b 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -1025,11 +1025,31 @@ void SmEditWindow::InsertText(const OUString& rText)
nEndIndex += aSelection.nEndPos;
+ // TODO: unify this function with the InsertCommand: The do the same thing for different
+ // callers
+ OUString string(rText);
+
// put a space before a new command if not in the beginning of a line
if (aSelection.nStartPos > 0 && aCurrentFormula[nStartIndex - 1] != ' ')
- pEditView->InsertText(" " + rText);
+ string = " " + string;
+
+ pEditView->InsertText(string);
+
+ // Remember start of the selection and move the cursor there afterwards.
+ aSelection.nEndPara = aSelection.nStartPara;
+ if (HasMark(string))
+ {
+ aSelection.nEndPos = aSelection.nStartPos;
+ pEditView->SetSelection(aSelection);
+ SelNextMark();
+ }
else
- pEditView->InsertText(rText);
+ { // set selection after inserted text
+ aSelection.nEndPos = aSelection.nStartPos + string.getLength();
+ aSelection.nStartPos = aSelection.nEndPos;
+ pEditView->SetSelection(aSelection);
+ }
+
aModifyTimer.Start();
StartCursorMove();
GrabFocus();
More information about the Libreoffice-commits
mailing list