Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Uncaught TypeError: Cannot read property 'focusTerminal' of null #189

Closed
feesta opened this issue Mar 13, 2017 · 4 comments
Closed

Uncaught TypeError: Cannot read property 'focusTerminal' of null #189

feesta opened this issue Mar 13, 2017 · 4 comments

Comments

@feesta
Copy link

feesta commented Mar 13, 2017

  1. text file open.
  2. press option-command-f
    expected: "Replace in buffer". Running "Replace in buffer" from drop down operates correctly.

Atom: 1.15.0 x64
Electron: 1.3.13
OS: Mac OS X 10.11.6
Thrown From: platformio-ide-terminal package 2.4.0

Stack Trace

Uncaught TypeError: Cannot read property 'focusTerminal' of null

At ~/.atom/packages/platformio-ide-terminal/lib/status-bar.coffee:26

TypeError: Cannot read property 'focusTerminal' of null
    at /packages/platformio-ide-terminal/lib/status-bar.coffee:26:58)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/app.asar/src/command-registry.js:259:29)
    at /app.asar/src/command-registry.js:3:59
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:599:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:390:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/app.asar/src/window-event-handler.js:106:36)
    at /app.asar/src/window-event-handler.js:3:59)

Commands

     -1:34.1.0 platformio-ide-terminal:focus (input.hidden-input)

Non-Core Packages

atom-beautify 0.29.17 
blame 0.10.2 
colorblind-syntax 1.1.2 
duplicate-removal 0.1.3 
git-difftool 0.2.7 
jshint 1.8.6 
linter 1.11.23 
linter-eslint 8.1.3 
linter-jsxhint 0.1.2 
markdown-preview-plus 2.4.9 
mdn-doc 0.3.0 
merge-conflicts 1.4.4 
minimap 4.26.8 
platformio-ide-terminal 2.4.0 
pretty-json 1.6.1 
react 0.16.2 
remote-sync 4.1.5 
@pettyron
Copy link

pettyron commented Mar 14, 2017

I ran into this same error. I found the error trying to use Atom's built in find and replace.

To workaround this, for now, I commented out the keymap for Platformio-IDE that is throwing the error.

Atom Settings/Packages Platformio ide Terminal > View Code

platformio-ide-termial/keymaps/platformio-ide-terminal.cson

'.platform-darwin atom-workspace':
  'cmd-shift-t': 'platformio-ide-terminal:new'
  'cmd-shift-j': 'platformio-ide-terminal:prev'
  'cmd-shift-k': 'platformio-ide-terminal:next'
  'cmd-shift-x': 'platformio-ide-terminal:close'
  # 'cmd-alt-f': 'platformio-ide-terminal:focus'
  'ctrl-enter': 'platformio-ide-terminal:insert-selected-text'
  'ctrl-`': 'platformio-ide-terminal:toggle'

'.platform-linux atom-workspace, .platform-win32 atom-workspace':
  'alt-shift-t': 'platformio-ide-terminal:new'
  'alt-shift-j': 'platformio-ide-terminal:prev'
  'alt-shift-k': 'platformio-ide-terminal:next'
  'alt-shift-x': 'platformio-ide-terminal:close'
  'ctrl-enter': 'platformio-ide-terminal:insert-selected-text'
  'ctrl-`': 'platformio-ide-terminal:toggle'
  'ctrl-alt-f': 'platformio-ide-terminal:focus'

'.platform-darwin .platformio-ide-terminal .terminal':
  'cmd-c': 'platformio-ide-terminal:copy'
  'cmd-v': 'platformio-ide-terminal:paste'

'.platform-linux .platformio-ide-terminal .terminal, .platform-win32 .platformio-ide-terminal .terminal':
  'alt-v': 'platformio-ide-terminal:paste'
  'alt-c': 'platformio-ide-terminal:copy'

Then restarted Atom and there is no longer an error. However now there is no shortcut to focus the terminal which I can live with. But others may not in their workflow perhaps. But it is at least a temporary fix. Another option is to just change the keymap to something else.

http://flight-manual.atom.io/behind-atom/sections/keymaps-in-depth/

@Asday
Copy link

Asday commented Mar 22, 2017

This isn't a keymap issue; if you attempt to focus the terminal when none are open, this error is thrown.

@DroidPulkit
Copy link

True but it need to be caught so the error doesn't come or open the terminal in case it is already not opened

ivankravets pushed a commit that referenced this issue May 20, 2017
* Fix focus issue when terminal is not active

#189

* blurring terminal return focus to previous element

* lastActive element is now updated at each terminal focus
@the-j0k3r
Copy link
Collaborator

Please retest again with platformio-atom-ide-terminal 2.9.0 is using node-pty-prebuilt instead unmaintained and outdated pty.js

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants