-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zsh / oh-my-zsh - no scroll #151
Comments
Thanks for reporting @wallverb. I do not have access to zsh right now, so I am not able to test this out. Could you please take a look at your console in the developer tools of your browser and provide us with any errors/logs that might appear when attempting to scroll when in zsh with oh-my-zsh? |
@parisk - when zsh/oh-my-zsh is executing that
which seems like that
and then
|
@parisk, any movement on fixing this? Really appreciate the work! |
@richarddavenport unfortunately I didn't have time to deal with this and I do not project to be able to do so by the end of the month. It would be extremely helpful if we could get an external contribution on this and I can definitely help anyone out with figuring out the internals of xterm.js. |
@parisk I'd love to help! Is there any documentation anywhere, or could you help me get going with debugging? Is there an editor or IDE that works best? VS Code/Webstorm/Chrome Dev Tools? Thanks! |
@richarddavenport any editor works well. All the code is in |
@richarddavenport I think @Tyriar is right. Any editor supporting JavaScript works, so feel free to choose the one that suits you better. Personal opinion though would be choosing an editor or IDE that uses xterm.js itself though, in order to dogfood it as well (use xterm.js when developing xterm.js). The two solutions that I am aware of right now are:
Debugging with Chrome/Firefox DevTools is the best way to go IMO. Considering the documentation, there is no public website at the moment but you should expect it within the week. Till that time just run Feel free to ask for more help in case the above do not suffice. |
@richarddavenport I published a preview version of the docs website, which contains the API reference. Most public methods are documented. You can take a look at http://docs.xtermjs.org/. Hope it helps 😊 . |
Wow! That's pretty awesome! @wallverb is right about the |
Yes I'm a bit hesitant to touch it as I don't know what it does either. This reference doc we use mentioned it here:
The code also mentions: // ESC = Application Keypad (DECPAM).
case '=':
this.log('Serial port requested application keypad.');
this.applicationKeypad = true;
this.state = normal;
break;
// ESC > Normal Keypad (DECPNM).
case '>':
this.log('Switching back to normal keypad.');
this.applicationKeypad = false;
this.state = normal;
break; Looking into what DECPAM and DECPNM will likely lead us to an answer. Also if there's a difference with DECKPAM and DECKPNM. |
Xterm.js scrolling with oh my zsh now works, with this branch |
Hi. Found this thread from the related bug on Oh My Zsh.
I think DECPAM and DECPNM are just typos for DECKPAM and DECKPNM. The mnemonics are "DEC KeyPad Application Mode" and "DEC KeyPad Normal Mode". Application keypad modes change what character sequences the cursor keypad and/or numeric keypad keys send in response to key presses. There are two (or more) distinct keypad modes which can be set to either "application" or "normal": the numeric keypad and the cursor keypad. The It seems to me there may be a bug with the Home and End keys, though. Their behavior is modified by the Regardless, it's surprising to me that the keypad mode would affect mouse scroll wheel behavior. (That's the scrolling that OP is talking, about, right?) Maybe the fix is as simple as removing that
You can test this behavior under |
I believe this is the same root cause as why scrolling doesn't work in vim which also sets |
Following xterm's mouse spec the mouse actions don't get modified by DECKPAM or DECKPNM. Does anyone know why we have the |
I think I have some more input to provide here.
In addition, even if we removed this it would result in a This should be most probably handled in the previous event handler.
@richarddavenport did this work without any change on xterm.js? |
@parisk Yes, it is working without any change to xterm.js. |
Shouldn't this behavior be just a function of the mouse tracking mode, Alternate Screen, and Alternate Scroll modes, and not the numeric/cursor Application Keypad modes? OP is using |
@parisk I second what apjanke says - why should a keyboard mode settings interfere at all with the mouse behavior? The official xterm spec does not mention any of this, therefore implementing an xterm compatible model may not have such a limitation. Maybe I miss something here. Furthermore the alternate screen switch (DECSET 1047) is used to indicate different terminal behavior - the normal screen buffer (1047 low) comes with the scrolling buffer while the alternate one (1047 high) has none. The latter is used by all curses apps, vim, emacs and other more sophisticated terminal apps using the terminal as a canvas (most apps heavily relying on terminfo). For those apps there is no terminal scrolling. You can test this yourself by running vim or emacs in xterm - you can't scroll back to previous terminal content. After closing the app and returning to normal shell interface terminal scrolling is "enabled" again. There are also apps that do more advanced drawing on the normal screen (e.g. man, top) and don't register mouse tracking. xterm is still scrollable for those and their content just sits at the end of the output buffer. |
What's the easiest "work-around" available before this is addressed a more verbose manner? |
@ksnyde this is probably the easiest: microsoft/vscode#7817 (comment). I haven't tried it personally though. |
Unfortunately, that will break other key bindings which depend on There's an open OMZ PR I put in to drop the That is, if you are using Oh My Zsh. If you are using one of the Linux distributions which configure
(This may still break other key bindings that depend on application keypad mode.) |
Minor difference, but this is not quite true: in xterm, at least some versions of it, if you run |
Thanks for clarification @apjanke - to fully mimick xterm's behavior the handling of the scroll buffer and DECSET 1047 has to be reviewed first IMO. |
This change allows wheel events in application mode which fixes mouse wheel scrolling in oh-my-zsh and powershell for Linux (among others). Along with xtermjs#287 a functional scroll bar will also be usable in those shells. Fixes xtermjs#151
FWIW, I think this is a case of Xterm.js deviating from normal xterm behavior, and is not Oh My Zsh's problem, and this bug should be closed. If OMZ does provide a compatibility shim for it, it should be confined to a plugin. |
Yes, I agree with #289. "Application mode" as discussed here is just a keypad mode switch; mouse behavior should be unaffected by it, so wheel events should be allowed. |
If i start demo with
zsh
instead ofbash
and haveoh-my-zsh
installed then the scroll will not work in xterm.jsI am not sure if this is an issue with
xterm.js
oroh-my-zsh
The command that causes scroll to stop working is this command:
echoti smkx
that is located in.oh-my-zsh/lib/key-bindings.zsh
One can also start
xterm.js
withoutoh-my-zsh
and type that command into terminal and it will stop scrolling.The text was updated successfully, but these errors were encountered: