From f78a0704f132219ce97f582d0479c972a2b84bd2 Mon Sep 17 00:00:00 2001 From: Roi Martin Date: Sat, 15 Nov 2014 13:13:19 +0100 Subject: [PATCH] Minor fixes in Wrap Print first character of the new line. Control maxX and maxY to avoid invalid calls to View.SetRune. Add error handling when calling View.SetRune. --- view.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/view.go b/view.go index 3fa2b6a..9f4f4cb 100644 --- a/view.go +++ b/view.go @@ -189,19 +189,21 @@ func (v *View) draw() error { if x == maxX && v.Wrap { x = 0 y++ - for _, p := range v.WrapPrefix { - if x == maxX { + for _, p := range v.WrapPrefix + string(ch) { + if x >= maxX || y >= maxY { break } - v.setRune(x, y, p) + if err := v.setRune(x, y, p); err != nil { + return err + } x++ } } else if x < maxX && y < maxY { if err := v.setRune(x, y, ch); err != nil { return err } + x++ } - x++ } y++ }