mirror of
https://github.com/atom/atom.git
synced 2026-01-24 22:38:20 -05:00
Refactor dd to push a SelectLine operation on top of Delete
Delete expects to compose with a motion, which selects the text to be deleted. SelectLine slots in cleanly to make dd delete the current line.
This commit is contained in:
@@ -80,6 +80,9 @@ class Editor extends Template
|
||||
deleteChar: ->
|
||||
@aceEditor.remove 'right'
|
||||
|
||||
selectLine: ->
|
||||
@aceEditor.selection.selectLine()
|
||||
|
||||
deleteLine: ->
|
||||
@aceEditor.removeLines()
|
||||
|
||||
|
||||
@@ -87,4 +87,9 @@ module.exports =
|
||||
column = nextLineMatch?.index or 0
|
||||
{ row, column }
|
||||
|
||||
SelectLine: class
|
||||
isComplete: -> true
|
||||
|
||||
select: (editor) ->
|
||||
editor.selectLine()
|
||||
|
||||
|
||||
@@ -71,10 +71,9 @@ class VimMode
|
||||
|
||||
delete: () ->
|
||||
if @topOperator() instanceof op.Delete
|
||||
@topOperator().complete = true
|
||||
@processOpStack()
|
||||
@pushOperator(new op.SelectLine)
|
||||
else
|
||||
@pushOperator new op.Delete()
|
||||
@pushOperator(new op.Delete)
|
||||
|
||||
pushOperator: (op) ->
|
||||
@opStack.push(op)
|
||||
|
||||
Reference in New Issue
Block a user