Mercurial > hg > octave-nkf
changeset 18088:c2822fb91973 stable
maint: Merge changes for release candidate.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 05 Dec 2013 10:42:05 -0500 |
parents | 49609fbc5a8e (diff) d734216aa2b1 (current diff) |
children | 518f4138bcd0 |
files | |
diffstat | 5 files changed, 20 insertions(+), 39 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc +++ b/libgui/src/m-editor/file-editor-tab.cc @@ -1158,31 +1158,12 @@ } void -file_editor_tab::message_duplicate_file_name (const QString& saveFileName) -{ - // Could overwrite the file here (and tell user the file was - // overwritten), but the user could have unintentionally - // selected the same name not intending to overwrite. - - // Create a NonModal message about error. - QMessageBox* msgBox - = new QMessageBox (QMessageBox::Critical, tr ("Octave Editor"), - tr ("File not saved! The selected file name\n%1\n" - "is the same as the current file name"). - arg (saveFileName), - QMessageBox::Ok, 0); - - show_dialog (msgBox); -} - -void file_editor_tab::handle_save_file_as_answer (const QString& saveFileName) { if (saveFileName == _file_name) { - message_duplicate_file_name (saveFileName); - // Nothing done, allow editing again. - _edit_area->setReadOnly (false); + // same name as actual file, save it as "save" would do + save_file (saveFileName); } else { @@ -1194,17 +1175,11 @@ void file_editor_tab::handle_save_file_as_answer_close (const QString& saveFileName) { - if (saveFileName == _file_name) - { - message_duplicate_file_name (saveFileName); - // Nothing done, allow editing again. - _edit_area->setReadOnly (false); - } - else - { - // Have editor check for conflict, delete tab after save. - emit editor_check_conflict_save (saveFileName, true); - } + // saveFileName == _file_name can not happen, because we only can get here + // when we close a tab and _file_name is not a valid file name yet + + // Have editor check for conflict, delete tab after save. + emit editor_check_conflict_save (saveFileName, true); } void
--- a/libgui/src/m-editor/file-editor-tab.h +++ b/libgui/src/m-editor/file-editor-tab.h @@ -179,7 +179,6 @@ bool valid_file_name (const QString& file=QString ()); void save_file (const QString& saveFileName, bool remove_on_success = false); void save_file_as (bool remove_on_success = false); - void message_duplicate_file_name (const QString& fileName); void update_lexer (); void request_add_breakpoint (int line);
--- a/scripts/set/setxor.m +++ b/scripts/set/setxor.m @@ -61,7 +61,7 @@ na = rows (a); nb = rows (b); [c, i] = sortrows ([a; b]); n = rows (c); - idx = find (all (c(1:n-1) == c(2:n), 2)); + idx = find (all (c(1:n-1, :) == c(2:n, :), 2)); if (! isempty (idx)) c([idx, idx+1],:) = []; i([idx, idx+1],:) = []; @@ -94,9 +94,16 @@ %!assert (setxor ([1,2,3],[2,3,4]),[1,4]) %!assert (setxor ({'a'}, {'a', 'b'}), {'b'}) + %!test %! a = [3, 1, 4, 1, 5]; b = [1, 2, 3, 4]; -%! [y, ia, ib] = setxor (a, b.'); -%! assert (y, [2, 5]); -%! assert (y, sort ([a(ia), b(ib)])); +%! [c, ia, ib] = setxor (a, b.'); +%! assert (c, [2, 5]); +%! assert (c, sort ([a(ia), b(ib)])); +%!test +%! a = [1 2; 4 5; 1 3]; b = [1 1; 1 2; 4 5; 2 10]; +%! [c, ia, ib] = setxor (a, b, "rows"); +%! assert (c, [1 1; 1 3; 2 10]); +%! assert (c, sortrows ([a(ia,:); b(ib,:)])); +
--- a/scripts/testfun/runtests.m +++ b/scripts/testfun/runtests.m @@ -127,7 +127,7 @@ if (fid >= 0) str = fread (fid, "*char").'; fclose (fid); - retval = ! isempty (regexp (str, '^%!(?:test|assert|error|warning)', + retval = ! isempty (regexp (str, '^%!(?:test|xtest|assert|error|warning)', 'lineanchors', 'once')); else error ("runtests: fopen failed: %s", f);