mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
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:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user