Skip to content

fix: skip hlsearch highlighting when popup is open - #56

Open
VimWei wants to merge 1 commit into
romainl:masterfrom
VimWei:fix-popup
Open

VimWei wants to merge 1 commit into
romainl:masterfrom
VimWei:fix-popup

Conversation

@VimWei

@VimWei VimWei commented Sep 3, 2026

Copy link
Copy Markdown

Problem

With hlsearch on, navigating the helptoc TOC popup with J/K flickers and jumps
incorrectly. helptoc's Filter() moves the main-buffer cursor (normal! 0{lnum}zt) on each
J/K, firing CursorMoveds:StartHL(), whose search side effects (go<byte>,
norm! n, winrestview()) conflict with the popup's redraw. Checking &buftype ==# 'popup'
does not work: the event fires in the main buffer, not the popup window.

Solution

Bail out of s:StartHL() when a popup is open, via popup_list() (guarded for Vim < 8.2):

if !v:hlsearch || mode() isnot 'n' || (exists('*popup_list') && !empty(popup_list()))
    return
endif

Fix

fixes: #55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

helptoc popup J/K navigation flickers and jumps with hlsearch on

1 participant