Mercurial > hg > octave-shane
changeset 16720:973fd2367d44
select octave lexer for unnamed files and bash lexer for files without extension
* file-editor-tab.cc(update_lexer): differentiate between unnamed files (octave
lexer) and files without or with unknown extension (bash lexer),
(notice_settings): unconditionally call update_lexer for noticing style
changes for unnamed files; do not update the title of the tab
author | Torsten <ttl@justmail.de> |
---|---|
date | Sun, 02 Jun 2013 21:13:47 +0200 |
parents | 0f6f14e3ac6a |
children | a71a784c7611 |
files | libgui/src/m-editor/file-editor-tab.cc |
diffstat | 1 files changed, 8 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc +++ b/libgui/src/m-editor/file-editor-tab.cc @@ -252,8 +252,9 @@ { lexer = new QsciLexerDiff (); } - else - { + else if (_file_name.isEmpty () + || _file_name.at (_file_name.count () - 1) == '/') + { // new, no yet named file: let us assume it is octave #if defined (HAVE_LEXER_OCTAVE) lexer = new QsciLexerOctave (); #elif defined (HAVE_LEXER_MATLAB) @@ -262,6 +263,10 @@ lexer = new QsciLexerBash (); #endif } + else + { // other or no extension + lexer = new QsciLexerBash (); + } } _lexer_apis = new QsciAPIs(lexer); @@ -1140,8 +1145,7 @@ { // QSettings pointer is checked before emitting. - if (!_file_name.isEmpty ()) - update_lexer (); // do not update lexer when tab is just created + update_lexer (); //highlight current line color QVariant default_var = QColor (240, 240, 240); @@ -1214,7 +1218,6 @@ _long_title = settings->value ("editor/longWindowTitle", false).toBool (); - update_window_title (false); } void