summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorMarcos Paulo de Souza <marcos.souza.org@gmail.com>2015-12-15 18:37:04 -0200
committerjan iversen <jani@documentfoundation.org>2015-12-24 19:34:38 +0000
commitfc47ee6fbf67781acd07549c40a75c9272572085 (patch)
tree3ef2af57a72c0af58a5c63208cfdc808705789cf /starmath
parent536fcf91de1bdbfca4c300484ebe672f9cbca0e7 (diff)
Fix tdf#32062: Math overwrites selected area when click on element
Change-Id: I42ce83d1647d054419dbf664dfbfb2bc1cd01338 Reviewed-on: https://gerrit.libreoffice.org/20729 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: jan iversen <jani@documentfoundation.org>
Diffstat (limited to 'starmath')
-rw-r--r--starmath/source/edit.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index f156ee6762b8..11f0227d7f65 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -1026,6 +1026,11 @@ void SmEditWindow::InsertText(const OUString& rText)
// callers
OUString string(rText);
+ OUString selected(pEditView->GetSelected());
+ // if we have text selected, use it in the first placeholder
+ if (!selected.isEmpty())
+ string = string.replaceFirst("<?>", selected);
+
// put a space before a new command if not in the beginning of a line
if (aSelection.nStartPos > 0 && aCurrentFormula[nStartIndex - 1] != ' ')
string = " " + string;