octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #53421] Excessive newlines displayed for deep


From: Sahil Yadav
Subject: [Octave-bug-tracker] [bug #53421] Excessive newlines displayed for deep structs
Date: Sun, 25 Mar 2018 06:46:12 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36

Follow-up Comment #5, bug #53421 (project octave):

>From what I gather, the solution lies in this condition
<https://hg.savannah.gnu.org/hgweb/octave/file/bccb203494f6/libinterp/octave-value/ov-base.cc#l441>.

  if (print_padding && pad_after && ! Vcompact_format)
    newline (output_buf);


*print_padding* is always true as can be seen here
<https://hg.savannah.gnu.org/hgweb/octave/file/bccb203494f6/libinterp/octave-value/ov.h#l1273>.
Maybe if we can introduce one more condition in the above if
Vstruct_levels_to_print <= 2 
 or put some condition which will regulate when to make print_padding as
false? When Vstruct_levels_to_print <= 2 evaluates to true, print a newline
else do not. And it looks kinda ugly if we completely remove the if condition
at all as can be seen in below examples:


The padded lines are not there at the end

octave:1> struct_levels_to_print(10)
octave:2> s.s.s.s.s.A = 1:10
s =

  scalar structure containing the fields:

    s =

      scalar structure containing the fields:

        s =

          scalar structure containing the fields:

            s =

              scalar structure containing the fields:

                s =

                  scalar structure containing the fields:

                    A =

                        1    2    3    4    5    6    7    8    9   10

octave:3>


Padding should be there in the below two cases, which can be accompanied if we
introduce a new condition about the levels of struct to print.

octave:14> a.A = 10;
octave:15> a.B = 10;
octave:16> a.C = 10;
octave:17> a.D = 1:10;
octave:18> a.E = 10;
octave:19> a
a =

  scalar structure containing the fields:

    A =  10
    B =  10
    C =  10
    D =

        1    2    3    4    5    6    7    8    9   10
    E =  10

octave:20>



octave:25> a.A = 10;
octave:26> a.B = 10;
octave:27> a.C = 10;
octave:28> a.D = 1:10;
octave:29> a.E = 1:10;
octave:30> a.F = 1:10;
octave:31> a
a =

  scalar structure containing the fields:

    A =  10
    B =  10
    C =  10
    D =

        1    2    3    4    5    6    7    8    9   10
    E =

        1    2    3    4    5    6    7    8    9   10
    F =

        1    2    3    4    5    6    7    8    9   10

octave:32>


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?53421>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]