mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Set .hidden-input to fixed position so we don't have to move it when the cursor moves
This commit is contained in:
@@ -196,18 +196,11 @@ describe "Editor", ->
|
||||
it "moves the cursor to the character at the given row and column", ->
|
||||
expect(editor.getCursor().position()).toEqual(top: 2 * editor.lineHeight, left: 2 * editor.charWidth)
|
||||
|
||||
it "moves the hidden input element to the position of the cursor to prevent scrolling misbehavior", ->
|
||||
expect(editor.hiddenInput.position()).toEqual(top: 2 * editor.lineHeight, left: 2 * editor.charWidth)
|
||||
|
||||
describe "if soft-wrap is enabled", ->
|
||||
beforeEach ->
|
||||
setEditorWidthInChars(editor, 20)
|
||||
editor.setSoftWrap(true)
|
||||
|
||||
it "doesn't move the hidden input beyond the right side of the horizontal scroller to prevent chrome from auto-scrolling", ->
|
||||
editor.setCursorScreenPosition([4, 20])
|
||||
expect(editor.hiddenInput.position()).toEqual(top: 4 * editor.lineHeight, left: editor.horizontalScroller.width() - editor.charWidth)
|
||||
|
||||
describe "when the arrow keys are pressed", ->
|
||||
it "moves the cursor by a single row/column", ->
|
||||
editor.trigger keydownEvent('right')
|
||||
|
||||
@@ -141,12 +141,6 @@ class Editor extends View
|
||||
@hiddenInput.on "textInput", (e) =>
|
||||
@insertText(e.originalEvent.data)
|
||||
|
||||
@on 'cursor:position-changed', =>
|
||||
position = @pixelPositionForScreenPosition(@cursor.getScreenPosition())
|
||||
if @softWrap
|
||||
position.left = Math.min(position.left, @horizontalScroller.width() - @charWidth)
|
||||
@hiddenInput.css(position)
|
||||
|
||||
@horizontalScroller.on 'scroll', =>
|
||||
if @horizontalScroller.scrollLeft() == 0
|
||||
@gutter.removeClass('drop-shadow')
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
}
|
||||
|
||||
.editor .hidden-input {
|
||||
position: absolute;
|
||||
position: fixed;
|
||||
z-index: -1;
|
||||
top: 0;
|
||||
left: 0;
|
||||
|
||||
Reference in New Issue
Block a user