Closed ronaldocpontes closed 9 years ago
Well noted. This is probably caused by an experimental re-implementation of term.js::resize, because the original implementation delete lines where it shouldn't. It has been deactivated for now. I'll close but re-open if it happens again.
Just happened to me on 0.1.0.16
Opened Atom Opened Termrk with Alt+Space Entered some console commands Tried to scroll console Error appears and repeats
Could you post the error log? TypeError
is quite vague and could come from multiple places.
Log:
/Users/zachary/.atom/packages/Termrk/node_modules/term.js/src/term.js:1208
Hide Stack Trace
TypeError: Cannot read property '0' of undefined
at Terminal.refresh (/Users/zachary/.atom/packages/Termrk/node_modules/term.js/src/term.js:1208:18)
at Terminal.refresh (/Users/zachary/.atom/packages/Termrk/lib/termjs-fix.coffee:127:9)
at Terminal.scrollDisp (/Users/zachary/.atom/packages/Termrk/node_modules/term.js/src/term.js:1401:8)
at TermrkView.module.exports.TermrkView.terminalMousewheel (/Users/zachary/.atom/packages/Termrk/lib/termrk-view.coffee:163:19)
at TermrkView.terminalMousewheel (/Users/zachary/.atom/packages/Termrk/lib/termrk-view.coffee:2:1)
Just got the same exact issue with 0.1.17:
/Users/joshglendenning/.atom/packages/Termrk/node_modules/term.js/src/term.js:1208
TypeError: Cannot read property '0' of undefined
at Terminal.refresh (/Users/joshglendenning/.atom/packages/Termrk/node_modules/term.js/src/term.js:1208:18)
at Terminal.refresh (/Users/joshglendenning/.atom/packages/Termrk/lib/termjs-fix.coffee:127:41)
at Terminal.scrollDisp (/Users/joshglendenning/.atom/packages/Termrk/node_modules/term.js/src/term.js:1401:8)
at TermrkView.module.exports.TermrkView.terminalMousewheel (/Users/joshglendenning/.atom/packages/Termrk/lib/termrk-view.coffee:240:28)
at TermrkView.terminalMousewheel (/Users/joshglendenning/.atom/packages/Termrk/lib/termrk-view.coffee:3:61)
Hello all,
I corrected this issue by modifing the terminalMousewheel event in lib/termk-view.coffee file, as follows:
terminalMousewheel: (event) =>
deltaY = event.wheelDeltaY
#This line breaks things on OS X
#deltaY/120 is not needed for scrolling
#deltaY /= 120
deltaY *= -1
@terminal.scrollDisp(deltaY)
From what I can tell, the way that the delta Y values from the "mouse wheel" are being used is causing the problem. Depending on your operating system, the way in which this value is interpreted varies. If this is the case, the way this mouse event is handled needs to be universal.
Mozilla has some good documentation talking about these delta values - https://developer.mozilla.org/en-US/docs/Web/Events/mousewheel
This solution works for me as well, does it work for anyone else? I changed how scrolling was handled -- I pretty much looked how term.js does it, and converted it over to CoffeeScript.
terminalMousewheel: (event) =>
#This breaks everything :(
#deltaY = event.wheelDeltaY
#deltaY /= 120
#deltaY *= -1
#Works on OSX only?
#deltaY = event.wheelDeltaY
#deltaY *= -1
#Possible catch-all solution?
deltaY = event.wheelDeltaY
#Handle scrolling based on the event type
#Based on how term.js handles mouse scrolling
if event.type is 'DOMMouseScroll'
deltaY += if event.detail < 0 then -1 else 1
deltaY *= -1 #Correct scrolling direction
else
deltaY += if event.wheelDeltaY > 0 then -1 else 1
deltaY *= -1 #Correct scrolling direction
@terminal.scrollDisp(deltaY)
Oooh yay! This fixes the bug for me on OS X! I'd recommend merging this!
@sasquatch666 Glad to hear!
I am looking into some other things to make a more solid fix for @romgrk -- Hopefully this is pushed as update shortly
:D
Hello everyone,
So as a workaround, here's what's implemented:
Again, I cannot test the code on OS X, therefore I have to wait for your feedback; let me know how it goes. @ZachR0 if you see any changes that should be made, or have a more robust solution >> https://github.com/romgrk/termrk/blob/master/lib/termrk-view.coffee#L157 Don't hesitate to send a PR. (....or just the plain code, I'll do a good old copy/paste)
This has been reported as fixed. Closing, but reopen if it's not the case.
[Enter steps to reproduce below:]
Atom Version: 0.202.0 System: Mac OS X 10.8.5 Thrown From: Termrk package, v0.1.13
Stack Trace
Uncaught TypeError: Cannot read property '0' of undefined
Commands
Config
Installed Packages