aki77 / atom-expand-region

expanding selection
https://atom.io/packages/expand-region
MIT License
89 stars 9 forks source link

Uncaught TypeError: Cannot read property 'push' of undefined #23

Closed maikeldaloo closed 6 years ago

maikeldaloo commented 7 years ago

Code block that caused this bug: Cursor position is somewhere within the word, not exact position.

<option value="" data-state="Melb[cursor]ourne">Melbourne</option>
<option value="" data-state="Syd[cursor]ney">Sydney</option>
<option value="" data-state="Adel[cursor]aide">Adelaide</option>
<option value="" data-state="Brisb[cursor]ane">Brisbane</option>
<option value="" data-state="Canb[cursor]erra">Canberra</option>
  1. Multi-cursor, press Alt+Up, it throws error.
  2. Tested this with only 2 cursors, it works, 3 or more seems to break.

I hope that's helpful.

Atom: 1.18.0 x64 Electron: 1.3.15 OS: Mac OS X 10.12.5 Thrown From: expand-region package 0.3.0

Stack Trace

Uncaught TypeError: Cannot read property 'push' of undefined

At /Users/maikel/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:854

TypeError: Cannot read property 'push' of undefined
    at /packages/expand-region/lib/expand-region.coffee:129:42
    at TextBuffer.module.exports.TextBuffer.transact (/Users/maikel/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:849:24)
    at TextEditor.module.exports.TextEditor.transact (/Users/maikel/Applications/Atom.app/Contents/Resources/app/src/text-editor.js:1599:32)
    at ExpandRegion.module.exports.ExpandRegion.computeRanges (/packages/expand-region/lib/expand-region.coffee:112:13)
    at ExpandRegion.module.exports.ExpandRegion.computeCandidates (/packages/expand-region/lib/expand-region.coffee:65:7)
    at ExpandRegion.module.exports.ExpandRegion.expand (/packages/expand-region/lib/expand-region.coffee:16:20)
    at /packages/expand-region/lib/expand-region.coffee:1:1)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Users/maikel/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:265:35)
    at /Users/maikel/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:3:65
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Users/maikel/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:610:22)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Users/maikel/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:401:28)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/Users/maikel/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:100:42)
    at HTMLDocument.<anonymous> (/Users/maikel/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:3:65)

Commands

     -0:38.4.0 docblockr:parse-enter (input.hidden-input)
     -0:38.4.0 editor:newline (input.hidden-input)
     -0:22.8.0 core:move-left (input.hidden-input)
  2x -0:11.6.0 core:backspace (input.hidden-input)
     -0:11 core:move-right (input.hidden-input)
     -0:10.6.0 editor:select-to-end-of-word (input.hidden-input)
     -0:10 core:copy (input.hidden-input)
  2x -0:09.8.0 core:move-left (input.hidden-input)
     -0:09.1.0 core:paste (input.hidden-input)
  2x -0:08.0 core:move-left (input.hidden-input)
     -0:07.5.0 editor:select-to-beginning-of-word (input.hidden-input)
     -0:06.9.0 core:move-left (input.hidden-input)
  2x -0:06.7.0 core:move-right (input.hidden-input)
     -0:05.8.0 expand-region:expand (input.hidden-input)
     -0:05.8.0 editor:select-word (atom-text-editor.editor.is-focused)
  2x -0:05.7.0 emmet:balance-outward (atom-text-editor.editor.is-focused)

Non-Core Packages

atom-handlebars 1.3.0 
atom-ternjs 0.18.3 
custom-title 1.0.1 
docblockr 0.10.5 
editorconfig 2.2.2 
emmet 2.4.3 
expand-region 0.3.0 
sort-lines 0.14.0 
sync-settings 0.8.2 
bparticle commented 5 years ago

This bug is still present and affects my Atom editor version 1.30.0 on Linux. How come it is closed without any comments? Is there a fix available?