From 1ae60fa7ed07c69dd00a0459eed80ffc43d0dc4e Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Thu, 21 Mar 2024 20:00:34 +0800 Subject: [PATCH] fix #297 : Filename that contains '&' doesn't correctly displayed in the editor tab. --- NEWS.md | 1 + RedPandaIDE/editor.cpp | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/NEWS.md b/NEWS.md index 411449c8..634bfb64 100644 --- a/NEWS.md +++ b/NEWS.md @@ -71,6 +71,7 @@ Red Panda C++ Version 2.27 - fix: Can't correctly retrieve function parameters type. - fix: Auto type induction for expression contains '[]' are not correct. - fix: Option 'Pause after run in console' for tools doesn't work. + - fix: Filename that contains '&' doesn't correctly displayed in the editor tab. Red Panda C++ Version 2.26 - enhancement: Code suggestion for embedded std::vectors. diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index ee8b6a4a..72db5772 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -5467,17 +5467,18 @@ void Editor::updateCaption(const QString& newCaption) { int index = mParentPageControl->indexOf(this); if (index==-1) return; + QString caption; if (newCaption.isEmpty()) { - QString caption = QFileInfo(mFilename).fileName(); + caption = QFileInfo(mFilename).fileName(); if (this->modified()) { caption.append("[*]"); } if (this->readOnly()) { caption.append("["+tr("Readonly")+"]"); - } - mParentPageControl->setTabText(index,caption); + } } else { - mParentPageControl->setTabText(index,newCaption); + caption = newCaption; } - + caption = caption.replace("&","&&"); + mParentPageControl->setTabText(index,caption); }