diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-05-02 19:42:31 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-02 19:42:31 +0800 |
commit | 808752f1b09d2f03af5b58167602fef8320c11dc (patch) | |
tree | 0cf72ae00bd1b08053daee0ede8aa5495be704f0 /src/nvim/drawscreen.c | |
parent | fba18a3b62310f4535d979a05288101b9af2ef50 (diff) | |
parent | 5b111a8f00f8dbe458a3d437c9f06c9419d24840 (diff) | |
download | rneovim-808752f1b09d2f03af5b58167602fef8320c11dc.tar.gz rneovim-808752f1b09d2f03af5b58167602fef8320c11dc.tar.bz2 rneovim-808752f1b09d2f03af5b58167602fef8320c11dc.zip |
Merge pull request #23320 from luukvbaal/smoothscroll
feat(ui): add 'smoothscroll' option
Diffstat (limited to 'src/nvim/drawscreen.c')
-rw-r--r-- | src/nvim/drawscreen.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c index b5e516005b..ec5163f37a 100644 --- a/src/nvim/drawscreen.c +++ b/src/nvim/drawscreen.c @@ -1447,6 +1447,26 @@ static void win_update(win_T *wp, DecorProviders *providers) init_search_hl(wp, &screen_search_hl); + // Make sure skipcol is valid, it depends on various options and the window + // width. + if (wp->w_skipcol > 0) { + int w = 0; + int width1 = wp->w_width_inner - win_col_off(wp); + int width2 = width1 + win_col_off2(wp); + int add = width1; + + while (w < wp->w_skipcol) { + if (w > 0) { + add = width2; + } + w += add; + } + if (w != wp->w_skipcol) { + // always round down, the higher value may not be valid + wp->w_skipcol = w - add; + } + } + // Force redraw when width of 'number' or 'relativenumber' column // changes. int nrwidth = (wp->w_p_nu || wp->w_p_rnu || *wp->w_p_stc) ? number_width(wp) : 0; |