]> git.ipfire.org Git - thirdparty/vim.git/commit
patch 9.2.0407: tabpanel: A few issues with the tabpanel master v9.2.0407
authorHirohito Higashi <h.east.727@gmail.com>
Mon, 27 Apr 2026 21:14:46 +0000 (21:14 +0000)
committerChristian Brabandt <cb@256bit.org>
Mon, 27 Apr 2026 21:16:56 +0000 (21:16 +0000)
commit2d43240659868e91e7c371017793091082bfda74
treee3d714d9ca4d09b512977d0b6b622b18dd03a61b
parent7e765148964b4758e7c45bbb781a476178e3aaa1
patch 9.2.0407: tabpanel: A few issues with the tabpanel

Problem:  Several issues around the tabpanel scrollbar:
          1. :set tabpanelopt= completion did not offer "scroll" and
              "scrollbar".
          2. gt/gT and other tab switches did not update the scrollbar
              thumb; the current tab could move outside the visible
              panel range without the view following.
          3. When tpl_scroll_offset was at its maximum, the thumb's
              bottom did not reach the last screen row due to integer
              truncation in thumb_top (e.g. 31 tabs on 24 rows + :tablast
              left a one-row gap).
          4. For align:right the scrollbar was drawn on the panel's
              left edge (adjacent to the buffer area), which breaks the
              common convention that a vertical scrollbar sits on the
              right.
Solution: - Add "scroll" and "scrollbar" to the 'tabpanelopt' expansion
            list.  Cover the completion in test_options.vim and extend
            util/gen_opt_test.vim with the new valid/invalid values;
            drop the now-redundant acceptance test from
            test_tabpanel.vim.
          - In draw_tabpanel(), remember the last-drawn curtab and,
            when it changes, adjust tpl_scroll_offset so curtab_row
            falls inside [offset, offset + Rows).  Mouse wheel and
            drag leave curtab unchanged, so the user's chosen offset
            is preserved.
          - In draw_tabpanel_scrollbar(), compute thumb_top as
            (Rows - thumb_height) * tpl_scroll_offset
            / (tpl_total_rows - Rows), mirroring the mapping already
            used by tabpanel_drag_scrollbar().  This guarantees the
            thumb's bottom reaches the last row at the maximum offset.
          - In draw_tabpanel(), place the scrollbar at the tabpanel's
            right edge for both align:left and align:right (previously
            align:right put it on the panel's left edge next to the
            vertical separator).  For align:right this means the
            scrollbar now sits at the screen's right edge.
          - Update :h tabpanel-scroll to describe the new, align-
            independent placement.
          - Add Test_tabpanel_scrollbar_follows_curtab() and
            Test_tabpanel_scrollbar_reaches_bottom() to exercise the
            regressions fixed by items 2 and 3.

closes: #20052

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
12 files changed:
runtime/doc/options.txt
runtime/doc/tabpage.txt
runtime/doc/version9.txt
src/optionstr.c
src/proto/tabpanel.pro
src/tabpanel.c
src/testdir/dumps/Test_tabpanel_many_tabpages_4.dump
src/testdir/test_options.vim
src/testdir/test_tabpanel.vim
src/testdir/util/gen_opt_test.vim
src/version.c
src/window.c