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

Commit c5ff94f

Browse files
committed
Ensure autocomplete-active Class Is Removed
- Prevent confirmation when model isn't active - Fixes #261
1 parent 6cc0f15 commit c5ff94f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Press `UP` and `DOWN` to select another suggestion, press `TAB` to confirm your
3333
Additionally, the keymap can be customized in your keymap.cson:
3434

3535
```coffeescript
36-
'atom-text-editor:not(mini) .autocomplete-plus.autocomplete-suggestion-list':
36+
'atom-text-editor:not(mini).autocomplete-active':
3737
'tab': 'unset!'
3838
'enter': 'autocomplete-plus:confirm'
3939
'up': 'unset!'

lib/suggestion-list-element.coffee

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class SuggestionListElement extends HTMLElement
5454

5555
removeActiveClassFromEditor: ->
5656
editorElement = atom.views.getView(atom.workspace.getActiveTextEditor())
57-
editorElement.classList.add 'autocomplete-active'
57+
editorElement.classList.remove 'autocomplete-active'
5858

5959
moveSelectionUp: ->
6060
unless @selectedIndex <= 0
@@ -84,6 +84,7 @@ class SuggestionListElement extends HTMLElement
8484
# Private: Confirms the currently selected item or cancels the list view
8585
# if no item has been selected
8686
confirmSelection: ->
87+
return unless @model.isActive()
8788
item = @getSelectedItem()
8889
if item?
8990
@model.confirm(item)

0 commit comments

Comments
 (0)