Method name 💄

This commit is contained in:
Nathan Sobo
2012-06-13 11:49:01 -06:00
parent 0c7e9f34cc
commit f000686f07
6 changed files with 27 additions and 27 deletions

View File

@@ -231,7 +231,7 @@ describe "Editor", ->
describe ".setActiveEditSessionIndex(index)", ->
it "restores the buffer, cursors, selections, and scroll position of the edit session associated with the index", ->
editor.attachToDom(heightInLines: 10)
editor.setSelectionBufferRange([[40, 0], [43, 1]])
editor.setSelectedBufferRange([[40, 0], [43, 1]])
expect(editor.getSelection().getScreenRange()).toEqual [[40, 0], [43, 1]]
previousScrollHeight = editor.verticalScrollbar.prop('scrollHeight')
editor.scrollTop(750)
@@ -1512,13 +1512,13 @@ describe "Editor", ->
it "adds/removes the 'selected' class to the fold's line element and hides the cursor if it is on the fold line", ->
editor.createFold(2, 4)
editor.setSelectionBufferRange([[1, 0], [2, 0]], reverse: true)
editor.setSelectedBufferRange([[1, 0], [2, 0]], reverse: true)
expect(editor.lineElementForScreenRow(2)).toMatchSelector('.fold.selected')
editor.setSelectionBufferRange([[1, 0], [1, 1]])
editor.setSelectedBufferRange([[1, 0], [1, 1]])
expect(editor.lineElementForScreenRow(2)).not.toMatchSelector('.fold.selected')
editor.setSelectionBufferRange([[1, 0], [5, 0]])
editor.setSelectedBufferRange([[1, 0], [5, 0]])
expect(editor.lineElementForScreenRow(2)).toMatchSelector('.fold.selected')
editor.setCursorScreenPosition([3,0])
@@ -1537,7 +1537,7 @@ describe "Editor", ->
editor.renderLines() # re-render lines so certain lines are not rendered
editor.createFold(2, 4)
editor.setSelectionBufferRange([[1, 0], [5, 0]])
editor.setSelectedBufferRange([[1, 0], [5, 0]])
expect(editor.renderedLines.find('.fold.selected')).toExist()
editor.scrollToBottom()

View File

@@ -93,7 +93,7 @@ describe "Autocomplete", ->
describe "when text is selected", ->
it 'autocompletes word when there is only a prefix', ->
editor.buffer.insert([10,0] ,"extra:sort:extra")
editor.setSelectionBufferRange [[10,7], [10,10]]
editor.setSelectedBufferRange [[10,7], [10,10]]
autocomplete.attach()
expect(editor.lineForBufferRow(10)).toBe "extra:shift:extra"
@@ -105,7 +105,7 @@ describe "Autocomplete", ->
it 'autocompletes word when there is only a suffix', ->
editor.buffer.insert([10,0] ,"extra:current:extra")
editor.setSelectionBufferRange [[10,6],[10,12]]
editor.setSelectedBufferRange [[10,6],[10,12]]
autocomplete.attach()
expect(editor.lineForBufferRow(10)).toBe "extra:quicksort:extra"
@@ -116,7 +116,7 @@ describe "Autocomplete", ->
expect(autocomplete.matchesList.find('li:contains(current)')).not.toExist()
it 'autocompletes word when there is a prefix and suffix', ->
editor.setSelectionBufferRange [[5,7],[5,12]]
editor.setSelectedBufferRange [[5,7],[5,12]]
autocomplete.attach()
expect(editor.lineForBufferRow(5)).toBe " concat = items.shift();"
@@ -129,7 +129,7 @@ describe "Autocomplete", ->
describe 'autocomplete:confirm event', ->
it 'replaces selection with selected match, moves the cursor to the end of the match, and removes the autocomplete menu', ->
editor.buffer.insert([10,0] ,"extra:sort:extra")
editor.setSelectionBufferRange [[10,7], [10,9]]
editor.setSelectedBufferRange [[10,7], [10,9]]
autocomplete.attach()
miniEditor.trigger "autocomplete:confirm"
@@ -156,7 +156,7 @@ describe "Autocomplete", ->
describe 'autocomplete:cancel event', ->
it 'does not replace selection, removes autocomplete view and returns focus to editor', ->
editor.buffer.insert([10,0] ,"extra:so:extra")
editor.setSelectionBufferRange [[10,7], [10,8]]
editor.setSelectedBufferRange [[10,7], [10,8]]
originalSelectionBufferRange = editor.getSelection().getBufferRange()
autocomplete.attach()

View File

@@ -45,15 +45,15 @@ describe "CommandInterpreter", ->
describe "when a single selection", ->
it 'maintains the current selection', ->
editor.clearSelections()
editor.setSelectionBufferRange([[1,1], [2,2]])
editor.setSelectedBufferRange([[1,1], [2,2]])
interpreter.eval(editor, '.')
expect(editor.getSelection().getBufferRange()).toEqual [[1,1], [2,2]]
editor.setSelectionBufferRange([[1,1], [2,2]])
editor.setSelectedBufferRange([[1,1], [2,2]])
interpreter.eval(editor, '.,')
expect(editor.getSelection().getBufferRange()).toEqual [[1,1], [12,2]]
editor.setSelectionBufferRange([[1,1], [2,2]])
editor.setSelectedBufferRange([[1,1], [2,2]])
interpreter.eval(editor, ',.')
expect(editor.getSelection().getBufferRange()).toEqual [[0,0], [2,2]]
@@ -77,18 +77,18 @@ describe "CommandInterpreter", ->
editor.clearSelections()
it 'selects text matching regex after current selection', ->
editor.setSelectionBufferRange([[4,16], [4,20]])
editor.setSelectedBufferRange([[4,16], [4,20]])
interpreter.eval(editor, '/pivot/')
expect(editor.getSelection().getBufferRange()).toEqual [[6,16], [6,21]]
it 'does not require the trailing slash', ->
editor.setSelectionBufferRange([[4,16], [4,20]])
editor.setSelectedBufferRange([[4,16], [4,20]])
interpreter.eval(editor, '/pivot')
expect(editor.getSelection().getBufferRange()).toEqual [[6,16], [6,21]]
it "searches from the end of each selection in the buffer", ->
editor.clearSelections()
editor.setSelectionBufferRange([[4,16], [4,20]])
editor.setSelectedBufferRange([[4,16], [4,20]])
editor.addSelectionForBufferRange([[1,16], [2,20]])
expect(editor.getSelections().length).toBe 2
interpreter.eval(editor, '/pivot')
@@ -98,7 +98,7 @@ describe "CommandInterpreter", ->
expect(selections[1].getBufferRange()).toEqual [[6,16], [6,21]]
it "wraps around to the beginning of the buffer, but doesn't infinitely loop if no matches are found", ->
editor.setSelectionBufferRange([[10, 0], [10,3]])
editor.setSelectedBufferRange([[10, 0], [10,3]])
interpreter.eval(editor, '/pivot')
expect(editor.getSelection().getBufferRange()).toEqual [[3,8], [3,13]]
@@ -154,7 +154,7 @@ describe "CommandInterpreter", ->
expect(cursors[2].getBufferPosition()).toEqual [7, 5]
it "loops through current selections and selects text matching the regex", ->
editor.setSelectionBufferRange [[3,0], [3,62]]
editor.setSelectedBufferRange [[3,0], [3,62]]
editor.addSelectionForBufferRange [[6,0], [6,65]]
interpreter.eval(editor, 'x/current')
@@ -169,20 +169,20 @@ describe "CommandInterpreter", ->
describe "substitution", ->
it "does nothing if there are no matches", ->
editor.setSelectionBufferRange([[6, 0], [6, 44]])
editor.setSelectedBufferRange([[6, 0], [6, 44]])
interpreter.eval(editor, 's/not-in-text/foo/')
expect(buffer.lineForRow(6)).toBe ' current < pivot ? left.push(current) : right.push(current);'
describe "when not global", ->
describe "when there is a single selection", ->
it "performs a single substitution within the current selection", ->
editor.setSelectionBufferRange([[6, 0], [6, 44]])
editor.setSelectedBufferRange([[6, 0], [6, 44]])
interpreter.eval(editor, 's/current/foo/')
expect(buffer.lineForRow(6)).toBe ' foo < pivot ? left.push(current) : right.push(current);'
describe "when there are multiple selections", ->
it "performs a single substitutions within each of the selections", ->
editor.setSelectionBufferRange([[5, 0], [5, 20]])
editor.setSelectedBufferRange([[5, 0], [5, 20]])
editor.addSelectionForBufferRange([[6, 0], [6, 44]])
interpreter.eval(editor, 's/current/foo/')
@@ -191,7 +191,7 @@ describe "CommandInterpreter", ->
describe "when global", ->
it "performs a multiple substitutions within the current selection", ->
editor.setSelectionBufferRange([[6, 0], [6, 44]])
editor.setSelectedBufferRange([[6, 0], [6, 44]])
interpreter.eval(editor, 's/current/foo/g')
expect(buffer.lineForRow(6)).toBe ' foo < pivot ? left.push(foo) : right.push(current);'
@@ -222,7 +222,7 @@ describe "CommandInterpreter", ->
describe "when there are multiple selections", ->
it "performs a multiple substitutions within each of the selections", ->
editor.setSelectionBufferRange([[5, 0], [5, 20]])
editor.setSelectedBufferRange([[5, 0], [5, 20]])
editor.addSelectionForBufferRange([[6, 0], [6, 44]])
interpreter.eval(editor, 's/current/foo/g')

View File

@@ -721,7 +721,7 @@ class Editor extends View
getSelectionsOrderedByBufferPosition: -> @activeEditSession.getSelectionsOrderedByBufferPosition()
getLastSelectionInBuffer: -> @activeEditSession.getLastSelectionInBuffer()
getSelectedText: -> @activeEditSession.getSelectedText()
setSelectionBufferRange: (bufferRange, options) -> @activeEditSession.setSelectedBufferRange(bufferRange, options)
setSelectedBufferRange: (bufferRange, options) -> @activeEditSession.setSelectedBufferRange(bufferRange, options)
setSelectedBufferRanges: (bufferRanges, options) -> @activeEditSession.setSelectedBufferRanges(bufferRanges, options)
addSelectionForBufferRange: (bufferRange, options) -> @activeEditSession.addSelectionForBufferRange(bufferRange, options)
selectRight: -> @activeEditSession.selectRight()

View File

@@ -96,7 +96,7 @@ class Autocomplete extends View
cancel: ->
@detach()
@editor.buffer.change(@currentMatchBufferRange, @originalSelectedText) if @currentMatchBufferRange
@editor.setSelectionBufferRange(@originalSelectionBufferRange)
@editor.setSelectedBufferRange(@originalSelectionBufferRange)
attach: ->
@confirmed = false
@@ -195,7 +195,7 @@ class Autocomplete extends View
@editor.insertText(match.infix)
@currentMatchBufferRange = [startPosition, [startPosition.row, startPosition.column + match.infix.length]]
@editor.setSelectionBufferRange(@currentMatchBufferRange)
@editor.setSelectedBufferRange(@currentMatchBufferRange)
@isAutocompleting = false
prefixAndSuffixOfSelection: (selection) ->

View File

@@ -22,7 +22,7 @@ class Dialog extends View
extension = fs.extension(path)
baseName = fs.base(path)
range = [[0, path.length - baseName.length], [0, path.length - extension.length]]
@miniEditor.setSelectionBufferRange(range)
@miniEditor.setSelectedBufferRange(range)
confirm: ->
return if @onConfirm(@miniEditor.getText()) is false