diff --git a/lua/vgit/features/screens/ProjectDiffScreen/Store.lua b/lua/vgit/features/screens/ProjectDiffScreen/Store.lua index 5ea166e8..a21eb47f 100644 --- a/lua/vgit/features/screens/ProjectDiffScreen/Store.lua +++ b/lua/vgit/features/screens/ProjectDiffScreen/Store.lua @@ -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) diff --git a/lua/vgit/features/screens/ProjectDiffScreen/init.lua b/lua/vgit/features/screens/ProjectDiffScreen/init.lua index 6541cdb0..4f510dc8 100644 --- a/lua/vgit/features/screens/ProjectDiffScreen/init.lua +++ b/lua/vgit/features/screens/ProjectDiffScreen/init.lua @@ -395,7 +395,7 @@ function ProjectDiffScreen:show() mode = 'n', key = '', 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() @@ -479,7 +479,6 @@ function ProjectDiffScreen:show() mode = 'n', key = '', handler = loop.coroutine(function() - local mark, _ = self.diff_view:get_current_mark_under_cursor() local filename = self.store:get_filepath() loop.free_textlock() @@ -489,6 +488,8 @@ function ProjectDiffScreen:show() return end + local mark = self.diff_view:get_current_mark_under_cursor() + self:destroy() fs.open(filename)