Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 9c83c6b

Browse files
committed
Merge pull request #122 from atom/as-stop-using-marker-properties
Add marker layers on TextEditor and stop using marker custom properties
2 parents 2d03cf9 + 9a36898 commit 9c83c6b

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

lib/corrections-view.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class CorrectionsView extends SelectListView
2424
@cancel()
2525
return unless correction
2626
@editor.transact =>
27-
@editor.setSelectedBufferRange(@marker.getRange())
27+
@editor.setSelectedBufferRange(@marker.getBufferRange())
2828
@editor.insertText(correction)
2929

3030
cancelled: ->

lib/spell-check-view.coffee

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class SpellCheckView
1616
@initializeMarkerLayer()
1717

1818
@correctMisspellingCommand = atom.commands.add atom.views.getView(@editor), 'spell-check:correct-misspelling', =>
19-
if marker = @markerLayer.findMarkers({containsPoint: @editor.getCursorBufferPosition()})[0]
19+
if marker = @markerLayer.findMarkers({containsBufferPosition: @editor.getCursorBufferPosition()})[0]
2020
CorrectionsView ?= require './corrections-view'
2121
@correctionsView?.destroy()
2222
@correctionsView = new CorrectionsView(@editor, @getCorrections(marker), marker)
@@ -42,7 +42,7 @@ class SpellCheckView
4242
@disposables.add @editor.onDidDestroy(@destroy.bind(this))
4343

4444
initializeMarkerLayer: ->
45-
@markerLayer = @editor.getBuffer().addMarkerLayer()
45+
@markerLayer = @editor.addMarkerLayer({maintainHistory: false})
4646
@markerLayerDecoration = @editor.decorateMarkerLayer(@markerLayer, {
4747
type: 'highlight',
4848
class: 'spell-check-misspelling',
@@ -84,12 +84,7 @@ class SpellCheckView
8484

8585
addMarkers: (misspellings) ->
8686
for misspelling in misspellings
87-
@markerLayer.markRange(misspelling,
88-
invalidate: 'touch',
89-
replicate: 'false',
90-
persistent: false,
91-
maintainHistory: false,
92-
)
87+
@markerLayer.markBufferRange(misspelling, {invalidate: 'touch'})
9388

9489
updateMisspellings: ->
9590
# Task::start can throw errors atom/atom#3326
@@ -100,5 +95,5 @@ class SpellCheckView
10095

10196
getCorrections: (marker) ->
10297
SpellChecker ?= require 'spellchecker'
103-
misspelling = @editor.getTextInBufferRange(marker.getRange())
98+
misspelling = @editor.getTextInBufferRange(marker.getBufferRange())
10499
corrections = SpellChecker.getCorrectionsForMisspelling(misspelling)

spec/spell-check-spec.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ describe "Spell check", ->
22
[workspaceElement, editor, editorElement, spellCheckModule] = []
33

44
textForMarker = (marker) ->
5-
editor.getTextInBufferRange(marker.getRange())
5+
editor.getTextInBufferRange(marker.getBufferRange())
66

77
getMisspellingMarkers = ->
88
spellCheckModule.misspellingMarkersForEditor(editor)

0 commit comments

Comments
 (0)