File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -142,7 +142,7 @@ lsp.code_actions = function(opts)
142142 }
143143
144144 for key , value in pairs (widths ) do
145- widths [key ] = math.max (value , vim . fn .strdisplaywidth (entry [key ]))
145+ widths [key ] = math.max (value , utils .strdisplaywidth (entry [key ]))
146146 end
147147
148148 table.insert (results , entry )
@@ -159,15 +159,15 @@ lsp.code_actions = function(opts)
159159 local displayer = entry_display .create {
160160 separator = " " ,
161161 items = {
162- { width = widths .idx },
162+ { width = widths .idx + 1 }, -- +1 for ":" suffix
163163 { width = widths .command_title },
164164 { width = widths .client_name },
165165 },
166166 }
167167
168168 local function make_display (entry )
169169 return displayer {
170- {entry .idx , " TelescopePromptPrefix" },
170+ {entry .idx .. " : " , " TelescopePromptPrefix" },
171171 {entry .command_title },
172172 {entry .client_name , " TelescopeResultsComment" },
173173 }
Original file line number Diff line number Diff line change @@ -259,13 +259,14 @@ utils.strdisplaywidth = (function()
259259
260260 return function (str , col )
261261 local startcol = col or 0
262+ str = tostring (str )
262263 local s = ffi .new (' char[?]' , # str + 1 )
263264 ffi .copy (s , str )
264265 return ffi .C .linetabsize_col (startcol , s ) - startcol
265266 end
266267 else
267268 return function (str , col )
268- return # str - (col or 0 )
269+ return # ( tostring ( str )) - (col or 0 )
269270 end
270271 end
271272end )()
You can’t perform that action at this time.
0 commit comments