Notepad3 icon indicating copy to clipboard operation
Notepad3 copied to clipboard

Add a bit more URL recognition intelligence

Open teknowledgist opened this issue 3 months ago • 4 comments

If you have code with a URL contained in single quotes, Notepad3 includes the final single quote in the URL. What happens with a CTRL-click on the URL is (usually) a 404 since the url doesn't actually end in '.

Because ' is a legal URL character, I understand why it is doing that, but could some logic be added to be a bit smarter about it? At a minimum, don't include a ' at the end of the url if the URL is immediately preceded by a '.

Basically, it should be easy to identify an invalid ' in a line like (This is what I encounter a lot.): $URL = 'https://example.com'

It gets harder in a line like (totally made up code because I am not aware of a real example): <definition:'url=https://example.com'>

Although, there simply cannot be all that many actual pages with URLs that end in ', so simply ignoring it at the end of any URL string would probably be correct 99.999% of the time.

Thanks!

teknowledgist avatar Sep 10 '25 15:09 teknowledgist

FYI this was brought up in the past, and some reasoning given

https://github.com/rizonesoft/Notepad3/issues/3875#issuecomment-1004195819

jupester avatar Sep 11 '25 02:09 jupester

Hello @teknowledgist , @jupester,

Indeed the case with a ' at the end of an URL is not correctly handled.

Image

I hoop @RaiKoHoff finds some time to fix it? 😢

hpwamr avatar Sep 11 '25 08:09 hpwamr

Hrmmm... I see there are definitely complications beyond what I was considering. Paraphrasing some of @RaiKoHoff 's example:

https://example.com/HomerSimpson's life/work is a valid URI, but checking for a space after the ' isn't enough.

https://example.com/MontgomeryBurns' life/work is also valid. Counting ' won't work either.

https://example.com/NedFlanders' 'life'/'work' is also valid.

(Why anyone would be stupid enough to include multiple spaces or apostrophes in a URI is different question!)

teknowledgist avatar Sep 11 '25 19:09 teknowledgist

Why anyone would be stupid enough to include multiple spaces or apostrophes in a URI is different question!

Notepad3 already supports "apostrophes" in URLs. However, "one or more spaces" in a URL are hypothetical cases where I don't recommend Notepad3 support.

hpwamr avatar Sep 12 '25 08:09 hpwamr