if (regionindex > -1 && regionindex < hiddenColumns.size())
{
int[] region = hiddenColumns.get(regionindex);
- if (column >= region[0] && column <= region[1])
+ // already know that column <= region[1] as cursor returns containing
+ // region or region to right
+ if (column >= region[0])
{
return false;
}
{
// deleted last region, index is now end of alignment
index = hiddenCols.size();
- }
- // update the cursor position
- HiddenCursorPosition newpos = new HiddenCursorPosition(index,
- oldpos.getHiddenSoFar());
- cursorPos.compareAndSet(oldpos, newpos);
+ HiddenCursorPosition newpos = new HiddenCursorPosition(index,
+ oldpos.getHiddenSoFar());
+ cursorPos.compareAndSet(oldpos, newpos);
+ }
}
hiddenColumns = hiddenCols;
}
}
}
}
- HiddenCursorPosition newpos = new HiddenCursorPosition(index,
- hiddenCount);
- cursorPos.compareAndSet(oldpos, newpos);
- return newpos;
+
+ if (index != oldpos.getRegionIndex()
+ || hiddenCount != oldpos.getHiddenSoFar())
+ {
+ HiddenCursorPosition newpos = new HiddenCursorPosition(index,
+ hiddenCount);
+ cursorPos.compareAndSet(oldpos, newpos);
+ return newpos;
+ }
+ return oldpos;
}
/**
}
- HiddenCursorPosition newpos = new HiddenCursorPosition(index,
- hiddenCount);
- cursorPos.compareAndSet(oldpos, newpos);
- return newpos;
+ if (index != oldpos.getRegionIndex()
+ || hiddenCount != oldpos.getHiddenSoFar())
+ {
+ HiddenCursorPosition newpos = new HiddenCursorPosition(index,
+ hiddenCount);
+ cursorPos.compareAndSet(oldpos, newpos);
+ return newpos;
+ }
+ return oldpos;
}
}