Skip to content

Commit

Permalink
fix(project_diff_preview): fix toggle issues
Browse files Browse the repository at this point in the history
  • Loading branch information
tanvirtin committed Nov 21, 2024
1 parent 3e3403c commit f30e62a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions lua/vgit/features/screens/ProjectDiffScreen/Store.lua
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ end
function Store:get_filepath()
local reponame = self.state.reponame
local filename = self:get_filename()
if not filename then return nil, { 'entry not found' } end

filename = fs.make_relative(reponame, filename)
filename = string.format('%s/%s', reponame, filename)
Expand Down
5 changes: 3 additions & 2 deletions lua/vgit/features/screens/ProjectDiffScreen/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ function ProjectDiffScreen:show()
mode = 'n',
key = '<enter>',
handler = loop.coroutine(function()
local mark, _ = self.diff_view:get_current_mark_under_cursor()
local mark = self.diff_view:get_current_mark_under_cursor()
if not mark then return end

local filepath = self.store:get_filepath()
Expand Down Expand Up @@ -479,7 +479,6 @@ function ProjectDiffScreen:show()
mode = 'n',
key = '<enter>',
handler = loop.coroutine(function()
local mark, _ = self.diff_view:get_current_mark_under_cursor()
local filename = self.store:get_filepath()
loop.free_textlock()

Expand All @@ -489,6 +488,8 @@ function ProjectDiffScreen:show()
return
end

local mark = self.diff_view:get_current_mark_under_cursor()

self:destroy()
fs.open(filename)

Expand Down

0 comments on commit f30e62a

Please sign in to comment.