Mercurial > hg > octave-lojdl
changeset 15853:e77cd781eeef
correctly displaying ranges and strings in the workspace view
* symbol-information.cc: use inc and limit for displaying a range and
correctly detect and display larger strings
author | Torsten <ttl@justmail.de> |
---|---|
date | Thu, 27 Dec 2012 15:01:22 +0100 |
parents | cd115ec92248 |
children | 98f6abe01b5a |
files | libgui/src/symbol-information.cc |
diffstat | 1 files changed, 20 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/symbol-information.cc +++ b/libgui/src/symbol-information.cc @@ -51,6 +51,7 @@ // for performance reasons. QString short_value_string; bool use_short_value_string = false; + if (ov.is_range ()) { use_short_value_string = true; @@ -58,8 +59,8 @@ Range r = ov.range_value (); double base = r.base (); - double increment = r.base (); - double limit = r.base (); + double increment = r.inc (); + double limit = r.limit (); std::stringstream buffer; @@ -72,16 +73,24 @@ } else if (ov.is_matrix_type () || ov.is_cell ()) { - if (ov.numel () > 10) - use_short_value_string = true; - } - else if (ov.is_string ()) - { - if (ov.string_value ().length () > 40) + if (ov.is_string ()) // a string? { - use_short_value_string = true; - short_value_string - = QString::fromStdString (ov.string_value ().substr (0, 40)); + if (ov.string_value ().length () > 30) + { + use_short_value_string = true; + short_value_string = QString ("\"") + + QString::fromStdString (ov.string_value ().substr (0, 30)) + + QString (" ... \""); + } + } + else // arrays and cell arrays + { + if (ov.numel () > 10) + { + use_short_value_string = true; + short_value_string = QString("..."); + // TODO: what kind of short version can be printed for arrays? + } } }