fix(eval): winnr('$') counts non-current hidden/unfocusable windows #34207

Problem:  Non-visible/focusable windows are assigned a window number,
          whereas commands that use this window number skip over them.

Solution: Skip over non-visible/focusable windows when computing
          the window number, unless it is made the current window
          through the API in which case an identifiable window number
          is still useful. This also ensures it matches the window
          number of the window entered by `<winnr>wincmd w` since
          403fcacf.
This commit is contained in:
luukvbaal
2025-06-02 00:12:12 +02:00
committed by GitHub
parent 5cfbc35aa8
commit 981d4ba45e
10 changed files with 62 additions and 34 deletions

View File

@ -13347,7 +13347,8 @@ M.funcs = {
desc = [=[
The result is a Number, which is the number of the current
window. The top window has number 1.
Returns zero for a popup window.
Returns zero for a hidden or non |focusable| window, unless
it is the current window.
The optional argument {arg} supports the following values:
$ the number of the last window (the window