mirror of https://github.com/chzyer/readline.git
Merge pull request #29 from bdarnell/div-by-zero
Fix a division by zero on terminals that report 0 width.
This commit is contained in:
commit
5aaa89df05
|
@ -320,7 +320,7 @@ func (r *RuneBuffer) MoveTo(ch rune, prevChar, reverse bool) (success bool) {
|
||||||
func (r *RuneBuffer) IdxLine() int {
|
func (r *RuneBuffer) IdxLine() int {
|
||||||
totalWidth := runes.WidthAll(r.buf[:r.idx]) + r.PromptLen()
|
totalWidth := runes.WidthAll(r.buf[:r.idx]) + r.PromptLen()
|
||||||
w := getWidth(r.cfg.StdoutFd)
|
w := getWidth(r.cfg.StdoutFd)
|
||||||
if w < 0 {
|
if w <= 0 {
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
line := totalWidth / w
|
line := totalWidth / w
|
||||||
|
|
Loading…
Reference in New Issue