Merge branch 'master' into cj-add-react-editor-shims

This commit is contained in:
Nathan Sobo
2014-06-11 06:48:16 -06:00
7 changed files with 62 additions and 10 deletions

View File

@@ -75,7 +75,7 @@
"autosave": "0.13.0",
"background-tips": "0.14.0",
"bookmarks": "0.23.0",
"bracket-matcher": "0.44.0",
"bracket-matcher": "0.45.0",
"command-palette": "0.22.0",
"deprecation-cop": "0.6.0",
"dev-live-reload": "0.31.0",
@@ -116,7 +116,7 @@
"language-html": "0.22.0",
"language-hyperlink": "0.10.0",
"language-java": "0.10.0",
"language-javascript": "0.26.0",
"language-javascript": "0.27.0",
"language-json": "0.8.0",
"language-less": "0.9.0",
"language-make": "0.10.0",

View File

@@ -24,9 +24,9 @@ function executeCommands(commands, done, index) {
function bootstrap() {
var apmInstallPath = path.resolve(__dirname, '..', 'apm');
if (!fs.existsSync(apmInstallPath))
fs.mkdirSync(apmInstallPath);
fs.mkdirSync(apmInstallPath);
if (!fs.existsSync(path.join(apmInstallPath, 'node_modules')))
fs.mkdirSync(path.join(apmInstallPath, 'node_modules'));
fs.mkdirSync(path.join(apmInstallPath, 'node_modules'));
var apmPath = path.resolve(__dirname, '..', 'apm', 'node_modules', 'atom-package-manager', 'bin', 'apm')
var apmFlags = process.env.JANKY_SHA1 || process.argv.indexOf('--no-color') !== -1 ? '--no-color' : '';
@@ -39,12 +39,12 @@ function bootstrap() {
var echoNewLine = process.platform == 'win32' ? 'echo.' : 'echo';
var commands = [
{command: initialNpmCommand + npmFlags + 'install --quiet', options: {cwd: path.resolve(__dirname, '..', 'build'), ignoreStdout: true}},
{command: npmPath + npmFlags + 'install --quiet', options: {cwd: apmInstallPath, ignoreStdout: true}},
echoNewLine,
apmPath + ' clean ' + apmFlags,
apmPath + ' install --quiet ' + apmFlags,
apmPath + ' dedupe --quiet ' + apmFlags + ' ' + packagesToDedupe.join(' '),
{command: initialNpmCommand + npmFlags + 'install --quiet', options: {cwd: path.resolve(__dirname, '..', 'build'), ignoreStdout: true}},
{command: npmPath + npmFlags + 'install --quiet', options: {cwd: apmInstallPath, ignoreStdout: true}},
echoNewLine,
apmPath + ' clean ' + apmFlags,
apmPath + ' install --quiet ' + apmFlags,
apmPath + ' dedupe --quiet ' + apmFlags + ' ' + packagesToDedupe.join(' '),
];
process.chdir(path.dirname(__dirname));

View File

@@ -863,6 +863,30 @@ describe "Editor", ->
expect(selection1.getScreenRange()).toEqual [[3, 0], [4, 5]]
expect(selection2.getScreenRange()).toEqual [[5, 6], [6, 2]]
describe ".selectToBeginningOfNextParagraph()", ->
it "selects from the cursor to first line of the next paragraph", ->
editor.setSelectedBufferRange([[3, 0], [4, 5]])
editor.addCursorAtScreenPosition([5, 6])
editor.selectToScreenPosition([6, 2])
editor.selectToBeginningOfNextParagraph()
selections = editor.getSelections()
expect(selections.length).toBe 1
expect(selections[0].getScreenRange()).toEqual [[3, 0], [10, 0]]
describe ".selectToBeginningOfPreviousParagraph()", ->
it "selects from the cursor to the first line of the pevious paragraph", ->
editor.setSelectedBufferRange([[3, 0], [4, 5]])
editor.addCursorAtScreenPosition([5, 6])
editor.selectToScreenPosition([6, 2])
editor.selectToBeginningOfPreviousParagraph()
selections = editor.getSelections()
expect(selections.length).toBe 1
expect(selections[0].getScreenRange()).toEqual [[0, 0], [5, 6]]
it "merges selections if they intersect, maintaining the directionality of the last selection", ->
editor.setCursorScreenPosition([4, 10])
editor.selectToScreenPosition([5, 27])

View File

@@ -306,6 +306,8 @@ EditorComponent = React.createClass
'editor:move-to-beginning-of-next-word': => editor.moveCursorToBeginningOfNextWord()
'editor:move-to-previous-word-boundary': => editor.moveCursorToPreviousWordBoundary()
'editor:move-to-next-word-boundary': => editor.moveCursorToNextWordBoundary()
'editor:select-to-beginning-of-next-paragraph': => editor.selectToBeginningOfNextParagraph()
'editor:select-to-beginning-of-previous-paragraph': => editor.selectToBeginningOfPreviousParagraph()
'editor:select-to-end-of-line': => editor.selectToEndOfLine()
'editor:select-to-beginning-of-line': => editor.selectToBeginningOfLine()
'editor:select-to-end-of-word': => editor.selectToEndOfWord()

View File

@@ -171,6 +171,8 @@ class EditorView extends View
'editor:move-to-beginning-of-next-word': => @editor.moveCursorToBeginningOfNextWord()
'editor:move-to-previous-word-boundary': => @editor.moveCursorToPreviousWordBoundary()
'editor:move-to-next-word-boundary': => @editor.moveCursorToNextWordBoundary()
'editor:select-to-beginning-of-next-paragraph': => @editor.selectToBeginningOfNextParagraph()
'editor:select-to-beginning-of-previous-paragraph': => @editor.selectToBeginningOfPreviousParagraph()
'editor:select-to-end-of-line': => @editor.selectToEndOfLine()
'editor:select-to-beginning-of-line': => @editor.selectToBeginningOfLine()
'editor:select-to-end-of-word': => @editor.selectToEndOfWord()

View File

@@ -1829,6 +1829,20 @@ class Editor extends Model
selectWord: ->
@expandSelectionsForward (selection) => selection.selectWord()
# Public: Expand selections to the beginning of the next paragraph.
#
# Operates on all selections. Moves the cursor to the beginning of the next
# paragraph while preserving the selection's tail position.
selectToBeginningOfNextParagraph: ->
@expandSelectionsForward (selection) => selection.selectToBeginningOfNextParagraph()
# Public: Expand selections to the beginning of the next paragraph.
#
# Operates on all selections. Moves the cursor to the beginning of the next
# paragraph while preserving the selection's tail position.
selectToBeginningOfPreviousParagraph: ->
@expandSelectionsBackward (selection) => selection.selectToBeginningOfPreviousParagraph()
# Public: Select the range of the given marker if it is valid.
#
# marker - A {DisplayBufferMarker}

View File

@@ -236,6 +236,16 @@ class Selection extends Model
selectToNextWordBoundary: ->
@modifySelection => @cursor.moveToNextWordBoundary()
# Public: Selects all the text from the current cursor position to the
# beginning of the next paragraph.
selectToBeginningOfNextParagraph: ->
@modifySelection => @cursor.moveToBeginningOfNextParagraph()
# Public: Selects all the text from the current cursor position to the
# beginning of the previous paragraph.
selectToBeginningOfPreviousParagraph: ->
@modifySelection => @cursor.moveToBeginningOfPreviousParagraph()
# Public: Moves the selection down one row.
addSelectionBelow: ->
range = (@getGoalBufferRange() ? @getBufferRange()).copy()