Prevent autoscrolling scroll-view when cursor is at end of longest line

If the longest line is longer than the width of the scroll view, we need
to allow 2px horizontally to prevent the hidden input from
autoscrolling.
This commit is contained in:
Nathan Sobo
2014-05-22 20:17:45 -06:00
parent 446a48ca00
commit fae035731f

View File

@@ -169,6 +169,7 @@ EditorScrollViewComponent = React.createClass
return {top: 0, left: 0} unless @isMounted() and focused and editor.getCursor()?
{top, left, height, width} = editor.getCursor().getPixelRect()
width = 2 if width is 0 # Prevent autoscroll at the end of longest line
top -= editor.getScrollTop()
left -= editor.getScrollLeft()
top = Math.max(0, Math.min(editor.getHeight() - height, top))