- enhancement: Display ascii control chars.

This commit is contained in:
Roy Qu 2024-02-27 13:23:58 +08:00
parent 451e201881
commit bc0d55b1bb
8 changed files with 21 additions and 13 deletions

View File

@ -10,6 +10,7 @@ Red Panda C++ Version 2.27
- enhancement: Support unicode combining characters. - enhancement: Support unicode combining characters.
- enhancement: Don't force fixed-width when using non fixed-width fonts. - enhancement: Don't force fixed-width when using non fixed-width fonts.
- change: Replace non-ascii font with fallback font. - change: Replace non-ascii font with fallback font.
- enhancement: Display ascii control chars.
Red Panda C++ Version 2.26 Red Panda C++ Version 2.26
- enhancement: Code suggestion for embedded std::vectors. - enhancement: Code suggestion for embedded std::vectors.

View File

@ -555,6 +555,7 @@ else: unix:!android: target.path = $${PREFIX}/bin
!isEmpty(target.path): INSTALLS += target !isEmpty(target.path): INSTALLS += target
RESOURCES += \ RESOURCES += \
fonts.qrc \
codes.qrc \ codes.qrc \
defaultconfigs.qrc \ defaultconfigs.qrc \
icons.qrc \ icons.qrc \

5
RedPandaIDE/fonts.qrc Normal file
View File

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/fonts">
<file alias="asciicontrol.ttf">resources/fonts/asciicontrol.ttf</file>
</qresource>
</RCC>

View File

@ -46,6 +46,7 @@
#include <QSharedMemory> #include <QSharedMemory>
#include <QBuffer> #include <QBuffer>
#include <winuser.h> #include <winuser.h>
#include <QFontDatabase>
#include "widgets/cpudialog.h" #include "widgets/cpudialog.h"
#endif #endif
@ -404,6 +405,7 @@ int main(int argc, char *argv[])
e.reason(), e.reason(),
QMessageBox::Ok); QMessageBox::Ok);
} }
// qDebug()<<"Load font"<<QFontDatabase::addApplicationFont(":/fonts/asciicontrol.ttf");
MainWindow mainWindow; MainWindow mainWindow;
pMainWindow = &mainWindow; pMainWindow = &mainWindow;

Binary file not shown.

View File

@ -723,6 +723,7 @@ QStringList Settings::Editor::fontFamilies() const
result.append(mFallbackFontName2); result.append(mFallbackFontName2);
if (mUseFallbackFont3) if (mUseFallbackFont3)
result.append(mFallbackFontName3); result.append(mFallbackFontName3);
result.append("Red Panda Control");
return result; return result;
} }

View File

@ -669,8 +669,8 @@ void Document::loadFromFile(const QString& filename, const QByteArray& encoding,
} else if (line.endsWith("\n")){ } else if (line.endsWith("\n")){
line.remove(line.length()-1,1); line.remove(line.length()-1,1);
} }
if (isBinaryContent(line)) // if (isBinaryContent(line))
throw BinaryFileError(tr("'%1' is a binaray File!").arg(filename)); // throw BinaryFileError(tr("'%1' is a binaray File!").arg(filename));
if (allAscii) { if (allAscii) {
allAscii = isTextAllAscii(line); allAscii = isTextAllAscii(line);
} }

View File

@ -724,17 +724,15 @@ QStringList absolutePaths(const QString &dirPath, const QStringList &relativePat
return list; return list;
} }
// bool isBinaryContent(const QByteArray &text)
// {
bool isBinaryContent(const QByteArray &text) // for (char c:text) {
{ // if (c>=0 && c<' ' && c!='\t' && c!='\n' && c!='\r') {
for (char c:text) { // return true;
if (c>=0 && c<' ' && c!='\t' && c!='\n' && c!='\r') { // }
return true; // }
} // return false;
} // }
return false;
}
void clearQPlainTextEditFormat(QTextEdit *editor) void clearQPlainTextEditFormat(QTextEdit *editor)
{ {