Skip to content

Commit

Permalink
Merge pull request #11 from willothy/fix-remove-rpad
Browse files Browse the repository at this point in the history
fix: remove right padding from paragraph and descendants
  • Loading branch information
mobily authored Mar 29, 2024
2 parents ca7d5fc + 2770d4b commit cdd4556
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lua/nui-components/paragraph.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@ function Paragraph:prop_types()
end

function Paragraph:_calculate_gap_width(max_width, text_width)
local align = self:get_props().align
local props = self:get_props()
local align, truncate = props.align, props.truncate

local gap_width = max_width - text_width
if align == "left" then
if align == "left" and not truncate then
return 0, gap_width
elseif align == "center" then
return math.floor(gap_width / 2), math.ceil(gap_width / 2)
return math.floor(gap_width / 2), truncate and 0 or math.ceil(gap_width / 2)
elseif align == "right" then
return gap_width, 0
end
Expand Down

0 comments on commit cdd4556

Please sign in to comment.