sublimehq / sublime_text

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

Scroll bars cannot be enabled inside phantoms #3390

Open evandrocoan opened 4 years ago

evandrocoan commented 4 years ago

Description

Scroll bars cannot be enabled inside phantoms.

Steps to reproduce

import sublime
import sublime_plugin

class EventListener(sublime_plugin.EventListener):

    def on_selection_modified(self, view):
        HTML_TEMPLATE = """
            <body id="line-annotation">
                <style>
                    html, body {
                        overflow: scroll;
                        height: 150px;
                    }
                </style>
                Hi. <br>
                Hi. <br>
                Hi. <br>
                Hi. <br>
                Hi. <br>
                Hi. <br>
                Hi. <br>
                Hi. <br>
                Hi. <br>
                Hi. <br>
                Hi. <br>
                Hi. <br>
                Hi. <br>
                Hi. <br>
                Hi. <br>
                Hi. <br>
                Hi. <br>
                Hi. <br>
            </body>
            """

        point = view.line(view.sel()[0]).end()

        view.erase_phantoms('line_annotation')
        view.add_phantom(
            'line_annotation',
            sublime.Region(point, point + 1),
            HTML_TEMPLATE,
            sublime.LAYOUT_INLINE
        )

Expected behavior

After 150px of height, scroll bars should appear.

Actual behavior

Scroll bars never appear.

Environment

Related:

  1. Phantoms interfere with normal mouse navigation #2417
  2. Inconsistent Sublime Phantoms Behavior #2871
  3. Minihtml popup flickers when updating. #3107
wbond commented 4 years ago

Currently neither overflow nor height are part of minihtml - https://www.sublimetext.com/docs/minihtml.html#css.