mirror of
https://github.com/atom/atom.git
synced 2026-02-09 14:15:24 -05:00
Merge branch 'master' of github.com:github/atom
This commit is contained in:
@@ -33,13 +33,13 @@ class Autocomplete extends View
|
||||
@editor.on 'buffer-path-change', => @setCurrentBuffer(@editor.buffer)
|
||||
@editor.on 'before-remove', => @currentBuffer?.off '.autocomplete'
|
||||
|
||||
@editor.on 'autocomplete:toggle', => @attach()
|
||||
@on 'autocomplete:toggle', => @detach()
|
||||
@editor.on 'autocomplete:attach', => @attach()
|
||||
@on 'autocomplete:confirm', => @confirm()
|
||||
@on 'autocomplete:cancel', => @cancel()
|
||||
|
||||
@miniEditor.buffer.on 'change', =>
|
||||
@filterMatchList() if @parent()[0]
|
||||
@miniEditor.buffer.on 'change', (e) =>
|
||||
return unless @parent()[0]
|
||||
@filterMatchList()
|
||||
|
||||
@miniEditor.preempt 'move-up', =>
|
||||
@selectPreviousMatch()
|
||||
@@ -122,13 +122,14 @@ class Autocomplete extends View
|
||||
|
||||
if (prefix.length + suffix.length) > 0
|
||||
currentWord = prefix + @editor.getSelectedText() + suffix
|
||||
@matches = (match for match in @wordMatches(prefix, suffix) when match.word != currentWord)
|
||||
@baseMatches = (match for match in @wordMatches(prefix, suffix) when match.word != currentWord)
|
||||
else
|
||||
@matches = []
|
||||
@renderMatchList()
|
||||
@baseMatches = []
|
||||
|
||||
@filterMatchList()
|
||||
|
||||
filterMatchList: ->
|
||||
@matches = fuzzyFilter(@matches, @miniEditor.buffer.getText(), key: 'word')
|
||||
@matches = fuzzyFilter(@baseMatches, @miniEditor.getText(), key: 'word')
|
||||
@renderMatchList()
|
||||
|
||||
renderMatchList: ->
|
||||
|
||||
@@ -201,11 +201,14 @@ class Editor extends View
|
||||
else
|
||||
@gutter.addClass('drop-shadow')
|
||||
|
||||
@on 'attach', =>
|
||||
@on 'attach', (e) =>
|
||||
return if @attached
|
||||
@attached = true
|
||||
@calculateDimensions()
|
||||
@hiddenInput.width(@charWidth)
|
||||
@setMaxLineLength() if @softWrap
|
||||
@focus() if @isFocused
|
||||
@trigger 'editor-open', [this]
|
||||
|
||||
rootView: ->
|
||||
@parents('#root-view').view()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
window.keymap.bindKeys '.editor',
|
||||
'escape': 'autocomplete:toggle'
|
||||
'escape': 'autocomplete:attach'
|
||||
|
||||
window.keymap.bindKeys '#autocomplete .editor',
|
||||
'enter': 'autocomplete:confirm'
|
||||
|
||||
@@ -21,8 +21,8 @@ windowAdditions =
|
||||
$(document).on 'keydown', @_handleKeyEvent
|
||||
|
||||
startup: (path) ->
|
||||
@attachRootView(path)
|
||||
@loadUserConfiguration()
|
||||
@attachRootView(path)
|
||||
$(window).on 'close', => @close()
|
||||
$(window).on 'beforeunload', =>
|
||||
@shutdown()
|
||||
@@ -53,7 +53,7 @@ windowAdditions =
|
||||
try
|
||||
require atom.userConfigurationPath if fs.exists(atom.userConfigurationPath)
|
||||
catch error
|
||||
console.error "Failed to load `#{atom.userConfigurationPath}`", error
|
||||
console.error "Failed to load `#{atom.userConfigurationPath}`", error.message, error
|
||||
@showConsole()
|
||||
|
||||
requireStylesheet: (path) ->
|
||||
|
||||
Reference in New Issue
Block a user