Miscellaneous Bug Fixes (#423)
fix: Show non-resolvable notes in winbar (#417) fix: add more emojis and make emoji picker configurable (#414) fix: comment creation should not be possible for renamed and moved files (#416) fix: color highlight groups are invalid (#421) fix: plugin failing to build on Windows (#419) --------- Co-authored-by: Jakub F. Bortlík <jakub.bortlik@proton.me>
This commit is contained in:
committed by
GitHub
parent
30daecfb60
commit
be027331e1
@@ -152,7 +152,7 @@ M.get_reviewer_data = function()
|
||||
return
|
||||
end
|
||||
|
||||
local current_file = M.get_current_file()
|
||||
local current_file = M.get_current_file_path()
|
||||
if current_file == nil then
|
||||
u.notify("Error getting current file from Diffview", vim.log.levels.ERROR)
|
||||
return
|
||||
@@ -163,7 +163,7 @@ M.get_reviewer_data = function()
|
||||
|
||||
local is_current_sha_focused = M.is_current_sha_focused()
|
||||
|
||||
local modification_type = hunks.get_modification_type(old_line, new_line, current_file, is_current_sha_focused)
|
||||
local modification_type = hunks.get_modification_type(old_line, new_line, is_current_sha_focused)
|
||||
if modification_type == nil then
|
||||
u.notify("Error getting modification type", vim.log.levels.ERROR)
|
||||
return
|
||||
@@ -180,6 +180,7 @@ M.get_reviewer_data = function()
|
||||
|
||||
return {
|
||||
file_name = layout.a.file.path,
|
||||
old_file_name = M.is_file_renamed() and layout.b.file.path or "",
|
||||
old_line_from_buf = old_line,
|
||||
new_line_from_buf = new_line,
|
||||
modification_type = modification_type,
|
||||
@@ -205,14 +206,38 @@ M.is_current_sha_focused = function()
|
||||
return current_win == b_win
|
||||
end
|
||||
|
||||
---Get currently shown file
|
||||
---@return string|nil
|
||||
M.get_current_file = function()
|
||||
---Get currently shown file data
|
||||
M.get_current_file_data = function()
|
||||
local view = diffview_lib.get_current_view()
|
||||
if not view or not view.panel or not view.panel.cur_file then
|
||||
return
|
||||
end
|
||||
return view.panel.cur_file.path
|
||||
return view and view.panel and view.panel.cur_file
|
||||
end
|
||||
|
||||
---Get currently shown file path
|
||||
---@return string|nil
|
||||
M.get_current_file_path = function()
|
||||
local file_data = M.get_current_file_data()
|
||||
return file_data and file_data.path
|
||||
end
|
||||
|
||||
---Get currently shown file's old path
|
||||
---@return string|nil
|
||||
M.get_current_file_oldpath = function()
|
||||
local file_data = M.get_current_file_data()
|
||||
return file_data and file_data.oldpath
|
||||
end
|
||||
|
||||
---Tell whether current file is renamed or not
|
||||
---@return boolean|nil
|
||||
M.is_file_renamed = function()
|
||||
local file_data = M.get_current_file_data()
|
||||
return file_data and file_data.status == "R"
|
||||
end
|
||||
|
||||
---Tell whether current file has changes or not
|
||||
---@return boolean|nil
|
||||
M.does_file_have_changes = function()
|
||||
local file_data = M.get_current_file_data()
|
||||
return file_data.stats.additions > 0 or file_data.stats.deletions > 0
|
||||
end
|
||||
|
||||
---Diffview exposes events which can be used to setup autocommands.
|
||||
|
||||
Reference in New Issue
Block a user