mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Implement editor:move-selection-left
This commit is contained in:
@@ -127,6 +127,8 @@
|
||||
|
||||
# Atom Specific
|
||||
'ctrl-W': 'editor:select-word'
|
||||
'cmd-ctrl-left': 'editor:move-selection-left'
|
||||
'cmd-ctrl-right': 'editor:move-selection-right'
|
||||
|
||||
# Sublime Parity
|
||||
'cmd-a': 'core:select-all'
|
||||
|
||||
@@ -74,6 +74,13 @@
|
||||
{ label: 'Join Lines', command: 'editor:join-lines' }
|
||||
]
|
||||
}
|
||||
{
|
||||
label: 'Columns',
|
||||
submenu: [
|
||||
{ label: 'Move Selection Left', command: 'editor:move-selection-left' }
|
||||
{ label: 'Move Selection Right', command: 'editor:move-selection-right' }
|
||||
]
|
||||
}
|
||||
{
|
||||
label: 'Text',
|
||||
submenu: [
|
||||
@@ -128,7 +135,6 @@
|
||||
{ label: 'Select to First Character of Line', command: 'editor:select-to-first-character-of-line' }
|
||||
{ label: 'Select to End of Word', command: 'editor:select-to-end-of-word' }
|
||||
{ label: 'Select to End of Line', command: 'editor:select-to-end-of-line' }
|
||||
{ label: 'Move Selection Right', command: 'editor:move-selection-right' }
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -343,6 +343,7 @@ atom.commands.add 'atom-text-editor:not([mini])', stopEventPropagationAndGroupUn
|
||||
'editor:checkout-head-revision': -> @checkoutHeadRevision()
|
||||
'editor:move-line-up': -> @moveLineUp()
|
||||
'editor:move-line-down': -> @moveLineDown()
|
||||
'editor:move-selection-left': -> @moveSelectionLeft()
|
||||
'editor:move-selection-right': -> @moveSelectionRight()
|
||||
'editor:duplicate-lines': -> @duplicateLines()
|
||||
'editor:join-lines': -> @joinLines()
|
||||
|
||||
@@ -932,6 +932,27 @@ class TextEditor extends Model
|
||||
|
||||
@setSelectedBufferRange(selection.translate([insertDelta]), preserveFolds: true, autoscroll: true)
|
||||
|
||||
moveSelectionLeft: ->
|
||||
selections = @getSelectedBufferRanges()
|
||||
|
||||
translationDelta = [0, -1]
|
||||
translatedRanges = []
|
||||
|
||||
@transact =>
|
||||
for selection in selections
|
||||
range = new Range(selection.start.translate(translationDelta), selection.start)
|
||||
|
||||
insertionPoint = selection.end
|
||||
text = @buffer.getTextInRange(range)
|
||||
|
||||
console.log(text)
|
||||
|
||||
@buffer.insert(insertionPoint, text)
|
||||
@buffer.delete(range)
|
||||
translatedRanges.push(selection.translate(translationDelta))
|
||||
|
||||
@setSelectedBufferRanges(translatedRanges)
|
||||
|
||||
moveSelectionRight: ->
|
||||
selections = @getSelectedBufferRanges()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user