forked from mirror/readline
Fix a division by zero on terminals that report 0 width.
This is true of emacs shell-mode.
This commit is contained in:
parent
8181d5ed14
commit
c3db9c3189
|
@ -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