Bug 425127 - Uneven margins between all 4 sides
Summary: Uneven margins between all 4 sides
Status: CONFIRMED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: 20.04.2
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-07 22:42 UTC by wg9rffujwz8y276u
Modified: 2020-08-11 21:10 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
2 (34.48 KB, image/png)
2020-08-10 22:55 UTC, wg9rffujwz8y276u
Details
3 (127.30 KB, image/png)
2020-08-10 22:56 UTC, wg9rffujwz8y276u
Details
4 (126.32 KB, image/png)
2020-08-10 22:56 UTC, wg9rffujwz8y276u
Details
5 (133.58 KB, image/png)
2020-08-10 22:56 UTC, wg9rffujwz8y276u
Details
6 (128.50 KB, image/png)
2020-08-10 22:57 UTC, wg9rffujwz8y276u
Details
7 (122.27 KB, image/png)
2020-08-10 22:57 UTC, wg9rffujwz8y276u
Details

Note You need to log in before you can comment on or make changes to this bug.
Description wg9rffujwz8y276u 2020-08-07 22:42:30 UTC
SUMMARY
Suggestion, split the setting to define margins in 4 options (like css, top right bottom left).

Even with monospaced fonts, "Align to center" on or off, I still get uneven margins, visually, between the 4 sides. 

That's expected behavior since the width and height of window can't always coincide with the remaining space, margin and line spacing.
If I'm able to set them individually I would be able to have correct margins at least in the maximized view.

STEPS TO REPRODUCE
1. Open Konsole
2. Set Margin and Line Spacing to 6px
3. Run a command that fills the screen with text
4. Try to keep all margins equal

OBSERVED RESULT
Margins are uneven. If that doesn't happen, change the window size or try a monospaced font.
I could be wrong but I think the top margin is always bigger than the bottom no matter the margin settings.

EXPECTED RESULT
Equal margins in all 4 sides

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.71.0
Qt Version: 5.12.7
Comment 1 Nate Graham 2020-08-10 14:32:52 UTC
A screenshot would help us understand what you're seeing. Can you attach one?
Comment 2 wg9rffujwz8y276u 2020-08-10 22:55:51 UTC
Created attachment 130768 [details]
2
Comment 3 wg9rffujwz8y276u 2020-08-10 22:56:07 UTC
Created attachment 130769 [details]
3
Comment 4 wg9rffujwz8y276u 2020-08-10 22:56:40 UTC
Created attachment 130770 [details]
4
Comment 5 wg9rffujwz8y276u 2020-08-10 22:56:54 UTC
Created attachment 130771 [details]
5
Comment 6 wg9rffujwz8y276u 2020-08-10 22:57:05 UTC
Created attachment 130772 [details]
6
Comment 7 wg9rffujwz8y276u 2020-08-10 22:57:28 UTC
Created attachment 130773 [details]
7
Comment 8 wg9rffujwz8y276u 2020-08-10 23:05:41 UTC
I just took these screenshots in a live Kubuntu 20.04 virtual machine with default settings. The margins are not equal if you compare top/bottom with left/right. To better visualize them you can imagine that each monospaced character has a box around it, that's their real size. And maybe the margins are what's outside the sum of all of them? It's probably not like that in the code at all but I don't know how else to describe it.
Comment 9 wg9rffujwz8y276u 2020-08-10 23:09:19 UTC
for ((i=1; i<=9000; i++)); do echo -n "01"; done;
Comment 10 Nate Graham 2020-08-10 23:12:47 UTC
Thanks, that's helpful!
Comment 11 Christoph Feck 2020-08-11 06:39:13 UTC
To me this is a WONTFIX. If you always center the "image", then it will jitter when resizing the window. You can change the margins (i.e. the left/top one), and make it half as wide as your available margin for a specific window size.
Comment 12 wg9rffujwz8y276u 2020-08-11 17:52:50 UTC
It's ok if it doesn't bother others but for me it looks really bad when both margins are not equal or you have dead space because there isn't room for an extra line. I can notice that even if it's just a single pixel.

I don't know how other terminals solve this problem. I suggested splitting margin settings but there's probably a better way. E.g could you hide overflow top when scrolling down, and vice versa, so the text get cut but the margins look consistent?

I'll understand if you need to WONTFIX, it's probably a hard problem to solve.
Comment 13 Christoph Feck 2020-08-11 20:16:00 UTC
> I don't know how other terminals solve this problem

Do those terminals resize the window smoothly or in steps? Do they have a configurable margin, or do they just distribute the remaining free space?
Comment 14 Christoph Feck 2020-08-11 20:45:29 UTC
It looks like the "Align to center" option could resolve this issue, but enabling it doesn't make a difference here.

Some more observations: The scrollbar is no longer visually separated from the terminal view, which adds to the uneven appearance.

For vertical margins, the fonts themselves include margins at the top and at the bottom for ascenders/descenders or diacritics, and it depends on the selected font if they appear even or uneven. See e.g. The Kpfx image at http://www.myfirstfont.com/glossary.html; the K doesn't have even margins between the two bearing lines.

> To better visualize them you can imagine that each monospaced character has a box around it, that's their real size.

I suggest to select all characters with the mouse to see their actual cell boxes used for layout.
Comment 15 wg9rffujwz8y276u 2020-08-11 21:01:36 UTC
>Do those terminals resize the window smoothly or in steps? Do they have a configurable margin, or do they just distribute the remaining free space?

I'm not qualified to answer these questions but I'll try.

I installed and configured alacritty and when I resize the window can see the text adapting very quickly but there's still some lag. If I resize fast I can see the background. So in steps? While the margins still aren't perfect for 100% of window sizes and ratios, it feels more consistent.

There are some extra settings
https://github.com/alacritty/alacritty/blob/master/alacritty.yml#L32

Kitty has a lot of options but for some reason it's crashing when I press a key.

https://sw.kovidgoyal.net/kitty/conf.html#window-layout

window_resize_step_cells, window_resize_step_lines
window_margin_width
single_window_margin_width
window_padding_width
placement_strategy
Comment 16 wg9rffujwz8y276u 2020-08-11 21:10:35 UTC
(In reply to Christoph Feck from comment #14)
> It looks like the "Align to center" option could resolve this issue, but
> enabling it doesn't make a difference here.

In the screenshots attached I tried with both on and off.

> Some more observations: The scrollbar is no longer visually separated from
> the terminal view, which adds to the uneven appearance.

Alacritty doesn't show the scrollbar for me. That's a good observation. I see a border with my theme but in the screenshots I attached with the default theme it does look worse because of that. It could help if the scrollbar background was configurable but that's out of the subject maybe.


> For vertical margins, the fonts themselves include margins at the top and at
> the bottom for ascenders/descenders or diacritics, and it depends on the
> selected font if they appear even or uneven. See e.g. The Kpfx image at
> http://www.myfirstfont.com/glossary.html; the K doesn't have even margins
> between the two bearing lines.
> I suggest to select all characters with the mouse to see their actual cell
> boxes used for layout.

Oh so that's why the top margin looks bigger for me. Paying the price of the highest possible character I would guess.