From 2eb424ce3d0a74c8e2d766fcae284b0319bc9cda Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Fri, 15 Apr 2022 10:55:42 +1000 Subject: [PATCH] honour last character --- view.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/view.go b/view.go index cb735bd..d2c2b75 100644 --- a/view.go +++ b/view.go @@ -922,6 +922,7 @@ func (v *View) draw() error { y := 0 emptyCell := cell{chr: ' ', fgColor: ColorDefault, bgColor: ColorDefault} + var prevFgColor Attribute for _, vline := range v.viewLines[start:] { if y >= maxY { break @@ -940,8 +941,13 @@ func (v *View) draw() error { if j > len(vline.line)-1 { c = emptyCell + c.fgColor = prevFgColor } else { c = vline.line[j] + // capturing previous foreground colour so that if we're using the reverse + // attribute we honour the final character's colour and don't awkwardly switch + // to a new background colour for the remainder of the line + prevFgColor = c.fgColor } fgColor := c.fgColor