@@ -12,7 +12,7 @@ local async = require("diffview.async")
1212local M = {
1313 is_open = false ,
1414 bufnr = nil ,
15- tabnr = nil ,
15+ tabid = nil ,
1616 stored_win = nil ,
1717 buf_winids = {},
1818}
@@ -67,7 +67,7 @@ M.open = function()
6767 return
6868 end
6969 M .diffview_layout = M .diffview .cur_layout
70- M .tabnr = vim .api .nvim_get_current_tabpage ()
70+ M .tabid = vim .api .nvim_get_current_tabpage ()
7171
7272 if state .settings .discussion_diagnostic ~= nil or state .settings .discussion_sign ~= nil then
7373 u .notify (
@@ -78,13 +78,13 @@ M.open = function()
7878
7979 -- Register Diffview hook for close event to set tab page # to nil
8080 local on_diffview_closed = function (view )
81- if view .tabpage == M .tabnr then
82- M .tabnr = nil
81+ if view .tabpage == M .tabid then
82+ M .tabid = nil
8383 require (" gitlab.actions.discussions.winbar" ).cleanup_timer ()
8484 end
8585 end
8686 require (" diffview.config" ).user_emitter :on (" view_closed" , function (_ , args )
87- if M .tabnr == args .tabpage then
87+ if M .tabid == args .tabpage then
8888 M .is_open = false
8989 on_diffview_closed (args )
9090 end
101101
102102-- Closes the reviewer and cleans up
103103M .close = function ()
104- if M .tabnr ~= nil and vim .api .nvim_tabpage_is_valid (M .tabnr ) then
105- vim .cmd .tabclose (vim .api .nvim_tabpage_get_number (M .tabnr ))
104+ if M .tabid ~= nil and vim .api .nvim_tabpage_is_valid (M .tabid ) then
105+ vim .cmd .tabclose (vim .api .nvim_tabpage_get_number (M .tabid ))
106106 end
107107 local discussions = require (" gitlab.actions.discussions" )
108108 discussions .close ()
@@ -136,11 +136,11 @@ M.jump = function(file_name, old_file_name, line_number, new_buffer)
136136 -- Draft comments don't have `old_file_name` set
137137 old_file_name = old_file_name or file_name
138138
139- if M .tabnr == nil then
139+ if M .tabid == nil then
140140 u .notify (" Can't jump to Diffvew. Is it open?" , vim .log .levels .ERROR )
141141 return
142142 end
143- vim .api .nvim_set_current_tabpage (M .tabnr )
143+ vim .api .nvim_set_current_tabpage (M .tabid )
144144
145145 if M .diffview == nil then
146146 u .notify (" Could not find Diffview view" , vim .log .levels .ERROR )
@@ -288,7 +288,7 @@ M.set_callback_for_file_changed = function(callback)
288288 pattern = { " DiffviewDiffBufWinEnter" },
289289 group = group ,
290290 callback = function (...)
291- if M .tabnr == vim .api .nvim_get_current_tabpage () then
291+ if M .tabid == vim .api .nvim_get_current_tabpage () then
292292 callback (... )
293293 end
294294 end ,
@@ -303,7 +303,7 @@ M.set_callback_for_buf_read = function(callback)
303303 pattern = { " DiffviewDiffBufRead" },
304304 group = group ,
305305 callback = function (...)
306- if vim .api .nvim_get_current_tabpage () == M .tabnr then
306+ if vim .api .nvim_get_current_tabpage () == M .tabid then
307307 callback (... )
308308 end
309309 end ,
@@ -318,7 +318,7 @@ M.set_callback_for_reviewer_leave = function(callback)
318318 pattern = { " DiffviewViewLeave" , " DiffviewViewClosed" },
319319 group = group ,
320320 callback = function (...)
321- if vim .api .nvim_get_current_tabpage () == M .tabnr then
321+ if vim .api .nvim_get_current_tabpage () == M .tabid then
322322 callback (... )
323323 end
324324 end ,
@@ -334,7 +334,7 @@ M.set_callback_for_reviewer_enter = function(callback)
334334 pattern = { " DiffviewViewEnter" , " DiffviewViewOpened" },
335335 group = group ,
336336 callback = function (...)
337- if vim .api .nvim_get_current_tabpage () == M .tabnr then
337+ if vim .api .nvim_get_current_tabpage () == M .tabid then
338338 callback (... )
339339 end
340340 end ,
0 commit comments