From ab1541ea205d34d9eb258659b82772be4c30e4e4 Mon Sep 17 00:00:00 2001 From: rbong Date: Tue, 17 Sep 2024 21:54:12 -0400 Subject: [PATCH] Fix parsing lines --- lua/flog/graph.lua | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lua/flog/graph.lua b/lua/flog/graph.lua index 92630c2..2d5ac83 100644 --- a/lua/flog/graph.lua +++ b/lua/flog/graph.lua @@ -177,15 +177,23 @@ function M.get_graph( -- Read output until EOF or start token local out = {} local nlines = 0 - for line in handle:lines() do - if strip_cr then + if strip_cr then + for line in handle:lines() do + nlines = nlines + 1 line = line:gsub('\r$', '') + if line == start_token then + break + end + out[nlines] = line end - nlines = nlines + 1 - if line == start_token then - break + else + for line in handle:lines() do + nlines = nlines + 1 + if line == start_token then + break + end + out[nlines] = line end - out[nlines] = line end -- Save commit