mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
Revert "Selection support for bracket matcher"
This reverts commit 460c4a0b09.
This commit is contained in:
@@ -30,8 +30,6 @@ module.exports =
|
||||
editor.on 'cursor:moved.bracket-matcher', => @updateMatch(editor)
|
||||
editor.command 'editor:go-to-matching-bracket.bracket-matcher', =>
|
||||
@goToMatchingPair(editor)
|
||||
editor.command 'editor:select-to-matching-bracket.bracket-matcher', =>
|
||||
@selectToMatchingPair(editor)
|
||||
editor.on 'editor:will-be-removed', => editor.off('.bracket-matcher')
|
||||
editor.startHighlightView = @addHighlightView(editor)
|
||||
editor.endHighlightView = @addHighlightView(editor)
|
||||
@@ -59,24 +57,6 @@ module.exports =
|
||||
else if previousPosition.isEqual(endPosition)
|
||||
editor.setCursorBufferPosition(startPosition)
|
||||
|
||||
selectToMatchingPair: (editor) ->
|
||||
return unless @pairHighlighted
|
||||
return unless underlayer = editor.getPane()?.find('.underlayer')
|
||||
|
||||
position = editor.getCursorBufferPosition()
|
||||
previousPosition = position.translate([0, -1])
|
||||
startPosition = underlayer.find('.bracket-matcher:first').data('bufferPosition')
|
||||
endPosition = underlayer.find('.bracket-matcher:last').data('bufferPosition')
|
||||
|
||||
if position.isEqual(startPosition)
|
||||
editor.selectToScreenPosition(editor.screenPositionForBufferPosition(endPosition.translate([0, 1])))
|
||||
else if previousPosition.isEqual(startPosition)
|
||||
editor.selectToScreenPosition(editor.screenPositionForBufferPosition(endPosition))
|
||||
else if position.isEqual(endPosition)
|
||||
editor.selectToScreenPosition(editor.screenPositionForBufferPosition(startPosition.translate([0, 1])))
|
||||
else if previousPosition.isEqual(endPosition)
|
||||
editor.selectToScreenPosition(editor.screenPositionForBufferPosition(startPosition))
|
||||
|
||||
moveHighlightViews: (editor, bufferRange) ->
|
||||
{ start, end } = Range.fromObject(bufferRange)
|
||||
startPixelPosition = editor.pixelPositionForBufferPosition(start)
|
||||
|
||||
@@ -86,17 +86,6 @@ describe "bracket matching", ->
|
||||
editor.trigger "editor:go-to-matching-bracket"
|
||||
expect(editor.getCursorBufferPosition()).toEqual [0, 28]
|
||||
|
||||
describe "when editor:select-to-matching-bracket is triggered", ->
|
||||
it " selects until the next matched bracket", ->
|
||||
editor.moveCursorToEndOfLine()
|
||||
editor.moveCursorLeft()
|
||||
editor.trigger "editor:select-to-matching-bracket"
|
||||
expect(editor.getCursorBufferPosition()).toEqual [12, 1]
|
||||
selections = editor.getSelections()
|
||||
expect(selections.length).toBe(1)
|
||||
range = selections[0].getBufferRange()
|
||||
expect(range).toEqual([[0,28], [12,1]])
|
||||
|
||||
describe "matching bracket insertion", ->
|
||||
beforeEach ->
|
||||
editSession.buffer.setText("")
|
||||
|
||||
Reference in New Issue
Block a user