Mercurial > hg > octave-nkf
changeset 17825:53f433bae63b
display (possibly truncated) values of strings in workspace view
* ov-str-mat.h, ov-str-mat.cc (octave_char_matrix_str::short_disp):
New function.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 01 Nov 2013 14:45:35 -0400 |
parents | 86e8dbccf7c7 |
children | 574ab045f70c |
files | libinterp/octave-value/ov-str-mat.cc libinterp/octave-value/ov-str-mat.h |
diffstat | 2 files changed, 21 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/octave-value/ov-str-mat.cc +++ b/libinterp/octave-value/ov-str-mat.cc @@ -270,6 +270,25 @@ current_print_indent_level (), true); } +std::string +octave_char_matrix_str::short_disp (void) const +{ + std::string retval; + + if (matrix.ndims () == 2 && numel () > 0) + { + retval = string_value (); + + // FIXME -- should this be configurable? + + if (retval.length () > 100) + retval = retval.substr (0, 100); + } + + return retval; +} + + bool octave_char_matrix_str::save_ascii (std::ostream& os) {