diff options
| author | Pietro Gagliardi <[email protected]> | 2014-12-16 20:19:06 -0500 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-12-16 20:19:06 -0500 |
| commit | 041c99df078f07f8720bc0a7f395ec5b28465da9 (patch) | |
| tree | 637087dfe3886f32b3cb780e5f2c98aee9f96101 | |
| parent | 060b062045965188d539ad5542b44f7a25c350f6 (diff) | |
Fixed deselection redraw.
| -rw-r--r-- | wintable/new/select.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/wintable/new/select.h b/wintable/new/select.h index 00b1d8d..11d7ce9 100644 --- a/wintable/new/select.h +++ b/wintable/new/select.h @@ -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) { |
