diff gui/src/m-editor/file-editor-tab.cc @ 14873:355d6c165df0 gui

Added syntax highlighting support for .sh/.bat/.pl and .diff-files. * file-editor-tab: Added lexer objects for various file suffixes.
author Jacob Dawid <jacob.dawid@gmail.com>
date Wed, 18 Jul 2012 05:45:40 -0400
parents db3c84d38345
children 5d74d8b982a5
line wrap: on
line diff
--- a/gui/src/m-editor/file-editor-tab.cc	Tue Jul 17 11:38:54 2012 -0400
+++ b/gui/src/m-editor/file-editor-tab.cc	Wed Jul 18 05:45:40 2012 -0400
@@ -19,6 +19,17 @@
 #include "file-editor.h"
 #include "octave-link.h"
 
+
+#include <Qsci/qsciapis.h>
+// Not available in the Debian repos yet!
+// #include <Qsci/qscilexeroctave.h>
+#include "lexer-octave-gui.h"
+#include <Qsci/qscilexercpp.h>
+#include <Qsci/qscilexerbash.h>
+#include <Qsci/qscilexerperl.h>
+#include <Qsci/qscilexerbatch.h>
+#include <Qsci/qscilexerdiff.h>
+
 #include "resource-manager.h"
 #include <QMessageBox>
 #include <QVBoxLayout>
@@ -236,6 +247,22 @@
     {
       lexer = new QsciLexerCPP ();
     }
+  else if (_file_name.endsWith (".sh"))
+    {
+      lexer = new QsciLexerBash ();
+    }
+  else if (_file_name.endsWith (".pl"))
+    {
+      lexer = new QsciLexerPerl ();
+    }
+  else if (_file_name.endsWith (".bat"))
+    {
+      lexer = new QsciLexerBatch ();
+    }
+  else if (_file_name.endsWith (".diff"))
+    {
+      lexer = new QsciLexerDiff ();
+    }
 
   QSettings *settings = resource_manager::instance ()->get_settings ();