Skip to content

Commit 9d1a256

Browse files
authored
Merge pull request #141 from KimJBaran/patch-1
Bugfix: point color wasn't applied when point_idx = 0
2 parents af2cf5a + 2990b69 commit 9d1a256

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

lua/ccc/ui/float.lua

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ end
157157
---@return integer
158158
local function adjust2bar(value, min, max)
159159
local opts = require("ccc.config").options
160-
return utils.round((value - min) / (max - min) * opts.bar_len)
160+
local raw = utils.round((value - min) / (max - min) * opts.bar_len)
161+
return utils.clamp(raw, 1, opts.bar_len)
161162
end
162163

163164
---@param value number
@@ -167,9 +168,6 @@ end
167168
local function create_bar(value, min, max)
168169
local opts = require("ccc.config").options
169170
local point_idx = adjust2bar(value, min, max)
170-
if point_idx == 0 then
171-
return opts.point_char .. opts.bar_char:rep(opts.bar_len - 1)
172-
end
173171
return opts.bar_char:rep(point_idx - 1) .. opts.point_char .. opts.bar_char:rep(opts.bar_len - point_idx)
174172
end
175173

0 commit comments

Comments
 (0)