# HG changeset patch # User Bram Moolenaar # Date 1644249605 -3600 # Node ID 298b32b544aef2fedb2cbba47ae94be4fa5cc6f1 # Parent aac8ffd95aea2b2ea030043f8fa7c2cbb3ce9d4d patch 8.2.4320: Athena and Motif: when maximized scrollbar position is wrong Commit: https://github.com/vim/vim/commit/28f1a51bde36e2770dd54c9e2ae69a26cafa5a64 Author: qsmodo <75080827+qsmodo@users.noreply.github.com> Date: Mon Feb 7 15:57:50 2022 +0000 patch 8.2.4320: Athena and Motif: when maximized scrollbar position is wrong Problem: Athena and Motif: when maximized scrollbar position is wrong. Solution: Implement the scrollbar padding functions. (closes https://github.com/vim/vim/issues/9712) diff --git a/src/gui_athena.c b/src/gui_athena.c --- a/src/gui_athena.c +++ b/src/gui_athena.c @@ -1894,17 +1894,27 @@ gui_mch_set_scrollbar_pos( int gui_mch_get_scrollbar_xpadding(void) { - // TODO: Calculate the padding for adjust scrollbar position when the - // Window is maximized. - return 0; + int xpad; + Dimension tw, ww; + Position tx; + + XtVaGetValues(textArea, XtNwidth, &tw, XtNx, &tx, NULL); + XtVaGetValues(vimShell, XtNwidth, &ww, NULL); + xpad = ww - tw - tx - gui.scrollbar_width; + return (xpad < 0) ? 0 : xpad; } int gui_mch_get_scrollbar_ypadding(void) { - // TODO: Calculate the padding for adjust scrollbar position when the - // Window is maximized. - return 0; + int ypad; + Dimension th, wh; + Position ty; + + XtVaGetValues(textArea, XtNheight, &th, XtNy, &ty, NULL); + XtVaGetValues(vimShell, XtNheight, &wh, NULL); + ypad = wh - th - ty - gui.scrollbar_height; + return (ypad < 0) ? 0 : ypad; } void diff --git a/src/gui_motif.c b/src/gui_motif.c --- a/src/gui_motif.c +++ b/src/gui_motif.c @@ -1745,17 +1745,27 @@ gui_mch_set_scrollbar_pos( int gui_mch_get_scrollbar_xpadding(void) { - // TODO: Calculate the padding for adjust scrollbar position when the - // Window is maximized. - return 0; + int xpad; + Dimension tw, ww; + Position tx; + + XtVaGetValues(textArea, XtNwidth, &tw, XtNx, &tx, NULL); + XtVaGetValues(vimShell, XtNwidth, &ww, NULL); + xpad = ww - tw - tx - gui.scrollbar_width; + return (xpad < 0) ? 0 : xpad; } int gui_mch_get_scrollbar_ypadding(void) { - // TODO: Calculate the padding for adjust scrollbar position when the - // Window is maximized. - return 0; + int ypad; + Dimension th, wh; + Position ty; + + XtVaGetValues(textArea, XtNheight, &th, XtNy, &ty, NULL); + XtVaGetValues(vimShell, XtNheight, &wh, NULL); + ypad = wh - th - ty - gui.scrollbar_height; + return (ypad < 0) ? 0 : ypad; } void diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -747,6 +747,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 4320, +/**/ 4319, /**/ 4318,