mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Always keep hidden input position in visible area
Previously the input could be offscreen depend on the scroll position of the editor and this would cause a scroll event to occur when the input gained focused causing the editor rendering to go out of sync.
This commit is contained in:
@@ -630,6 +630,7 @@ class Editor extends View
|
||||
|
||||
handleEvents: ->
|
||||
@on 'focus', =>
|
||||
@updateHiddenInputOffset()
|
||||
@hiddenInput.focus()
|
||||
false
|
||||
|
||||
@@ -693,10 +694,15 @@ class Editor extends View
|
||||
else
|
||||
@gutter.addClass('drop-shadow')
|
||||
|
||||
updateHiddenInputOffset: ->
|
||||
cursorView = @getCursorView()
|
||||
if cursorView?.is(':visible')
|
||||
offset = cursorView.offset()
|
||||
offset.top = Math.min(@height(), offset.top)
|
||||
@hiddenInput.offset(offset)
|
||||
|
||||
handleInputEvents: ->
|
||||
@on 'cursor:moved', =>
|
||||
cursorView = @getCursorView()
|
||||
@hiddenInput.offset(cursorView.offset()) if cursorView.is(':visible')
|
||||
@on 'cursor:moved', => @updateHiddenInputOffset()
|
||||
|
||||
selectedText = null
|
||||
@hiddenInput.on 'compositionstart', =>
|
||||
|
||||
Reference in New Issue
Block a user