romgrk / termrk

Terminal for atom, using pty.js & term.js
MIT License
33 stars 7 forks source link

Possible fix for Issue #27, #25, and #15 #32

Closed ghost closed 2 years ago

ghost commented 9 years ago

Possible fix for Issue #27, #25, and #15 (Uncaught TypeError: Cannot read property '0' of undefined)

I changed how scrolling was handled in termrk-view.coffee. I pretty much looked how term.js does it, and converted it over to CoffeeScript, commenting out the old code.

May need further testing?

ghost commented 9 years ago

This fix works for me on OS X, as well as Ubuntu.

romgrk commented 9 years ago

Hello, first let me apologize for my horrible response delay, I'm planting trees deep in the north.

Now, about the PR, well thanks a lot for taking the time to go through that! Bad side is that it doesn't work for me (on Debian jessie/sid). However, going through your code gave me a few ideas.

The problem when I test the code is that the final deltaY value ends up being either -119, -1 or 119. Nicht gut, because terminal::scrollDisp takes a number of lines as argument. I don't know which values it takes for you, but they're probably different. (Am I right?)

But then I was thinking and I said to myself, what if I divide the value by itself? Then I end up always having either 1 or -1!

I'm in a hurry and I don't have more time to discuss this, but does something like this work for you?

deltaY = event.wheelDeltaY
deltaY /= -deltaY

@terminal.scrollDisp(deltaY)

If you could watch into this, test it on OSX, make the code more compact, delete comments (if I write bad code, delete it; don't comment it) and keep a consistent 4-space indentation (I saw some 2-spaces), it would be awesome, and I'll merge this (as soon as I find time and an internet connexion).

Again, thanks for your time.

romgrk commented 9 years ago

(and if you could give me some logs of some WheelEvents on OSX or Ubuntu, you would have me eternal gratitude, I only get 'wheel' type events on debian, no DOMMouseScroll or the other one I can't remember)

ghost commented 9 years ago

@romgrk Sorry for the late response! I will look into what you said and get back to you when I can :D