-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Support clicking directly on a URL to open it #2146
Conversation
Ah, finally completed it, eh! Congratz Sorry for the delay, didn't get time to test. It seems to be working fine on my device without a mouse. Also should add a key in Maybe this should also only be triggered if Also regex Also it would be better if you added some comments in Thanks |
No worries, three days isn't that long :)
Ah, I see what you mean, hadn't noticed that. I don't think the commit you're linking to matters for this. I'll take a look at it.
Hm, not sure I see how it would be slowed down? It only runs if you tap the screen, and you don't typically do that very often for other things? But sure, we can have an option. I see below that you want to do this?
I would hate that, since I want to be able to open URLs in the easiest way possible (I use IRC and Slack in Termux, so I open URLs all the time). But we could have an option for it.
Right, I just reused
Sure. I'm on vacation now though, so will do this next week. |
Thanks. If it's fixable, then great.
Probably, slowing down may not be that much an issue, if regex is precompiled. But would be better to have an option in case someone doesn't want it. Okay, then we can just leave it at directly opening on touch for now unless some issue arises in future for someone.
No worries.
Thanks
Yeah, enjoy for now then. Will leave this for next release. I will refactor the |
…n click The user can add `terminal-onclick-url-open` entry to `termux.properties` file to enable opening url links in terminal transcript on click or on tap. The default value is `false`. So adding the entry `terminal-onclick-url-open=true` to `termux.properties` file will enable url opening. Running `termux-reload-settings` command will also update the behaviour instantaneously if changed. This commit just adds the property and doesn't implement the functionality. That will later be merged from #2146.
1dc0ea4
to
e1dbfda
Compare
Sorry for the very long delay here. I've now fixed the issue if you click on the blank space on the right, taken the option you added into use, added some comments and tests for Btw, one thing I noticed while testing this is that when you long press to select text, an offset is applied so the word on the line above where you pressed is selected. However when mouse tracking is enabled, this offset is not applied, so that means that different lines are affected when you click and when you long press when mouse tracking is enabled. For URL opening I used the same code to get the position as the long press uses, so that uses the offset. |
e1dbfda
to
16b167b
Compare
No worries about the delay. Thanks for adding the comments and tests. The issues seem to be fixed. I am not sure why that offset was added, might be because pressing with finger will have a larger touch area and we need to select bottom of line. Is that affecting behaviour for you? Pull request looks good. I can merge it if you don't plan on changing anything further. I force pushed to use |
I'm not sure either. Well, it is affecting me in that I have to press a different place when I want to select/open url and when I want to interact with an application with mouse tracking. Not really related to this PR though, other than that I had to choose one of the behaviors when implementing it, and I chose the same as when selecting text because that fit better with the code. But as for the actual behavior I'm not sure I see how the offset is improving things.
Great. No, I don't plan any more changes. |
Well, neither the comment, nor the commit message (check top) when it was added in So it has no significance in actual selection. If its indeed causing problem in selection with accuracy, then maybe it should be removed, unless someone objects.
If you wanna remove the offset, you can do it here, otherwise will merge. |
This allows you to click/press directly on a URL in the terminal view to open it. It takes priority over opening the keyboard, so if you click on a URL it is opened, and if you click anywhere else the keyboard opens like before. Currently, if the application in the terminal is tracking the mouse and you click on a URL, both actions happen. The mouse event is sent to the application, and the URL is also opened. To enable support for this, you have to set `terminal-onclick-url-open=true` in `termux.properties`.
16b167b
to
25650b5
Compare
Alright, I've removed the offset and changed the calculation of column number for selection/url to match the calculation used for mouse tracking. See commit 54bb83d for an explanation. |
25650b5
to
55af769
Compare
When calculating the row that is clicked, for mouse tracking mFontLineSpacingAndAscent was taken into account, but for selection and URL clicking it wasn't. This adds a common function for calculating the column and row which does take it into account and use that for all three. I'm not quite sure why it's necessary to subtract mFontLineSpacingAndAscent, but with this calculation the click location matches the line that is acted on for me with both touch and mouse and on different font sizes. It also removes the offset for finger the selection/url used because I don't think it's common for apps on Android to have such an offset, and because the mouse tracking did not use such an offset.
55af769
to
54bb83d
Compare
Testing and working fine for both tapping and clicking. Users would need to fix their muscle memory and tap directly on the text since offset has now been removed, but shouldn't be too much of an issue. I think removing offset would also improve selecting text at the bottom of the terminal too. Thanks for this! |
will we get this update on playstore or f-droid version of termux app? |
you can make a popup message which can ask users if they want to leave the app to open the url or not "do you want to open the url?" |
Playstore releases have been deprecated and haven't received an update for over an year. https://github.com/termux/termux-app#google-play-store-deprecated
Can be added later. Also an option to view in browser or webview. |
How does this feature work? Click-Url.mp4 |
Read changelog. |
app version 0.118 Click-url1.mp4 |
Exit termux app completely and start again. |
Turns out that I had a space character after |
…n click The user can add `terminal-onclick-url-open` entry to `termux.properties` file to enable opening url links in terminal transcript on click or on tap. The default value is `false`. So adding the entry `terminal-onclick-url-open=true` to `termux.properties` file will enable url opening. Running `termux-reload-settings` command will also update the behaviour instantaneously if changed. This commit just adds the property and doesn't implement the functionality. That will later be merged from termux#2146.
Added: Allow users to directly open URL links in terminal transcript when clicked or tapped The user can add `terminal-onclick-url-open=true` entry to `termux.properties` file to enable opening of URL links in terminal transcript when clicked or tapped. The default value is `false`. Running `termux-reload-settings` command will also update the behaviour instantaneously if changed. Implemented in termux#2146
…n click The user can add `terminal-onclick-url-open` entry to `termux.properties` file to enable opening url links in terminal transcript on click or on tap. The default value is `false`. So adding the entry `terminal-onclick-url-open=true` to `termux.properties` file will enable url opening. Running `termux-reload-settings` command will also update the behaviour instantaneously if changed. This commit just adds the property and doesn't implement the functionality. That will later be merged from termux#2146.
Added: Allow users to directly open URL links in terminal transcript when clicked or tapped The user can add `terminal-onclick-url-open=true` entry to `termux.properties` file to enable opening of URL links in terminal transcript when clicked or tapped. The default value is `false`. Running `termux-reload-settings` command will also update the behaviour instantaneously if changed. Implemented in termux#2146
This allows you to click/press directly on a URL in the terminal view to
open it. It takes priority over opening the keyboard, so if you click on
a URL it is opened, and if you click anywhere else the keyboard opens
like before.
Currently, if the application in the terminal is tracking the mouse and
you click on a URL, both actions happen. The mouse event is sent to the
application, and the URL is also opened.