sublimehq / sublime_text

Issue tracker for Sublime Text
https://www.sublimetext.com
812 stars 40 forks source link

Link in the annotation added through view.add_regions has painting issues #3396

Open rchl opened 4 years ago

rchl commented 4 years ago

Description

In ST4 it's possible to add special annotations through a view.add_regions call. If that annotation contains a link then the bottom part of the link (the underline) is not painted correctly.

Steps to reproduce

  1. In the console run:
    view.add_regions('test_me', view.sel(), annotations=['<a href="subl:">Do I look pretty?</a>'], flags=sublime.DRAW_NO_FILL | sublime.DRAW_NO_OUTLINE)

Expected behavior

Actual behavior

The underline rendering is spotty. Screenshot 2020-06-10 at 10 04 03

Environment

keith-hall commented 4 years ago

The underlines are also drawn in the wrong place in some circumstances and neither the link text nor the underline are clickable - tested on Xubuntu 19.04: image

view.add_regions(key="tmp", regions=[view.sel()[0]], annotations=["<span>Hello World!</span><a href='subl://insert {\"characters\": \"hola!\"}'>⏹️</a>"], on_close=lambda: view.erase_regions("tmp"))
rwols commented 4 years ago

Semi-related painting issue: when changing the font-size (with ctrl+scrollwheel for example), the annotations don't reposition themselves horizontally.

rwols commented 4 years ago

There's also a paint fill issue it seems.

Screenshot from 2020-06-23 16-02-25

Run this in the ST console:

view.add_regions("asdf", regions=[view.sel()[0]], annotations=['<body><style>.x .y {background-color: color(var(--redish));}</style><div class="x"><span class="y">hello</span></div></body>'])

CSS:

.x .y {
    background-color: color(var(--redish));
}

HTML:

<div class="x">
    <span class="y">
        hello
    </span>
</div>
rchl commented 4 years ago

It appears that the initial issue is resolved in 4079 (it might need more testing on various platforms though).

rwols commented 3 years ago

I haven't encountered painting issues for a while now.

rchl commented 3 years ago

Your example above still seems to have issues.