Natools

Check-in [a94c289c5f]
Login
Overview
Comment:s_expressions-printers-pretty: fix cursor updates in single-line quoted string atoms
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a94c289c5f3a995ed2f73bb89b083d8820927d21
User & Date: nat on 2014-02-04 19:17:32
Other Links: manifest | tags
Context
2014-02-05
19:22
s_expressions-printers-pretty-tests: new test for newline output formats check-in: d002179746 user: nat tags: trunk
2014-02-04
19:17
s_expressions-printers-pretty: fix cursor updates in single-line quoted string atoms check-in: a94c289c5f user: nat tags: trunk
2014-02-03
21:05
s_expressions-printers-pretty: add missing width handling in Open_List and Close_List check-in: 7037b039d6 user: nat tags: trunk
Changes

Modified src/natools-s_expressions-printers-pretty.adb from [8c6b5053f5] to [e2efaff8cb].

871
872
873
874
875
876
877

878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
         declare
            Width : constant Screen_Offset
              := Single_Line_Quoted_Width (Data, Output.Param.Char_Encoding);
         begin
            if Fit_In_Line (Output, Blank_Width + Width) then
               if Output.Need_Blank then
                  Output.Stream.Write ((0 => Encodings.Space));

               end if;
               Write_Quoted (Output, Data, True);
               Output.Cursor := Output.Cursor + Blank_Width + Width;
               Output.Need_Blank := False;
               return;
            end if;

            if Indent_Width (Output) + Width <= Output.Param.Width then
               Newline (Output);
               Write_Quoted (Output, Data, True);
               Output.Cursor := Output.Cursor + Width;
               Output.Need_Blank := False;
               return;
            end if;
         end;
      end if;

      --  Fall back on a universal token encoding







>


<







<







871
872
873
874
875
876
877
878
879
880

881
882
883
884
885
886
887

888
889
890
891
892
893
894
         declare
            Width : constant Screen_Offset
              := Single_Line_Quoted_Width (Data, Output.Param.Char_Encoding);
         begin
            if Fit_In_Line (Output, Blank_Width + Width) then
               if Output.Need_Blank then
                  Output.Stream.Write ((0 => Encodings.Space));
                  Output.Cursor := Output.Cursor + 1;
               end if;
               Write_Quoted (Output, Data, True);

               Output.Need_Blank := False;
               return;
            end if;

            if Indent_Width (Output) + Width <= Output.Param.Width then
               Newline (Output);
               Write_Quoted (Output, Data, True);

               Output.Need_Blank := False;
               return;
            end if;
         end;
      end if;

      --  Fall back on a universal token encoding