Don't try to scroll if we're deselecting. First part of mouse deselect fix.

This commit is contained in:
Pietro Gagliardi 2014-12-16 18:40:58 -05:00
parent 54a359d260
commit b9c46d4cdf
1 changed files with 5 additions and 0 deletions

View File

@ -36,6 +36,10 @@ 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
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;
@ -76,6 +80,7 @@ static void doselect(struct table *t, intptr_t row, intptr_t column)
hscrollto(t, (xpos + width) - t->hpagesize); hscrollto(t, (xpos + width) - t->hpagesize);
} }
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
r.left = client.left; r.left = client.left;