aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-table-subset.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-10-30 04:36:24 +0800
committerChris Lahey <clahey@src.gnome.org>2001-10-30 04:36:24 +0800
commitaa1899af14ef8c2792b5c25b3aef6f5b6a9a92ac (patch)
treef479642f4b221fdf278578624c2dc71e04425a51 /widgets/table/e-table-subset.c
parentf828accd314674f31de652bf4cd5d0b5e136f9ab (diff)
downloadgsoc2013-evolution-aa1899af14ef8c2792b5c25b3aef6f5b6a9a92ac.tar
gsoc2013-evolution-aa1899af14ef8c2792b5c25b3aef6f5b6a9a92ac.tar.gz
gsoc2013-evolution-aa1899af14ef8c2792b5c25b3aef6f5b6a9a92ac.tar.bz2
gsoc2013-evolution-aa1899af14ef8c2792b5c25b3aef6f5b6a9a92ac.tar.lz
gsoc2013-evolution-aa1899af14ef8c2792b5c25b3aef6f5b6a9a92ac.tar.xz
gsoc2013-evolution-aa1899af14ef8c2792b5c25b3aef6f5b6a9a92ac.tar.zst
gsoc2013-evolution-aa1899af14ef8c2792b5c25b3aef6f5b6a9a92ac.zip
Don't go outside the table looking for matches when doing the last_access
2001-10-29 Christopher James Lahey <clahey@ximian.com> * e-table-subset.c (etss_get_view_row), e-tree-sorted.c (check_last_access), e-tree-table-adapter.c (find_row_num): Don't go outside the table looking for matches when doing the last_access search. svn path=/trunk/; revision=14359
Diffstat (limited to 'widgets/table/e-table-subset.c')
-rw-r--r--widgets/table/e-table-subset.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/widgets/table/e-table-subset.c b/widgets/table/e-table-subset.c
index d37e35d22b..a55f9b4b0f 100644
--- a/widgets/table/e-table-subset.c
+++ b/widgets/table/e-table-subset.c
@@ -43,13 +43,15 @@ static ETableModelClass *etss_parent_class;
static gint
etss_get_view_row (ETableSubset *etss, int row)
{
- int limit;
const int n = etss->n_map;
const int * const map_table = etss->map_table;
int i;
- limit = MIN(n, etss->last_access + 10);
- for (i = etss->last_access; i < limit; i++) {
+ int end = MIN(etss->n_map, etss->last_access + 10);
+ int start = MAX(0, etss->last_access - 10);
+ int initial = MAX (MIN (etss->last_access, end), start);
+
+ for (i = initial; i < end; i++) {
if (map_table [i] == row){
d(g_print("a) Found %d from %d\n", i, etss->last_access));
etss->last_access = i;
@@ -57,8 +59,7 @@ etss_get_view_row (ETableSubset *etss, int row)
}
}
- limit = MAX(0, etss->last_access - 10);
- for (i = etss->last_access - 1; i >= limit; i--) {
+ for (i = initial - 1; i >= start; i--) {
if (map_table [i] == row){
e_table_model_row_changed (E_TABLE_MODEL (etss), i);
d(g_print("b) Found %d from %d\n", i, etss->last_access));