fix(statusline): fix status line cache key (#656)

## Description

<!-- Describe the big picture of your changes to communicate to the
maintainers
  why we should accept this pull request. -->
-
d972bc0a47
breaks cache key for virtual lines since `0 and 1 or 0` also evaluates
to 1 in lua.

## Related Issue(s)

<!--
  If this PR fixes any issues, please link to the issue here.
  - Fixes #<issue_number>
-->
- Fixes #510 

## Screenshots

<!-- Add screenshots of the changes if applicable. -->
This commit is contained in:
莊加旭 (Max Chuang) 2025-01-20 20:26:20 +08:00 committed by GitHub
parent 384b9a7a36
commit af559349e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -237,7 +237,7 @@ end
function M.get()
local win = vim.g.statusline_winid
local buf = vim.api.nvim_win_get_buf(win)
local key = ("%d:%d:%d:%d"):format(win, buf, vim.v.lnum, vim.v.virtnum and 1 or 0)
local key = ("%d:%d:%d:%d"):format(win, buf, vim.v.lnum, vim.v.virtnum ~= 0 and 1 or 0)
if cache[key] then
return cache[key]
end