remove SplitByMultiLine

This commit is contained in:
chzyer 2016-03-31 00:15:33 +08:00
parent b1b67f8632
commit e5e328dcc7
2 changed files with 0 additions and 33 deletions

View File

@ -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() {

View File

@ -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)