Fixed deselection redraw.

This commit is contained in:
Pietro Gagliardi 2014-12-16 20:19:06 -05:00
parent 060b062045
commit 041c99df07
1 changed files with 5 additions and 5 deletions

View File

@ -36,15 +36,16 @@ static void doselect(struct table *t, intptr_t row, intptr_t column)
if (t->selectedColumn >= t->nColumns)
panic("sanity check failure: new Table selection invalid (column out of range)");
// only scroll if we selected something
if (t->selectedRow == -1 || t->selectedColumn == -1)
goto noScroll;
// do this even if we don't scroll before; noScroll depends on it
if (GetClientRect(t->hwnd, &client) == 0)
panic("error getting Table client rect in doselect()");
client.top += t->headerHeight;
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)
if (t->selectedRow < t->vscrollpos)
vscrollto(t, t->selectedRow);
@ -83,7 +84,6 @@ static void doselect(struct table *t, intptr_t row, intptr_t column)
noScroll:
// now redraw the old and new /rows/
// 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.right = client.right;
if (oldrow != -1 && oldrow >= t->vscrollpos) {