From 51daaf6f5aa81cdfa5ae2946090f969d68295543 Mon Sep 17 00:00:00 2001 From: shadmansaleh Date: Tue, 3 Aug 2021 09:56:07 +0600 Subject: [PATCH] fix: Fixes bug diff somtimes doubled --- lua/lualine/components/diff.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/lualine/components/diff.lua b/lua/lualine/components/diff.lua index 5c5aede..b160e3e 100644 --- a/lua/lualine/components/diff.lua +++ b/lua/lualine/components/diff.lua @@ -151,7 +151,10 @@ end -- Updates the async function for current file function Diff.update_git_diff_getter() -- stop older function properly before overwritting it - if Diff.get_git_diff then Diff.get_git_diff:stop() end + if Diff.get_git_diff then + Diff.get_git_diff:stop() + Diff.diff_data = '' + end -- Donn't show git diff when current buffer doesn't have a filename if #vim.fn.expand('%') == 0 then Diff.get_git_diff = nil; @@ -174,6 +177,7 @@ function Diff.update_git_diff_getter() on_exit = function() if Diff.diff_data ~= '' then Diff.process_diff(Diff.diff_data) + Diff.diff_data = '' else Diff.git_diff = {added = 0, modified = 0, removed = 0} end