Merge branch 'master' into as-tiled-rendering

This commit is contained in:
Antonio Scandurra
2015-05-11 09:18:13 +02:00
13 changed files with 159 additions and 58 deletions

View File

@@ -6,6 +6,6 @@
"url": "https://github.com/atom/atom.git"
},
"dependencies": {
"atom-package-manager": "0.164.0"
"atom-package-manager": "0.166.0"
}
}

View File

@@ -1,7 +1,7 @@
{
"name": "atom",
"productName": "Atom",
"version": "0.197.0",
"version": "0.199.0",
"description": "A hackable text editor for the 21st Century.",
"main": "./src/browser/main.js",
"repository": {
@@ -31,9 +31,9 @@
"color": "^0.7.3",
"delegato": "^1",
"emissary": "^1.3.3",
"event-kit": "^1.1",
"event-kit": "^1.1.1",
"first-mate": "^3.1",
"fs-plus": "^2.7.1",
"fs-plus": "^2.8.0",
"fstream": "0.1.24",
"fuzzaldrin": "^2.1",
"git-utils": "^3.0.0",
@@ -71,20 +71,20 @@
"underscore-plus": "^1.6.6"
},
"packageDependencies": {
"atom-dark-syntax": "0.26.0",
"atom-dark-syntax": "0.27.0",
"atom-dark-ui": "0.49.0",
"atom-light-syntax": "0.26.0",
"atom-light-syntax": "0.28.0",
"atom-light-ui": "0.41.0",
"base16-tomorrow-dark-theme": "0.25.0",
"base16-tomorrow-light-theme": "0.8.0",
"one-dark-ui": "0.8.0",
"one-dark-syntax": "0.4.0",
"one-light-syntax": "0.5.0",
"one-light-ui": "0.8.0",
"solarized-dark-syntax": "0.32.0",
"solarized-light-syntax": "0.19.0",
"base16-tomorrow-dark-theme": "0.26.0",
"base16-tomorrow-light-theme": "0.9.0",
"one-dark-ui": "0.8.1",
"one-dark-syntax": "0.5.0",
"one-light-syntax": "0.6.0",
"one-light-ui": "0.8.1",
"solarized-dark-syntax": "0.35.0",
"solarized-light-syntax": "0.21.0",
"archive-view": "0.56.0",
"autocomplete": "0.44.0",
"autocomplete": "0.46.0",
"autoflow": "0.22.0",
"autosave": "0.20.0",
"background-tips": "0.24.0",
@@ -107,16 +107,16 @@
"link": "0.30.0",
"markdown-preview": "0.148.0",
"metrics": "0.45.0",
"notifications": "0.42.0",
"notifications": "0.43.0",
"open-on-github": "0.36.0",
"package-generator": "0.38.0",
"release-notes": "0.52.0",
"settings-view": "0.196.0",
"settings-view": "0.198.0",
"snippets": "0.89.0",
"spell-check": "0.56.0",
"status-bar": "0.69.0",
"styleguide": "0.44.0",
"symbols-view": "0.95.0",
"symbols-view": "0.96.0",
"tabs": "0.68.0",
"timecop": "0.31.0",
"tree-view": "0.171.0",
@@ -128,16 +128,16 @@
"language-clojure": "0.14.0",
"language-coffee-script": "0.40.0",
"language-csharp": "0.5.0",
"language-css": "0.28.0",
"language-gfm": "0.71.0",
"language-css": "0.29.0",
"language-gfm": "0.72.0",
"language-git": "0.10.0",
"language-go": "0.25.0",
"language-html": "0.36.0",
"language-html": "0.37.0",
"language-hyperlink": "0.13.0",
"language-java": "0.15.0",
"language-javascript": "0.76.0",
"language-javascript": "0.77.0",
"language-json": "0.14.0",
"language-less": "0.26.0",
"language-less": "0.27.0",
"language-make": "0.14.0",
"language-mustache": "0.11.0",
"language-objective-c": "0.15.0",
@@ -147,7 +147,7 @@
"language-python": "0.34.0",
"language-ruby": "0.52.0",
"language-ruby-on-rails": "0.21.0",
"language-sass": "0.36.0",
"language-sass": "0.37.0",
"language-shellscript": "0.14.0",
"language-source": "0.9.0",
"language-sql": "0.15.0",

View File

@@ -0,0 +1,4 @@
{
"name": "package-with-invalid-url-package-json",
"repository": "foo"
}

View File

@@ -15,15 +15,23 @@ ChromedriverPort = 9515
ChromedriverURLBase = "/wd/hub"
ChromedriverStatusURL = "http://localhost:#{ChromedriverPort}#{ChromedriverURLBase}/status"
pollChromeDriver = (done) ->
chromeDriverUp = (done) ->
checkStatus = ->
http.get(ChromedriverStatusURL, (response) ->
if response.statusCode is 200
done()
else
pollChromeDriver(done)
).on("error", -> pollChromeDriver(done))
http
.get ChromedriverStatusURL, (response) ->
if response.statusCode is 200
done()
else
chromeDriverUp(done)
.on("error", -> chromeDriverUp(done))
setTimeout(checkStatus, 100)
chromeDriverDown = (done) ->
checkStatus = ->
http
.get ChromedriverStatusURL, (response) ->
chromeDriverDown(done)
.on("error", done)
setTimeout(checkStatus, 100)
buildAtomClient = (args, env) ->
@@ -137,9 +145,9 @@ module.exports = (args, env, fn) ->
chromedriver.stderr.on "close", ->
resolve(errorCode)
waitsFor("webdriver to start", pollChromeDriver, 15000)
waitsFor("webdriver to start", chromeDriverUp, 15000)
waitsFor("webdriver to finish", (done) ->
waitsFor("tests to run", (done) ->
finish = once ->
client
.simulateQuit()
@@ -162,3 +170,5 @@ module.exports = (args, env, fn) ->
fn(client.init()).then(finish)
, 30000)
waitsFor("webdriver to stop", chromeDriverDown, 15000)

View File

@@ -9,7 +9,7 @@ return if process.env.TRAVIS
fs = require "fs"
path = require "path"
temp = require("temp").track()
runAtom = require("./helpers/start-atom")
runAtom = require "./helpers/start-atom"
describe "Starting Atom", ->
[tempDirPath, otherTempDirPath, atomHome] = []
@@ -41,6 +41,69 @@ describe "Starting Atom", ->
.then ({value}) -> expect(value).toBe "Hello!"
.dispatchCommand("editor:delete-line")
it "opens the file to the specified line number", ->
filePath = path.join(fs.realpathSync(tempDirPath), "new-file")
fs.writeFileSync filePath, """
1
2
3
4
"""
runAtom ["#{filePath}:3"], {ATOM_HOME: atomHome}, (client) ->
client
.waitForWindowCount(1, 1000)
.waitForExist("atom-workspace", 5000)
.waitForPaneItemCount(1, 1000)
.waitForExist("atom-text-editor", 5000)
.then (exists) -> expect(exists).toBe true
.execute -> atom.workspace.getActiveTextEditor().getPath()
.then ({value}) -> expect(value).toBe filePath
.execute -> atom.workspace.getActiveTextEditor().getCursorBufferPosition()
.then ({value}) ->
expect(value.row).toBe 2
expect(value.column).toBe 0
it "opens the file to the specified line number and column number", ->
filePath = path.join(fs.realpathSync(tempDirPath), "new-file")
fs.writeFileSync filePath, """
1
2
3
4
"""
runAtom ["#{filePath}:2:2"], {ATOM_HOME: atomHome}, (client) ->
client
.waitForWindowCount(1, 1000)
.waitForExist("atom-workspace", 5000)
.waitForPaneItemCount(1, 1000)
.waitForExist("atom-text-editor", 5000)
.then (exists) -> expect(exists).toBe true
.execute -> atom.workspace.getActiveTextEditor().getPath()
.then ({value}) -> expect(value).toBe filePath
.execute -> atom.workspace.getActiveTextEditor().getCursorBufferPosition()
.then ({value}) ->
expect(value.row).toBe 1
expect(value.column).toBe 1
it "removes all trailing whitespace and colons from the specified path", ->
filePath = path.join(tempDirPath, "new-file")
runAtom ["#{filePath}: "], {ATOM_HOME: atomHome}, (client) ->
client
.waitForWindowCount(1, 1000)
.waitForExist("atom-workspace", 5000)
.waitForPaneItemCount(1, 1000)
.waitForExist("atom-text-editor", 5000)
.then (exists) -> expect(exists).toBe true
.execute -> atom.workspace.getActiveTextEditor().getPath()
.then ({value}) -> expect(value).toBe filePath
describe "when there is already a window open", ->
it "reuses that window when opening files, but not when opening directories", ->
tempFilePath = path.join(temp.mkdirSync("a-third-dir"), "a-file")
@@ -150,10 +213,12 @@ describe "Starting Atom", ->
.waitForWindowCount(2, 10000)
.then ({value: windowHandles}) ->
@window(windowHandles[0])
.waitForExist("atom-workspace")
.treeViewRootDirectories()
.then ({value: directories}) -> windowProjectPaths.push(directories)
.window(windowHandles[1])
.waitForExist("atom-workspace")
.treeViewRootDirectories()
.then ({value: directories}) -> windowProjectPaths.push(directories)

View File

@@ -46,6 +46,10 @@ describe "PackageManager", ->
expect(metadata.repository.type).toBe "git"
expect(metadata.repository.url).toBe "https://github.com/example/repo.git"
{metadata} = atom.packages.loadPackage("package-with-invalid-url-package-json")
expect(metadata.repository.type).toBe "git"
expect(metadata.repository.url).toBe "foo"
it "returns null if the package is not found in any package directory", ->
spyOn(console, 'warn')
expect(atom.packages.loadPackage("this-package-cannot-be-found")).toBeNull()

View File

@@ -132,3 +132,25 @@ describe "PaneContainerElement", ->
# dynamically close pane, the pane's flexscale will recorver to origin value
lowerPane.close()
expectPaneScale [leftPane, 0.5], [rightPane, 1.5]
it "unsubscribes from mouse events when the pane is detached", ->
container.getActivePane().splitRight()
element = getResizeElement(0)
spyOn(document, 'addEventListener').andCallThrough()
spyOn(document, 'removeEventListener').andCallThrough()
spyOn(element, 'resizeStopped').andCallThrough()
element.dispatchEvent(new MouseEvent('mousedown',
view: window
bubbles: true
button: 0
))
waitsFor ->
document.addEventListener.callCount is 2
runs ->
expect(element.resizeStopped.callCount).toBe 0
container.destroy()
expect(element.resizeStopped.callCount).toBe 1
expect(document.removeEventListener.callCount).toBe 2

View File

@@ -32,11 +32,6 @@ defaultOptions =
# Target a version of the regenerator runtime that
# supports yield so the transpiled code is cleaner/smaller.
'asyncToGenerator'
# Because Atom is currently packaged with a fork of React v0.11,
# it makes sense to use the reactCompat transform so the React
# JSX transformer produces pre-v0.12 code.
'reactCompat'
]
# Includes support for es7 features listed at:

View File

@@ -87,7 +87,7 @@ class AtomApplication
openWithOptions: ({pathsToOpen, urlsToOpen, test, pidToKillWhenClosed, devMode, safeMode, apiPreviewMode, newWindow, specDirectory, logFile, profileStartup}) ->
if test
@runSpecs({exitWhenDone: true, @resourcePath, specDirectory, logFile})
@runSpecs({exitWhenDone: true, @resourcePath, specDirectory, logFile, apiPreviewMode})
else if pathsToOpen.length > 0
@openPaths({pathsToOpen, pidToKillWhenClosed, newWindow, devMode, safeMode, apiPreviewMode, profileStartup})
else if urlsToOpen.length > 0
@@ -424,12 +424,7 @@ class AtomApplication
for window in @windows
if loadSettings = window.getLoadSettings()
unless loadSettings.isSpec
states.push(_.pick(loadSettings,
'initialPaths'
'devMode'
'safeMode'
'apiPreviewMode'
))
states.push(initialPaths: loadSettings.initialPaths)
@storageFolder.store('application.json', states)
loadState: ->
@@ -438,9 +433,9 @@ class AtomApplication
@openWithOptions({
pathsToOpen: state.initialPaths
urlsToOpen: []
devMode: state.devMode
safeMode: state.safeMode
apiPreviewMode: state.apiPreviewMode
devMode: @devMode
safeMode: @safeMode
apiPreviewMode: @apiPreviewMode
})
true
else
@@ -486,7 +481,7 @@ class AtomApplication
# :specPath - The directory to load specs from.
# :safeMode - A Boolean that, if true, won't run specs from ~/.atom/packages
# and ~/.atom/dev/packages, defaults to false.
runSpecs: ({exitWhenDone, resourcePath, specDirectory, logFile, safeMode}) ->
runSpecs: ({exitWhenDone, resourcePath, specDirectory, logFile, safeMode, apiPreviewMode}) ->
if resourcePath isnt @resourcePath and not fs.existsSync(resourcePath)
resourcePath = @resourcePath
@@ -498,7 +493,8 @@ class AtomApplication
isSpec = true
devMode = true
safeMode ?= false
new AtomWindow({bootstrapScript, resourcePath, exitWhenDone, isSpec, devMode, specDirectory, logFile, safeMode})
apiPreviewMode ?= false
new AtomWindow({bootstrapScript, resourcePath, exitWhenDone, isSpec, devMode, specDirectory, logFile, safeMode, apiPreviewMode})
runBenchmarks: ({exitWhenDone, specDirectory}={}) ->
try
@@ -516,13 +512,15 @@ class AtomApplication
return {pathToOpen} unless pathToOpen
return {pathToOpen} if fs.existsSync(pathToOpen)
pathToOpen = pathToOpen.replace(/[:\s]+$/, '')
[fileToOpen, initialLine, initialColumn] = path.basename(pathToOpen).split(':')
return {pathToOpen} unless initialLine
return {pathToOpen} unless parseInt(initialLine) > 0
return {pathToOpen} unless parseInt(initialLine) >= 0
# Convert line numbers to a base of 0
initialLine -= 1 if initialLine
initialColumn -= 1 if initialColumn
initialLine = Math.max(0, initialLine - 1) if initialLine
initialColumn = Math.max(0, initialColumn - 1) if initialColumn
pathToOpen = path.join(path.dirname(pathToOpen), fileToOpen)
{pathToOpen, initialLine, initialColumn}

View File

@@ -133,7 +133,6 @@ parseCommandLine = ->
safeMode = args['safe']
apiPreviewMode = args['one']
pathsToOpen = args._
pathsToOpen = [executedFrom] if executedFrom and pathsToOpen.length is 0
test = args['test']
specDirectory = args['spec-directory']
newWindow = args['new-window']

View File

@@ -886,7 +886,7 @@ class DisplayBuffer extends Model
getDecorations: (propertyFilter) ->
allDecorations = []
for markerId, decorations of @decorationsByMarkerId
allDecorations = allDecorations.concat(decorations) if decorations?
allDecorations.push(decorations...) if decorations?
if propertyFilter?
allDecorations = allDecorations.filter (decoration) ->
for key, value of propertyFilter
@@ -1120,7 +1120,7 @@ class DisplayBuffer extends Model
{screenLines, regions} = @buildScreenLines(startBufferRow, endBufferRow + bufferDelta)
screenDelta = screenLines.length - (endScreenRow - startScreenRow)
@screenLines[startScreenRow...endScreenRow] = screenLines
_.spliceWithArray(@screenLines, startScreenRow, endScreenRow - startScreenRow, screenLines, 10000)
@rowMap.spliceRegions(startBufferRow, endBufferRow - startBufferRow, regions)
@findMaxLineLength(startScreenRow, endScreenRow, screenLines, screenDelta)

View File

@@ -34,7 +34,7 @@ class Package
repoUrl = metadata.repository?.url
if repoUrl
info = hostedGitInfo.fromUrl(repoUrl)
if info.getDefaultRepresentation() is 'shortcut'
if info?.getDefaultRepresentation() is 'shortcut'
metadata.repository.url = info.https().replace(/^git\+/, '')
@loadMetadata: (packagePath, ignoreErrors=false) ->

View File

@@ -12,6 +12,9 @@ class PaneResizeHandleElement extends HTMLElement
@isHorizontal = @parentElement.classList.contains("horizontal")
@classList.add if @isHorizontal then 'horizontal' else 'vertical'
detachedCallback: ->
@resizeStopped()
resizeToFitContent: ->
# clear flex-grow css style of both pane
@previousSibling.model.setFlexScale(1)
@@ -43,6 +46,7 @@ class PaneResizeHandleElement extends HTMLElement
resizePane: ({clientX, clientY, which}) ->
return @resizeStopped() unless which is 1
return @resizeStopped() unless @previousSibling? and @nextSibling?
if @isHorizontal
totalWidth = @previousSibling.clientWidth + @nextSibling.clientWidth