Merge branch 'master' into ns-pane-splits-with-models

This commit is contained in:
Nathan Sobo
2014-01-10 10:40:52 -07:00
19 changed files with 105 additions and 26 deletions

View File

@@ -210,7 +210,7 @@ module.exports = (grunt) ->
grunt.registerTask('compile', ['coffee', 'prebuild-less', 'cson'])
grunt.registerTask('lint', ['coffeelint', 'csslint', 'lesslint'])
grunt.registerTask('test', ['shell:kill-atom', 'run-specs'])
grunt.registerTask('ci', ['download-atom-shell', 'build', 'set-development-version', 'lint', 'test', 'publish-build'])
grunt.registerTask('ci', ['output-disk-space', 'download-atom-shell', 'build', 'set-development-version', 'lint', 'test', 'publish-build'])
grunt.registerTask('deploy', ['partial-clean', 'download-atom-shell', 'build', 'codesign'])
grunt.registerTask('docs', ['markdown:guides', 'build-docs'])
grunt.registerTask('default', ['download-atom-shell', 'build', 'set-development-version', 'install'])

View File

@@ -0,0 +1,25 @@
module.exports = (grunt) ->
{spawn} = require('./task-helpers')(grunt)
grunt.registerTask 'output-disk-space', 'Print diskspace available', ->
return unless process.platform is 'darwin'
done = @async()
cmd = 'df'
args = ['-Hl']
spawn {cmd, args}, (error, result, code) ->
return done(error) if error?
lines = result.stdout.split("\n")
for line in lines[1..]
[filesystem, size, used, avail, capacity, extra] = line.split(/\s+/)
capacity = parseInt(capacity)
if capacity > 90
grunt.log.error("#{filesystem} is at #{capacity}% capacity!")
else if capacity > 80
grunt.log.ok("#{filesystem} is at #{capacity}% capacity.")
done()

View File

@@ -39,7 +39,7 @@ module.exports = (grunt) ->
proc = childProcess.spawn(options.cmd, options.args, options.opts)
proc.stdout.on 'data', (data) -> stdout.push(data.toString())
proc.stderr.on 'data', (data) -> stderr.push(data.toString())
proc.on 'exit', (exitCode, signal) ->
proc.on 'close', (exitCode, signal) ->
error = new Error(signal) if exitCode != 0
results = {stderr: stderr.join(''), stdout: stdout.join(''), code: exitCode}
grunt.log.error results.stderr if exitCode != 0

View File

@@ -111,6 +111,7 @@
'cmd-alt-p': 'editor:log-cursor-scope'
'cmd-k cmd-u': 'editor:upper-case'
'cmd-k cmd-l': 'editor:lower-case'
'cmd-l': 'editor:select-line'
'body.platform-darwin .editor:not(.mini)':
# Atom specific
@@ -129,6 +130,7 @@
'cmd-/': 'editor:toggle-line-comments'
'cmd-j': 'editor:join-line'
'cmd-D': 'editor:duplicate-line'
'cmd-L': 'editor:split-selections-into-lines'
'cmd-alt-[': 'editor:fold-current-row'
'cmd-alt-]': 'editor:unfold-current-row'

View File

@@ -99,6 +99,7 @@
submenu: [
{ label: 'Add Selection Above', command: 'editor:add-selection-above' }
{ label: 'Add Selection Below', command: 'editor:add-selection-below' }
{ label: 'Split into Lines', command: 'editor:split-selections-into-lines'}
{ type: 'separator' }
{ label: 'Select to Top', command: 'core:select-to-top' }
{ label: 'Select to Bottom', command: 'core:select-to-bottom' }

View File

@@ -106,6 +106,7 @@
submenu: [
{ label: 'Add Selection &Above', command: 'editor:add-selection-above' }
{ label: 'Add Selection &Below', command: 'editor:add-selection-below' }
{ label: 'S&plit into Lines', command: 'editor:split-selections-into-lines'}
{ type: 'separator' }
{ label: 'Select to &Top', command: 'core:select-to-top' }
{ label: 'Select to Botto&m', command: 'core:select-to-bottom' }

View File

@@ -24,10 +24,10 @@
"coffee-script": "1.6.3",
"coffeestack": "0.6.0",
"emissary": "0.19.0",
"first-mate": "0.11.0",
"first-mate": "0.14.0",
"fs-plus": "0.14.0",
"fstream": "0.1.24",
"fuzzaldrin": "0.1.0",
"fuzzaldrin": "0.5.0",
"git-utils": "0.29.0",
"guid": "0.0.10",
"jasmine-focused": "~0.15.0",
@@ -73,22 +73,22 @@
"command-palette": "0.14.0",
"dev-live-reload": "0.22.0",
"editor-stats": "0.12.0",
"exception-reporting": "0.9.0",
"exception-reporting": "0.10.0",
"feedback": "0.22.0",
"find-and-replace": "0.68.0",
"fuzzy-finder": "0.28.0",
"find-and-replace": "0.70.0",
"fuzzy-finder": "0.30.0",
"gists": "0.13.0",
"git-diff": "0.21.0",
"github-sign-in": "0.15.0",
"go-to-line": "0.12.0",
"grammar-selector": "0.15.0",
"go-to-line": "0.14.0",
"grammar-selector": "0.16.0",
"image-view": "0.14.0",
"keybinding-resolver": "0.8.0",
"markdown-preview": "0.22.0",
"markdown-preview": "0.23.0",
"metrics": "0.20.0",
"package-generator": "0.23.0",
"release-notes": "0.15.0",
"settings-view": "0.54.0",
"settings-view": "0.55.0",
"snippets": "0.17.0",
"spell-check": "0.18.0",
"status-bar": "0.30.0",
@@ -97,7 +97,7 @@
"tabs": "0.16.0",
"terminal": "0.23.0",
"timecop": "0.12.0",
"to-the-hubs": "0.16.0",
"to-the-hubs": "0.17.0",
"tree-view": "0.58.0",
"visual-bell": "0.6.0",
"welcome": "0.4.0",

View File

@@ -819,6 +819,11 @@ describe "Editor", ->
editor.selectLine()
expect(editor.getSelectedBufferRange()).toEqual [[12,0], [12,2]]
editor.setCursorBufferPosition([0, 2])
editor.selectLine()
editor.selectLine()
expect(editor.getSelectedBufferRange()).toEqual [[0,0], [2,0]]
describe ".selectToBeginningOfWord()", ->
it "selects text from cusor position to beginning of word", ->
editor.setCursorScreenPosition [0,13]
@@ -1181,6 +1186,27 @@ describe "Editor", ->
[[10, 0], [10, 0]]
]
describe ".splitSelectionsIntoLines()", ->
it "splits all multi-line selections into one selection per line", ->
editor.setSelectedBufferRange([[0, 3], [2, 4]])
editor.splitSelectionsIntoLines()
expect(editor.getSelectedBufferRanges()).toEqual [
[[0, 3], [0, 29]]
[[1, 0], [1, 30]]
[[2, 0], [2, 4]]
]
editor.setSelectedBufferRange([[0, 3], [1, 10]])
editor.splitSelectionsIntoLines()
expect(editor.getSelectedBufferRanges()).toEqual [
[[0, 3], [0, 29]]
[[1, 0], [1, 10]]
]
editor.setSelectedBufferRange([[0, 0], [0, 3]])
editor.splitSelectionsIntoLines()
expect(editor.getSelectedBufferRanges()).toEqual [[[0, 0], [0, 3]]]
describe ".consolidateSelections()", ->
it "destroys all selections but the most recent, returning true if any selections were destroyed", ->
editor.setSelectedBufferRange([[3, 16], [3, 21]])

View File

@@ -52,12 +52,6 @@ class AtomPackage extends Package
console.warn "Failed to load package named '#{@name}'", e.stack ? e
this
enable: ->
atom.config.removeAtKeyPath('core.disabledPackages', @metadata.name)
disable: ->
atom.config.pushAtKeyPath('core.disabledPackages', @metadata.name)
reset: ->
@stylesheets = []
@keymaps = []

View File

@@ -52,6 +52,8 @@ class AtomApplication
resourcePath: null
version: null
exit: (status) -> app.exit(status)
constructor: (options) ->
{@resourcePath, @version, @devMode} = options
global.atomApplication = this

View File

@@ -18,7 +18,7 @@ class AtomWindow
isSpec: null
constructor: (settings={}) ->
{@resourcePath, pathToOpen, initialLine, @isSpec} = settings
{@resourcePath, pathToOpen, initialLine, @isSpec, @exitWhenDone} = settings
global.atomApplication.addWindow(this)
@setupNodePath(@resourcePath)
@@ -82,7 +82,7 @@ class AtomWindow
@browserWindow.destroy() if chosen is 0
@browserWindow.on 'crashed', =>
atom.exit(100) if @isSpec
global.atomApplication.exit(100) if @exitWhenDone
chosen = dialog.showMessageBox @browserWindow,
type: 'warning'

View File

@@ -73,11 +73,11 @@ class Directory
if fullPath is @getPath()
''
else if fullPath.indexOf(path.join(@getPath(), path.sep)) is 0
else if @isPathPrefixOf(@getPath(), fullPath)
fullPath.substring(@getPath().length + 1)
else if fullPath is @getRealPathSync()
''
else if fullPath.indexOf(path.join(@getRealPathSync(), path.sep)) is 0
else if @isPathPrefixOf(@getRealPathSync(), fullPath)
fullPath.substring(@getRealPathSync().length + 1)
else
fullPath
@@ -139,3 +139,7 @@ class Directory
if @watchSubscription?
@watchSubscription.close()
@watchSubscription = null
# Private: Does given full path start with the given prefix?
isPathPrefixOf: (prefix, fullPath) ->
fullPath.indexOf(prefix) is 0 and fullPath[prefix.length] is path.sep

View File

@@ -168,7 +168,7 @@ class DisplayBufferMarker
# Returns a {String} representation of the marker
inspect: ->
"DisplayBufferMarker(id: #{@id}, bufferRange: #{@getBufferRange().inspect()})"
"DisplayBufferMarker(id: #{@id}, bufferRange: #{@getBufferRange()})"
### Internal ###

View File

@@ -183,6 +183,7 @@ class EditorView extends View
'editor:newline-above': @insertNewlineAbove
'editor:add-selection-below': @addSelectionBelow
'editor:add-selection-above': @addSelectionAbove
'editor:split-selections-into-lines': => @editor.splitSelectionsIntoLines()
'editor:toggle-soft-tabs': @toggleSoftTabs
'editor:toggle-soft-wrap': @toggleSoftWrap
'editor:fold-all': @foldAll

View File

@@ -1191,6 +1191,23 @@ class Editor extends Model
addSelectionAbove: ->
@expandSelectionsBackward (selection) => selection.addSelectionAbove()
# Public: Split any multi-line selections into one selection per line.
#
# This methods break apart all multi-line selections to create multiple
# single-line selections that cumulatively cover the same original area.
splitSelectionsIntoLines: ->
for selection in @getSelections()
range = selection.getBufferRange()
continue if range.isSingleLine()
selection.destroy()
{start, end} = range
@addSelectionForBufferRange([start, [start.row, Infinity]])
{row} = start
while ++row < end.row
@addSelectionForBufferRange([[row, 0], [row, Infinity]])
@addSelectionForBufferRange([[end.row, 0], [end.row, end.column]])
# Public: Transposes the current text selections.
#
# The text in each selection is reversed so `abcd` would become `dcba`. The

View File

@@ -47,6 +47,12 @@ class Package
isActive: ->
atom.packages.isPackageActive(@name)
enable: ->
atom.config.removeAtKeyPath('core.disabledPackages', @metadata.name)
disable: ->
atom.config.pushAtKeyPath('core.disabledPackages', @metadata.name)
isTheme: ->
!!@metadata?.theme

View File

@@ -39,7 +39,7 @@ class PaneContainer extends View
### Public ###
itemDestroyed: (item) ->
@trigger 'item-destroyed', item
@trigger 'item-destroyed', [item]
getRoot: ->
@children().first().view()

View File

@@ -300,7 +300,7 @@ class Project extends Model
promise = deferred.promise
promise.cancel = ->
task.terminate()
deferred.reject('cancelled')
deferred.resolve('cancelled')
promise
# Public: Performs a replace across all the specified files in the project.

View File

@@ -132,7 +132,7 @@ class Selection
# The line Number to select (default: the row of the cursor)
selectLine: (row=@cursor.getBufferPosition().row) ->
range = @editor.bufferRangeForBufferRow(row, includeNewline: true)
@setBufferRange(range)
@setBufferRange(@getBufferRange().union(range))
@linewise = true
@wordwise = false
@initialScreenRange = @getScreenRange()