Incorrect panel height when showing minihtml preview that is line-wrapped
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
- 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()
- Create
User/Default.sublime-commandswith following command (requirement for input panels to show up):
[
{
"caption": "Test CommandListHandler",
"command": "test_command_handler"
}
]
- Trigger
Test CommandListHandlercommand 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:
With two items, first having preview with wrapped line, the second item is not fully visible until scrolling to it:
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:
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
Same as https://github.com/sublimehq/sublime_text/issues/2885?
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.