diff options
| author | Pietro Gagliardi <[email protected]> | 2014-11-17 22:52:15 -0500 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-11-17 22:52:15 -0500 |
| commit | 46056e54e40eeaecd3e5cc8cd422cf3ca3554501 (patch) | |
| tree | d5fd4167f008070db90ea2e57a7911b24f6c169d /wintable/main.c | |
| parent | d893ba6c03f5d6bcc3ab38971f589ae05d532a9e (diff) | |
Added a prev parameter to finishSelect() on the new Windows Table. This will allow proper scrolling to the selection.
Diffstat (limited to 'wintable/main.c')
| -rw-r--r-- | wintable/main.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/wintable/main.c b/wintable/main.c index 826fe30..01a0a40 100644 --- a/wintable/main.c +++ b/wintable/main.c @@ -333,7 +333,7 @@ static void recomputeHScroll(struct table *t) SetScrollInfo(t->hwnd, SB_HORZ, &si, TRUE); } -static void finishSelect(struct table *t) +static void finishSelect(struct table *t, intptr_t prev) { if (t->selected < 0) t->selected = 0; @@ -346,9 +346,12 @@ static void finishSelect(struct table *t) static void keySelect(struct table *t, WPARAM wParam, LPARAM lParam) { + intptr_t prev; + // TODO figure out correct behavior with nothing selected if (t->count == 0) // don't try to do anything if there's nothing to do return; + prev = t->selected; switch (wParam) { case VK_UP: t->selected--; @@ -389,14 +392,16 @@ static void keySelect(struct table *t, WPARAM wParam, LPARAM lParam) // don't touch anything return; } - finishSelect(t); + finishSelect(t, prev); } static void selectItem(struct table *t, WPARAM wParam, LPARAM lParam) { int x, y; LONG h; + intptr_t prev; + prev = t->selected; x = GET_X_LPARAM(lParam); y = GET_Y_LPARAM(lParam); h = rowHeight(t); @@ -407,7 +412,7 @@ static void selectItem(struct table *t, WPARAM wParam, LPARAM lParam) if (t->selected >= t->count) t->selected = -1; t->focusedColumn = hitTestColumn(t, x); - finishSelect(t); + finishSelect(t, prev); } static void vscrollto(struct table *t, intptr_t newpos) |
