diff libgui/src/m-editor/octave-txt-lexer.cc @ 19348:c364b9a44580 gui-release

provide an editor lexer for text or unknown files (bug #43572) * default-qt-settings.in: fix color for numbers in bash files, add defaults for the new text lexer * file-editor-tab.cc (update_lexer): only select the bash lexer for .sh-files, select the new text lexer for .m-files or unnamed files if octave and matlab lexer is not available as well as for files with no or unknown extension * octave-txt-lexer.h: new lexer class derived from QsciLexer just providing the default style for text or unknown files * octave-txt-lexer.cc (language, description): implemented functions * module.mk: added new files octave-txt-lexer.cc/.h * settings-dialog.cc (constructor): read the settings for the new text lexer; (write-changed-settings): write settings for the new lexer into the files
author Torsten <ttl@justmail.de>
date Sun, 23 Nov 2014 13:13:35 +0100
parents
children 4197fc428c7d
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgui/src/m-editor/octave-txt-lexer.cc	Sun Nov 23 13:13:35 2014 +0100
@@ -0,0 +1,52 @@
+/*
+
+Copyright (C) 2014 Torsten
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+Octave is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+// Author: Torsten <ttl@justmail.de>
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_QSCINTILLA
+
+#include <Qsci/qscilexer.h>
+
+#include "octave-txt-lexer.h"
+
+QString
+octave_txt_lexer::description (int style) const
+{
+  if (style == 0)
+    return tr ("Default");
+  else
+    return QString ();
+};
+
+
+const char*
+octave_txt_lexer::language () const
+{
+  return "Text";
+}
+
+
+#endif