mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Remove *.getLastCursor()
This commit is contained in:
@@ -1727,7 +1727,7 @@ describe "EditSession", ->
|
||||
expect(cursor3.getScreenPosition()).toEqual [1, 0]
|
||||
|
||||
it "does not destroy cursor or selection anchors when a change encompasses them", ->
|
||||
cursor = editSession.getLastCursor()
|
||||
cursor = editSession.getCursor()
|
||||
cursor.setBufferPosition [3, 3]
|
||||
editSession.buffer.delete([[3, 1], [3, 5]])
|
||||
expect(cursor.getBufferPosition()).toEqual [3, 1]
|
||||
@@ -1791,7 +1791,7 @@ describe "EditSession", ->
|
||||
|
||||
describe ".deleteLine()", ->
|
||||
it "deletes the first line when the cursor is there", ->
|
||||
editSession.getLastCursor().moveToTop()
|
||||
editSession.getCursor().moveToTop()
|
||||
line1 = buffer.lineForRow(1)
|
||||
count = buffer.getLineCount()
|
||||
expect(buffer.lineForRow(0)).not.toBe(line1)
|
||||
@@ -1803,7 +1803,7 @@ describe "EditSession", ->
|
||||
count = buffer.getLineCount()
|
||||
secondToLastLine = buffer.lineForRow(count - 2)
|
||||
expect(buffer.lineForRow(count - 1)).not.toBe(secondToLastLine)
|
||||
editSession.getLastCursor().moveToBottom()
|
||||
editSession.getCursor().moveToBottom()
|
||||
editSession.deleteLine()
|
||||
newCount = buffer.getLineCount()
|
||||
expect(buffer.lineForRow(newCount - 1)).toBe(secondToLastLine)
|
||||
@@ -1830,8 +1830,8 @@ describe "EditSession", ->
|
||||
|
||||
it "deletes the entire region when invoke on a folded region", ->
|
||||
editSession.foldBufferRow(1)
|
||||
editSession.getLastCursor().moveToTop()
|
||||
editSession.getLastCursor().moveDown()
|
||||
editSession.getCursor().moveToTop()
|
||||
editSession.getCursor().moveDown()
|
||||
expect(buffer.getLineCount()).toBe(13)
|
||||
editSession.deleteLine()
|
||||
expect(buffer.getLineCount()).toBe(4)
|
||||
@@ -1840,7 +1840,7 @@ describe "EditSession", ->
|
||||
count = buffer.getLineCount()
|
||||
expect(count).toBeGreaterThan(0)
|
||||
for line in [0...count]
|
||||
editSession.getLastCursor().moveToBottom()
|
||||
editSession.getCursor().moveToBottom()
|
||||
editSession.deleteLine()
|
||||
expect(buffer.getLineCount()).toBe(1)
|
||||
expect(buffer.getText()).toBe('')
|
||||
@@ -1849,7 +1849,7 @@ describe "EditSession", ->
|
||||
count = buffer.getLineCount()
|
||||
expect(count).toBeGreaterThan(0)
|
||||
for line in [0...count]
|
||||
editSession.getLastCursor().moveToTop()
|
||||
editSession.getCursor().moveToTop()
|
||||
editSession.deleteLine()
|
||||
expect(buffer.getLineCount()).toBe(1)
|
||||
expect(buffer.getText()).toBe('')
|
||||
|
||||
@@ -57,7 +57,7 @@ class Cursor
|
||||
isVisible: -> @visible
|
||||
|
||||
isLastCursor: ->
|
||||
this == @editSession.getLastCursor()
|
||||
this == @editSession.getCursor()
|
||||
|
||||
autoscrolled: ->
|
||||
@needsAutoscroll = false
|
||||
|
||||
@@ -370,9 +370,6 @@ class EditSession
|
||||
getCursor: ->
|
||||
_.last(@cursors)
|
||||
|
||||
getLastCursor: ->
|
||||
_.last(@cursors)
|
||||
|
||||
addCursorAtScreenPosition: (screenPosition) ->
|
||||
@addCursor(new Cursor(editSession: this, screenPosition: screenPosition))
|
||||
|
||||
@@ -455,16 +452,16 @@ class EditSession
|
||||
@moveCursors (cursor) -> cursor.setScreenPosition(position)
|
||||
|
||||
getCursorScreenPosition: ->
|
||||
@getLastCursor().getScreenPosition()
|
||||
@getCursor().getScreenPosition()
|
||||
|
||||
getCursorScreenRow: ->
|
||||
@getLastCursor().getScreenRow()
|
||||
@getCursor().getScreenRow()
|
||||
|
||||
setCursorBufferPosition: (position, options) ->
|
||||
@moveCursors (cursor) -> cursor.setBufferPosition(position, options)
|
||||
|
||||
getCursorBufferPosition: ->
|
||||
@getLastCursor().getBufferPosition()
|
||||
@getCursor().getBufferPosition()
|
||||
|
||||
getSelectedScreenRange: ->
|
||||
@getLastSelection().getScreenRange()
|
||||
|
||||
@@ -187,7 +187,6 @@ class Editor extends View
|
||||
|
||||
getCursor: -> @activeEditSession.getCursor()
|
||||
getCursors: -> @activeEditSession.getCursors()
|
||||
getLastCursor: -> @activeEditSession.getLastCursor()
|
||||
addCursorAtScreenPosition: (screenPosition) -> @activeEditSession.addCursorAtScreenPosition(screenPosition)
|
||||
addCursorAtBufferPosition: (bufferPosition) -> @activeEditSession.addCursorAtBufferPosition(bufferPosition)
|
||||
moveCursorUp: -> @activeEditSession.moveCursorUp()
|
||||
|
||||
@@ -26,7 +26,7 @@ module.exports =
|
||||
enableSnippetsInEditor: (editor) ->
|
||||
editor.command 'snippets:expand', (e) =>
|
||||
editSession = editor.activeEditSession
|
||||
prefix = editSession.getLastCursor().getCurrentWordPrefix()
|
||||
prefix = editSession.getCursor().getCurrentWordPrefix()
|
||||
if snippet = @snippetsByExtension[editSession.getFileExtension()]?[prefix]
|
||||
editSession.transact ->
|
||||
snippetExpansion = new SnippetExpansion(snippet, editSession)
|
||||
|
||||
Reference in New Issue
Block a user