diff --git a/runebuf.go b/runebuf.go index 579dae4..11d8491 100644 --- a/runebuf.go +++ b/runebuf.go @@ -30,17 +30,7 @@ type RuneBuffer struct { } func (r *RuneBuffer) OnWidthChange(newWidth int) { - oldWidth := r.width - if newWidth < oldWidth { - sp := SplitByMultiLine( - r.PromptLen(), oldWidth, newWidth, r.buf[:r.idx]) - idxLine := len(sp) - 1 - r.clean(idxLine) - } else { - r.Clean() - } r.width = newWidth - r.print() } func (r *RuneBuffer) Backup() { diff --git a/utils.go b/utils.go index 468ab9b..8ee2f8f 100644 --- a/utils.go +++ b/utils.go @@ -86,29 +86,6 @@ func escapeKey(r rune) rune { return r } -func SplitByMultiLine(start, oldWidth, newWidth int, rs []rune) []string { - var ret []string - buf := bytes.NewBuffer(nil) - currentWidth := start - for _, r := range rs { - w := runes.Width(r) - currentWidth += w - buf.WriteRune(r) - if currentWidth == newWidth { - ret = append(ret, buf.String()) - buf.Reset() - continue - } - if currentWidth >= oldWidth { - ret = append(ret, buf.String()) - buf.Reset() - currentWidth = 0 - } - } - ret = append(ret, buf.String()) - return ret -} - func SplitByLine(start, screenWidth int, rs []rune) []string { var ret []string buf := bytes.NewBuffer(nil)