[vim/vim] X11: Fix horizontal border correction for screen dimensions (PR #11950)

6 views
Skip to first unread message

qsmodo

unread,
Feb 4, 2023, 6:10:12 PM2/4/23
to vim/vim, Subscribed

This prevents column(s) from being taken off upon a :vsplit (which could then be claimed by resizing the window).

I'm unsure about what this function should do relating to vertical calculations. The comment in the function implies that it is only about window decoration, but :h gdr disagrees.

I'm leaving a scaffold for vertical calculations in case it's obvious to maintainers. It can of course be removed if I'm getting it wrong or if it won't be used.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/11950

Commit Summary

  • 2877cc9 Fix horizontal border correction for screen dimensions.

File Changes

(1 file)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11950@github.com>

codecov[bot]

unread,
Feb 4, 2023, 6:22:31 PM2/4/23
to vim/vim, Subscribed

Codecov Report

Merging #11950 (2877cc9) into master (4be18e7) will increase coverage by 0.37%.
The diff coverage is n/a.

@@            Coverage Diff             @@

##           master   #11950      +/-   ##

==========================================

+ Coverage   81.88%   82.25%   +0.37%     

==========================================

  Files         164      154      -10     

  Lines      193673   183289   -10384     

  Branches    43787    41363    -2424     

==========================================

- Hits       158582   150769    -7813     

+ Misses      22252    19968    -2284     

+ Partials    12839    12552     -287     
Flag Coverage Δ
huge-clang-none 82.60% <ø> (-0.02%) ⬇️
huge-gcc-testgui 51.58% <ø> (+<0.01%) ⬆️
huge-gcc-unittests 0.29% <ø> (-0.01%) ⬇️
linux 82.25% <ø> (-0.02%) ⬇️
mingw-x64-HUGE ?
mingw-x86-HUGE ?
windows ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/regexp_bt.c 78.52% <0.00%> (-7.46%) ⬇️
src/typval.c 83.13% <0.00%> (-6.86%) ⬇️
src/gui_beval.c 45.66% <0.00%> (-6.70%) ⬇️
src/json.c 77.84% <0.00%> (-5.47%) ⬇️
src/regexp_nfa.c 85.14% <0.00%> (-4.56%) ⬇️
src/libvterm/src/parser.c 55.18% <0.00%> (-4.15%) ⬇️
src/edit.c 82.81% <0.00%> (-3.48%) ⬇️
src/gui.c 69.59% <0.00%> (-3.09%) ⬇️
src/ui.c 75.30% <0.00%> (-2.85%) ⬇️
src/normal.c 87.69% <0.00%> (-2.84%) ⬇️
... and 124 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11950/c1416874816@github.com>

Bram Moolenaar

unread,
Feb 5, 2023, 11:03:45 AM2/5/23
to vim/vim, Subscribed


> This prevents column(s) from being taken off upon a :vsplit (which
> could then be claimed by resizing the window).
>
> I'm unsure about what this function should do relating to vertical
> calculations. The comment in the function implies that it is only
> about window decoration, but :h gdr disagrees.
>
> I'm leaving a scaffold for vertical calculations in case it's obvious
> to maintainers. It can of course be removed if I'm getting it wrong or
> if it won't be used.

I don't think it is a good idea to change how 'guiheadroom' is used.
It's hard to predict what happens with different window managers.
The commented-out code should probably just be left out.

The main line in your patch is:

xborder = x - attr.x > 0 ? x - attr.x : xborder;

Where "x" is the position of the root, the window that fills the screen.
I don't see how it's position can ever be smaller than that of the Vim
window. Or how you expect to get the border width from this
computation. Does this only work when the Vim window is maximized? A
comment to explain this would be very helpful.


--
From "know your smileys":
2B|^2B Message from Shakespeare

/// Bram Moolenaar -- ***@***.*** -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11950/c1418086723@github.com>

qsmodo

unread,
Feb 8, 2023, 8:48:36 AM2/8/23
to vim/vim, Subscribed

I don't see how it's position can ever be smaller than that of the Vim
window.

Me neither. It was just a sanity check, but if it's deemed unnecessary it can be removed.

Or how you expect to get the border width from this
computation. Does this only work when the Vim window is maximized? A
comment to explain this would be very helpful.

Yes. only when maximized. Before I do so...:

I don't think it is a good idea to change how 'guiheadroom' is used.
It's hard to predict what happens with different window managers.

I reckoned this could be the case, just wasn't sure about this asymmetry. Most popular desktops nowadays support vertical docks and some even default to them (Gnome).

But thinking this over, there is a better solution that I wonder how I didn't realize before: Instead of doing all these clunky calculations, just use attr.width and attr.height to retrieve the exact values? Wouldn't that be the silver bullet?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11950/c1422626594@github.com>

Reply all
Reply to author
Forward
0 new messages