t9md / atom-cursor-history

Cursor position history manager
https://atom.io/packages/cursor-history
MIT License
59 stars 7 forks source link

Uncaught Error: no pane found for [object Object] #40

Closed despairblue closed 5 years ago

despairblue commented 7 years ago

[Enter steps to reproduce:]

Not sure how that happens, yet.

Atom: 1.19.1 x64 Electron: 1.6.9 OS: Mac OS X 10.12.5 Thrown From: cursor-history package 0.12.0

Stack Trace

Uncaught Error: no pane found for [object Object]

At /Users/despairblue/.atom/packages/cursor-history/lib/history.js:241

Error: no pane found for [object Object]
    at History.jump (/packages/cursor-history/lib/history.js:241:15)
    at jump (/packages/cursor-history/lib/main.js:37:57)
    at /packages/cursor-history/lib/main.js:42:11)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:265:35)
    at /Applications/Atom.app/Contents/Resources/app/src/command-registry.js:3:65
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:610:22)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:401:28)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:100:42)
    at HTMLDocument.<anonymous> (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:3:65)

Commands

     -0:12.9.0 command-palette:toggle (input.hidden-input)
  3x -0:12.7.0 blur (input.hidden-input)
     -0:12.1.0 editor:consolidate-selections (input.hidden-input)
     -0:12.1.0 core:cancel (input.hidden-input)
  2x -0:12 blur (input.hidden-input)
  4x -0:09.6.0 cursor-history:prev-within-editor (input.hidden-input)
     -0:06.2.0 cursor-history:prev (input.hidden-input)
  4x -0:06.2.0 blur (input.hidden-input)
     -0:05.6.0 cursor-history:next (input.hidden-input)
  4x -0:05.6.0 blur (input.hidden-input)
  3x -0:05.4.0 cursor-history:next (input.hidden-input)
  3x -0:05.1.0 blur (input.hidden-input)
     -0:04.8.0 cursor-history:next (input.hidden-input)
  3x -0:04.8.0 blur (input.hidden-input)
     -0:04.6.0 cursor-history:next (input.hidden-input)
  2x -0:00.3.0 blur (input.hidden-input)

Non-Core Packages

advanced-open-file 0.16.6 
atom-beautify 0.30.5 
atom-debugger 0.1.6 
atom-fuzzy-grep 0.16.0 
atom-handlebars 1.3.0 
atom-jinja2 0.6.0 
atom-keyboard-macros-vim 0.1.6 
atom-lupa 0.7.40 
atom-typescript 11.0.6 
atomic-chrome 0.3.2 
autocomplete-emojis 2.5.0 
autocomplete-paths 2.6.0 
blame 0.12.0 
bug-report 0.7.1 
busy-signal 1.4.3 
character-table 0.4.3 
choose-pane 0.7.0 
color-picker 2.2.5 
cursor-history 0.12.0 
dash 1.7.1 
docblockr 0.11.0 
editorconfig 2.2.2 
elm-format 2.2.0 
elmjutsu 5.6.2 
file-icons 2.1.10 
flow-ide 1.8.1 
git-plus 7.9.3 
gitignore-snippets 0.2.5 
grammar-token-limit 0.1.1 
graphviz-preview-plus 1.4.4 
haskell-grammar 0.4.0 
highlight-selected 0.13.1 
html-to-elm 0.2.0 
hyperclick 0.1.3 
indentation-indicator 1.1.0 
intentions 1.1.5 
js-hyperclick 1.11.0 
jumpy 3.1.3 
keybinding-cheatsheet 0.1.1 
language-ansible 0.2.1 
language-babel 2.71.0 
language-docker 1.1.8 
language-dot 1.7.0 
language-dotfiles 1.1.0 
language-elm 1.5.0 
language-env 0.2.0 
language-fish-shell 1.0.5 
language-graphql 0.9.0 
language-hugo 0.3.1 
language-ini 1.19.0 
language-latex 1.1.0 
language-lua 0.9.11 
language-nimrod 0.1.0 
language-ocaml 1.9.5 
language-reason 0.0.3 
language-rust 0.4.12 
language-swift 0.5.0 
language-thrift 1.0.2 
linter 2.2.0 
linter-alex 4.0.0 
linter-coffeelint 1.2.1 
linter-elm-make 0.23.7 
linter-eslint 8.2.1 
linter-js-yaml 1.2.7 
linter-markdown 5.1.0 
linter-refmt 0.3.1 
linter-rust 0.8.0 
linter-shellcheck 1.4.4 
linter-tslint 1.7.0 
linter-ui-default 1.6.5 
markdown-preview-plus 2.4.10 
maximize-panes 0.2.0 
merge-conflicts 1.4.5 
narrow 0.50.3 
nix 2.1.0 
nuclide 0.245.0 
nuclide-format-js 0.0.41 
ocaml-merlin 0.14.4 
one-tab 0.10.0 
open-on-bitbucket 0.5.0 
open-this 0.4.0 
package-cop 0.2.10 
package-sync 1.1.0 
pdf-view 0.59.0 
pigments 0.40.2 
platformio-ide-terminal 2.5.5 
prettier-atom 0.37.0 
project-folder 1.5.0 
racer 0.20.0 
reason-refmt 0.3.2 
regex-railroad-diagram 0.19.3 
relative-numbers 0.8.0 
rustfmt 0.1.3 
set-syntax 0.3.2 
sort-lines 0.14.0 
split-diff 1.4.3 
standardjs-snippets 2.6.0 
tabs-to-spaces 1.0.3 
tool-bar 1.1.0 
vim-mode-plus 0.96.2 
vim-mode-plus-ex-mode 0.9.1 
vim-mode-plus-project-find-from-search 0.2.0 
JobJob commented 5 years ago

@t9md love your packages!

I get this almost every time I move between different files, possibly after searching in files and jumping to a new file? Happy to help debug this if you want to point me where to look.

t9md commented 5 years ago

You can enable cursor history debug, by following command. Then observe developer console, which show history table on each jump. Maybe setting small history number on max config would be also helpful.

config_js_ ___github_cram-vocabulary
JobJob commented 5 years ago

It seems to be adding entries when I click or move inside the find in files (project-find) dialog. Then if I close the dialog, then try to go back or forward to those entries, I trigger the error.

The lines marked with a - are the ones from the project-find boxes

  5: (0, 0), config.jl
  6: (0, 0), -
  7: (300, 24), es.py
  8: (0, 16), -
  9: (0, 0), -
> 10: 
JobJob commented 5 years ago

Same story for the regular find-and-replace pane

JobJob commented 5 years ago

@t9md presumably you'd want to put a condition around https://github.com/t9md/atom-cursor-history/blob/fb521cb9ac2460212dc5657de8052168f2b31c43/lib/history.js#L200

maybe checking for newEntry.URI being falsy, it seems to be undefined in the entries from the find panes

t9md commented 5 years ago

Spent several minutes trying to reproduce issue, but I couldn't reproduce the issue. Fix maybe super easy, but I first want to understand steps to reproduce and have clear understanding of the cause.

JobJob commented 5 years ago

Thanks for taking the time to take a look, sorry you weren't able to reproduce from the above:

Mac OS Atom 1.34.0 atom-cursor-history 0.13.1

1) click somewhere in a file

# cursor-history: moved enough [mousedown]
  0: (0, 0), history.js
  1: (201, 7), history.js
> 2: 

2) cmd-f (keyboard shortcut for toggle find-replace pane) 3) click in replace field with mouse

# cursor-history: focus lost [mousedown]
  0: (0, 0), history.js
  1: (201, 7), history.js
  2: (0, 0), -
> 3: 

4) click back into file

# cursor-history: moved enough [mousedown]
  0: (0, 0), history.js
  1: (201, 7), history.js
  2: (0, 0), -
  3: (193, 18), history.js
> 4: 

5) type shortcut for move back in history

That should give you the stack trace.

I've fixed the issue locally by adding

    if(newEntry.URI){
      this.entries.push(newEntry)
    }

here: https://github.com/t9md/atom-cursor-history/blob/fb521cb9ac2460212dc5657de8052168f2b31c43/lib/history.js#L200

Which stops the blank url entries from the file pane from appearing in the list.

Thanks for your help and for your great packages, particularly vim-mode-plus which is brilliant.

t9md commented 5 years ago

OK, I could finally reproduce it! Thank you, I've already tried same procedure but couldn't reproduce. The difference is I set searchAllPanes: false. I could reproduce after I changed it to false(it's default).

I'll check why and fix it thanks!