Add clickable regions to statusline with %[FuncName] item#19841
Open
mattn wants to merge 6 commits intovim:masterfrom
Open
Add clickable regions to statusline with %[FuncName] item#19841mattn wants to merge 6 commits intovim:masterfrom
mattn wants to merge 6 commits intovim:masterfrom
Conversation
Add support for clickable regions in the statusline using the %@funcName@ syntax. When a user clicks on a region, the specified Vim function is called with a dictionary containing click details (button, nclicks, modifiers, minwid, winid). The function can return non-zero to trigger a statusline redraw. - Add %@funcName@ and %@@ (end region) parsing in build_stl_str_hl() - Add stl_click_handler() in mouse.c to dispatch clicks to callbacks - Store resolved click regions per window (w_stl_click) - Add 'statusline_click' feature flag for has() detection - Add 'statuslineclick' option to statuslineopt for enable/disable - Add documentation and tests
Use %[FuncName] to start a clickable region and %[] to end it, instead of %@funcName@ and %@@. This avoids conflict with the existing %@ line break notation and works with :set without needing to escape special characters.
Rename parameters mouse_col and mod_mask to mcol and mods to avoid shadowing the global variables with the same names.
Member
Author
|
I plan to add clickable region support for |
- Fix -Wshadow in win_free(): remove inner 'int i' that shadows outer - Fix -Wunused-parameter in stl_click_handler(): cast params to void when FEAT_EVAL is not defined (tiny build)
Member
|
Thanks, unfortunately ASAN detected a memory leak. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add support for clickable regions in the statusline using
%[FuncName]syntax. When a user clicks on a region, the specified Vim function is called with a dictionary argument. The function can return non-zero to trigger a statusline redraw.%[FuncName]starts a clickable region,%[]ends it. If%[]is omitted, the region extends to the end of the statusline.%N[FuncName]passes an identifier N to the callback asminwid.The callback receives a Dictionary with:
minwid: identifier from%N[Func](0 if not specified)nclicks: number of clicks (1, 2, or 3)button:"l"(left),"m"(middle),"r"(right)mods: modifier keys, combination of"s"(shift),"c"(ctrl),"a"(alt)winid: window-ID of the clicked statuslineUse
has('statusline_click')to check availability.2026-03-26.231437.mp4