Skip to content

Commit

Permalink
fix(ui): hover now opens repo url when no diff with main. Fixes #1430
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed May 12, 2024
1 parent d397434 commit 4084506
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lua/lazy/view/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand Down

0 comments on commit 4084506

Please sign in to comment.