summaryrefslogtreecommitdiffhomepage
path: root/diff.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'diff.cpp')
-rw-r--r--diff.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/diff.cpp b/diff.cpp
index b56fd51..ea9b04e 100644
--- a/diff.cpp
+++ b/diff.cpp
@@ -81,6 +81,16 @@ void Diff::create(const std::string& old_version, const std::string& new_version
return;
}
+ // re-adjust if search crossed
+ if (old_pos0 > old_pos1) {
+ old_pos0 = old_pos1;
+ new_pos0 = old_pos1;
+ }
+ if (new_pos0 > new_pos1) {
+ old_pos0 = new_pos1;
+ new_pos0 = new_pos1;
+ }
+
// insert in the middle
if (old_pos0 == old_pos1) {
m_pos0 = old_pos0;