Skip to content

Commit

Permalink
Fix panic 'integer divide by zero' when terminal width too low (chzye…
Browse files Browse the repository at this point in the history
  • Loading branch information
fxaguessy authored and chzyer committed Dec 8, 2017
1 parent a4d5111 commit 40d6036
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion complete.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 40d6036

Please sign in to comment.