# HG changeset patch # User John W. Eaton # Date 1414519081 14400 # Node ID 86f50893acd8a62f7c55797251dfba8e6844f6f2 # Parent e1713e281ac540f4cee71be966a59e2decb795d0# Parent 0e077a29854f2986dfbdcf39aba563e3970069c7 maint: Periodic merge of gui-release to default. diff -r e1713e281ac5 -r 86f50893acd8 libgui/src/m-editor/file-editor-tab.cc --- a/libgui/src/m-editor/file-editor-tab.cc Tue Oct 07 21:11:17 2014 +0200 +++ b/libgui/src/m-editor/file-editor-tab.cc Tue Oct 28 13:58:01 2014 -0400 @@ -1577,10 +1577,22 @@ // and add the extra grid layout to the dialog's layout dialog_layout->addLayout (extra,rows,0,1,dialog_layout->columnCount ()); + // add the possible filters and the default suffix + QStringList filters; + filters << tr ("Octave Files (*.m)") + << tr ("All Files (*)"); + fileDialog->setNameFilters (filters); + fileDialog->setDefaultSuffix ("m"); if (valid_file_name ()) { fileDialog->selectFile (_file_name); + QFileInfo file_info (_file_name); + if (file_info.suffix () != "m") + { // it is not an octave file + fileDialog->selectNameFilter (filters.at (1)); // "All Files" + fileDialog->setDefaultSuffix (""); // no default suffix + } } else { @@ -1601,11 +1613,12 @@ fileDialog->selectFile (fname + ".m"); } - fileDialog->setNameFilter (tr ("Octave Files (*.m);;All Files (*)")); - fileDialog->setDefaultSuffix ("m"); fileDialog->setAcceptMode (QFileDialog::AcceptSave); fileDialog->setViewMode (QFileDialog::Detail); + connect (fileDialog, SIGNAL (filterSelected (const QString&)), + this, SLOT (handle_save_as_filter_selected (const QString&))); + if (remove_on_success) { connect (fileDialog, SIGNAL (fileSelected (const QString&)), @@ -1629,6 +1642,20 @@ _save_as_desired_eol = static_cast (index); } +void +file_editor_tab::handle_save_as_filter_selected (const QString& filter) +{ + QFileDialog *file_dialog = qobject_cast (sender ()); + + QRegExp rx ("\\*\\.([^ ^\\)]*)[ \\)]"); // regexp for suffix in filter + int index = rx.indexIn (filter,0); // get first suffix in filter + + if (index > -1) + file_dialog->setDefaultSuffix (rx.cap (1)); // found a suffix, set default + else + file_dialog->setDefaultSuffix (""); // not found, clear default +} + bool file_editor_tab::check_valid_identifier (QString file_name) { diff -r e1713e281ac5 -r 86f50893acd8 libgui/src/m-editor/file-editor-tab.h --- a/libgui/src/m-editor/file-editor-tab.h Tue Oct 07 21:11:17 2014 +0200 +++ b/libgui/src/m-editor/file-editor-tab.h Tue Oct 28 13:58:01 2014 -0400 @@ -162,6 +162,7 @@ void handle_save_file_as_answer (const QString& fileName); void handle_save_file_as_answer_close (const QString& fileName); void handle_save_file_as_answer_cancel (); + void handle_save_as_filter_selected (const QString& filter); void handle_combo_eol_current_index (int index); // When apis preparation has finished and is ready to save diff -r e1713e281ac5 -r 86f50893acd8 libinterp/parse-tree/lex.ll --- a/libinterp/parse-tree/lex.ll Tue Oct 07 21:11:17 2014 +0200 +++ b/libinterp/parse-tree/lex.ll Tue Oct 28 13:58:01 2014 -0400 @@ -169,7 +169,8 @@ { \ curr_lexer->lexer_debug (PATTERN); \ \ - if (curr_lexer->previous_token_may_be_command ()) \ + if (curr_lexer->previous_token_may_be_command () \ + && curr_lexer->space_follows_previous_token ()) \ { \ yyless (0); \ curr_lexer->push_start_state (COMMAND_START); \ diff -r e1713e281ac5 -r 86f50893acd8 scripts/plot/draw/private/__bar__.m --- a/scripts/plot/draw/private/__bar__.m Tue Oct 07 21:11:17 2014 +0200 +++ b/scripts/plot/draw/private/__bar__.m Tue Oct 28 13:58:01 2014 -0400 @@ -437,6 +437,8 @@ ydat = get (hlist, "ydata"); if (iscell (ydat)) y = cell2mat (ydat.'); + elseif (isvector (ydat)) + y = ydat(:); else y = ydat; endif