Skip to content
This repository has been archived by the owner on Jul 17, 2020. It is now read-only.

focusEditor() does not work From active Pane Item #384

Open
JakeIwen opened this issue Jul 9, 2020 · 0 comments
Open

focusEditor() does not work From active Pane Item #384

JakeIwen opened this issue Jul 9, 2020 · 0 comments

Comments

@JakeIwen
Copy link

JakeIwen commented Jul 9, 2020

if a non- TextEditor pane is selected, focusEditor() is called via atom.workspace.onDidChangeActivePaneItem( in atom-ternjs-manager.js.

I believe this break happened in Release 0.18.0

see this issue for an example of the problem it causes

Here's my patch in atom-ternjs-helper.js

export function focusEditor() {

 // const editor = atom.workspace.getActiveTextEditor();
 // getActiveTextEditor() will return the last focused textEditor, and re-focus it at the end of this function

  const editor = atom.workspace.getActivePaneItem();
  // Instead use getActivePaneItem() and isValidEditor() to determine editor validity. 

  // if (!editor) { // this condition pretty much never met with getActiveTextEditor()
  if (!isValidEditor(editor)) {
    
    return;
    
  }

  const view = atom.views.getView(editor);

  view && view.focus && view.focus();
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant