Mercurial > hg > octave-terminal
changeset 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 |
files | gui/src/m-editor/file-editor-tab.cc gui/src/m-editor/file-editor-tab.h |
diffstat | 2 files changed, 27 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/gui/src/m-editor/file-editor-tab.cc +++ b/gui/src/m-editor/file-editor-tab.cc @@ -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 ();
--- a/gui/src/m-editor/file-editor-tab.h +++ b/gui/src/m-editor/file-editor-tab.h @@ -22,12 +22,6 @@ #include <QWidget> #include <QCloseEvent> #include <QFileSystemWatcher> - -#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 "octave-event-observer.h" class file_editor;