From fc47ee6fbf67781acd07549c40a75c9272572085 Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Tue, 15 Dec 2015 18:37:04 -0200 Subject: Fix tdf#32062: Math overwrites selected area when click on element Change-Id: I42ce83d1647d054419dbf664dfbfb2bc1cd01338 Reviewed-on: https://gerrit.libreoffice.org/20729 Tested-by: Jenkins Reviewed-by: jan iversen --- starmath/source/edit.cxx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'starmath') 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; -- cgit