Delete break line characters from Suggests

This commit is contained in:
c-bata 2018-06-24 14:19:00 +09:00
parent df741236e4
commit e33c41b012

@ -108,6 +108,12 @@ func (c *CompletionManager) update() {
}
}
func deleteBreakLineCharacters(s string) string {
s = strings.Replace(s, "\n", "", -1)
s = strings.Replace(s, "\r", "", -1)
return s
}
func formatTexts(o []string, max int, prefix, suffix string) (new []string, width int) {
l := len(o)
n := make([]string, l)
@ -117,6 +123,8 @@ func formatTexts(o []string, max int, prefix, suffix string) (new []string, widt
lenShorten := runewidth.StringWidth(shortenSuffix)
min := lenPrefix + lenSuffix + lenShorten
for i := 0; i < l; i++ {
o[i] = deleteBreakLineCharacters(o[i])
w := runewidth.StringWidth(o[i])
if width < w {
width = w