atom-tablr icon indicating copy to clipboard operation
atom-tablr copied to clipboard

Uncaught TypeError: Cannot read property 'getCursors' of null

Open StefanoCecere opened this issue 9 years ago • 4 comments

when i edit a cell, and press enter to close it.. the value gets saved anyway.. but i get this red Error


Atom Version: 1.6.1 System: Mac OS X 10.11.4 Thrown From: tablr package, v1.1.0

Stack Trace

Uncaught TypeError: Cannot read property 'getCursors' of null

At /Users/krur/.atom/packages/tablr/lib/table-element.coffee:855

TypeError: Cannot read property 'getCursors' of null
    at tablr-editor.module.exports.TableElement.confirmCellEdit (/Users/krur/.atom/packages/tablr/lib/table-element.coffee:855:29)
    at atom-text-editor.textEditorSubscriptions.add.atom.commands.add.core:confirm (/Users/krur/.atom/packages/tablr/lib/table-element.coffee:933:10)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:260:29)
    at /Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:3:61
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:570:16)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:378:22)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeydown (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:97:36)
    at HTMLDocument.<anonymous> (/Applications/Atom.app/Contents/Resources/app.asar/src/window-event-handler.js:3:61)

StefanoCecere avatar Mar 31 '16 18:03 StefanoCecere

I'm experiencing this a lot too, same conditions. It stops for a while after closing the app and then kicks back in.

sashmackinnon avatar Aug 04 '16 00:08 sashmackinnon

Me too...

Atom Version: 1.6.1 System: Mac OS X 10.11.4 ** Tablr package: 1.8.3

Have you got any idea about it @abe33? Tablr is a very good package and it works very nice, with this exception :crying_cat_face:

Regards, Iván

ivanhercaz avatar May 10 '18 12:05 ivanhercaz

I have the same issue

Atom Last Version: System: Windows 10 Tablr package: Last version

typo3ua avatar Jan 12 '21 17:01 typo3ua

Potential fix (disclaimer that I don't understand the multi-cell editing well, see 2256b1df2b149f681ac192082158d6eab3ce54e8 for original, pre-ES6 commit):

positions is only used within the conditional, so update confirmCellEdit():

   confirmCellEdit () {
     this.stopEdit()
-    const positions = this.tableEditor.getCursors().map(c => c.getPosition())
 
     const newValue = this.editor.getText()
     if (newValue !== this.tableEditor.getLastCursor().getValue()) {
+      const positions = this.tableEditor.getCursors().map(c => c.getPosition())
       this.tableEditor.setValuesAtScreenPositions(positions, [newValue])
     }
   }

EDIT: Actually, that won't work at all, this.tableEditor will still be null. It only seemed like it worked because I restarted Atom, which "fixes" things temporarily.

malicious avatar Jan 16 '21 22:01 malicious