From 11bceaf972d98f6283016296853724a98ea80693 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Mon, 29 May 2023 10:52:17 +0800 Subject: [PATCH] - enhancement: support function arguments like "int (&t)[]" - change: Don't show error dialog when bookmark/debug configuration json files are empty. --- NEWS.md | 5 +++-- RedPandaIDE/debugger.cpp | 8 +++++--- RedPandaIDE/widgets/bookmarkmodel.cpp | 4 +++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/NEWS.md b/NEWS.md index 757d55bb..59b553d7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -7,8 +7,9 @@ Red Panda C++ Version 2.22 - fix: lambda expression is not correctly handled. - fix: '__extension__' should be ignored when parsing C/C++ codes. - enhancement: show completion for return type of lambda expressions. - - upgrade raylib to 4.5, raygui to 3.6 - + - enhancement: support function arguments like "int (&t)[]" + - change: Don't show error dialog when bookmark/debug configuration json files are empty. + - upgrade raylib to 4.5, raygui to 3.6 Red Panda C++ Version 2.21 diff --git a/RedPandaIDE/debugger.cpp b/RedPandaIDE/debugger.cpp index 938d8be8..c75493bd 100644 --- a/RedPandaIDE/debugger.cpp +++ b/RedPandaIDE/debugger.cpp @@ -809,10 +809,12 @@ PDebugConfig Debugger::load(const QString &filename, bool forProject) if (!file.exists()) return pConfig; if (file.open(QFile::ReadOnly)) { - QByteArray content = file.readAll(); - QJsonParseError error; + QByteArray content = file.readAll().trimmed(); + if (content.isEmpty()) + return pConfig; + QJsonParseError error; QJsonDocument doc(QJsonDocument::fromJson(content,&error)); - if (error.error != QJsonParseError::NoError) { + if (error.error == QJsonParseError::NoError) { throw FileError(tr("Error in json file '%1':%2 : %3") .arg(filename) .arg(error.offset) diff --git a/RedPandaIDE/widgets/bookmarkmodel.cpp b/RedPandaIDE/widgets/bookmarkmodel.cpp index 84cefb6e..3716b429 100644 --- a/RedPandaIDE/widgets/bookmarkmodel.cpp +++ b/RedPandaIDE/widgets/bookmarkmodel.cpp @@ -307,7 +307,9 @@ QList BookmarkModel::load(const QString& filename, qint64 criteriaTim if (!file.exists()) return bookmarks; if (file.open(QFile::ReadOnly)) { - QByteArray content = file.readAll(); + QByteArray content = file.readAll().trimmed(); + if (content.isEmpty()) + return bookmarks; QJsonParseError error; QJsonDocument doc(QJsonDocument::fromJson(content,&error)); if (error.error != QJsonParseError::NoError) {