fix: git stash entry formatting (#1452)
This commit is contained in:
committed by
GitHub
parent
a20f01353b
commit
6b1579741a
@@ -249,16 +249,40 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
function make_entry.gen_from_git_stash()
|
||||
function make_entry.gen_from_git_stash(opts)
|
||||
local displayer = entry_display.create {
|
||||
separator = " ",
|
||||
items = {
|
||||
{ width = 10 },
|
||||
opts.show_branch and { width = 15 } or "",
|
||||
{ remaining = true },
|
||||
},
|
||||
}
|
||||
|
||||
local make_display = function(entry)
|
||||
return displayer {
|
||||
{ entry.value, "TelescopeResultsLineNr" },
|
||||
opts.show_branch and { entry.branch_name, "TelescopeResultsIdentifier" } or "",
|
||||
entry.commit_info,
|
||||
}
|
||||
end
|
||||
|
||||
return function(entry)
|
||||
if entry == "" then
|
||||
return nil
|
||||
end
|
||||
local splitted = vim.split(entry, ":")
|
||||
|
||||
local splitted = utils.max_split(entry, ": ", 2)
|
||||
local stash_idx = splitted[1]
|
||||
local _, branch_name = string.match(splitted[2], "^([WIP on|On]+) (.+)")
|
||||
local commit_info = splitted[3]
|
||||
|
||||
return {
|
||||
value = splitted[1],
|
||||
ordinal = splitted[3],
|
||||
display = splitted[3],
|
||||
value = stash_idx,
|
||||
ordinal = commit_info,
|
||||
branch_name = branch_name,
|
||||
commit_info = commit_info,
|
||||
display = make_display,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user