mirror of https://github.com/chzyer/readline.git
Fix panic 'integer divide by zero' when terminal width too low (#137)
This commit is contained in:
parent
a4d5111b61
commit
40d6036c33
|
@ -203,7 +203,9 @@ func (o *opCompleter) CompleteRefresh() {
|
||||||
// -1 to avoid reach the end of line
|
// -1 to avoid reach the end of line
|
||||||
width := o.width - 1
|
width := o.width - 1
|
||||||
colNum := width / colWidth
|
colNum := width / colWidth
|
||||||
|
if colNum != 0 {
|
||||||
colWidth += (width - (colWidth * colNum)) / colNum
|
colWidth += (width - (colWidth * colNum)) / colNum
|
||||||
|
}
|
||||||
|
|
||||||
o.candidateColNum = colNum
|
o.candidateColNum = colNum
|
||||||
buf := bufio.NewWriter(o.w)
|
buf := bufio.NewWriter(o.w)
|
||||||
|
|
Loading…
Reference in New Issue