mirror of
https://github.com/atom/atom.git
synced 2026-02-14 16:45:14 -05:00
Merge remote-tracking branch 'origin/command-extensions' into dev
Conflicts: spec/app/editor-spec.coffee spec/app/root-view-spec.coffee src/app/editor.coffee src/extensions/strip-trailing-whitespace.coffee
This commit is contained in:
@@ -1127,3 +1127,20 @@ class Editor extends View
|
||||
@clearRenderedLines()
|
||||
@updateDisplay()
|
||||
grammarChanged
|
||||
|
||||
bindToKeyedEvent: (key, event, callback) ->
|
||||
binding = {}
|
||||
binding[key] = event
|
||||
window.keymap.bindKeys '.editor', binding
|
||||
@on event, =>
|
||||
callback(this, event)
|
||||
|
||||
replaceSelectedText: (replaceFn) ->
|
||||
selection = @getSelection()
|
||||
return false if selection.isEmpty()
|
||||
|
||||
text = replaceFn(@getTextInRange(selection.getBufferRange()))
|
||||
return false if text is null or text is undefined
|
||||
|
||||
@insertText(text, select: true)
|
||||
true
|
||||
|
||||
Reference in New Issue
Block a user