mirror of
https://gitlab.gnome.org/GNOME/gitg
synced 2024-09-13 21:21:17 +00:00
Fix restore scroll when not visible
This commit is contained in:
parent
3acfb98cb3
commit
8e16491f95
|
@ -240,11 +240,12 @@ namespace GitgHistory
|
|||
|
||||
d_selected.clear();
|
||||
|
||||
Gtk.TreePath startp, endp;
|
||||
view.get_visible_range(out startp, out endp);
|
||||
|
||||
d_scroll_to = null;
|
||||
|
||||
Gtk.TreePath startp, endp;
|
||||
|
||||
var isvis = view.get_visible_range(out startp, out endp);
|
||||
|
||||
view.get_selection().selected_foreach((model, path, iter) => {
|
||||
var c = d_commit_list_model.commit_from_iter(iter);
|
||||
|
||||
|
@ -253,7 +254,9 @@ namespace GitgHistory
|
|||
d_selected.add(c.get_id());
|
||||
|
||||
if (d_scroll_to == null &&
|
||||
startp.compare(path) <= 0 && endp.compare(path) >= 0)
|
||||
(!isvis || startp.compare(path) <= 0 && endp.compare(path) >= 0))
|
||||
{
|
||||
if (isvis)
|
||||
{
|
||||
Gdk.Rectangle rect;
|
||||
Gdk.Rectangle visrect;
|
||||
|
@ -272,6 +275,12 @@ namespace GitgHistory
|
|||
// something related to a border or padding of the
|
||||
// treeview (i.e. theme related)
|
||||
d_scroll_y = (float)(rect.y + rect.height / 2.0 - y + 2) / (float)visrect.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
d_scroll_y = 0.5f;
|
||||
}
|
||||
|
||||
d_scroll_to = c.get_id();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue