diff --git a/extension/lib/commands-frame.coffee b/extension/lib/commands-frame.coffee index ef61e8aa..1fbe9a27 100644 --- a/extension/lib/commands-frame.coffee +++ b/extension/lib/commands-frame.coffee @@ -94,23 +94,25 @@ helper_follow = ({id, combine = true}, matcher, {vim}) -> length = vim.state.markerElements.push(element) wrapper = {type, semantic, shape, elementIndex: length - 1} - # Combine links with the same href. - if combine and wrapper.type == 'link' and - # If the element has an 'onclick' attribute we cannot be sure that all - # links with this href actually do the same thing. On some pages, such as - # startpage.com, actual proper links have the 'onclick' attribute, so we - # can’t exclude such links in `utils.isProperLink`. - not element.hasAttribute('onclick') + if wrapper.type == 'link' {href} = element wrapper.href = href - if href of hrefs - parent = hrefs[href] - wrapper.parentIndex = parent.elementIndex - parent.shape.area += wrapper.shape.area - parent.numChildren++ - else - wrapper.numChildren = 0 - hrefs[href] = wrapper + + # Combine links with the same href. + if combine and wrapper.type == 'link' and + # If the element has an 'onclick' attribute we cannot be sure that all + # links with this href actually do the same thing. On some pages, such + # as startpage.com, actual proper links have the 'onclick' attribute, + # so we can’t exclude such links in `utils.isProperLink`. + not element.hasAttribute('onclick') + if href of hrefs + parent = hrefs[href] + wrapper.parentIndex = parent.elementIndex + parent.shape.area += wrapper.shape.area + parent.numChildren++ + else + wrapper.numChildren = 0 + hrefs[href] = wrapper return wrapper diff --git a/extension/lib/help.coffee b/extension/lib/help.coffee index 88461666..92de62f6 100644 --- a/extension/lib/help.coffee +++ b/extension/lib/help.coffee @@ -60,8 +60,7 @@ injectHelp = (window, vimfx) -> computedStyle = window.getComputedStyle(container) fontSize = originalFontSize = parseFloat(computedStyle.getPropertyValue('font-size')) - while wrapper.clientHeight < container.clientHeight and - fontSize <= MAX_FONT_SIZE + while container.scrollTopMax == 0 and fontSize <= MAX_FONT_SIZE fontSize++ container.style.fontSize = "#{fontSize}px" container.style.fontSize = "#{Math.max(fontSize - 1, originalFontSize)}px"