summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;