fix #297 : Filename that contains '&' doesn't correctly displayed in the editor tab.

This commit is contained in:
Roy Qu 2024-03-21 20:00:34 +08:00
parent 5b328f1e1a
commit 1ae60fa7ed
2 changed files with 7 additions and 5 deletions

View File

@ -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.

View File

@ -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);
}