Mercurial > hg > octave-nkf
changeset 16242:2a81ce01c383
Fix history() so that it shows all commands when called with no arguments.
* libinterp/interpfcn/oct-hist.cc(do_history): Correctly change input number
of history lines to display from negative value to positive value. A negative
value is reserved for "display all".
author | Rik <rik@octave.org> |
---|---|
date | Sat, 09 Mar 2013 19:43:58 -0800 |
parents | 4ef7bd2d7e8d |
children | 428da5debfe4 |
files | libinterp/interpfcn/oct-hist.cc |
diffstat | 1 files changed, 12 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/interpfcn/oct-hist.cc +++ b/libinterp/interpfcn/oct-hist.cc @@ -141,7 +141,7 @@ int nargin = args.length (); - // Number of history lines to show + // Number of history lines to show (-1 = all) int limit = -1; for (octave_idx_type i = 0; i < nargin; i++) @@ -155,6 +155,8 @@ else if (arg.is_numeric_type ()) { limit = arg.int_value (); + if (limit < 0) + limit = -limit; continue; } else @@ -210,7 +212,13 @@ int tmp; if (sscanf (option.c_str (), "%d", &tmp) == 1) - limit = tmp; + { + if (tmp > 0) + limit = tmp; + else + limit = -tmp; + } + else { if (option.length () > 0 && option[0] == '-') @@ -223,8 +231,8 @@ } } - if (limit < 0) - limit = -limit; +// if (limit < 0) +// limit = -limit; hlist = command_history::list (limit, numbered_output);