This commit is contained in:
Kovid Goyal 2022-03-15 13:18:07 +05:30
parent 7168ceab94
commit 946589d1f1
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -285,7 +285,10 @@ def zsh_output_serializer(ans: Completions) -> str:
has_descriptions = any(matches.values())
if has_descriptions or matches.word_transforms:
lines.append('compdescriptions=(')
sz = max(map(wcswidth, matches.transformed_words()))
try:
sz = max(map(wcswidth, matches.transformed_words()))
except ValueError:
sz = 0
limit = min(16, sz)
for word, desc in matches.transformed_items():
lines.extend(map(shlex.quote, fmt_desc(word, desc, limit)))