[Libreoffice-commits] core.git: starmath/source
Marcos Paulo de Souza
marcos.souza.org at gmail.com
Wed Jul 24 10:53:11 PDT 2013
starmath/source/edit.cxx | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
New commits:
commit f583a199b3a0812523ed75e1d2099325edad24f7
Author: Marcos Paulo de Souza <marcos.souza.org at gmail.com>
Date: Sun Jul 21 14:34:53 2013 -0300
fdo#43090: Improvement: Just auto close when found placeholder
Another verification needs to be done, auto close when it's in the end of line.
Change-Id: I675ac6b6a0477fc9b5747860df8dff2866189433
Reviewed-on: https://gerrit.libreoffice.org/5008
Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
Tested-by: Fridrich Strba <fridrich at documentfoundation.org>
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index 45d27ce..ec9680f 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -419,6 +419,13 @@ void SmEditWindow::KeyInput(const KeyEvent& rKEvt)
{
StartCursorMove();
+ bool autoClose = false;
+ ESelection aSelection = pEditView->GetSelection();
+ OUString selected = pEditView->GetEditEngine()->GetText(aSelection);
+
+ if (selected.trim() == "<?>")
+ autoClose = true;
+
if (!pEditView)
CreateEditView();
if ( !pEditView->PostKeyEvent(rKEvt) )
@@ -466,13 +473,13 @@ void SmEditWindow::KeyInput(const KeyEvent& rKEvt)
else if (charCode == '(')
close = " )";
- // auto close the current character
- if (!close.isEmpty())
+ // auto close the current character only when needed
+ if (!close.isEmpty() && autoClose)
{
pEditView->InsertText(close);
// position it at center of brackets
- ESelection aSelection = pEditView->GetSelection();
- aSelection.nStartPos = aSelection.nEndPos = aSelection.nEndPos - 2;
+ aSelection.nStartPos += 2;
+ aSelection.nEndPos = aSelection.nStartPos;
pEditView->SetSelection(aSelection);
}
More information about the Libreoffice-commits
mailing list