From 48b6c24882adce7ac4d499f5c84f326efb7d0f5b Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Thu, 3 Jul 2014 17:36:45 -0700 Subject: [PATCH] Add Editor::selectionFlashDuration rather than magic number --- spec/editor-component-spec.coffee | 2 +- src/editor.coffee | 1 + src/selection.coffee | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/editor-component-spec.coffee b/spec/editor-component-spec.coffee index cbb4f6140..1be909417 100644 --- a/spec/editor-component-spec.coffee +++ b/spec/editor-component-spec.coffee @@ -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) diff --git a/src/editor.coffee b/src/editor.coffee index 10475a0c2..53fd7b2ca 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -146,6 +146,7 @@ class Editor extends Model selections: null suppressSelectionMerging: false updateBatchDepth: 0 + selectionFlashDuration: 500 @delegatesMethods 'suggestedIndentForBufferRow', 'autoIndentBufferRow', 'autoIndentBufferRows', 'autoDecreaseIndentForBufferRow', 'toggleLineCommentForBufferRow', 'toggleLineCommentsForBufferRows', diff --git a/src/selection.coffee b/src/selection.coffee index ef663a45c..93bebbe7c 100644 --- a/src/selection.coffee +++ b/src/selection.coffee @@ -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.