fix(ui): hover now opens repo url when no diff with main. Fixes #1430

This commit is contained in:
Folke Lemaitre 2024-05-12 09:43:30 +02:00
parent d3974346b6
commit 40845063a2
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 5 additions and 2 deletions

View File

@ -211,13 +211,13 @@ function M:restore(opts)
end
function M:hover()
if self:diff({ browser = true }) then
if self:diff({ browser = true, hover = true }) then
return
end
self:open_url("")
end
---@param opts? {commit?:string, browser:boolean}
---@param opts? {commit?:string, browser:boolean, hover:boolean}
function M:diff(opts)
opts = opts or {}
local plugin = self.render:get_plugin()
@ -231,6 +231,9 @@ function M:diff(opts)
local info = assert(Git.info(plugin.dir))
local target = assert(Git.get_target(plugin))
diff = { from = info.commit, to = target.commit }
if opts.hover and diff.from == diff.to then
return
end
end
if not diff then