Fix inclusion of LF in IntralineLoader
An edit may contain consecutive LFs. Currently, if a replacement region ends with the first LF, the second LF may still be included, producing a region that spans two lines. If there is another region that starts with this second LF, the end of the first region will be greater than the beginning of the second one, which is an error. The error does not seem to affect the old diff view but is caught by SideBySide2. Fixed by checking if the region already ends with LF. Change-Id: I86aa9100dc1318935aa350a0aba0c411e2dc5841
This commit is contained in:
@@ -248,12 +248,14 @@ class IntraLineLoader extends CacheLoader<IntraLineDiffKey, IntraLineDiff> {
|
||||
//
|
||||
if (ab < ae //
|
||||
&& (ab == 0 || a.charAt(ab - 1) == '\n') //
|
||||
&& ae < a.size() && a.charAt(ae) == '\n') {
|
||||
&& ae < a.size() && a.charAt(ae - 1) != '\n'
|
||||
&& a.charAt(ae) == '\n') {
|
||||
ae++;
|
||||
}
|
||||
if (bb < be //
|
||||
&& (bb == 0 || b.charAt(bb - 1) == '\n') //
|
||||
&& be < b.size() && b.charAt(be) == '\n') {
|
||||
&& be < b.size() && b.charAt(be - 1) != '\n'
|
||||
&& b.charAt(be) == '\n') {
|
||||
be++;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user