pimentel / atom-r-exec

Send R code to various R consoles from the Atom editor
https://atom.io/packages/r-exec
MIT License
19 stars 8 forks source link

Uncaught Error: Undefined screen line when clipping screen position #25

Closed davharris closed 7 years ago

davharris commented 8 years ago

Steps to reproduce:

  1. Open a file called test.R
  2. Click on "Packages" in the menu bar
  3. Click R-exec > Send line/selection

I get this error reliably, regardless of the content of the line. The line is sent to the terminal and evaluated by R, but a red box pops up telling me to file an issue.

Atom Version: 1.4.3 System: Mac OS X 10.11.3 Thrown From: r-exec package, v0.3.3

Stack Trace

Uncaught Error: Undefined screen line when clipping screen position

At /Applications/Atom.app/Contents/Resources/app.asar/src/display-buffer.js:886

Error: Undefined screen line when clipping screen position
    at DisplayBuffer.module.exports.DisplayBuffer.clipScreenPosition (/Applications/Atom.app/Contents/Resources/app.asar/src/display-buffer.js:874:15)
    at DisplayBuffer.module.exports.DisplayBuffer.bufferPositionForScreenPosition (/Applications/Atom.app/Contents/Resources/app.asar/src/display-buffer.js:826:20)
    at TextEditorMarker.module.exports.TextEditorMarker.setHeadScreenPosition (/Applications/Atom.app/Contents/Resources/app.asar/src/text-editor-marker.js:185:60)
    at /Applications/Atom.app/Contents/Resources/app.asar/src/cursor.js:67:31
    at Cursor.module.exports.Cursor.changePosition (/Applications/Atom.app/Contents/Resources/app.asar/src/cursor.js:673:7)
    at Cursor.module.exports.Cursor.setScreenPosition (/Applications/Atom.app/Contents/Resources/app.asar/src/cursor.js:65:19)
    at /Applications/Atom.app/Contents/Resources/app.asar/src/text-editor.js:1448:23
    at TextEditor.module.exports.TextEditor.moveCursors (/Applications/Atom.app/Contents/Resources/app.asar/src/text-editor.js:1652:9)
    at TextEditor.module.exports.TextEditor.setCursorScreenPosition (/Applications/Atom.app/Contents/Resources/app.asar/src/text-editor.js:1447:19)
    at Object.module.exports.sendCommand (/Users/davidharris/.atom/packages/r-exec/lib/r-exec.coffee:98:14)
    at atom-workspace.<anonymous> (/Users/davidharris/.atom/packages/r-exec/lib/r-exec.coffee:40:34)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:260:29)
    at CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:3:61)
    at CommandRegistry.module.exports.CommandRegistry.dispatch (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:160:19)
    at AtomEnvironment.module.exports.AtomEnvironment.dispatchApplicationMenuCommand (/Applications/Atom.app/Contents/Resources/app.asar/src/atom-environment.js:1013:28)
    at emitOne (events.js:77:13)
    at EventEmitter.emit (events.js:169:7)

Commands

     -0:21.2.0 pane:reopen-closed-item (atom-text-editor.editor.is-focused)
     -0:11.9.0 editor:newline-below (atom-text-editor.editor.is-focused)
     -0:11.2.0 core:move-up (atom-text-editor.editor.is-focused)
     -0:10.8.0 editor:select-to-end-of-line (atom-text-editor.editor.is-focused)
     -0:10.5.0 editor:newline-below (atom-text-editor.editor.is-focused)
     -0:09.8.0 core:move-up (atom-text-editor.editor.is-focused)
     -0:02.2.0 r-exec:send-command (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "themes": [
      "one-light-ui",
      "one-light-syntax"
    ]
  },
  "r-exec": {
    "advancePosition": true,
    "whichApp": "Terminal"
  }
}

Installed Packages

# User
language-r, v0.4.0
r-exec, v0.3.3

# Dev
No dev packages
davharris commented 8 years ago

I've also updated my ~InitScript~ keybinding script to bind the command to cmd-enter, and now I get the same behavior from the keyboard as well.

pimentel commented 8 years ago

hi @davharris ! thanks for submitting this bug report. I am fairly certain it is fixed in the current development version.

to be sure, does this only happened at the end of the file or does it happen when you are sending anything? I've had this issue only when sending the final line and also with advancePosition set to True.

Also, could you check if the bug happens when advancePosition is set to False?

if your response is what I think is happening, then I will push the current development version so you and everyone else can update.

thanks for using the package!

pimentel commented 8 years ago

actually, I'm fairly confident in the fix. I just pushed a new version (v0.3.4) with this bug fix and some slightly better behavior when advancing (skip comments).

let me know if it fixes things.

thanks!