Skip to content

Commit c4d6cd2

Browse files
committed
fix(staging): double-width staging indicator being cut off (#27)
1 parent 83c97a9 commit c4d6cd2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lua/tinygit/commands/stage/telescope.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,16 @@ local function newFinder(hunks)
4646
location = ":" .. h.lnum
4747
if h.fileMode == "renamed" then location = location .. " (renamed)" end
4848
end
49-
local status = h.alreadyStaged and conf.stagedIndicator
50-
or (" "):rep(vim.api.nvim_strwidth(conf.stagedIndicator))
49+
50+
local iconWidth = vim.api.nvim_strwidth(conf.stagedIndicator)
51+
local status = h.alreadyStaged and conf.stagedIndicator or (" "):rep(iconWidth)
5152
status = status .. " " -- padding
5253

5354
local out = status .. name .. location .. added .. del
5455
local statPos = #status + #name + #location
5556
local hlGroups = require("tinygit.config").config.appearance.hlGroups
5657
local highlights = {
57-
{ { 0, 1 }, "Keyword" }, -- icon for stage status
58+
{ { 0, iconWidth }, "Keyword" }, -- icon for stage status
5859
{ { #status + #name, statPos }, "Comment" }, -- lnum
5960
{ { statPos, statPos + #added }, hlGroups.addedText }, -- added
6061
{ { statPos + #added + 1, statPos + #added + #del }, hlGroups.removedText }, -- removed

0 commit comments

Comments
 (0)