mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-17 22:14:53 +02:00
When truncating descriptions for completion truncate at word boundaries
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"kitty/tools/cli/markup"
|
||||
"kitty/tools/tty"
|
||||
"kitty/tools/utils"
|
||||
"kitty/tools/utils/style"
|
||||
"kitty/tools/wcswidth"
|
||||
"strings"
|
||||
)
|
||||
@@ -67,7 +68,7 @@ func (self *Match) FormatForCompletionList(max_word_len int, f *markup.Context,
|
||||
word += strings.Repeat(" ", max_word_len-word_len)
|
||||
}
|
||||
if wcswidth.Stringwidth(desc) > max_desc_len {
|
||||
desc = wcswidth.TruncateToVisualLength(desc, max_desc_len-2) + "\x1b[m\x1b]8;;\x1b\\…"
|
||||
desc = style.WrapTextAsLines(desc, "", max_desc_len-2)[0] + "…"
|
||||
}
|
||||
if multiline {
|
||||
return word + "\n" + strings.Repeat(" ", max_word_len+2) + desc
|
||||
|
||||
Reference in New Issue
Block a user