]> git.lyx.org Git - lyx.git/blobdiff - src/changes.C
* src/CutAndPaste.C:
[lyx.git] / src / changes.C
index e3cbdf5270299d1cea95552b1ac51fe12447fb7e..511e429ede717258b03927e40e0335fc533a34c5 100644 (file)
@@ -53,8 +53,16 @@ bool Change::isSimilarTo(Change const & change)
 
 bool operator==(Change const & l, Change const & r)
 {
-       return l.type == r.type &&
-              l.author == r.author &&
+       if (l.type != r.type) {
+               return false;
+       }
+
+       // two changes of type UNCHANGED are always equal
+       if (l.type == Change::UNCHANGED) {
+               return true;
+       }
+       
+       return l.author == r.author &&
               l.changetime == r.changetime;
 }
 
@@ -77,18 +85,6 @@ bool operator!=(Changes::Range const & r1, Changes::Range const & r2)
 }
 
 
-bool Changes::Range::contains(Range const & r) const
-{
-       return r.start >= start && r.end <= end;
-}
-
-
-bool Changes::Range::contains(pos_type const pos) const
-{
-       return pos >= start && pos < end;
-}
-
-
 bool Changes::Range::intersects(Range const & r) const
 {
        return r.start < end && r.end > start; // end itself is not in the range!
@@ -230,11 +226,10 @@ void Changes::insert(Change const & change, lyx::pos_type pos)
 }
 
 
-Change const Changes::lookup(pos_type const pos) const
+Change const Changes::lookup(pos_type const pos) const
 {
-       if (table_.empty()) {
-               return Change(Change::UNCHANGED);
-       }
+       static Change const noChange = Change(Change::UNCHANGED);
+               
        ChangeTable::const_iterator it = table_.begin();
        ChangeTable::const_iterator const end = table_.end();
 
@@ -243,7 +238,7 @@ Change const Changes::lookup(pos_type const pos) const
                        return it->change;
        }
 
-       return Change(Change::UNCHANGED);
+       return noChange;
 }