From 498c0f8f1f7eaa9422e015e43e4d9c0f3dcd26e2 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 26 May 2021 21:42:46 +0200 Subject: ETable: Sometimes does not scroll to the cursor row It could sometimes happen that the request to scroll to the cursor had been received before the actual content size had been recalculated, which resulted in no scrollbar position change and the cursor had been left out of the view. --- src/e-util/e-table-item.c | 2 ++ src/e-util/e-table.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/e-util/e-table-item.c b/src/e-util/e-table-item.c index a6b648776e..66a05287d4 100644 --- a/src/e-util/e-table-item.c +++ b/src/e-util/e-table-item.c @@ -1008,6 +1008,8 @@ eti_request_region_show (ETableItem *eti, end_col, end_row, &x1, &y1, &x2, &y2); + eti->cursor_on_screen = TRUE; + if (delay) priv->show_cursor_delay_source = e_canvas_item_show_area_delayed_ex ( GNOME_CANVAS_ITEM (eti), x1, y1, x2, y2, delay); diff --git a/src/e-util/e-table.c b/src/e-util/e-table.c index 05bea36703..7856ed4054 100644 --- a/src/e-util/e-table.c +++ b/src/e-util/e-table.c @@ -769,10 +769,24 @@ table_canvas_reflow_idle (ETable *e_table) if (oldwidth != width - 1 || oldheight != height - 1) { + ESelectionModel *selection_model; + gnome_canvas_set_scroll_region ( GNOME_CANVAS (e_table->table_canvas), 0, 0, width - 1, height - 1); set_header_canvas_width (e_table); + + selection_model = e_table_get_selection_model (e_table); + if (selection_model) { + gint cursor_row, cursor_col; + + cursor_row = e_selection_model_cursor_row (selection_model); + cursor_col = e_selection_model_cursor_col (selection_model); + + if (cursor_row >= 0 && cursor_col >= 0) + e_selection_model_cursor_changed (selection_model, cursor_row, cursor_col); + + } } e_table->reflow_idle_id = 0; return FALSE; -- cgit v1.2.1