- fix: "UTF-8 BOM" can't be correctly loaded as project file's encoding.
- fix: Project file's encoding is not correctly updated after converted manually.
This commit is contained in:
parent
b80cfe71f8
commit
9be257e8e8
2
NEWS.md
2
NEWS.md
|
@ -5,6 +5,8 @@ Red Panda C++ Version 2.24
|
|||
- fix: Code completion doesn't work if "min id length to show completion" is not 1.
|
||||
- fix: english typos. (thanks for sangiye0@github)
|
||||
- fix: Goto definition/declaration may choose wrong symbol is multiple files are opened and symbols have the same name.
|
||||
- fix: "UTF-8 BOM" can't be correctly loaded as project file's encoding.
|
||||
- fix: Project file's encoding is not correctly updated after converted manually.
|
||||
|
||||
Red Panda C++ Version 2.23
|
||||
|
||||
|
|
|
@ -337,6 +337,13 @@ void Editor::convertToEncoding(const QByteArray &encoding)
|
|||
mEncodingOption = encoding;
|
||||
setModified(true);
|
||||
save();
|
||||
if (mProject) {
|
||||
PProjectUnit unit = mProject->findUnit(this);
|
||||
if (unit) {
|
||||
unit->setEncoding(mEncodingOption);
|
||||
unit->setRealEncoding(mFileEncoding);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Editor::save(bool force, bool doReparse) {
|
||||
|
|
|
@ -242,7 +242,10 @@ void Project::open()
|
|||
newUnit->setOverrideBuildCmd(ini.GetBoolValue(groupName,"OverrideBuildCmd", false));
|
||||
newUnit->setBuildCmd(fromByteArray(ini.GetValue(groupName,"BuildCmd", "")));
|
||||
newUnit->setEncoding(ini.GetValue(groupName, "FileEncoding",ENCODING_PROJECT));
|
||||
if (QTextCodec::codecForName(newUnit->encoding())==nullptr) {
|
||||
if (newUnit->encoding()!=ENCODING_UTF16_BOM &&
|
||||
newUnit->encoding()!=ENCODING_UTF8_BOM &&
|
||||
newUnit->encoding()!=ENCODING_UTF32_BOM &&
|
||||
QTextCodec::codecForName(newUnit->encoding())==nullptr) {
|
||||
newUnit->setEncoding(ENCODING_PROJECT);
|
||||
}
|
||||
newUnit->setRealEncoding(ini.GetValue(groupName, "RealEncoding",ENCODING_ASCII));
|
||||
|
|
Loading…
Reference in New Issue