equal
deleted
inserted
replaced
183 val (s1, rest1) = Document.chop(lines1) |
183 val (s1, rest1) = Document.chop(lines1) |
184 |
184 |
185 if (l1 == l2) { |
185 if (l1 == l2) { |
186 if (0 <= c1 && c1 <= c2 && c2 <= s1.length) { |
186 if (0 <= c1 && c1 <= c2 && c2 <= s1.length) { |
187 Some( |
187 Some( |
188 if (lines1.isEmpty) ("", prefix) |
188 if (lines1.isEmpty) ("", prefix ::: Document.split(insert)) |
189 else { |
189 else { |
190 val removed_text = s1.substring(c1, c2) |
190 val removed_text = s1.substring(c1, c2) |
191 val changed_text = s1.substring(0, c1) + insert + s1.substring(c2) |
191 val changed_text = s1.substring(0, c1) + insert + s1.substring(c2) |
192 (removed_text, prefix ::: Document.split(changed_text) ::: rest1) |
192 (removed_text, prefix ::: Document.split(changed_text) ::: rest1) |
193 }) |
193 }) |
197 else { |
197 else { |
198 val (middle, lines2) = rest1.splitAt(l2 - l1 - 1) |
198 val (middle, lines2) = rest1.splitAt(l2 - l1 - 1) |
199 val (s2, rest2) = Document.chop(lines2) |
199 val (s2, rest2) = Document.chop(lines2) |
200 if (0 <= c1 && c1 <= s1.length && 0 <= c2 && c2 <= s2.length) { |
200 if (0 <= c1 && c1 <= s1.length && 0 <= c2 && c2 <= s2.length) { |
201 Some( |
201 Some( |
202 if (lines1.isEmpty) ("", prefix) |
202 if (lines1.isEmpty) ("", prefix ::: Document.split(insert)) |
203 else { |
203 else { |
204 val r1 = s1.substring(c1) |
204 val r1 = s1.substring(c1) |
205 val r2 = s2.substring(0, c2) |
205 val r2 = s2.substring(0, c2) |
206 val removed_text = |
206 val removed_text = |
207 if (lines2.isEmpty) Document.text(Line(r1) :: middle) |
207 if (lines2.isEmpty) Document.text(Line(r1) :: middle) |