|
539 | 539 | ---@param opts table|nil |
540 | 540 | ---@return boolean |
541 | 541 | function View:is_visible(opts) |
| 542 | + -- TODO multi-instance rewrite and consistency check |
542 | 543 | if opts and opts.tabpage then |
543 | 544 | if globals.TABPAGES[opts.tabpage] == nil then |
544 | 545 | return false |
@@ -618,10 +619,10 @@ function View:winid(tabpage, callsite) |
618 | 619 | local msg = string.format("View:winid(%3s, %-20.20s)", tabpage, callsite) |
619 | 620 |
|
620 | 621 | if bufnr then |
621 | | - for _, w in pairs(vim.api.nvim_tabpage_list_wins(tabpage or 0)) do |
622 | | - if vim.api.nvim_win_get_buf(w) == bufnr then |
623 | | - log.line("dev", "%s b%d : w%s", msg, bufnr, w) |
624 | | - return w |
| 622 | + for _, winid in pairs(vim.api.nvim_tabpage_list_wins(tabpage or 0)) do |
| 623 | + if vim.api.nvim_win_get_buf(winid) == bufnr then |
| 624 | + log.line("dev", "%s b%d : w%s", msg, bufnr, winid) |
| 625 | + return winid |
625 | 626 | end |
626 | 627 | end |
627 | 628 | else |
@@ -669,6 +670,8 @@ function View:get_winid(tabpage, callsite) |
669 | 670 | if winid ~= tabinfo_winid then |
670 | 671 | notify.error(msg) |
671 | 672 | end |
| 673 | + |
| 674 | + return winid |
672 | 675 | end |
673 | 676 |
|
674 | 677 | -- legacy codepath |
@@ -712,6 +715,7 @@ function View:prevent_buffer_override() |
712 | 715 | local curbuf = vim.api.nvim_win_get_buf(curwin) |
713 | 716 | local bufname = vim.api.nvim_buf_get_name(curbuf) |
714 | 717 |
|
| 718 | + --- TODO multi-instance this can be removed as winid() will handle it |
715 | 719 | if not bufname:match("NvimTree") then |
716 | 720 | for i, tabpage in ipairs(globals.TABPAGES) do |
717 | 721 | if tabpage.winid == view_winid then |
|
0 commit comments