Skip to content

Commit

Permalink
Try to scroll annotation view the first time it's shown
Browse files Browse the repository at this point in the history
Fixes #1096
  • Loading branch information
johnfactotum committed Oct 13, 2023
1 parent e7979ce commit 00b3aec
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/annotations.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,15 @@ GObject.registerClass({
'unbind': (_, listItem) =>
utils.disconnect(listItem.item.item, handlers.get(listItem)),
})

// XXX: `scroll_to()` doesn't work until after the list view is shown
// or rather, not even then; probably a GTK bug?
const handler = this.connect('map', () => {
this.disconnect(handler)
if (this.#location)
// horrible hack but it's better than nothing I guess
setTimeout(() => this.scrollToCFI(this.#location.cfi), 100)
})
}
setupModel(model) {
const tree = Gtk.TreeListModel
Expand Down

0 comments on commit 00b3aec

Please sign in to comment.