diff --git a/NEWS.md b/NEWS.md index 125c375a..1feefba6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -8,6 +8,7 @@ Red Panda C++ Version 1.0.9 - 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 - 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 - enhancement: auto complete '#undef' diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 88feb87f..532a2de2 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -2724,10 +2724,8 @@ void Editor::insertCodeSnippet(const QString &code) // else if EndsStr(#10, s) then // Delete(s,Length(s),1); setSelText(s); - setCaretXY(cursorPos); //restore cursor pos before insert -// fText.SelText := s; -// Text.CaretXY := CursorPos; if (mUserCodeInTabStops.count()>0) { + setCaretXY(cursorPos); //restore cursor pos before insert mTabStopBegin = caretX(); mTabStopEnd = caretX(); popUserCodeInTabStops();