Skip to content

Commit

Permalink
Merge pull request atom#8779 from atom/cz-electron-32
Browse files Browse the repository at this point in the history
Update to Electron v0.33.x
  • Loading branch information
Nathan Sobo committed Oct 16, 2015
2 parents 56d5cea + 4093e6d commit 26a5b26
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 19 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"url": "https://github.com/atom/atom/issues"
},
"license": "MIT",
"electronVersion": "0.30.7",
"electronVersion": "0.33.6",
"dependencies": {
"async": "0.2.6",
"atom-keymap": "^6.1.0",
Expand Down Expand Up @@ -115,7 +115,7 @@
"update-package-dependencies": "0.10.0",
"welcome": "0.31.0",
"whitespace": "0.31.0",
"wrap-guide": "0.38.0",
"wrap-guide": "0.38.1",
"language-c": "0.49.0",
"language-clojure": "0.18.0",
"language-coffee-script": "0.42.0",
Expand Down
2 changes: 1 addition & 1 deletion spec/compile-cache-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe 'CompileCache', ->
CompileCache.resetCacheStats()

spyOn(Babel, 'transform').andReturn {code: 'the-babel-code'}
spyOn(CoffeeScript, 'compile').andReturn {js: 'the-coffee-code', v3SourceMap: {}}
spyOn(CoffeeScript, 'compile').andReturn {js: 'the-coffee-code', v3SourceMap: "{}"}
spyOn(TypeScriptSimple::, 'compile').andReturn 'the-typescript-code'
spyOn(CSONParser, 'parse').andReturn {the: 'cson-data'}

Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/babel/invalid.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
'use 6to6';

module.exports = v => v + 1
module.exports = async function hello() {}
16 changes: 8 additions & 8 deletions spec/lines-yardstick-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ describe "LinesYardstick", ->

expect(linesYardstick.pixelPositionForScreenPosition([0, 0])).toEqual({left: 0, top: 0})
expect(linesYardstick.pixelPositionForScreenPosition([0, 1])).toEqual({left: 7, top: 0})
expect(linesYardstick.pixelPositionForScreenPosition([0, 5])).toEqual({left: 37.8046875, top: 0})
expect(linesYardstick.pixelPositionForScreenPosition([1, 6])).toEqual({left: 43.20703125, top: 14})
expect(linesYardstick.pixelPositionForScreenPosition([1, 9])).toEqual({left: 72.20703125, top: 14})
expect(linesYardstick.pixelPositionForScreenPosition([2, Infinity])).toEqual({left: 288.046875, top: 28})
expect(linesYardstick.pixelPositionForScreenPosition([0, 5])).toEqual({left: 37.78125, top: 0})
expect(linesYardstick.pixelPositionForScreenPosition([1, 6])).toEqual({left: 43.171875, top: 14})
expect(linesYardstick.pixelPositionForScreenPosition([1, 9])).toEqual({left: 72.171875, top: 14})
expect(linesYardstick.pixelPositionForScreenPosition([2, Infinity])).toEqual({left: 287.859375, top: 28})

it "reuses already computed pixel positions unless it is invalidated", ->
atom.styles.addStyleSheet """
Expand All @@ -105,9 +105,9 @@ describe "LinesYardstick", ->

linesYardstick.invalidateCache()

expect(linesYardstick.pixelPositionForScreenPosition([1, 2])).toEqual({left: 24.00390625, top: 14})
expect(linesYardstick.pixelPositionForScreenPosition([2, 6])).toEqual({left: 72.01171875, top: 28})
expect(linesYardstick.pixelPositionForScreenPosition([5, 10])).toEqual({left: 120.01171875, top: 70})
expect(linesYardstick.pixelPositionForScreenPosition([1, 2])).toEqual({left: 24, top: 14})
expect(linesYardstick.pixelPositionForScreenPosition([2, 6])).toEqual({left: 72, top: 28})
expect(linesYardstick.pixelPositionForScreenPosition([5, 10])).toEqual({left: 120, top: 70})

it "correctly handles RTL characters", ->
atom.styles.addStyleSheet """
Expand Down Expand Up @@ -156,7 +156,7 @@ describe "LinesYardstick", ->
expect(linesYardstick.screenPositionForPixelPosition({top: 32, left: 24.3})).toEqual([2, 3])
expect(linesYardstick.screenPositionForPixelPosition({top: 46, left: 66.5})).toEqual([3, 9])
expect(linesYardstick.screenPositionForPixelPosition({top: 80, left: 99.9})).toEqual([5, 14])
expect(linesYardstick.screenPositionForPixelPosition({top: 80, left: 224.4365234375})).toEqual([5, 29])
expect(linesYardstick.screenPositionForPixelPosition({top: 80, left: 224.2365234375})).toEqual([5, 29])
expect(linesYardstick.screenPositionForPixelPosition({top: 80, left: 225})).toEqual([5, 30])

it "clips pixel positions above buffer start", ->
Expand Down
1 change: 1 addition & 0 deletions spec/module-cache-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ describe 'ModuleCache', ->
exports.load = function() { require('underscore-plus'); };
"""

spyOn(process, 'cwd').andReturn('/') # Required when running this test from CLI
packageMain = require(indexPath)
Module._findPath.reset()
expect(-> packageMain.load()).toThrow()
Expand Down
12 changes: 8 additions & 4 deletions spec/text-editor-component-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3482,12 +3482,14 @@ describe "TextEditorComponent", ->

editor.moveRight()
nextAnimationFrame()
right = wrapperNode.pixelPositionForScreenPosition([0, 6]).left

margin = component.presenter.getHorizontalScrollMarginInPixels()
right = wrapperNode.pixelPositionForScreenPosition([0, 4]).left + margin
expect(wrapperNode.getScrollRight()).toBeCloseTo right, 0

editor.moveRight()
nextAnimationFrame()
right = wrapperNode.pixelPositionForScreenPosition([0, 7]).left
right = wrapperNode.pixelPositionForScreenPosition([0, 5]).left + margin
expect(wrapperNode.getScrollRight()).toBeCloseTo right, 0

it "scrolls left when the last cursor gets closer than ::horizontalScrollMargin to the left of the editor", ->
Expand All @@ -3499,12 +3501,14 @@ describe "TextEditorComponent", ->

editor.moveLeft()
nextAnimationFrame()
left = wrapperNode.pixelPositionForScreenPosition([6, 59]).left

margin = component.presenter.getHorizontalScrollMarginInPixels()
left = wrapperNode.pixelPositionForScreenPosition([6, 61]).left - margin
expect(wrapperNode.getScrollLeft()).toBeCloseTo left, 0

editor.moveLeft()
nextAnimationFrame()
left = wrapperNode.pixelPositionForScreenPosition([6, 58]).left
left = wrapperNode.pixelPositionForScreenPosition([6, 60]).left - margin
expect(wrapperNode.getScrollLeft()).toBeCloseTo left, 0

it "scrolls down when inserting lines makes the document longer than the editor's height", ->
Expand Down
4 changes: 4 additions & 0 deletions src/application-delegate.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ _ = require 'underscore-plus'
ipc = require 'ipc'
remote = require 'remote'
shell = require 'shell'
webFrame = require 'web-frame'
{Disposable} = require 'event-kit'
{getWindowLoadSettings, setWindowLoadSettings} = require './window-load-settings-helpers'

Expand Down Expand Up @@ -163,3 +164,6 @@ class ApplicationDelegate

openExternal: (url) ->
shell.openExternal(url)

disablePinchToZoom: ->
webFrame.setZoomLevelLimits(1, 1)
2 changes: 2 additions & 0 deletions src/atom-environment.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ class AtomEnvironment extends Model
@stylesElement = @styles.buildStylesElement()
@document.head.appendChild(@stylesElement)

@applicationDelegate.disablePinchToZoom()

@keymaps.subscribeToFileReadFailure()
@keymaps.loadBundledKeymaps()

Expand Down
4 changes: 2 additions & 2 deletions src/browser/atom-protocol-handler.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class AtomProtocolHandler

# Creates the 'atom' custom protocol handler.
registerAtomProtocol: ->
protocol.registerProtocol 'atom', (request) =>
protocol.registerFileProtocol 'atom', (request, callback) =>
relativePath = path.normalize(request.url.substr(7))

if relativePath.indexOf('assets/') is 0
Expand All @@ -41,4 +41,4 @@ class AtomProtocolHandler
filePath = path.join(loadPath, relativePath)
break if fs.statSyncNoException(filePath).isFile?()

new protocol.RequestFileJob(filePath)
callback(filePath)
2 changes: 1 addition & 1 deletion src/browser/atom-window.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class AtomWindow
hash: encodeURIComponent(JSON.stringify(loadSettings))

getLoadSettings: ->
if @browserWindow.webContents?.loaded
if @browserWindow.webContents? and not @browserWindow.webContents.isLoading()
hash = url.parse(@browserWindow.webContents.getUrl()).hash.substr(1)
JSON.parse(decodeURIComponent(hash))

Expand Down

0 comments on commit 26a5b26

Please sign in to comment.