mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Move hidden input to follow cursor to stop spurious scrolling
Commit 8e77c05c fixed scrolling *up* when clicking the buffer while
scrolled down. But it was still scrolling to the far left when typing /
clicking on a really long line. This commit solves both issues by
always positioning the hidden input to the same location as the cursor,
so it doesn't tell webkit to scroll away from the current focus when it
is focused or the user types.
This commit is contained in:
@@ -66,7 +66,6 @@ class Editor extends Template
|
||||
|
||||
handleEvents: ->
|
||||
@on 'focus', =>
|
||||
@hiddenInput.css(top: @scrollTop())
|
||||
@hiddenInput.focus()
|
||||
false
|
||||
|
||||
@@ -79,8 +78,12 @@ class Editor extends Template
|
||||
@hiddenInput.on "textInput", (e) =>
|
||||
@insertText(e.originalEvent.data)
|
||||
|
||||
@on 'cursor:position-changed', =>
|
||||
@hiddenInput.css(@pixelPositionFromPoint(@cursor.getPosition()))
|
||||
|
||||
@one 'attach', =>
|
||||
@calculateDimensions()
|
||||
@hiddenInput.width(@charWidth)
|
||||
@focus()
|
||||
|
||||
buildLineElement: (lineText) ->
|
||||
|
||||
Reference in New Issue
Block a user