fix: preserve panel background in cursor mode (renderTextCursorContent)
Replace full ANSI reset sequences (\x1b[0m) added by lipgloss.Render() for gutter markers, cursor highlights, and selection highlights with background-preserving resets (\x1b[39;22;23;24;59;48;2;R;G;Bm) that restore the panel background color. Without this fix, every \x1b[0m from lipgloss-styled elements in renderTextCursorContent resets the panel background (set by the outer renderPreviewContent wrapper), causing some letters to have incorrect or missing background color in caret mode.
This commit is contained in:
parent
e890e1871b
commit
ce2f488c89
2 changed files with 15 additions and 2 deletions
|
|
@ -1886,7 +1886,20 @@ func (m *Model) renderTextCursorContent() string {
|
|||
}
|
||||
lines[idx] = marker + line
|
||||
}
|
||||
return strings.Join(lines, "\n")
|
||||
result := strings.Join(lines, "\n")
|
||||
|
||||
// Replace full ANSI resets with background-preserving resets.
|
||||
// lipgloss.Render() appends \x1b[0m which resets the panel background
|
||||
// set by the outer renderPreviewContent wrapper. Instead, reset only
|
||||
// foreground and text attributes, then restore the panel background
|
||||
// so that gutter markers, cursor highlights, and selection highlights
|
||||
// don't break the panel background for subsequent text on the line.
|
||||
panelBG := lipgloss.NewStyle().Background(m.palette.Panel).Render("")
|
||||
bgCode := strings.TrimSuffix(panelBG, "\x1b[0m")
|
||||
inner := bgCode[2 : len(bgCode)-1]
|
||||
safeReset := "\x1b[39;22;23;24;59;" + inner + "m"
|
||||
result = strings.ReplaceAll(result, "\x1b[0m", safeReset)
|
||||
return result
|
||||
}
|
||||
|
||||
func (m *Model) moveTextCursorWordForward() {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ right_path = ''
|
|||
|
||||
[ui]
|
||||
app_title = 'vcom'
|
||||
theme = 'catppuccin-mocha'
|
||||
theme = 'nord-frost'
|
||||
icon_mode = 'auto'
|
||||
show_title_bar = true
|
||||
show_footer = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue