Merge branch 'master' into asar

This commit is contained in:
Cheng Zhao
2015-04-03 19:50:53 +08:00
9 changed files with 85 additions and 16 deletions

View File

@@ -32,12 +32,12 @@
"delegato": "^1",
"emissary": "^1.3.3",
"event-kit": "^1.0.3",
"first-mate": "^3.0.0",
"first-mate": "^3.0.1",
"fs-plus": "^2.6",
"fstream": "0.1.24",
"fuzzaldrin": "^2.1",
"git-utils": "^3.0.0",
"grim": "1.2",
"grim": "1.2.1",
"jasmine-json": "~0.0",
"jasmine-tagged": "^1.1.4",
"jquery": "^2.1.1",
@@ -64,9 +64,9 @@
"space-pen": "3.8.2",
"stacktrace-parser": "0.1.1",
"temp": "0.8.1",
"text-buffer": "^5.1.0",
"text-buffer": "^5.1.1",
"theorist": "^1.0.2",
"typescript-simple": "^1.0.0",
"typescript-simple": "1.0.0",
"underscore-plus": "^1.6.6"
},
"packageDependencies": {
@@ -82,7 +82,7 @@
"one-light-ui": "0.4.0",
"solarized-dark-syntax": "0.32.0",
"solarized-light-syntax": "0.19.0",
"archive-view": "0.53.0",
"archive-view": "0.55.0",
"autocomplete": "0.44.0",
"autoflow": "0.22.0",
"autosave": "0.20.0",
@@ -102,7 +102,7 @@
"grammar-selector": "0.46.0",
"image-view": "0.54.0",
"incompatible-packages": "0.24.0",
"keybinding-resolver": "0.29.0",
"keybinding-resolver": "0.30.0",
"link": "0.30.0",
"markdown-preview": "0.146.0",
"metrics": "0.45.0",
@@ -123,7 +123,7 @@
"welcome": "0.26.0",
"whitespace": "0.29.0",
"wrap-guide": "0.31.0",
"language-c": "0.42.0",
"language-c": "0.43.0",
"language-clojure": "0.13.0",
"language-coffee-script": "0.39.0",
"language-csharp": "0.5.0",

View File

@@ -724,6 +724,21 @@ describe "DisplayBuffer", ->
expect(displayBuffer.clipScreenPosition([0, 1], clip: 'forward')).toEqual [0, tabLength]
expect(displayBuffer.clipScreenPosition([0, tabLength], clip: 'forward')).toEqual [0, tabLength]
describe "::screenPositionForPixelPosition(pixelPosition)", ->
it "clips pixel positions above buffer start", ->
displayBuffer.setLineHeightInPixels(20)
expect(displayBuffer.screenPositionForPixelPosition(top: -Infinity, left: -Infinity)).toEqual [0, 0]
expect(displayBuffer.screenPositionForPixelPosition(top: -Infinity, left: Infinity)).toEqual [0, 0]
expect(displayBuffer.screenPositionForPixelPosition(top: -1, left: Infinity)).toEqual [0, 0]
expect(displayBuffer.screenPositionForPixelPosition(top: 0, left: Infinity)).toEqual [0, 29]
it "clips pixel positions below buffer end", ->
displayBuffer.setLineHeightInPixels(20)
expect(displayBuffer.screenPositionForPixelPosition(top: Infinity, left: -Infinity)).toEqual [12, 2]
expect(displayBuffer.screenPositionForPixelPosition(top: Infinity, left: Infinity)).toEqual [12, 2]
expect(displayBuffer.screenPositionForPixelPosition(top: displayBuffer.getHeight() + 1, left: 0)).toEqual [12, 2]
expect(displayBuffer.screenPositionForPixelPosition(top: displayBuffer.getHeight() - 1, left: 0)).toEqual [12, 0]
describe "::screenPositionForBufferPosition(bufferPosition, options)", ->
it "clips the specified buffer position", ->
expect(displayBuffer.screenPositionForBufferPosition([0, 2])).toEqual [0, 2]

View File

@@ -1419,6 +1419,22 @@ describe "TextEditorComponent", ->
beforeEach ->
linesNode = componentNode.querySelector('.lines')
describe "when the mouse is single-clicked above the first line", ->
it "moves the cursor to the start of file buffer position", ->
editor.setText('foo')
editor.setCursorBufferPosition([0, 3])
height = 4.5 * lineHeightInPixels
wrapperNode.style.height = height + 'px'
wrapperNode.style.width = 10 * charWidth + 'px'
component.measureDimensions()
nextAnimationFrame()
coordinates = clientCoordinatesForScreenPosition([0, 2])
coordinates.clientY = -1
linesNode.dispatchEvent(buildMouseEvent('mousedown', coordinates))
nextAnimationFrame()
expect(editor.getCursorScreenPosition()).toEqual [0, 0]
describe "when the mouse is single-clicked below the last line", ->
it "moves the cursor to the end of file buffer position", ->
editor.setText('foo')

View File

@@ -2730,6 +2730,20 @@ describe "TextEditor", ->
"""
describe "when many selections get added in shuffle order", ->
it "cuts them in order", ->
editor.setSelectedBufferRanges([
[[2,8], [2, 13]]
[[0,4], [0,13]],
[[1,6], [1, 10]],
])
editor.cutSelectedText()
expect(atom.clipboard.read()).toEqual """
quicksort
sort
items
"""
describe ".cutToEndOfLine()", ->
describe "when soft wrap is on", ->
it "cuts up to the end of the line", ->
@@ -2792,6 +2806,20 @@ describe "TextEditor", ->
[[5, 8], [5, 8]]
])
describe "when many selections get added in shuffle order", ->
it "copies them in order", ->
editor.setSelectedBufferRanges([
[[2,8], [2, 13]]
[[0,4], [0,13]],
[[1,6], [1, 10]],
])
editor.copySelectedText()
expect(atom.clipboard.read()).toEqual """
quicksort
sort
items
"""
describe ".pasteText()", ->
copyText = (text, {startColumn, textEditor}={}) ->
startColumn ?= 0
@@ -2886,8 +2914,12 @@ describe "TextEditor", ->
editor.setSelectedBufferRanges([[[0, 4], [0, 13]], [[1, 6], [1, 10]]])
editor.copySelectedText()
it "pastes each selection separately into the buffer", ->
editor.copySelectedText()
it "pastes each selection in order separately into the buffer", ->
editor.setSelectedBufferRanges([
[[1, 6], [1, 10]]
[[0, 4], [0, 13]],
])
editor.moveRight()
editor.insertText("_")
editor.pasteText()

View File

@@ -768,7 +768,7 @@ class Atom extends Model
callback(showSaveDialogSync())
showSaveDialogSync: (defaultPath) ->
defaultPath ?= @project?.getPath()
defaultPath ?= @project?.getPaths()[0]
currentWindow = @getCurrentWindow()
dialog = remote.require('dialog')
dialog.showSaveDialog currentWindow, {title: 'Save File', defaultPath}

View File

@@ -33,6 +33,10 @@ class AutoUpdateManager
else
autoUpdater = require 'auto-updater'
autoUpdater.on 'error', (event, message) =>
@setState(ErrorState)
console.error "Error Downloading Update: #{message}"
autoUpdater.setFeedUrl @feedUrl
autoUpdater.on 'checking-for-update', =>
@@ -44,10 +48,6 @@ class AutoUpdateManager
autoUpdater.on 'update-available', =>
@setState(DownladingState)
autoUpdater.on 'error', (event, message) =>
@setState(ErrorState)
console.error "Error Downloading Update: #{message}"
autoUpdater.on 'update-downloaded', (event, releaseNotes, @releaseVersion) =>
@setState(UpdateAvailableState)
@emitUpdateAvailableEvent(@getWindows()...)

View File

@@ -692,6 +692,7 @@ class DisplayBuffer extends Model
targetLeft = pixelPosition.left
defaultCharWidth = @defaultCharWidth
row = Math.floor(targetTop / @getLineHeightInPixels())
targetLeft = 0 if row < 0
targetLeft = Infinity if row > @getLastRow()
row = Math.min(row, @getLastRow())
row = Math.max(0, row)

View File

@@ -2,6 +2,7 @@ _ = require 'underscore-plus'
{deprecate} = require 'grim'
{specificity} = require 'clear-cut'
{Subscriber} = require 'emissary'
{Emitter} = require 'event-kit'
FirstMate = require 'first-mate'
{ScopeSelector} = FirstMate
ScopedPropertyStore = require 'scoped-property-store'
@@ -69,3 +70,7 @@ class GrammarRegistry extends FirstMate.GrammarRegistry
propertiesForScope: (scope, keyPath) ->
deprecate 'Use atom.config.getAll instead.'
atom.config.settingsForScopeDescriptor(scope, keyPath)
clearObservers: ->
@off()
@emitter = new Emitter

View File

@@ -843,7 +843,7 @@ class TextEditor extends Model
mutateSelectedText: (fn) ->
@mergeIntersectingSelections =>
@transact =>
fn(selection, index) for selection, index in @getSelections()
fn(selection, index) for selection, index in @getSelectionsOrderedByBufferPosition()
# Move lines intersection the most recent selection up by one row in screen
# coordinates.
@@ -2621,7 +2621,7 @@ class TextEditor extends Model
# Essential: For each selection, copy the selected text.
copySelectedText: ->
maintainClipboard = false
for selection in @getSelections()
for selection in @getSelectionsOrderedByBufferPosition()
if selection.isEmpty()
previousRange = selection.getBufferRange()
selection.selectLine()