Formatting of links when selected or on mouseover has a blue/gray background
-
npp debug info is at the bottom
The background color for clickable links in npp are turning a blue/gray when the mouse is over a link or I move the cursor to within a link using the mouse or keyboard. It’s extremely distracting.
In Settings / preferences / MISC. / Clickable Link Settings
if I disable and then re-enable the Enable thing this fixes the issue. Mousing over a link changes the underline from black to blue and is not distracting.
However, if I exit and restart npp then npp starts starts turning the background blue/gray again.I have posted images to https://imgur.com/a/TJIgGrm
Notepad++ v7.8.8 (32-bit)
Build time : Jun 24 2020 - 00:15:36
Path : C:\Program Files (x86)\Notepad++\notepad++.exe
Admin mode : OFF
Local Conf mode : OFF
OS Name : Windows 10 Home (64-bit)
OS Version : 1909
OS Build : 18363.959
Current ANSI codepage : 1252
Plugins : DSpellCheck.dll mimeTools.dll NppConverter.dll NppExport.dll NppTextFX.dll PythonScript.dll -
Also, the issue goes away if I enable and then disable “No underline” in Settings / preferences / MISC. / Clickable Link Settings. It comes back if I exit and restart npp.
-
While the now mislabeled foreground color for links (URL hovered fgColor) can be used to change the background color it was still disorienting even when I made the background a very faint yellow. I could make it white but wanted to know I’m hovering on a link without having to watch the cursor.
Unfortunately, we can’t change the text color. That setting is ignored.
I normally use the default theme with no customization meaning it has black text on a white background. Prior to v7.8.7 links were underlined and when the cursor or mouse is in one the background remains white and text color and its underline turn blue.
In https://community.notepad-plus-plus.org/topic/19500/7-8-7-release-candidate-3 donho mentions
The old mechanism for clickable link causes a lot problem and
performance issue, that’s why we have implemented in another way which
is cleaner and more efficient. The price to pay is the hovered effect
changed (and I kind of like it), but it worth it.It’s not worth it for me. I’m hoping that the text color becomes customizable and then npp can go back to the same visual behavior that it had in all previous releases since clickable links were introduced.
It seems changing the text color is possible or at least the underline color can be changed. One of the v7.8.9 fixes was “Fix URL Hovered colour disappears after modifying any Clickable Link Settings regression.” With previous version, or v7.8.8, if I enabled and then disabled clickable links then npp was in a mode where when the cursor or mouse was in a link that the background was white, the text was black, and configured URL hovered foreground color would be applied to the underline.
This is very close to the desired behavior which is that the background remains white and both the underline plus text would change to the configured URL hovered foreground color.
To take advantage of this I would have to go into Settings / MISC. every time I start npp. That’s not a big deal but turning just the underline blue is a little too subtle. I tried red which works better as an indicator but is too close to the misspelled word underline. I need the older behavior where the text changes color.
-
Since you have the PythonScript plugin installed, you can try to get
back to the old behavior by using something like this. (put this into a user startup.py file)
Roughly tested, it seems to do the job.from Npp import editor, editor1, editor2, SCINTILLANOTIFICATION, INDICATORSTYLE def revert_url_indicator(args): editor1.indicSetHoverStyle(8, INDICATORSTYLE.TEXTFORE) editor2.indicSetHoverStyle(8, INDICATORSTYLE.TEXTFORE) editor.callbackSync(revert_url_indicator, [SCINTILLANOTIFICATION.UPDATEUI])
-
Thank you @Ekopalypse. I’m getting an error from startup.py
Python 2.7.6-notepad++ r2 (default, Apr 21 2014, 19:26:54) [MSC v.1600 32 bit (Intel)] Initialisation took 93ms Ready. Traceback (most recent call last): File "C:\Users\...\startup.py", line 4, in revert_url_indicator editor1.indicSetHoverStyle(8, INDICATORSTYLE.TEXTFORE) AttributeError: 'Editor' object has no attribute 'indicSetHoverStyle' Traceback (most recent call last): File "C:\Users\...\startup.py", line 4, in revert_url_indicator editor1.indicSetHoverStyle(8, INDICATORSTYLE.TEXTFORE) AttributeError: 'Editor' object has no attribute 'indicSetHoverStyle' Traceback (most recent call last): File "C:\Users\...\startup.py", line 4, in revert_url_indicator editor1.indicSetHoverStyle(8, INDICATORSTYLE.TEXTFORE) AttributeError: 'Editor' object has no attribute 'indicSetHoverStyle'
-
@mkupper ,
What version of PythonScript are you using? Given the Python 2.7.6 in your error message, it might not be new enough for the methods (and internally, messages) used by the script @Ekopalypse shared
-
Thank you @PeterJones, that worked. I was using using PythonScript version 1.0.8. There is a longish story behind that related to my using npp on Windows 2000 and Vista machines. As this machine is Windows 10 I updated PythonScript to 1.5.4 and now your code works.
Now when I move the cursor or hover on a URL or link they are switching to blue text (the configured URL hovered foreground color) on a white background though the underline disappears as I hover.
-
@mkupper said in Formatting of links when selected or on mouseover has a blue/gray background:
Now when I move the cursor or hover on a URL or link they are switching to blue text (the configured URL hovered foreground color) on a white background though the underline disappears as I hover.
Previously the function was using styles where one could have combined foreground color and underline attribute.
The new implementation is using indicators and these do not allow this mix.Does that bother you a lot? Because if you want exactly the same
behavior, then, probably - because not tested, there are a few steps
to do continuously:- get rid of the current indicators set in the visible part of the document
- calculate the start and end position of each url in the visible range
- apply styling to the urls
Since it has caused performance problems in the past,
I do not expect better performance by using Python instead of C++. -
Thank you @Ekopalypse for the explanation of styles vs. indicators. After a few days of using npp with the python script modified indicators I’m quite happy with the results.
-