# HG changeset patch # User Rik # Date 1440078174 25200 # Node ID 642ce72cf1abfaead53c61e999ed383aad4c4f4e # Parent 951019b7afd4bc6309d2d2c21eafc58e32a706a4# Parent 7e9c752138ec1a3d07ff17d4d31cee957acc7ed2 maint: Periodic merge of stable to default. diff -r 951019b7afd4 -r 642ce72cf1ab libgui/src/m-editor/find-dialog.cc --- a/libgui/src/m-editor/find-dialog.cc Wed Aug 19 16:18:45 2015 -0400 +++ b/libgui/src/m-editor/find-dialog.cc Thu Aug 20 06:42:54 2015 -0700 @@ -237,6 +237,10 @@ if (lbeg == lend) _search_line_edit->setText (_edit_area->selectedText ()); } + + // set focus to "Find what" and select all text + _search_line_edit->setFocus(); + _search_line_edit->selectAll(); } void diff -r 951019b7afd4 -r 642ce72cf1ab libinterp/corefcn/file-io.cc --- a/libinterp/corefcn/file-io.cc Wed Aug 19 16:18:45 2015 -0400 +++ b/libinterp/corefcn/file-io.cc Thu Aug 20 06:42:54 2015 -0700 @@ -1608,7 +1608,12 @@ IEEE little endian.\n\ @end table\n\ \n\ +If no @var{arch} is given the value used in the call to @code{fopen} which\n\ +created the file descriptor is used. Otherwise, the value specified with\n\ +@code{fread} overrides that of @code{fopen} and determines the data format.\n\ +\n\ The output argument @var{val} contains the data read from the file.\n\ +\n\ The optional return value @var{count} contains the number of elements read.\n\ @seealso{fwrite, fgets, fgetl, fscanf, fopen}\n\ @end deftypefn") diff -r 951019b7afd4 -r 642ce72cf1ab liboctave/array/Range.cc --- a/liboctave/array/Range.cc Wed Aug 19 16:18:45 2015 -0400 +++ b/liboctave/array/Range.cc Thu Aug 20 06:42:54 2015 -0700 @@ -244,7 +244,7 @@ } else if (! ascending && rng_base < rng_limit && rng_inc > 0.0) { - double tmp = rng_limit; + double tmp = max (); rng_limit = min (); rng_base = tmp; rng_inc = -rng_inc; @@ -274,7 +274,7 @@ } else if (! ascending && rng_base < rng_limit && rng_inc > 0.0) { - double tmp = rng_limit; + double tmp = max (); rng_limit = min (); rng_base = tmp; rng_inc = -rng_inc; diff -r 951019b7afd4 -r 642ce72cf1ab scripts/io/strread.m --- a/scripts/io/strread.m Wed Aug 19 16:18:45 2015 -0400 +++ b/scripts/io/strread.m Thu Aug 20 06:42:54 2015 -0700 @@ -1,5 +1,5 @@ ## Copyright (C) 2009-2015 Eric Chassande-Mottin, CNRS (France) -## Parts Copyright (C) 2012 Philip Nienhuis +## Parts Copyright (C) 2012-2015 Philip Nienhuis ## ## This file is part of Octave. ## @@ -123,9 +123,13 @@ ## ## @item @qcode{"delimiter"} ## Any character in @var{value} will be used to split @var{str} into words -## (default value = any whitespace). +## (default value = any whitespace). Note that whitespace is implicitly added +## to the set of delimiter characters unless a @qcode{"%s"} format conversion +## specifier is supplied; see @qcode{"whitespace"} parameter below. The set +## of delimiter characters cannot be empty; if needed Octave substitutes a +## space as delimiter. ## -## @item @qcode{"emptyvalue"}: +## @item @qcode{"emptyvalue"} ## Value to return for empty numeric values in non-whitespace delimited data. ## The default is NaN@. When the data type does not support NaN (int32 for ## example), then default is zero. @@ -146,15 +150,21 @@ ## @item @qcode{"whitespace"} ## Any character in @var{value} will be interpreted as whitespace and trimmed; ## the string defining whitespace must be enclosed in double quotes for proper -## processing of special characters like @qcode{"@xbackslashchar{}t"}. The -## default value for whitespace is +## processing of special characters like @qcode{"@xbackslashchar{}t"}. In +## each data field, multiple consecutive whitespace characters are collapsed +## into one space and leading and trailing whitespace is removed. The default +## value for whitespace is ## @c Note: the next line specifically has a newline which generates a space ## @c in the output of qcode, but keeps the next line < 80 characters. ## @qcode{" ## @xbackslashchar{}b@xbackslashchar{}r@xbackslashchar{}n@xbackslashchar{}t"} -## (note the space). Unless whitespace is set to @qcode{""} (empty) AND at -## least one @qcode{"%s"} format conversion specifier is supplied, a space is -## always part of whitespace. +## (note the space). Whitespace is always added to the set of delimiter +## characters unless at least one @qcode{"%s"} format conversion specifier is +## supplied; in that case only whitespace explicitly specified in +## @qcode{"delimiter"} is retained as delimiter and removed from the set of +## whitespace characters. If whitespace characters are to be kept as-is (in +## e.g., strings), specify an empty value (i.e., @qcode{""}) for +## @qcode{"whitespace"}; obviously, whitespace cannot be a delimiter then. ## ## @end table ## @@ -388,7 +398,7 @@ if (! isempty (white_spaces)) ## For numeric fields, whitespace is always a delimiter, but not for text ## fields - if (isempty (strfind (format, "%s"))) + if (isempty (regexp (format, '%\*?\d*s'))) ## Add whitespace to delimiter set delimiter_str = unique ([white_spaces delimiter_str]); else @@ -1086,3 +1096,9 @@ ## Test for false positives in check for non-supported format specifiers %!test %! assert (strread ("Total: 32.5 % (of cm values)","Total: %f % (of cm values)"), 32.5, 1e-5); + +## Test various forms of string format specifiers (bug #45712) +%!test +%! str = "14 :1 z:2 z:3 z:5 z:11"; +%! [a, b, c, d] = strread (str, "%f %s %*s %3s %*3s %f", "delimiter", ":"); +%! assert ({a, b, c, d}, {14, {"1 z"}, {"3 z"}, 11});