From 3abba9d69bc19c2fc567fb87920db46392579b23 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Sun, 6 Nov 2022 15:26:50 -0500 Subject: [PATCH] Don't even bother with text wrapping This is a pretty useless feature, all things considered. It should be the job of the application to figure that out. --- buffer.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/buffer.go b/buffer.go index abc9593..5a296c8 100644 --- a/buffer.go +++ b/buffer.go @@ -98,10 +98,7 @@ func (buffer *Buffer) Write (bytes []byte) (bytesWritten int, err error) { for _, character := range text { buffer.SetRune(buffer.Dot.X, buffer.Dot.Y, character) buffer.Dot.X ++ - if buffer.Dot.X > buffer.width || character == '\n' { - buffer.Dot.X = 0 - buffer.Dot.Y ++ - } + if buffer.Dot.X > buffer.width { break } } return @@ -150,10 +147,7 @@ func (buffer *DamageBuffer) Write (bytes []byte) (bytesWritten int, err error) { for _, character := range text { buffer.SetRune(buffer.Dot.X, buffer.Dot.Y, character) buffer.Dot.X ++ - if buffer.Dot.X > buffer.width || character == '\n' { - buffer.Dot.X = 0 - buffer.Dot.Y ++ - } + if buffer.Dot.X > buffer.width { break } } return