changeset 23354:1a2941fb8ffd

Change display of structs to respect compact format. * ov-struct.cc (octave_struct::print_raw): Don't print newline before "struct array containing...". Rely on print_name_tag to figure out whether newline is required. Don't print newline after "struct array containing..." if format is compact. * ov-struct.cc (octave_struct::print_name_tag): Print a newline between name of variable and rest of printout if format is loose. * ov-struct.cc (octave_scalar_struct::print_raw): Don't print newline before "scalar structure containing...". Rely on print_name_tag to figure out whether newline is required. * ov-struct.cc (octave_struct::print_name_tag): Print a newline between name of variable and rest of printout if format is loose.
author Rik <rik@octave.org>
date Wed, 05 Apr 2017 16:54:21 -0700
parents 95744d6d7d3b
children 08db4e9dd149
files libinterp/octave-value/ov-struct.cc
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov-struct.cc	Wed Apr 05 17:07:58 2017 -0400
+++ b/libinterp/octave-value/ov-struct.cc	Wed Apr 05 16:54:21 2017 -0700
@@ -581,7 +581,6 @@
 
       increment_indent_level ();
 
-      newline (os);
       indent (os);
       dim_vector dv = dims ();
       os << dv.str () << " struct array containing the fields:";
@@ -597,7 +596,8 @@
 
           Cell val = map.contents (key);
 
-          newline (os);
+          if (i > 0 || ! Vcompact_format)
+            newline (os);
 
           if (print_fieldnames_only)
             {
@@ -638,6 +638,9 @@
     {
       os << name << " =";
       newline (os);
+      if (! Vcompact_format)
+        newline (os);
+
       retval = true;
     }
 
@@ -1263,9 +1266,6 @@
 
       increment_indent_level ();
 
-      if (! Vcompact_format)
-        newline (os);
-
       indent (os);
       os << "scalar structure containing the fields:";
       newline (os);
@@ -1319,6 +1319,9 @@
     {
       os << name << " =";
       newline (os);
+      if (! Vcompact_format)
+        newline (os);
+
       retval = true;
     }