Add Editor::selectionFlashDuration rather than magic number

This commit is contained in:
Ben Ogle 2014-07-03 17:36:45 -07:00
parent e5f800ef35
commit 48b6c24882
3 changed files with 3 additions and 2 deletions

View File

@ -749,7 +749,7 @@ describe "EditorComponent", ->
selectionNode = node.querySelector('.selection')
expect(selectionNode.classList.contains('flash')).toBe true
advanceClock 500
advanceClock editor.selectionFlashDuration
expect(selectionNode.classList.contains('flash')).toBe false
editor.setSelectedBufferRange([[1, 5], [1, 7]], flash: true)

View File

@ -146,6 +146,7 @@ class Editor extends Model
selections: null
suppressSelectionMerging: false
updateBatchDepth: 0
selectionFlashDuration: 500
@delegatesMethods 'suggestedIndentForBufferRow', 'autoIndentBufferRow', 'autoIndentBufferRows',
'autoDecreaseIndentForBufferRow', 'toggleLineCommentForBufferRow', 'toggleLineCommentsForBufferRows',

View File

@ -83,7 +83,7 @@ class Selection extends Model
@cursor.needsAutoscroll = false if @needsAutoscroll?
@marker.setBufferRange(bufferRange, options)
@autoscroll() if @needsAutoscroll and @editor.manageScrollPosition
@decoration.flash('flash', 500) if needsFlash
@decoration.flash('flash', @editor.selectionFlashDuration) if needsFlash
# Public: Returns the starting and ending buffer rows the selection is
# highlighting.