Merge branch 'master' of github.com:github/atom

This commit is contained in:
Nathan Sobo
2012-03-29 11:12:23 -07:00
7 changed files with 99 additions and 6 deletions

View File

@@ -158,7 +158,7 @@ class Buffer
if matchEndIndex > endIndex
regex.lastIndex = 0
if matchStartIndex < endIndex and match = regex.exec(text[matchStartIndex..endIndex])
if matchStartIndex < endIndex and match = regex.exec(text[matchStartIndex...endIndex])
matchLength = match[0].length
matchEndIndex = matchStartIndex + matchLength
else

View File

@@ -95,6 +95,14 @@ class CompositeSeleciton
selection.selectToEndOfLine() for selection in @getSelections()
@mergeIntersectingSelections()
selectToBeginningOfWord: ->
selection.selectToBeginningOfWord() for selection in @getSelections()
@mergeIntersectingSelections reverse: true
selectToEndOfWord: ->
selection.selectToEndOfWord() for selection in @getSelections()
@mergeIntersectingSelections()
setBufferRange: (bufferRange, options) ->
@getLastSelection().setBufferRange(bufferRange, options)

View File

@@ -116,6 +116,8 @@ class Editor extends View
@on 'select-to-bottom', => @selectToBottom()
@on 'select-to-end-of-line', => @selectToEndOfLine()
@on 'select-to-beginning-of-line', => @selectToBeginningOfLine()
@on 'select-to-end-of-word', => @selectToEndOfWord()
@on 'select-to-beginning-of-word', => @selectToBeginningOfWord()
buildCursorAndSelection: ->
@compositeSelection = new CompositeSelection(this)
@@ -395,8 +397,10 @@ class Editor extends View
selectDown: -> @compositeSelection.selectDown()
selectToTop: -> @compositeSelection.selectToTop()
selectToBottom: -> @compositeSelection.selectToBottom()
selectToEndOfLine: -> @compositeSelection.selectToEndOfLine()
selectToBeginningOfLine: -> @compositeSelection.selectToBeginningOfLine()
selectToEndOfLine: -> @compositeSelection.selectToEndOfLine()
selectToBeginningOfWord: -> @compositeSelection.selectToBeginningOfWord()
selectToEndOfWord: -> @compositeSelection.selectToEndOfWord()
selectToScreenPosition: (position) -> @compositeSelection.selectToScreenPosition(position)
clearSelections: -> @compositeSelection.clearSelections()

View File

@@ -1,9 +1,13 @@
window.keymap.bindKeys '.editor'
'meta-up': 'move-to-top'
'meta-shift-up': 'select-to-top'
'meta-down': 'move-to-bottom'
'meta-shift-down': 'select-to-bottom'
'meta-right': 'move-to-end-of-line'
'meta-left': 'move-to-beginning-of-line'
'alt-left': 'move-to-beginning-of-word'
'alt-right': 'move-to-end-of-word'
'alt-right': 'move-to-end-of-word'
'meta-shift-up': 'select-to-top'
'meta-shift-down': 'select-to-bottom'
'meta-shift-left': 'select-to-beginning-of-line'
'meta-shift-right': 'select-to-end-of-line'
'alt-shift-left': 'select-to-beginning-of-word'
'alt-shift-right': 'select-to-end-of-word'

View File

@@ -236,6 +236,14 @@ class Selection extends View
@modifySelection =>
@cursor.moveToEndOfLine()
selectToBeginningOfWord: ->
@modifySelection =>
@cursor.moveToBeginningOfWord()
selectToEndOfWord: ->
@modifySelection =>
@cursor.moveToEndOfWord()
cut: (maintainPasteboard=false) ->
@copy(maintainPasteboard)
@delete()