aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui/srceditor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qtmips_gui/srceditor.cpp')
-rw-r--r--qtmips_gui/srceditor.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/qtmips_gui/srceditor.cpp b/qtmips_gui/srceditor.cpp
index e7502ac..8b0000d 100644
--- a/qtmips_gui/srceditor.cpp
+++ b/qtmips_gui/srceditor.cpp
@@ -41,6 +41,7 @@
#include "srceditor.h"
#include "highlighterasm.h"
+#include "highlighterc.h"
void SrcEditor::setup_common() {
QFont font;
@@ -76,6 +77,14 @@ void SrcEditor::setFileName(QString filename) {
QFileInfo fi(filename);
fname = filename;
tname = fi.fileName();
+ delete highlighter;
+ highlighter = nullptr;
+ if ((fi.suffix() == "c") || (fi.suffix() == "C") ||
+ (fi.suffix() == "cpp") || ((fi.suffix() == "c++"))) {
+ highlighter = new HighlighterC(document());
+ } else {
+ highlighter = new HighlighterAsm(document());
+ }
}