Fixed deselection redraw.
This commit is contained in:
parent
060b062045
commit
041c99df07
|
@ -36,15 +36,16 @@ static void doselect(struct table *t, intptr_t row, intptr_t column)
|
||||||
if (t->selectedColumn >= t->nColumns)
|
if (t->selectedColumn >= t->nColumns)
|
||||||
panic("sanity check failure: new Table selection invalid (column out of range)");
|
panic("sanity check failure: new Table selection invalid (column out of range)");
|
||||||
|
|
||||||
// only scroll if we selected something
|
// do this even if we don't scroll before; noScroll depends on it
|
||||||
if (t->selectedRow == -1 || t->selectedColumn == -1)
|
|
||||||
goto noScroll;
|
|
||||||
|
|
||||||
if (GetClientRect(t->hwnd, &client) == 0)
|
if (GetClientRect(t->hwnd, &client) == 0)
|
||||||
panic("error getting Table client rect in doselect()");
|
panic("error getting Table client rect in doselect()");
|
||||||
client.top += t->headerHeight;
|
client.top += t->headerHeight;
|
||||||
height = rowht(t);
|
height = rowht(t);
|
||||||
|
|
||||||
|
// only scroll if we selected something
|
||||||
|
if (t->selectedRow == -1 || t->selectedColumn == -1)
|
||||||
|
goto noScroll;
|
||||||
|
|
||||||
// first vertically scroll to the new row to make it fully visible (or as visible as possible)
|
// first vertically scroll to the new row to make it fully visible (or as visible as possible)
|
||||||
if (t->selectedRow < t->vscrollpos)
|
if (t->selectedRow < t->vscrollpos)
|
||||||
vscrollto(t, t->selectedRow);
|
vscrollto(t, t->selectedRow);
|
||||||
|
@ -83,7 +84,6 @@ static void doselect(struct table *t, intptr_t row, intptr_t column)
|
||||||
noScroll:
|
noScroll:
|
||||||
// now redraw the old and new /rows/
|
// now redraw the old and new /rows/
|
||||||
// we do this after scrolling so the rectangles to be invalidated make sense
|
// we do this after scrolling so the rectangles to be invalidated make sense
|
||||||
// TODO this doesn't work correctly if we're deselecting
|
|
||||||
r.left = client.left;
|
r.left = client.left;
|
||||||
r.right = client.right;
|
r.right = client.right;
|
||||||
if (oldrow != -1 && oldrow >= t->vscrollpos) {
|
if (oldrow != -1 && oldrow >= t->vscrollpos) {
|
||||||
|
|
Loading…
Reference in New Issue