diff --git a/CHANGELOG.md b/CHANGELOG.md index b973d63..b3f0489 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,13 +6,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -## 2019/02/23 +## 2019/02/28 + +### Added + +- Add `ColumnResizer` to table which allows for custom column sizing +- Add widget padding ### Changed - Change various widget field names -- s/TextParse/ParseStyles -- Remove AddColorMap in place of modifying StyleParserColorMap directly +- s/`TextParse`/`ParseStyles` +- Remove `AddColorMap` in place of modifying `StyleParserColorMap` directly ## 2019/01/31 diff --git a/block.go b/block.go index 8ebbd85..3be9699 100644 --- a/block.go +++ b/block.go @@ -13,12 +13,12 @@ import ( // It implements all 3 of the methods needed for the `Drawable` interface. // Custom widgets will override the Draw method. type Block struct { - Border bool - BorderStyle Style - BorderLeft bool - BorderRight bool - BorderTop bool - BorderBottom bool + Border bool + BorderStyle Style + + BorderLeft, BorderRight, BorderTop, BorderBottom bool + + PaddingLeft, PaddingRight, PaddingTop, PaddingBottom int image.Rectangle Inner image.Rectangle @@ -76,7 +76,7 @@ func (self *Block) drawBorder(buf *Buffer) { // Draw implements the Drawable interface. func (self *Block) Draw(buf *Buffer) { if self.Border { - self.drawBorder(buf) + self.drawBorder(buf) } buf.SetString( self.Title, @@ -88,7 +88,12 @@ func (self *Block) Draw(buf *Buffer) { // SetRect implements the Drawable interface. func (self *Block) SetRect(x1, y1, x2, y2 int) { self.Rectangle = image.Rect(x1, y1, x2, y2) - self.Inner = image.Rect(self.Min.X+1, self.Min.Y+1, self.Max.X-1, self.Max.Y-1) + self.Inner = image.Rect( + self.Min.X+1+self.PaddingLeft, + self.Min.Y+1+self.PaddingTop, + self.Max.X-1+self.PaddingRight, + self.Max.Y-1+self.PaddingBottom, + ) } // GetRect implements the Drawable interface.