- fix: cursor is wrongly positioned when insert code snippets that don't have placeholders

This commit is contained in:
Roy Qu 2022-05-25 18:41:56 +08:00
parent 1e06907db5
commit fbdd268484
2 changed files with 2 additions and 3 deletions

View File

@ -8,6 +8,7 @@ Red Panda C++ Version 1.0.9
- fix: tab icon not correct restore when hide and show a panel - fix: tab icon not correct restore when hide and show a panel
- fix: the hiding state of the tools output panel is not correctly saved - fix: the hiding state of the tools output panel is not correctly saved
- enhancement: add "toggle explorer panel" and "toggle messages panel" in "view" menu - enhancement: add "toggle explorer panel" and "toggle messages panel" in "view" menu
- fix: cursor is wrongly positioned when insert code snippets that don't have placeholders
Red Panda C++ Version 1.0.8 Red Panda C++ Version 1.0.8
- enhancement: auto complete '#undef' - enhancement: auto complete '#undef'

View File

@ -2724,10 +2724,8 @@ void Editor::insertCodeSnippet(const QString &code)
// else if EndsStr(#10, s) then // else if EndsStr(#10, s) then
// Delete(s,Length(s),1); // Delete(s,Length(s),1);
setSelText(s); setSelText(s);
setCaretXY(cursorPos); //restore cursor pos before insert
// fText.SelText := s;
// Text.CaretXY := CursorPos;
if (mUserCodeInTabStops.count()>0) { if (mUserCodeInTabStops.count()>0) {
setCaretXY(cursorPos); //restore cursor pos before insert
mTabStopBegin = caretX(); mTabStopBegin = caretX();
mTabStopEnd = caretX(); mTabStopEnd = caretX();
popUserCodeInTabStops(); popUserCodeInTabStops();