Fix panic 'integer divide by zero' when terminal width too low (#137)

This commit is contained in:
François-Xavier Aguessy 2017-12-08 02:16:05 +01:00 committed by chzyer
parent a4d5111b61
commit 40d6036c33
1 changed files with 3 additions and 1 deletions

View File

@ -203,7 +203,9 @@ func (o *opCompleter) CompleteRefresh() {
// -1 to avoid reach the end of line
width := o.width - 1
colNum := width / colWidth
colWidth += (width - (colWidth * colNum)) / colNum
if colNum != 0 {
colWidth += (width - (colWidth * colNum)) / colNum
}
o.candidateColNum = colNum
buf := bufio.NewWriter(o.w)