mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Clear multiple selections on escape
The binding uses the `!important` selector to ensure that the editor always gets a chance to clear multiple selections before other bindings for escape are processed.
This commit is contained in:
@@ -104,6 +104,7 @@ class Editor extends View
|
||||
'editor:move-to-previous-word': @moveCursorToPreviousWord
|
||||
'editor:select-word': @selectWord
|
||||
'editor:newline': @insertNewline
|
||||
'editor:consolidate-selections': @consolidateSelections
|
||||
'editor:indent': @indent
|
||||
'editor:auto-indent': @autoIndent
|
||||
'editor:indent-selected-rows': @indentSelectedRows
|
||||
@@ -164,7 +165,7 @@ class Editor extends View
|
||||
documentation = {}
|
||||
for name, method of editorBindings
|
||||
do (name, method) =>
|
||||
@command name, => method.call(this); false
|
||||
@command name, (e) => method.call(this, e); false
|
||||
|
||||
getCursor: -> @activeEditSession.getCursor()
|
||||
getCursors: -> @activeEditSession.getCursors()
|
||||
@@ -232,6 +233,7 @@ class Editor extends View
|
||||
cutToEndOfLine: -> @activeEditSession.cutToEndOfLine()
|
||||
insertText: (text, options) -> @activeEditSession.insertText(text, options)
|
||||
insertNewline: -> @activeEditSession.insertNewline()
|
||||
consolidateSelections: (e) -> e.abortKeyBinding() unless @activeEditSession.consolidateSelections()
|
||||
insertNewlineBelow: -> @activeEditSession.insertNewlineBelow()
|
||||
insertNewlineAbove: -> @activeEditSession.insertNewlineAbove()
|
||||
indent: (options) -> @activeEditSession.indent(options)
|
||||
|
||||
@@ -31,3 +31,6 @@
|
||||
'enter': 'core:confirm',
|
||||
'escape': 'core:cancel'
|
||||
'meta-w': 'core:cancel'
|
||||
|
||||
'.editor !important':
|
||||
'escape': 'editor:consolidate-selections'
|
||||
|
||||
Reference in New Issue
Block a user