diff options
author | ericm <ericm> | 1999-11-24 01:09:07 (GMT) |
---|---|---|
committer | ericm <ericm> | 1999-11-24 01:09:07 (GMT) |
commit | abcfd77cbde42a883ece9a8db050e42b6ef9c45a (patch) | |
tree | 8b0902880bc85aa2e058c060030c624d97c571a3 /generic/tkListbox.c | |
parent | be89e43c7fbc9554b9b1daa5a2ad02eb3be030b7 (diff) | |
download | tk-abcfd77cbde42a883ece9a8db050e42b6ef9c45a.zip tk-abcfd77cbde42a883ece9a8db050e42b6ef9c45a.tar.gz tk-abcfd77cbde42a883ece9a8db050e42b6ef9c45a.tar.bz2 |
* tests/listbox.test: Added a test to check that the topIndex is
update when items are removed from the listvar variable.
* generic/tkListbox.c: Added a check the updates the topIndex when
items are removed from the listvar variable.
Diffstat (limited to 'generic/tkListbox.c')
-rw-r--r-- | generic/tkListbox.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/generic/tkListbox.c b/generic/tkListbox.c index ced0620..50e7652 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkListbox.c,v 1.12 1999/11/24 00:20:13 ericm Exp $ + * RCS: @(#) $Id: tkListbox.c,v 1.13 1999/11/24 01:09:07 ericm Exp $ */ #include "tkPort.h" @@ -3195,6 +3195,12 @@ ListboxListVarProc(clientData, interp, name1, name2, flags) if (oldLength != listPtr->nElements) { listPtr->flags |= UPDATE_V_SCROLLBAR; + if (listPtr->topIndex > (listPtr->nElements - listPtr->fullLines)) { + listPtr->topIndex = listPtr->nElements - listPtr->fullLines; + if (listPtr->topIndex < 0) { + listPtr->topIndex = 0; + } + } } /* |