Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(linepipe):git_bcommit now can support customized command #2846

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions lua/telescope/_.lua
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,15 @@ function LinesPipe:iter(schedule)
local text = nil
local index = nil

local get_next_text = function(previous)
local get_next_text = function()
index = nil

local read = self:read()
if previous == nil and read == nil then
if read == nil then
return
end

read = string.gsub(read or "", "\r", "")
return (previous or "") .. read
return string.gsub(read or "", "\r", "")
end

local next_value = nil
Expand All @@ -176,17 +175,24 @@ function LinesPipe:iter(schedule)
return nil
end

local start = index
local start = index or 1
index = string.find(text, "\n", index, true)

if index == nil then
text = get_next_text(string.sub(text, start or 1))
return next_value()
local previous = string.sub(text, start)
local next_text = get_next_text()
if next_text then
text = previous .. next_text
return next_value()
else
text = ""
return (#previous > 0) and previous or nil
end
end

index = index + 1

return string.sub(text, start or 1, index - 2)
return string.sub(text, start, index - 2)
end

text = get_next_text()
Expand Down