The clickable area of a hotspot is offset to the left by half a character width. For usual hotspots like links in hypertext (long string of narrow characters), this is hardly noticeable, but in my case my hotspots consist of a single character that is displayed as a relatively wide character representation. Having clicks on the right half of the representation ignored, or, worse, go to the next hotspot to the right if one is immediately adjacent, is quite irritating in this case.
This is because when determining whether the mouse is inside a hotspot, the mouse position is first rounded to the closest position between characters, as if to place the caret, and then the hotspotness of the character to the right of that position is checked. The attached patch fixes this to instead always consider the character on which the mouse is.
Steps to reproduce:
1. Build SciTE with the following patch applied:
diff -r 8ca6b7af8c10 -r 405886f36c75 src/Credits.cxx --- a/src/Credits.cxx Fri Dec 06 08:50:05 2013 +1100 +++ b/src/Credits.cxx Tue Dec 10 12:27:20 2013 +0100 @@ -411,6 +411,12 @@ SetAboutStyle(wsci, 1, ColourRGB(0, 0, 0)); int trsSty = 5; // define the stylenumber to assign font for translators. SString translator = GetTranslationToAbout("TranslationCredit", false); + wsci.Send(SCI_STYLESETHOTSPOT, 7, 1); + wsci.Send(SCI_STYLESETHOTSPOT, 8, 1); + wsci.Send(SCI_SETREPRESENTATION, (uptr_t)(char*)"X", (sptr_t)(char*)"Representation X"); + wsci.Send(SCI_SETREPRESENTATION, (uptr_t)(char*)"Y", (sptr_t)(char*)"Representation Y"); + AddStyledText(wsci, "X", 7); + AddStyledText(wsci, "Y", 8); SetAboutStyle(wsci, trsSty, ColourRGB(0, 0, 0)); AddStyledText(wsci, GetTranslationToAbout("Version").c_str(), trsSty); AddStyledText(wsci, " " VERSION_SCITE "\n", 1);
Actual result: When the mouse is over the right half of “Representation X”, “Representation Y” is underlined (and would receive a click if an event handler for it had been defined). When the mouse is over the right half of “Representation Y”, nothing is underlined (and no hotspot receives clicks).
Expected result: Exactly the hotspot under the mouse should be underlined and receive clicks.
Log in to post a comment.