Skip to content

Commit

Permalink
fix(doom): Correct negative offset when resizing terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
polirritmico committed Jun 11, 2024
1 parent 6818914 commit af53082
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lua/dashboard/theme/doom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,14 @@ local function generate_center(config)
end
before = curline

-- FIX: #422: In Lua the length of a string is the numbers of bytes not
-- FIX: #422: In Lua the length of a string is the number of bytes not
-- the number of characters.
local curline_str = api.nvim_buf_get_lines(config.bufnr, curline - 1, curline, false)[1]
local delta = col_width - api.nvim_strwidth(curline_str:sub(1, col + 1))
api.nvim_win_set_cursor(config.winid, { curline, col + delta })
local offset = col_width - api.nvim_strwidth(curline_str:sub(1, col + 1))
if offset < 0 then
offset = 0
end
api.nvim_win_set_cursor(config.winid, { curline, col + offset })
end,
})
end, 0)
Expand Down

0 comments on commit af53082

Please sign in to comment.