# HG changeset patch # User Torsten # Date 1370200427 -7200 # Node ID 973fd2367d442503551c938176344adcd3603a73 # Parent 0f6f14e3ac6a76bb6a6d99c1d59e93b9b3728a02 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 diff --git a/libgui/src/m-editor/file-editor-tab.cc b/libgui/src/m-editor/file-editor-tab.cc --- 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