Mercurial > octave
changeset 22921:b28801182c08
don't display "ans" for "display (expr)" (bug #49794)
* pr-output.cc (Fdisplay): Skip displaying "ans" if called with
single argument and that argument's name tag doesn't look like a
variable name.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 17 Dec 2016 11:10:22 -0500 |
parents | c9ef5571e11a |
children | b150be19734d |
files | libinterp/corefcn/pr-output.cc |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/pr-output.cc Fri Dec 16 13:13:18 2016 -0800 +++ b/libinterp/corefcn/pr-output.cc Sat Dec 17 11:10:22 2016 -0500 @@ -3635,8 +3635,7 @@ else { string_vector names = args.name_tags (); - std::string tmp = names(0); - name = valid_identifier (tmp) ? tmp : "ans"; + name = names(0); } // Only reason we got here is that there was no overloaded display @@ -3645,7 +3644,8 @@ octave_value value = args(0); bool is_scalar = value.is_scalar_type (); - octave_stdout << name << (is_scalar ? " = " : " =\n\n"); + if (valid_identifier (name)) + octave_stdout << name << (is_scalar ? " = " : " =\n\n"); // Use feval so that dispatch will also work for disp.