- fix: when open a file, all blank lines's indents are removed.

This commit is contained in:
Roy Qu 2022-01-24 15:41:23 +08:00
parent 4797c15b04
commit f21eded1ad
4 changed files with 261 additions and 225 deletions

View File

@ -18,6 +18,7 @@ Red Panda C++ Version 0.13.3
- add a new template for raylib shader apps
- fix: project files' charset settings doesn't work correctly
- enhancement: add exec charset option to compiler set settings
- fix: when open a file, all blank lines's indents are removed.
Red Panda C++ Version 0.13.2
- fix: "delete and exit" button in the environtment / folder option page doesn't work correctly

File diff suppressed because it is too large Load Diff

View File

@ -556,18 +556,25 @@ void SynEditStringList::loadFromFile(const QString& filename, const QByteArray&
}
internalClear();
while (true) {
if (line.endsWith("\r\n")) {
line.remove(line.length()-2,2);
} else if (line.endsWith("\r")) {
line.remove(line.length()-1,1);
} else if (line.endsWith("\n")){
line.remove(line.length()-1,1);
}
if (allAscii) {
allAscii = isTextAllAscii(line);
}
if (allAscii) {
addItem(trimRight(QString::fromLatin1(line)));
addItem(QString::fromLatin1(line));
} else {
QString newLine = codec->toUnicode(line.constData(),line.length(),&state);
if (state.invalidChars>0) {
needReread = true;
break;
}
addItem(trimRight(newLine));
addItem(newLine);
}
if (file.atEnd()){
break;
@ -600,7 +607,14 @@ void SynEditStringList::loadFromFile(const QString& filename, const QByteArray&
QString line;
internalClear();
while (textStream.readLineInto(&line)) {
addItem(trimRight(line));
if (line.endsWith("\r\n")) {
line.remove(line.length()-2,2);
} else if (line.endsWith("\r")) {
line.remove(line.length()-1,1);
} else if (line.endsWith("\n")){
line.remove(line.length()-1,1);
}
addItem(line);
}
emit inserted(0,mList.count());
}

View File

@ -138,7 +138,7 @@
<item>
<widget class="QCheckBox" name="chkAutoAddCharset">
<property name="text">
<string>Add Charset arguments when calling the compiler</string>
<string>Convert Executable's Charset</string>
</property>
</widget>
</item>