Fix max width handling

This commit is contained in:
c-bata 2017-07-19 16:06:02 +09:00
parent 8bcf5c31fc
commit 4f5eedaa32

View File

@ -205,9 +205,9 @@ func formatCompletions(completions []Completion, max int) (new []Completion, wid
if diff := max - completionMargin - leftWidth - rightWidth; diff < 0 {
if rightWidth > diff {
rightWidth -= diff
} else if rightWidth+rightMargin > diff {
leftWidth += rightWidth + rightMargin - diff
rightWidth += diff
} else if rightWidth+rightMargin > -diff {
leftWidth += rightWidth + rightMargin + diff
rightWidth = 0
}
}