-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Can't alt click to move cursor #316
Comments
@pdufour by just looking through hyperterm issues my mind gets blown by the crazy time saving things I didn't know about iTerm and mac terminal. Thanks for sharing 😉 +1 |
This is a must-have feature. |
The way hterm interpret it with span doesn't allow us the ability to do this now. From what I tried. I can set the cursor position but then it doesn't comply to text after it. |
Copying what I wrote on #1466:
|
Is this possible with a plugin? @ppot Can you give more detail on why it isn't doable? Would like to have a go at this unless the API totally prevents it. |
@adamscybot From what I tried, you can update the cursor position, but it didn't sync. You can try! |
Ah as in, the server didn't actually recognize the change? I guess you'd have to send the right control characters over the ssh channel to move the cursor, i.e. the equivalent of pressing the right or left arrow key however many keys you need to move. |
Ok, I have a working solution inside a plugin that is very very hacky. As mentioned, the lack of spans to detect click event makes this very tricky. I think proper support would need to be integrated into hyper itself. Or an improved plugin API. Regardless, I know it will help some people so I will finish it off this week and publish (hopefully tomorrow evening, GMT). |
Ok guys here we go: https:/adamscybot/hyper-alt-click It's a giant hack, and probably buggy, but I just needed this feature. Very experimental at this stage, hopefully room for improvement. Especially support in Vim/Nano etc. Completely untested on everything but my mac... |
@adamscybot What API improvements do you need to achieve this with a less-hacky plugin? |
@chabou The main issue is that each line in the terminal exists as a text node in the DOM. This means you can not attach a click handler to an individual letter. I think there needs to be a way to pass down your own element for rendering a line in the terminal. Im hacking around this problem by:
Yuck! I believe the base issue though actually exists in Google Hterm though, which seems to be responsible for the handling of the actual terminal lines. Not sure if it can easily be hacked in or if hterm would need to be replaced. I think this dependency is the limiting factor. |
Adding a span to every char could have a huge impact on performances. Hyper has a lot of hterm monkey patches. You can look deeper into hterm, try to add span for each chars and measure performance changes. Hyper has already a lot of performances issues. Adding DOM complexity seems harmful. |
@chabou Yeh, I can see how that could be an issue. Perhaps one route would be to try and formalise my method in some way? If there was a way to attach a click handler on a terminal line and then to modify how lines are rendered (pass down a custom component?) on a per-line basis. The primary issue with my hack is it blatantly ignores react by touching the DOM outside of the react ecosystem. This is outright incorrect and so the hack exists in a permanent state of instability. |
Hterm is itself outside react ecosystem (encapsulated in an iFrame). |
I was going to make a new issue, but this is related. In linux and OSX you can click to move the cursor in Vim and other apps. I know it's not a best practice for vim, but sometimes it's nice when I'm in a "just f*ck it" mood and don't want to deal with keyboard shortcuts. |
You're right. |
The good news is: it works great in |
@chabou Oooo xterm. Does this bring anything to the table in terms of per-character mouse events? Is alt+click already supported out of the box? |
@adamscybot col/row notion is reaaaally better handled in |
Ah this is exactly what was needed. I'm guessing I could just grab the xterm instance in a hyper plugin and plug away at it. I'll take a look once its in master. |
@adamscybot yes PRs welcome in xterm.js. If you want to contribute in this area please fork the v3 branch and make changes there to avoid merge conflict headaches. Created xtermjs/xterm.js#890 to discuss implementation 😃 Also working against the demo https:/sourcelair/xterm.js#demo will be easier than trying to pull the right version in to hyper. |
Update: There's a PR in xterm for this feature xtermjs/xterm.js#896 |
And we merged it today, coming in the next version 😃 |
Terminal app on mac has a nice feature where you can
alt + click
to move the cursor to a position. This does not work in Hyperterm.The text was updated successfully, but these errors were encountered: