Merge branch 'master' into bo-move-word-behavior

Conflicts:
	src/app/editor.coffee
This commit is contained in:
Ben Ogle 2013-07-23 15:34:20 -07:00
commit 1465736974
15 changed files with 65 additions and 12 deletions

View File

@ -1,3 +1,6 @@
* Improved: cmd-n now opens a new tab and cmd-shift-n now opens a new window.
* Added: Inspect Element context menu
* Fixed: Save As dialog now defaults to directory path of current editor
* Fixed: Using toggle comment shortcut respects indentation level
* Fixed: Search never completing in the command panel

View File

@ -773,6 +773,31 @@ describe "EditSession", ->
editSession.selectWord()
expect(editSession.getSelectedBufferRange()).toEqual [[12, 2], [12, 6]]
describe ".selectToFirstCharacterOfLine()", ->
it "moves to the first character of the current line or the beginning of the line if it's already on the first character", ->
editSession.setCursorScreenPosition [0,5]
editSession.addCursorAtScreenPosition [1,7]
editSession.selectToFirstCharacterOfLine()
[cursor1, cursor2] = editSession.getCursors()
expect(cursor1.getBufferPosition()).toEqual [0,0]
expect(cursor2.getBufferPosition()).toEqual [1,2]
expect(editSession.getSelections().length).toBe 2
[selection1, selection2] = editSession.getSelections()
expect(selection1.getBufferRange()).toEqual [[0,0], [0,5]]
expect(selection1.isReversed()).toBeTruthy()
expect(selection2.getBufferRange()).toEqual [[1,2], [1,7]]
expect(selection2.isReversed()).toBeTruthy()
editSession.selectToFirstCharacterOfLine()
[selection1, selection2] = editSession.getSelections()
expect(selection1.getBufferRange()).toEqual [[0,0], [0,5]]
expect(selection1.isReversed()).toBeTruthy()
expect(selection2.getBufferRange()).toEqual [[1,0], [1,7]]
expect(selection2.isReversed()).toBeTruthy()
describe ".setSelectedBufferRanges(ranges)", ->
it "clears existing selections and creates selections for each of the given ranges", ->
editSession.setSelectedBufferRanges([[[2, 2], [3, 3]], [[4, 4], [5, 5]]])

View File

@ -2,6 +2,7 @@ PaneContainer = require 'pane-container'
Pane = require 'pane'
{View} = require 'space-pen'
$ = require 'jquery'
{dirname} = require 'path'
describe "Pane", ->
[container, view1, view2, editSession1, editSession2, pane] = []
@ -373,7 +374,7 @@ describe "Pane", ->
pane.trigger 'core:save-as'
expect(atom.showSaveDialogSync).toHaveBeenCalled()
expect(atom.showSaveDialogSync).toHaveBeenCalledWith(dirname(editSession2.getPath()))
expect(editSession2.saveAs).toHaveBeenCalledWith('/selected/path')
describe "when the current item does not have a saveAs method", ->

View File

@ -199,9 +199,10 @@ window.atom =
showSaveDialog: (callback) ->
callback(showSaveDialogSync())
showSaveDialogSync: ->
showSaveDialogSync: (defaultPath) ->
defaultPath ?= project?.getPath()
currentWindow = remote.getCurrentWindow()
dialog.showSaveDialog currentWindow, title: 'Save File'
dialog.showSaveDialog currentWindow, {title: 'Save File', defaultPath}
openDevTools: ->
remote.getCurrentWindow().openDevTools()

View File

@ -1152,6 +1152,10 @@ class EditSession
selectToBeginningOfLine: ->
@expandSelectionsBackward (selection) => selection.selectToBeginningOfLine()
# Selects to the first non-whitespace character of the line.
selectToFirstCharacterOfLine: ->
@expandSelectionsBackward (selection) => selection.selectToFirstCharacterOfLine()
# Selects all the text from the current cursor position to the end of the line.
selectToEndOfLine: ->
@expandSelectionsForward (selection) => selection.selectToEndOfLine()

View File

@ -150,6 +150,7 @@ class Editor extends View
'editor:select-to-beginning-of-next-word': @selectToBeginningOfNextWord
'editor:select-to-next-word-boundary': @selectToNextWordBoundary
'editor:select-to-previous-word-boundary': @selectToPreviousWordBoundary
'editor:select-to-first-character-of-line': @selectToFirstCharacterOfLine
'editor:add-selection-below': @addSelectionBelow
'editor:add-selection-above': @addSelectionAbove
'editor:select-line': @selectLine
@ -337,6 +338,9 @@ class Editor extends View
# {Delegates to: EditSession.selectToBeginningOfLine}
selectToBeginningOfLine: -> @activeEditSession.selectToBeginningOfLine()
# {Delegates to: EditSession.selectToFirstCharacterOfLine}
selectToFirstCharacterOfLine: -> @activeEditSession.selectToFirstCharacterOfLine()
# {Delegates to: EditSession.selectToEndOfLine}
selectToEndOfLine: -> @activeEditSession.selectToEndOfLine()

View File

@ -55,8 +55,8 @@
'alt-meta-w': 'pane:close-other-items'
'meta-P': 'pane:close'
'meta-n': 'new-window'
'meta-N': 'new-editor'
'meta-n': 'new-editor'
'meta-N': 'new-window'
'meta-,': 'open-user-configuration'
'meta-o': 'open'
'meta-O': 'open-dev'

View File

@ -1,3 +1,4 @@
{dirname} = require 'path'
{View} = require 'space-pen'
$ = require 'jquery'
_ = require 'underscore'
@ -222,7 +223,10 @@ class Pane extends View
saveItemAs: (item, nextAction) ->
return unless item.saveAs?
path = atom.showSaveDialogSync()
itemPath = item.getUri?()
itemPath = dirname(itemPath) if itemPath
path = atom.showSaveDialogSync(itemPath)
if path
item.saveAs(path)
nextAction?()

View File

@ -198,6 +198,10 @@ class Selection
selectToBeginningOfLine: ->
@modifySelection => @cursor.moveToBeginningOfLine()
# Selects all the text from the current cursor position to the first character of the line.
selectToFirstCharacterOfLine: ->
@modifySelection => @cursor.moveToFirstCharacterOfLine()
# Selects all the text from the current cursor position to the end of the line.
selectToEndOfLine: ->
@modifySelection => @cursor.moveToEndOfLine()

View File

@ -13,7 +13,7 @@
.tree-view-resize-handle {
position: absolute;
top: 0;
right: 0;
right: -5px;
bottom: 0;
width: 10px;
cursor: col-resize;

View File

@ -16,6 +16,10 @@ class Task
bootstrap = """
require('coffee-script');
require('coffee-cache').setCacheDir('/tmp/atom-coffee-cache');
Object.defineProperty(require.extensions, '.coffee', {
writable: false,
value: require.extensions['.coffee']
});
require('task-bootstrap');
"""

View File

@ -98,7 +98,7 @@
bottom: 0;
width: 15px;
overflow-y: auto;
z-index: 1;
z-index: 3;
}
.editor .scroll-view {

View File

@ -9,6 +9,10 @@
try {
require('coffee-script');
require('coffee-cache').setCacheDir('/tmp/atom-coffee-cache');
Object.defineProperty(require.extensions, '.coffee', {
writable: false,
value: require.extensions['.coffee']
});
require(currentWindow.loadSettings.bootstrapScript);
currentWindow.emit('window:loaded');
}

View File

@ -24,11 +24,10 @@
}
.selection .region {
background-color: #333333;
background-color: #444444;
}
.line-number.cursor-line-no-selection,
.line.cursor-line {
.line-number.cursor-line-no-selection {
background-color: rgba(255, 255, 255, 0.14);
}

2
vendor/apm vendored

@ -1 +1 @@
Subproject commit ac0e54801b8fc1389c1810f0d4ac6670ff8a5602
Subproject commit b16d6d3acc5c2309eb664032f23ff9e433afc0e5