better appearance for reverse attribute

This commit is contained in:
Jesse Duffield
2022-04-15 10:56:49 +10:00
parent 6a153acc8f
commit 00afa30ebf
7 changed files with 35 additions and 37 deletions

View File

@@ -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

2
vendor/modules.txt vendored
View File

@@ -169,7 +169,7 @@ github.com/jesseduffield/go-git/v5/utils/merkletrie/filesystem
github.com/jesseduffield/go-git/v5/utils/merkletrie/index
github.com/jesseduffield/go-git/v5/utils/merkletrie/internal/frame
github.com/jesseduffield/go-git/v5/utils/merkletrie/noder
# github.com/jesseduffield/gocui v0.3.1-0.20220415000211-a826601ada29
# github.com/jesseduffield/gocui v0.3.1-0.20220415005542-2eb424ce3d0a
## explicit; go 1.12
github.com/jesseduffield/gocui
# github.com/jesseduffield/minimal/gitignore v0.3.3-0.20211018110810-9cde264e6b1e