mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Meta-a selects everything
This commit is contained in:
@@ -407,6 +407,7 @@ describe "Editor", ->
|
||||
|
||||
otherEditor.simulateDomAttachment()
|
||||
expect(otherEditor.setMaxLineLength).toHaveBeenCalled()
|
||||
|
||||
describe "when some lines at the end of the buffer are not visible on screen when the editor is attached", ->
|
||||
beforeEach ->
|
||||
editor.attachToDom(heightInLines: 5.5)
|
||||
@@ -1330,6 +1331,11 @@ describe "Editor", ->
|
||||
expect(editor.getSelection().getBufferRange()).toEqual [[9,3], [12,2]]
|
||||
expect(editor.getSelection().isReversed()).toBeFalsy()
|
||||
|
||||
describe "select-all", ->
|
||||
it "selects the entire buffer", ->
|
||||
editor.trigger 'select-all'
|
||||
expect(editor.getSelection().getBufferRange()).toEqual buffer.getRange()
|
||||
|
||||
describe "select-to-beginning-of-line", ->
|
||||
it "selects text from cusor position to beginning of line", ->
|
||||
editor.setCursorScreenPosition [12,2]
|
||||
|
||||
@@ -127,6 +127,9 @@ class CompositeSeleciton
|
||||
selectToTop: ->
|
||||
@expandSelectionsBackward (selection) => selection.selectToTop()
|
||||
|
||||
selectAll: ->
|
||||
@expandSelectionsForward (selection) => selection.selectAll()
|
||||
|
||||
selectToBottom: ->
|
||||
@expandSelectionsForward (selection) => selection.selectToBottom()
|
||||
|
||||
|
||||
@@ -140,6 +140,7 @@ class Editor extends View
|
||||
'select-to-beginning-of-line': @selectToBeginningOfLine
|
||||
'select-to-end-of-word': @selectToEndOfWord
|
||||
'select-to-beginning-of-word': @selectToBeginningOfWord
|
||||
'select-all': @selectAll
|
||||
|
||||
for name, method of editorBindings
|
||||
do (name, method) =>
|
||||
@@ -588,6 +589,7 @@ class Editor extends View
|
||||
selectDown: -> @compositeSelection.selectDown()
|
||||
selectToTop: -> @compositeSelection.selectToTop()
|
||||
selectToBottom: -> @compositeSelection.selectToBottom()
|
||||
selectAll: -> @compositeSelection.selectAll()
|
||||
selectToBeginningOfLine: -> @compositeSelection.selectToBeginningOfLine()
|
||||
selectToEndOfLine: -> @compositeSelection.selectToEndOfLine()
|
||||
selectToBeginningOfWord: -> @compositeSelection.selectToBeginningOfWord()
|
||||
|
||||
@@ -16,6 +16,7 @@ window.keymap.bindKeys '.editor',
|
||||
'shift-left': 'select-left'
|
||||
'shift-up': 'select-up'
|
||||
'shift-down': 'select-down'
|
||||
'meta-a': 'select-all'
|
||||
enter: 'newline'
|
||||
tab: 'tab'
|
||||
backspace: 'backspace'
|
||||
|
||||
@@ -206,6 +206,9 @@ class Selection extends View
|
||||
selectToBottom: ->
|
||||
@modifySelection => @cursor.moveToBottom()
|
||||
|
||||
selectAll: ->
|
||||
@setBufferRange(@editor.buffer.getRange())
|
||||
|
||||
selectToBeginningOfLine: ->
|
||||
@modifySelection => @cursor.moveToBeginningOfLine()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user