mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
18 lines
552 B
CoffeeScript
18 lines
552 B
CoffeeScript
_ = require 'underscore'
|
|
|
|
module.exports =
|
|
class CompositeCommand
|
|
constructor: (@subcommands) ->
|
|
|
|
execute: (editor) ->
|
|
for command in @subcommands
|
|
newRanges = []
|
|
currentRanges = editor.getSelectionsOrderedByBufferPosition().map (selection) -> selection.getBufferRange()
|
|
for currentRange in currentRanges
|
|
newRanges.push(command.execute(editor, currentRange)...)
|
|
editor.setSelectedBufferRanges(newRanges)
|
|
|
|
isRelativeAddress: ->
|
|
_.all(@subcommands, (command) -> command.isAddress() and command.isRelative())
|
|
|