diff --git a/spec/app/editor-spec.coffee b/spec/app/editor-spec.coffee index 0c0f76a58..690ea5c26 100644 --- a/spec/app/editor-spec.coffee +++ b/spec/app/editor-spec.coffee @@ -1214,7 +1214,7 @@ describe "Editor", -> describe "when scrolling more than the editors height", -> it "removes lines that are offscreen and not in range of the overdraw and builds lines that become visible", -> - editor.scrollTop(editor.scrollView.prop('scrollHeight') - editor.scrollView.height()) + editor.scrollTop(editor.layerHeight - editor.scrollView.height()) expect(editor.renderedLines.find('.line').length).toBe 8 expect(editor.renderedLines.find('.line:first').text()).toBe buffer.lineForRow(5) expect(editor.renderedLines.find('.line:last').text()).toBe buffer.lineForRow(12) @@ -2131,16 +2131,13 @@ describe "Editor", -> it "move the cursor to the end of the file", -> expect(editor.getCursorScreenPosition()).toEqual [0,0] - event = $.Event("click") - event.offsetY = Infinity + event = mousedownEvent(editor: editor, point: [Infinity, 10]) editor.underlayer.trigger event expect(editor.getCursorScreenPosition()).toEqual [12,2] it "selects to the end of the files when shift is pressed", -> expect(editor.getSelection().getScreenRange()).toEqual [[0,0], [0,0]] - event = $.Event("click") - event.offsetY = Infinity - event.shiftKey = true + event = mousedownEvent(editor: editor, point: [Infinity, 10], shiftKey: true) editor.underlayer.trigger event expect(editor.getSelection().getScreenRange()).toEqual [[0,0], [12,2]] diff --git a/src/app/editor.coffee b/src/app/editor.coffee index f52312ac8..905d14034 100644 --- a/src/app/editor.coffee +++ b/src/app/editor.coffee @@ -821,13 +821,9 @@ class Editor extends View @isFocused = false @removeClass 'is-focused' - @underlayer.on 'click', (e) => - return unless e.target is @underlayer[0] - return unless e.offsetY > @overlayer.height() - if e.shiftKey - @selectToBottom() - else - @moveCursorToBottom() + @underlayer.on 'mousedown', (e) => + @renderedLines.trigger(e) + false @overlayer.on 'mousedown', (e) => @overlayer.hide() @@ -1275,14 +1271,14 @@ class Editor extends View updateLayerDimensions: -> height = @lineHeight * @getScreenLineCount() unless @layerHeight == height - @underlayer.css('min-height', height) - @renderedLines.height(height) - @overlayer.height(height) @layerHeight = height + @renderedLines.height(@layerHeight) + @overlayer.height(@layerHeight) bottomPaddingInLines = if @mini then 0 else @bottomPaddingInLines - heightWithPadding = height + (@lineHeight * bottomPaddingInLines) + heightWithPadding = @layerHeight + (@lineHeight * bottomPaddingInLines) @verticalScrollbarContent.height(heightWithPadding) + @underlayer.height(heightWithPadding) @scrollBottom(height) if @scrollBottom() > height diff --git a/static/editor.less b/static/editor.less index e36496814..699ffe3bc 100644 --- a/static/editor.less +++ b/static/editor.less @@ -125,7 +125,7 @@ .editor .underlayer { z-index: 0; position: absolute; - height: 100%; + min-height: 100%; } .editor .lines {