File tree 1 file changed +8
-8
lines changed 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -73,25 +73,25 @@ type doc =
73
73
(* Replaces an earlier implementation that relied on repeatedly calling sub, with one inspired by the standard library *)
74
74
let breakString init s =
75
75
if s = " " then
76
- Nil
76
+ init
77
77
else
78
78
let r = ref init in
79
79
let j = ref (String. length s) in
80
80
for i = String. length s - 1 downto 0 do
81
- let text = Text (String. sub s (i + 1 ) (! j - i - 1 )) in
82
81
if String. unsafe_get s i = '\n' then begin
83
- if ! r = Nil then
84
- r := Concat (Line , text)
82
+ let text = (String. sub s (i + 1 ) (! j - i - 1 )) in
83
+ (if ! r = Nil then
84
+ r := CText (Line , text)
85
85
else
86
- r := Concat (Line , Concat (text, ! r ));
86
+ r := Concat (Line , CText ( ! r, text) ));
87
87
j := i
88
88
end
89
89
done ;
90
- let text = Text ( String. sub s 0 ! j) in
90
+ let text = String. sub s 0 ! j in
91
91
if ! r = Nil then
92
- text
92
+ Text text
93
93
else
94
- Concat (text, Concat ( Line , ! r) )
94
+ CText ( ! r, text )
95
95
96
96
97
97
let nil = Nil
You can’t perform that action at this time.
0 commit comments