Kaydet (Commit) 9e9693b9 authored tarafından Marcos Paulo de Souza's avatar Marcos Paulo de Souza Kaydeden (comit) Thomas Arnhold

fdo#68877: Select "<?>" as Elements window do

Elements Dock needs to have the same behavior of Elements window. After insert some symbol, if
this symbol have some placeholder, select the first placehold to user put some data.

This increases usability of Elements Dock.

Change-Id: Idc57cc6817d94f698632eb938600a55c8f9afbd8
Reviewed-on: https://gerrit.libreoffice.org/5780Reviewed-by: 's avatarThomas Arnhold <thomas@arnhold.org>
Tested-by: 's avatarThomas Arnhold <thomas@arnhold.org>
üst 7c032aa6
...@@ -1025,11 +1025,31 @@ void SmEditWindow::InsertText(const OUString& rText) ...@@ -1025,11 +1025,31 @@ void SmEditWindow::InsertText(const OUString& rText)
nEndIndex += aSelection.nEndPos; nEndIndex += aSelection.nEndPos;
// TODO: unify this function with the InsertCommand: The do the same thing for different
// callers
OUString string(rText);
// put a space before a new command if not in the beginning of a line // put a space before a new command if not in the beginning of a line
if (aSelection.nStartPos > 0 && aCurrentFormula[nStartIndex - 1] != ' ') if (aSelection.nStartPos > 0 && aCurrentFormula[nStartIndex - 1] != ' ')
pEditView->InsertText(" " + rText); string = " " + string;
pEditView->InsertText(string);
// Remember start of the selection and move the cursor there afterwards.
aSelection.nEndPara = aSelection.nStartPara;
if (HasMark(string))
{
aSelection.nEndPos = aSelection.nStartPos;
pEditView->SetSelection(aSelection);
SelNextMark();
}
else else
pEditView->InsertText(rText); { // set selection after inserted text
aSelection.nEndPos = aSelection.nStartPos + string.getLength();
aSelection.nStartPos = aSelection.nEndPos;
pEditView->SetSelection(aSelection);
}
aModifyTimer.Start(); aModifyTimer.Start();
StartCursorMove(); StartCursorMove();
GrabFocus(); GrabFocus();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment