sublimehq / sublime_text

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

[Bug] Tab close button drops down if it size increase #1661

Open Kristinita opened 7 years ago

Kristinita commented 7 years ago

Related forum post

1. Summary

Tab close button drops down if it size increase.

2. Settings

I use SashaSublime.sublime-theme.

3. Expected behavior

If

{
        "class": "tab_close_button",
        "settings": ["show_tab_close_buttons"],
        "content_margin": [8, 8]
},

Expected

4. Actual behavior

I reproduce the problem in a version of Sublime Text without plugins and user settings.

If

{
        "class": "tab_close_button",
        "settings": ["show_tab_close_buttons"],
        "content_margin": [15, 15]
},

Actual

Tab close button drops down.

5. Environment

Operating system and version: Windows 10 Enterprise LTSB 64-bit EN Sublime Text: Build 3126

Thanks.

ggets commented 3 years ago

just stumbled upon this while googling around this problem. I guess it's still relevant to this date. Negative margins are a must for good theme UI aligning.

deathaxe commented 3 years ago

It appears your close button image has quite a lot of empty space surrounding.

grafik

content_margin of tab_close_button defines the canvas size the image is rendered in. The default of [8, 8] means 16x16 logical pixels. You literly doubled the canvas size to 30x30 pixels while image source remains the same. Hence it and its "whitespace" are scaled, while image alignment keeps the same.

grafik

All items (text label and close button) are alligned to top left corner of a tab. The label and close button are not vertically centered.

Reducing tab_control's top content_margin value would move both the label and close button upwards.


You could use a different image to increase the size of the close button without modifying the canvas size.


I wouldn't call this a bug, that's just the way the theme engine works. It assumes the close button to be nearly as large as the line height. Hence a canvas size of 16x16 pixels seems fine.

An improvement might be vertically center label and close button.

An alternative might be to add a setting to control text_label position/margins.