@@ -53,11 +53,12 @@ function Extmark:highlight_pattern(opts)
5353 local extmark_opts = {
5454 end_col = to ,
5555 hl_group = hl ,
56+ priority = priority ,
5657 }
57- if priority then extmark_opts .priority = priority end
5858 local ok , value = pcall (vim .api .nvim_buf_set_extmark , self .bufnr , self .ns_id , row , from - 1 , extmark_opts )
5959 if not ok then return false , value end
60- j = from
60+ j = to
61+ if to < from then break end
6162 result [# result + 1 ] = value
6263 end
6364 else
@@ -71,11 +72,12 @@ function Extmark:highlight_pattern(opts)
7172 local extmark_opts = {
7273 end_col = to ,
7374 hl_group = hl ,
75+ priority = priority ,
7476 }
75- if priority then extmark_opts .priority = priority end
7677 local ok , value = pcall (vim .api .nvim_buf_set_extmark , self .bufnr , self .ns_id , i - 1 , from - 1 , extmark_opts )
7778 if not ok then return false , value end
78- j = from
79+ j = to
80+ if to < from then break end
7981 result [# result + 1 ] = value
8082 end
8183 end
@@ -101,13 +103,11 @@ function Extmark:highlight_range(opts)
101103 local col_range = opts .col_range
102104 local priority = opts .priority
103105
104- local extmark_opts = {
106+ return pcall ( vim . api . nvim_buf_set_extmark , self . bufnr , self . ns_id , row , col_range . from , {
105107 end_col = col_range .to ,
106108 hl_group = hl ,
107- }
108- if priority then extmark_opts .priority = priority end
109-
110- return pcall (vim .api .nvim_buf_set_extmark , self .bufnr , self .ns_id , row , col_range .from , extmark_opts )
109+ priority = priority ,
110+ })
111111end
112112
113113function Extmark :highlight (opts )
@@ -160,6 +160,7 @@ function Extmark:sign(opts)
160160
161161 local id = self :derive_id (row )
162162 local sign_definition = get_sign_definition (name )
163+ if not sign_definition then return false , ' unknown sign: ' .. tostring (name ) end
163164 local sign_text = sign_definition .text
164165
165166 return pcall (vim .api .nvim_buf_set_extmark , self .bufnr , self .ns_id , row , 0 , {
0 commit comments