Natools

Check-in [7037b039d6]
Login
Overview
Comment:s_expressions-printers-pretty: add missing width handling in Open_List and Close_List
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7037b039d6f59a811d3f2a224bc1b32506b1e3f8
User & Date: nat on 2014-02-03 21:05:08
Other Links: manifest | tags
Context
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
2014-02-02
12:58
s_expressions-printers-pretty-tests: new test for indentation mechanisms check-in: b48757a3eb user: nat tags: trunk
Changes

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

780
781
782
783
784
785
786








787
788
789
790
791
792
793
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801







+
+
+
+
+
+
+
+








   -----------------------
   -- Printer Interface --
   -----------------------

   overriding procedure Open_List (Output : in out Printer) is
   begin
      if Output.Param.Width > 0
        and then Output.Cursor > Output.Param.Width
        and then Output.Cursor > Indent_Width (Output) + 1
      then
         Newline (Output);
         Output.First := True;  --  inhibit extra space or newline
      end if;

      if not Output.First then
         if Output.Param.Newline_At (Output.Previous, Opening) then
            Newline (Output);
         elsif Output.Param.Space_At (Output.Previous, Opening) then
            Output.Stream.Write ((0 => Encodings.Space));
            Output.Cursor := Output.Cursor + 1;
         end if;
946
947
948
949
950
951
952








953
954
955
956
957
958
959
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975







+
+
+
+
+
+
+
+







      end;
   end Append_Atom;


   overriding procedure Close_List (Output : in out Printer) is
   begin
      Output.Indent_Level := Output.Indent_Level - 1;

      if Output.Param.Width > 0
        and then Output.Cursor > Output.Param.Width
        and then Output.Cursor > Indent_Width (Output) + 1
      then
         Newline (Output);
         Output.First := True;  --  inhibit extra space or newline
      end if;

      if not Output.First then
         if Output.Param.Newline_At (Output.Previous, Closing) then
            Newline (Output);
         elsif Output.Param.Space_At (Output.Previous, Closing) then
            Output.Stream.Write ((0 => Encodings.Space));
            Output.Cursor := Output.Cursor + 1;