summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 87272e5)
raw | patch | inline | side by side (parent: 87272e5)
author | joncruz <joncruz@users.sourceforge.net> | |
Tue, 16 May 2006 16:27:15 +0000 (16:27 +0000) | ||
committer | joncruz <joncruz@users.sourceforge.net> | |
Tue, 16 May 2006 16:27:15 +0000 (16:27 +0000) |
ChangeLog | patch | blob | history | |
src/document-subset.cpp | patch | blob | history |
diff --git a/ChangeLog b/ChangeLog
index 66c74833441ceba44ef6eceb86231f0a85bdfd41..965fb1f2bb0e4f4a4bd35cdf4075fd579e20aa1b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2006-05-16 Jon A. Cruz <jon@joncruz.org>
+
+ * src/document-subset.cpp:
+ Corrected ordering of children in subset.
+
2006-05-15 Jon A. Cruz <jon@joncruz.org>
* src/Makefile_insert, src/desktop.cpp, src/desktop.h,
src/layer-manager.cpp, src/menus-skeleton.h, src/verbs.cpp,
index 4e7e9f694f6a49e00fe995aa6aebe263c8572fa0..4ef547320a292cec1dca48c9b1a5161107dbee69 100644 (file)
--- a/src/document-subset.cpp
+++ b/src/document-subset.cpp
} else {
Siblings::const_iterator first=children.begin();
Siblings::const_iterator last=children.end() - 1;
- if ( children.size() == 1 ) {
- int pos = sp_object_compare_position(*first, obj);
+
+ while ( first != last ) {
+ Siblings::const_iterator mid = first + ( last - first + 1 ) / 2;
+ int pos = sp_object_compare_position(*mid, obj);
if ( pos < 0 ) {
- // All good.
+ first = mid;
} else if ( pos > 0 ) {
- last++;
+ if ( last == mid ) {
+ last = mid - 1; // already at the top limit
+ } else {
+ last = mid;
+ }
} else {
g_assert_not_reached();
}
- } else {
- while ( first != last ) {
- Siblings::const_iterator mid=first + ( last - first + 1 ) / 2;
- int pos=sp_object_compare_position(*mid, obj);
- if ( pos < 0 ) {
- first = mid;
- } else if ( pos > 0 ) {
- if ( last == mid ) {
- break;
- }
- last = mid;
- } else {
- g_assert_not_reached();
- }
+ }
+
+ if ( first == last ) {
+ // compare to the single possiblity left
+ int pos = sp_object_compare_position(*last, obj);
+ if ( pos < 0 ) {
+ last++;
}
}