mirror of
https://github.com/atom/atom.git
synced 2026-01-24 22:38:20 -05:00
Delete suffix before prefix
This allows the cursor buffer position to only be obtained once from the editor.
This commit is contained in:
@@ -135,8 +135,9 @@ class Autocomplete extends SelectList
|
||||
buffer = @editor.getBuffer()
|
||||
@editor.activeEditSession.transact =>
|
||||
selection.deleteSelectedText()
|
||||
buffer.delete(Range.fromPointWithDelta(@editor.getCursorBufferPosition(), 0, -match.prefix.length))
|
||||
buffer.delete(Range.fromPointWithDelta(@editor.getCursorBufferPosition(), 0, match.suffix.length))
|
||||
cursorPosition = @editor.getCursorBufferPosition()
|
||||
buffer.delete(Range.fromPointWithDelta(cursorPosition, 0, match.suffix.length))
|
||||
buffer.delete(Range.fromPointWithDelta(cursorPosition, 0, -match.prefix.length))
|
||||
@editor.insertText(match.word)
|
||||
@undoCount++
|
||||
|
||||
|
||||
Reference in New Issue
Block a user