From 6cbab4a6465c2dd7bd4c91db963127a803773db5 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Mon, 7 Feb 2022 09:53:02 +0800 Subject: [PATCH] - fix: typo error in the parser - fix: typing after symbols like 'std::string' shouldn't show code completion suggestions --- NEWS.md | 2 ++ RedPandaIDE/editor.cpp | 2 +- RedPandaIDE/parser/cppparser.cpp | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 15812dbc..f727d225 100644 --- a/NEWS.md +++ b/NEWS.md @@ -15,6 +15,8 @@ Red Panda C++ Version 0.14.1 - fix: actions not correctly disabled when compile - fix: can't differentiate disabled and enabled buttons, when using contrast icon set - fix: when running problem cases, the output textbox might be wrongly cleared. + - fix: typo error in the parser + - fix: typing after symbols like 'std::string' shouldn't show code completion suggestions Red Panda C++ Version 0.14.0 - enhancement: custom icon set ( in the configuration folder) diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 74934e2a..638614bd 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -3933,7 +3933,7 @@ QString Editor::getPreviousWordAtPositionForSuggestion(const BufferCoord &p) return ""; wordBegin = wordEnd; - while ((wordBegin >= 0) && isIdentChar(s[wordBegin])) { + while ((wordBegin >= 0) && (isIdentChar(s[wordBegin]) || s[wordBegin]==':') ) { wordBegin--; } wordBegin++; diff --git a/RedPandaIDE/parser/cppparser.cpp b/RedPandaIDE/parser/cppparser.cpp index 6f7a7042..3199cf12 100644 --- a/RedPandaIDE/parser/cppparser.cpp +++ b/RedPandaIDE/parser/cppparser.cpp @@ -1549,7 +1549,7 @@ bool CppParser::checkForStructs() int keyLen = calcKeyLenForStruct(word); if (keyLen<0) return false; - bool result = (word.length() == keyLen) || isSpaceChar(word[keyLen] == ' ') + bool result = (word.length() == keyLen) || isSpaceChar(word[keyLen]) || (word[keyLen] == '['); if (result) {