sublime_text icon indicating copy to clipboard operation
sublime_text copied to clipboard

Incorrect panel height when showing minihtml preview that is line-wrapped

Open rchl opened this issue 2 months ago • 2 comments

Description of the bug

An input handler where items show a minihtml preview with content that gets automatically line-wrapped due to being too long affects the panel height in a bad way.

Steps to reproduce

  1. Create a plugin:
import sublime
import sublime_plugin


class TestListInputHandler(sublime_plugin.ListInputHandler):
    def list_items(self):
        return [
            sublime.ListInputItem('some item', 'intentionally long long long long long long long long long long long long long ling line to trigger text wrapping'),
            # sublime.ListInputItem('some item', 'some value', 'item details'),
        ]

    def preview(self, text: str):
        return sublime.Html(f'<div style="background-color: blue; color: white">{text}</div>')


class TestCommandHandlerCommand(sublime_plugin.WindowCommand):
    def input(self, args: dict) -> sublime_plugin.CommandInputHandler:
        return TestListInputHandler()
  1. Create User/Default.sublime-commands with following command (requirement for input panels to show up):
[
    {
        "caption": "Test CommandListHandler",
        "command": "test_command_handler"
    }
]
  1. Trigger Test CommandListHandler command from the Command Palette

Expected behavior

The height of the quick panel always adapting dynamically to accommodate ideal visibility of items and the minihtml preview.

Actual behavior

With only one item, the item is not fully visible:

Image

With two items, first having preview with wrapped line, the second item is not fully visible until scrolling to it:

Image

With two items, first having non-wrapped line, second having preview with wrapped line, and then selecting the second line, the minihtml preview gets cropped:

Image

Sublime Text build number

4199

Operating system & version

macOS

(Linux) Desktop environment and/or window manager

No response

Additional information

No response

OpenGL context information


rchl avatar Nov 01 '25 16:11 rchl

Same as https://github.com/sublimehq/sublime_text/issues/2885?

kaste avatar Nov 04 '25 00:11 kaste

I suppose those could be merged if at the same time extending yours with extra information provided here. Your doesn't involve any list items being present so in theory it could be fixed without fixing issues mentioned here.

rchl avatar Nov 04 '25 10:11 rchl