# HG changeset patch # User Torsten # Date 1356616882 -3600 # Node ID e77cd781eeef8430ed9ae617150a83c38ea64a52 # Parent cd115ec922489490b4dd0aae6088512127f14f78 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 diff -r cd115ec92248 -r e77cd781eeef libgui/src/symbol-information.cc --- a/libgui/src/symbol-information.cc Wed Dec 26 12:56:38 2012 -0800 +++ b/libgui/src/symbol-information.cc Thu Dec 27 15:01:22 2012 +0100 @@ -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? + } } }