Skip to content

Commit 41919ea

Browse files
committed
Add a way to specify a default group max per row
1 parent f7c2a1f commit 41919ea

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

doc/scrollview.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,9 @@ scrollview_signs_max_per_row_by_group *scrollview_signs_max_per_row_by_grou
390390
|Dictionary| mapping sign groups (|String|) to maximum
391391
number of corresponding signs per row (|Number|). Groups
392392
not present in the dictionary, or that have a value of
393-
`-1`, have no group-specific limit. Defaults to `{}`.
394-
Example: `{'diagnostics': 1, 'keywords': 2}`.
393+
`-1`, have no group-specific limit. Use `'all'` to set a
394+
default limit for groups not explicitly specified.
395+
Defaults to `{}`. Example: `{'all': 2, 'diagnostics': 1}`.
395396

396397
scrollview_signs_on_startup *scrollview_signs_on_startup*
397398
|List| of |String|s specifying built-in sign groups to

lua/scrollview.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1875,7 +1875,9 @@ local show_signs = function(winid, sign_winids, bar_winid)
18751875
local filtered_list = {}
18761876
for _, props in ipairs(props_list) do
18771877
local group = sign_specs[props.sign_spec_id].group
1878-
local group_limit = max_signs_per_row_by_group[group] or -1
1878+
local group_limit = max_signs_per_row_by_group[group]
1879+
or max_signs_per_row_by_group['all']
1880+
or -1
18791881
group_counts[group] = (group_counts[group] or 0) + 1
18801882
if group_limit < 0 or group_counts[group] <= group_limit then
18811883
table.insert(filtered_list, props)

0 commit comments

Comments
 (0)