sublimehq / sublime_text

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

Sticky phantoms #6301

Open kaste opened 6 months ago

kaste commented 6 months ago

Problem description

I would think "sticky" phantoms would be very useful. I say "phantoms" because they should render Html like the phantoms do. But they're not inserted at a specific point in the buffer but attached to a view.

We should have a sticky phantom at the top of a view and one at the bottom of a view. Stickiness means that they're in a layer "above" the buffer and don't scroll.

There are numerous way to think about them:

I think there are endless ways to use them.

Preferred solution

I don't have a preferred, superior API for that in mind.

Alternatives

Sticky tooltips would be basically the same thing. Although tooltips probably have more shadow, look less flat as typical sticky headers/footers. Also the phantoms should not automatically react to ESC as tooltips do.

Additional Information

This is not the "breadcrumb"-feature (https://github.com/sublimehq/sublime_text/issues/5543) every other editor now has. The breadcrumbs have very different challenges.

rwols commented 6 months ago

How should this work when multiple plugins add sticky phantoms to the top and bottom of the view?

kaste commented 6 months ago

Throughout Sublime Text we only ever have "last-one-wins" API's. We have one gutter icon per line, one tooltip per view. If regions overlap they render however they want. :grin: etc. And you can't stack headers and footers endlessly anyway. (These are not "toast" messages.) To detect that on_hide callbacks like for the tooltips would be maybe necessary so that the plugin knows when the sticky phantom changes.