From 819f1a86f2213a0a6dd233ae12435be5b8233dd1 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Tue, 27 Mar 2012 09:12:58 -0700 Subject: [PATCH] Delete works for multiple selections --- spec/atom/editor-spec.coffee | 9 +++++++++ src/atom/composite-selection.coffee | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/spec/atom/editor-spec.coffee b/spec/atom/editor-spec.coffee index 2914d1f10..bd7cc0d92 100644 --- a/spec/atom/editor-spec.coffee +++ b/spec/atom/editor-spec.coffee @@ -971,6 +971,15 @@ describe "Editor", -> expect(cursor1.getBufferPosition()).toEqual [0,29] expect(cursor2.getBufferPosition()).toEqual [0,59] + describe "when selections are on the same line", -> + it "removes all selected text", -> + editor.setSelectionBufferRange([[0,4], [0,13]]) + editor.addSelectionForBufferRange([[0,16], [0,24]]) + + editor.delete() + + expect(editor.lineForBufferRow(0)).toBe 'var = () {' + describe "keyboard movement", -> it "moves all cursors", -> editor.setCursorScreenPosition([3, 13]) diff --git a/src/atom/composite-selection.coffee b/src/atom/composite-selection.coffee index ee3962c2f..60ca73e9d 100644 --- a/src/atom/composite-selection.coffee +++ b/src/atom/composite-selection.coffee @@ -39,7 +39,7 @@ class CompositeSeleciton selection.backspace() delete: -> - for selection in @getSelections() + @modifySelections (selection) -> selection.delete() selectToScreenPosition: (position) ->