[Libreoffice-commits] core.git: starmath/source
Marcos Paulo de Souza
marcos.souza.org at gmail.com
Tue Aug 13 23:36:55 PDT 2013
starmath/source/edit.cxx | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
New commits:
commit 2ebe64ba90cf35d2744519d6b3a033375715614e
Author: Marcos Paulo de Souza <marcos.souza.org at gmail.com>
Date: Tue Aug 13 11:22:47 2013 -0300
fdo#43090: Improve auto close brackets
Now it works this way:
* Auto close in end of current line of formula
* Auto close when we have "<?>" selected
* Auto close when we're in the beginning of current line.
We're adding a space between the brakets, like this: "[ ]" and putting the
cursor in the center of these brackets.
Change-Id: I8d77bfd7c33f875e7f4070343e634c2b6c45d33c
Reviewed-on: https://gerrit.libreoffice.org/5388
Reviewed-by: Tor Lillqvist <tml at iki.fi>
Tested-by: Tor Lillqvist <tml at iki.fi>
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index 2a7cb93..0459866 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -425,6 +425,34 @@ void SmEditWindow::KeyInput(const KeyEvent& rKEvt)
if (selected.trim() == "<?>")
autoClose = true;
+ else if (selected.isEmpty() && !aSelection.HasRange())
+ {
+ selected = pEditView->GetEditEngine()->GetText(aSelection.nEndPara);
+ if (!selected.isEmpty())
+ {
+ sal_Int32 index = selected.indexOf("\n", aSelection.nEndPos);
+ if (index != -1)
+ {
+ selected = selected.copy(index, sal_Int32(aSelection.nEndPos));
+ if (selected.trim().isEmpty())
+ autoClose = true;
+ }
+ else
+ {
+ sal_Int32 length = selected.getLength();
+ if (aSelection.nEndPos == length)
+ autoClose = true;
+ else
+ {
+ selected = selected.copy(aSelection.nEndPos, length);
+ if (selected.trim().isEmpty())
+ autoClose = true;
+ }
+ }
+ }
+ else
+ autoClose = true;
+ }
if (!pEditView)
CreateEditView();
More information about the Libreoffice-commits
mailing list