From fbdd2684849f69aeb0201ec41d2188438f2400ef Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Wed, 25 May 2022 18:41:56 +0800 Subject: [PATCH] - fix: cursor is wrongly positioned when insert code snippets that don't have placeholders --- NEWS.md | 1 + RedPandaIDE/editor.cpp | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) 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();