Skip to content

Commit

Permalink
docs: fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
luukvbaal committed Nov 25, 2023
1 parent 2e34e0a commit e8ab7ce
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Each segment can contain the following elements:
-- at least one of "name", "text", and "namespace" is required
-- legacy signs are matched against the defined sign name e.g. "DiagnosticSignError"
-- extmark signs can be matched against either the namespace or the sign text itself
name = { ".*" }, -- table of lua patterns to match the sign name against
name = { ".*" }, -- table of lua patterns to match the legacy sign name against
text = { ".*" }, -- table of lua patterns to match the extmark sign text against
namespace = { ".*" },-- table of lua patterns to match the extmark sign namespace against
-- below values list the default when omitted:
Expand Down
20 changes: 10 additions & 10 deletions lua/statuscol.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ local function sign_assign_segment(s, win)
for j = 1, ss.namecount do
if s.sign_name:find(ss.name[j]) then goto found end
end
elseif s.ns then -- extmark sign
else -- extmark sign
for j = 1, ss.nottextcount do
if s.wtext:find(ss.nottext[j]) then goto next end
end
Expand All @@ -73,23 +73,23 @@ local function sign_assign_segment(s, win)
if segment <= signsegmentcount then s.segment = segment end
end

--- Update sign cache and assign segment to defined legacy signs or placed extmark signs.
local function update_sign_defined(win, signs, reassign)
--- Update sign cache and assign segment to signs.
local function sign_cache_add(win, signs, reassign)
for i = 1, #signs do
local s = signs[i][4]
local name = s.sign_name
if s.sign_text then
if not s.sign_hl_group then s.sign_hl_group = "NoTexthl" end
if not name then
name = s.sign_text and s.sign_text..s.sign_hl_group
s.ns = nsmap[s.ns_id]
end
s.wtext = s.sign_text:gsub("%s", "")
if not s.sign_hl_group then s.sign_hl_group = "NoTexthl" end
if not reassign and sign_cache[s.sign_name] then
s.segment = sign_cache[s.sign_name].segment
else
sign_assign_segment(s, win)
end
s.wtext = s.sign_text:gsub("%s", "")
end
if s.segment and signsegments[s.segment].colwidth == 1 then s.sign_text = s.wtext end
if name then sign_cache[name] = s end
Expand All @@ -112,7 +112,7 @@ local function get_click_args(minwid, clicks, button, mods)
end

local function call_click_func(name, args)
local handler = cfg.clickhandlers[name:match("vim.diagnostic") or name]
local handler = cfg.clickhandlers[name]
if handler then S(function() handler(args) end) end
end

Expand Down Expand Up @@ -163,12 +163,12 @@ local function get_lnum_action(minwid, clicks, button, mods)
call_click_func("Lnum", args)
end

--- Place (extmark) signs in sign segments.
--- Place signs in sign segments.
local function place_signs(win, signs)
for i = 1, #signs do
local s = signs[i][4]
local name = s.sign_name or s.sign_text and s.sign_text..s.sign_hl_group
if not sign_cache[name] then update_sign_defined(win, {signs[i]}) end
if not sign_cache[name] then sign_cache_add(win, {signs[i]}) end
local sign = sign_cache[name]
if not sign.segment then goto nextsign end
local ss = signsegments[sign.segment]
Expand Down Expand Up @@ -209,7 +209,7 @@ local function update_callargs(args, win, tick)
local wss = ss.wins[win]
if ss.lnum and args.sclnu ~= wss.sclnu then
wss.sclnu = args.sclnu
update_sign_defined(win, signs, true)
sign_cache_add(win, signs, true)
end
wss.width = 0
wss.signs = {}
Expand Down Expand Up @@ -373,7 +373,7 @@ function M.setup(user)
end
if setscl and o.scl ~= "number" then o.scl = "no" end
-- For each sign segment, store the name patterns from other sign segments.
-- This list is used in update_sign_defined() to make sure that signs that
-- This list is used in sign_assign_segment() to make sure that signs that
-- have a dedicated segment do not get placed in a wildcard(".*") segment.
if signsegmentcount > 0 then
for i = 1, signsegmentcount do
Expand Down
6 changes: 2 additions & 4 deletions lua/statuscol/builtin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ function M.foldfunc(args)
local string = args.cul and args.relnum == 0 and "%#CursorLineFold#" or "%#FoldColumn#"
local level = foldinfo.level

if level == 0 then
return string..(" "):rep(width).."%*"
end
if level == 0 then return string..(" "):rep(width).."%*" end

local closed = foldinfo.lines > 0
local first_level = level - width - (closed and 1 or 0) + 1
Expand Down Expand Up @@ -87,7 +85,7 @@ function M.not_empty(args)
return not args.empty
end

--- Create new fold by middle-cliking the range.
--- Create new fold by middle-clicking the range.
local function create_fold(args)
if foldmarker then
c("norm! zf"..foldmarker.."G")
Expand Down

0 comments on commit e8ab7ce

Please sign in to comment.