Text insertion pane / panel


I’ve implemented the ‘ascii-art’ package form Flight Manual:Package: Modifying Text (below):

This works largely as expected, inserting ‘Hello, World!’ in my edit buffer when I press the hot key.

Now, open find-and-replace panel. Click on ‘Find in buffer’, and hit hotkey.
‘Hello, World!’ is inserted in my edit buffer, NOT in the ‘Find in buffer’ field as expected.

It does the same for Command Palet panel.

How do I get ascii-art.convert() to insert its text in the “active” field? Core keys (e.g., core.paste) work as expected.




Look at the code you’re using.

convert: ->
  if editor = atom.workspace.getActiveTextEditor()
    editor.insertText('Hello, World!')

It specifically addresses the active text editor, so no matter where your cursor is, you always know where the text will be inserted. There’s a Workspace::getActivePaneItem method, but no apparent way to do the same for panels.

You could probably kludge it by adding the inserted text to your clipboard and then pasting it.


The mini-editor fields don’t allow multi-line input, so this would also be a non-sequitur from that perspective. They aren’t really designed to be customized that much, just a place for the user to type text. That is slowly changing though.