Skip to content

Commit 5137b5e

Browse files
fix: use first window buffer if buffer is not current window
## Details Issue: #210 Sometimes the buffers associated with windows are switched from another window. An example of this is the ChatGPT plugin in the issue above where selecting a session changes the contents of the window, but from the sessions window. To get around this rather than always using the current window assuming events are triggered directly where rendering is needed use the complete list of windows associated with a buffer and only use the current window if it is contained in that list. This is part of the fix to enable this, another requires the plugin to trigger the TextChanged event so we can update what's rendered.
1 parent e1a2289 commit 5137b5e

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

Diff for: doc/render-markdown.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*render-markdown.txt* For 0.10.0 Last change: 2024 October 18
1+
*render-markdown.txt* For 0.10.0 Last change: 2024 October 20
22

33
==============================================================================
44
Table of Contents *render-markdown-table-of-contents*

Diff for: lua/render-markdown/health.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ local state = require('render-markdown.state')
44
local M = {}
55

66
---@private
7-
M.version = '7.4.5'
7+
M.version = '7.4.6'
88

99
function M.check()
1010
M.start('version')

Diff for: lua/render-markdown/manager.lua

+3-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ function M.attach(buf)
7171
if not state.enabled then
7272
return
7373
end
74-
local event, win = args.event, vim.api.nvim_get_current_win()
74+
local win, wins = util.current('win'), vim.fn.win_findbuf(buf)
75+
win = vim.tbl_contains(wins, win) and win or wins[1]
76+
local event = args.event
7577
ui.update(buf, win, event, vim.tbl_contains(change_events, event))
7678
end,
7779
})

0 commit comments

Comments
 (0)