From 5203d8f2592798c3ad4adb67b0a7f06afbb46382 Mon Sep 17 00:00:00 2001 From: sqshq Date: Fri, 19 Apr 2019 22:07:44 -0400 Subject: [PATCH] added margin for textbox component --- component/textbox/textbox.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/component/textbox/textbox.go b/component/textbox/textbox.go index e5b407b..4e9221e 100644 --- a/component/textbox/textbox.go +++ b/component/textbox/textbox.go @@ -43,7 +43,7 @@ func (t *TextBox) Draw(buffer *ui.Buffer) { t.Block.Draw(buffer) cells := ui.ParseStyles(t.text, ui.Theme.Paragraph.Text) - cells = ui.WrapCells(cells, uint(t.Inner.Dx())) + cells = ui.WrapCells(cells, uint(t.Inner.Dx()-2)) rows := ui.SplitCells(cells, '\n') @@ -51,10 +51,10 @@ func (t *TextBox) Draw(buffer *ui.Buffer) { if y+t.Inner.Min.Y >= t.Inner.Max.Y { break } - row = ui.TrimCells(row, t.Inner.Dx()) + row = ui.TrimCells(row, t.Inner.Dx()-2) for _, cx := range ui.BuildCellWithXArray(row) { x, cell := cx.X, cx.Cell - buffer.SetCell(cell, image.Pt(x, y+1).Add(t.Inner.Min)) + buffer.SetCell(cell, image.Pt(x+1, y+1).Add(t.Inner.Min)) } }