Lower priority of cursorline and colorcolumn highlighting
Fixes
@@ -518,6 +518,13 @@ func (w *BufWindow) displayBuffer() {
draw := func(r rune, combc []rune, style tcell.Style, showcursor bool) {
if nColsBeforeStart <= 0 {
+ _, origBg, _ := style.Decompose()
+ _, defBg, _ := config.DefStyle.Decompose()
+
+ // syntax highlighting with non-default background takes precedence
+ // over cursor-line and color-column
+ dontOverrideBackground := origBg != defBg
+
for _, c := range cursors {
if c.HasSelection() &&
(bloc.GreaterEqual(c.CurSelection[0]) && bloc.LessThan(c.CurSelection[1]) ||
@@ -530,7 +537,7 @@ func (w *BufWindow) displayBuffer() {
}
}
- if b.Settings["cursorline"].(bool) && w.active &&
+ if b.Settings["cursorline"].(bool) && w.active && !dontOverrideBackground &&
!c.HasSelection() && c.Y == bloc.Y {
if s, ok := config.Colorscheme["cursor-line"]; ok {
fg, _, _ := s.Decompose()
@@ -562,7 +569,7 @@ func (w *BufWindow) displayBuffer() {
}
if s, ok := config.Colorscheme["color-column"]; ok {
- if colorcolumn != 0 && vloc.X-w.gutterOffset+w.StartCol == colorcolumn {
+ if colorcolumn != 0 && vloc.X-w.gutterOffset+w.StartCol == colorcolumn && !dontOverrideBackground {
fg, _, _ := s.Decompose()
style = style.Background(fg)
}
