This commit is contained in:
Kovid Goyal 2012-06-19 14:00:48 +05:30
parent 475a41d158
commit 59b0d9e47c
2 changed files with 5 additions and 4 deletions

Binary file not shown.

View File

@ -227,11 +227,12 @@ class PagedDisplay
snap_to_selection: () -> snap_to_selection: () ->
# Ensure that the viewport is positioned at the start of the column # Ensure that the viewport is positioned at the start of the column
# containing the start of the current selection # containing the start of the current selection
sel = window.getSelection()
r = sel.getRangeAt(0).getBoundingClientRect()
node = sel.anchorNode
left = viewport_to_document(r.left, r.top, doc=node.ownerDocument)[0]
if this.in_paged_mode if this.in_paged_mode
sel = window.getSelection()
r = sel.getRangeAt(0).getBoundingClientRect()
node = sel.anchorNode
left = viewport_to_document(r.left, r.top, doc=node.ownerDocument)[0]
# Ensure we are scrolled to the column containing the start of the # Ensure we are scrolled to the column containing the start of the
# selection # selection
this.scroll_to_xpos(left+5) this.scroll_to_xpos(left+5)