chiark / gitweb /
Fix an edge case of divider-obsoletion in Group.
authorSimon Tatham <anakin@pobox.com>
Wed, 9 Oct 2013 20:44:51 +0000 (20:44 +0000)
committerSimon Tatham <anakin@pobox.com>
Wed, 9 Oct 2013 20:44:51 +0000 (20:44 +0000)
When you drag group elements around, previous dividers are meant to
dissolve whenever the same two elements are no longer on each side of
it. One case in which this didn't happen was that of dragging an
element from the left of a divider to the far right column - the
divider became invisible, but would then startlingly reappear if you
drag that element back to the left of whatever it was left of before.

[originally from svn r10051]

unfinished/group.c

index 74a63fc2a04a19be7bd5b3be83af550bcee9fde5..c3033264258fcef28d51f09b6040a039f37502de 100644 (file)
@@ -1430,8 +1430,9 @@ static game_state *execute_move(const game_state *from, const char *move)
         /*
          * Eliminate any obsoleted dividers.
          */
-        for (x = 0; x+1 < w; x++) {
-            int i = ret->sequence[x], j = ret->sequence[x+1];
+        for (x = 0; x < w; x++) {
+            int i = ret->sequence[x];
+            int j = (x+1 < w ? ret->sequence[x+1] : -1);
             if (ret->dividers[i] != j)
                 ret->dividers[i] = -1;
         }