aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/popupmenu.c
Commit message (Collapse)AuthorAge
* vim-patch:9.1.1011: popupmenu internal error with some abbr in completion ↵zeertzjq2025-01-13
| | | | | | | | | | | | item (#31988) Problem: Popup menu internal error with some abbr in completion item. Solution: Don't compute attributes when there is no corresponding text. Reduce indent in pum_redraw() while at it (zeertzjq). fixes: vim/vim#16427 closes: vim/vim#16435 https://github.com/vim/vim/commit/3a0cc36c69744a7727ce34311d39d2d9d8ddc6f9
* fix(popup): wrong extmark data sync when lines changed in popup preview #30246glepnir2025-01-05
| | | | | | | | Problem: when popup preview buffer has filetype like markdown and ts is enabled, the extmark clean and update not correct, if add the extmark sync there has lots of duplicate codes like nvim_buf_set_lines. Solution: use nvim_buf_set_lines api internally to set info to popup preview buffer.
* vim-patch:9.1.0956: completion may crash, completion highlight wrong with ↵glepnir2024-12-24
| | | | | | | | | | | | | | | | | | | | preview window Problem: completion may crash, completion highlight wrong with preview window (after v9.1.0954) Solution: correctly calculate scroll offset, check for preview window when adding extra highlighting (glepnir) when there have a preview window prepare_tagpreview will change curwin to preview window and this may cause ComplMatchIns check condition not correct. check wp is curwin and also the type of wp is not a preview or poup info fixes: https://github.com/vim/vim/issues/16284 closes: https://github.com/vim/vim/pull/16283 https://github.com/vim/vim/commit/8d0bb6dc9f2e5d94ebb59671d592c1b7fa325ca6
* vim-patch:9.1.0954: popupmenu.c can be improvedglepnir2024-12-24
| | | | | | | | | | | | | | | Problem: popupmenu.c can be improved Solution: slightly refactor the logic (glepnir) closes: vim/vim#16271 Replace some if blocks and combine user attr abstract to an inline function. https://github.com/vim/vim/commit/89a107efd141d5a1fed850af80a74900077666cf Co-authored-by: glepnir <glephunter@gmail.com>
* refactor: iwyu #31637Justin M. Keyes2024-12-23
| | | Result of `make iwyu` (after some "fixups").
* vim-patch:9.1.092: vim-patch:9.1.0923: wrong MIN macro in popupmenu.czeertzjq2024-12-13
| | | | | | | | | | | Problem: wrong MIN macro in popupmenu.c (after v9.1.0921) (zeertzjq) Solution: change it to MAX() https://github.com/vim/vim/commit/618c4d36ca92a62212a37e787c202229ceff8537 Co-authored-by: Christian Brabandt <cb@256bit.org> Co-authored-by: glepnir <glephunter@gmail.com>
* vim-patch:9.1.0921: popupmenu logic is a bit convolutedzeertzjq2024-12-13
| | | | | | | | | | | | | | | | | | Problem: popupmenu logic is a bit convoluted Solution: slightly refactor logic and use MIN/MAX() macros to simplify (glepnir) Define the MAX/MIN macros. Since we support some older platforms, C compilers may not be as smart. This helps reduce unnecessary if statements and redundant ternary expressions. Pre-calculate some expressions by defining variables. Remove unnecessary parentheses. Adjust certain lines to avoid exceeding 80 columns. closes: vim/vim#16205 https://github.com/vim/vim/commit/c942f84aadffd0c8969ecf81e3e9103722b2714f Co-authored-by: glepnir <glephunter@gmail.com>
* fix(float): close preview float window when no selected #29745glepnir2024-12-11
| | | | | | | Problem: Float preview window still exist when back at original. Or no info item is selected. Solution: if selected is -1 or no info is selected, if float preview window exist close it first.
* refactor(options): autogenerate valid values and flag enums for options (#31089)Famiu Haque2024-11-23
| | | | | | | | | | | | | | Problem: Option metadata like list of valid values for an option and option flags are not listed in the `options.lua` file and are instead manually defined in C, which means option metadata is split between several places. Solution: Put metadata such as list of valid values for an option and option flags in `options.lua`, and autogenerate the corresponding C variables and enums. Supersedes #28659 Co-authored-by: glepnir <glephunter@gmail.com>
* docs: misc (#31138)dundargoc2024-11-21
| | | Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* vim-patch:9.1.0830: using wrong highlight group for spaces for popupmenu ↵zeertzjq2024-11-03
| | | | | | | | | | | | | (#31054) Problem: using wrong highlight group for spaces for popupmenu Solution: use original attribute instead of combined attributed (glepnir) closes: vim/vim#15978 https://github.com/vim/vim/commit/bc10be7a4060748ed1876ab91cf53a2a8701ac13 Co-authored-by: glepnir <glephunter@gmail.com>
* fix(pum): don't select item when clicking to the left/right (#30967)zeertzjq2024-10-28
| | | | | | | Problem: Selecting an item in the right-click menu when clicking to the left/right of it is confusing, especially in a UI that doesn't support 'mousemoveevent'. Solution: Don't select an item when clicking to the left/right of the right-click menu.
* feat(ui): cascading style inheritance for Pmenu* highlights #29980Riley Bruins2024-10-10
| | | | - `PmenuSel` and `PmenuMatch` inherit from `Pmenu` - `PmenuMatchSel` inherits from both `PmenuSel` and `PmenuMatch`
* vim-patch:9.1.0772: some missing changes from v9.1.0771zeertzjq2024-10-10
| | | | | | | | | | | | Problem: some missing changes from v9.1.0771 Solution: use correct highlighting attribute and adjust comments (glepnir) closes: vim/vim#15836 https://github.com/vim/vim/commit/7baa014d0f73c3b2c6831471d047220633651238 Co-authored-by: glepnir <glephunter@gmail.com>
* vim-patch:9.1.0771: completion attribute hl_group is confusingzeertzjq2024-10-10
| | | | | | | | | | | | | Problem: Currently completion attribute hl_group is combined with all items, which is redundant and confusing with kind_hlgroup Solution: Renamed to abbr_hlgroup and combine it only with the abbr item (glepnir). closes: vim/vim#15818 https://github.com/vim/vim/commit/0fe17f8ffbd2588ecd2bf42dced556897bc64f89 Co-authored-by: glepnir <glephunter@gmail.com>
* vim-patch:9.1.0756: missing change from patch v9.1.0754 (#30636)glepnir2024-10-03
| | | | | | | | | Problem: missing change from patch v9.1.0754 Solution: use correct width for the actual item in pum_redraw() (glepnir) closes: vim/vim#15786 https://github.com/vim/vim/commit/a6d9e3c4e07f73f6523699961d8b7b54bdb80cf6
* vim-patch:9.1.0754: fixed order of items in insert-mode completion menu (#30619)glepnir2024-10-03
| | | | | | | | | | | | | Problem: fixed order of items in insert-mode completion menu Solution: Introduce the 'completeitemalign' option with default value "abbr,kind,menu" (glepnir). Adding an new option `completeitemalign` abbr is `cia` to custom the complete-item order in popupmenu. closes: vim/vim#14006 closes: vim/vim#15760 https://github.com/vim/vim/commit/6a89c94a9eeee53481ced1a1260a177bffde4c0f
* vim-patch:9.1.0690: cannot set special highlight kind in popupmenu (#30128)zeertzjq2024-08-24
| | | | | | | | | | | Problem: cannot set special highlight kind in popupmenu Solution: add kind_hlgroup item to complete function (glepnir) closes: vim/vim#15561 https://github.com/vim/vim/commit/38f99a1f0d61e9bde3f4a3d0cbe2d06185c4a57f Co-authored-by: glepnir <glephunter@gmail.com>
* vim-patch:9.1.0629: Rename of pum hl_group is incompletezeertzjq2024-07-27
| | | | | | | | | | | Problem: Rename of pum hl_group is incomplete in source. Solution: Also rename the test function. Rename to user_hlattr in code to avoid confusion with pum_extra. Add test with matched text highlighting (zeertzjq). closes: vim/vim#15348 https://github.com/vim/vim/commit/4100852e099133a0c9603e1087e5dc6d82001ce7
* vim-patch:9.1.0619: tests: test_popup failsglepnir2024-07-27
| | | | | | | | | | | | | Problem: tests: test_popup fails (after v9.1.0618) Solution: Correct test, move combining extra attributes to pum_compute_text_attrs() (glepnir) closes: vim/vim#15353 https://github.com/vim/vim/commit/8754efe437fcb17ad2c64192f8722e08d68e032e Co-authored-by: glepnir <glephunter@gmail.com>
* vim-patch:9.1.0618: cannot mark deprecated attributes in completion menuglepnir2024-07-27
| | | | | | | | | | | | Problem: cannot mark deprecated attributes in completion menu Solution: add hl_group to the Dictionary of supported completion fields (glepnir) closes: vim/vim#15314 https://github.com/vim/vim/commit/508e7856ec4afc9d6038b14bb6893668268dccab Co-authored-by: glepnir <glephunter@gmail.com>
* vim-patch:9.1.0525: Right release selects immediately when pum is truncated. ↵zeertzjq2024-07-05
| | | | | | | | | | | | | (#29568) Problem: Right release selects immediately when pum is truncated. Solution: Use pum_height instead of pum_size when checking click row. Don't place it above mouse row when there is more space below. (zeertzjq) fixes: vim/vim#15101 closes: vim/vim#15102 https://github.com/vim/vim/commit/761a420c66402545acd8ee3ffa17c3a1fc3110e4
* vim-patch:9.1.0496: matched text is highlighted case-sensitivelyzeertzjq2024-06-18
| | | | | | | | | | | | | Problem: matched text is highlighted case-sensitively Solution: use MB_STRNICMP, update highlighting when the base changes (glepnir) fixes: vim/vim#15021 closes: vim/vim#15023 https://github.com/vim/vim/commit/f189138b39a11ed5cf3adea6610469b478841aba Co-authored-by: glepnir <glephunter@gmail.com>
* vim-patch:9.1.0495: Matched text isn't highlighted in cmdline pumzeertzjq2024-06-18
| | | | | | | | | | | | Problem: Matched text isn't highlighted in cmdline pum. Solution: Use cmdline completion pattern in cmdline mode. (zeertzjq) closes: vim/vim#15029 https://github.com/vim/vim/commit/d8c9340fc67ca19f82ec3e77ec38296424e758cf Cherry-pick syntax.txt change from runtime update.
* vim-patch:9.1.0494: Wrong matched text highlighted in pum with 'rightleft' ↵zeertzjq2024-06-17
| | | | | | | | | | | (#29371) Problem: Wrong matched text highlighted in pum with 'rightleft'. Solution: Match using the original text instead of the reversed text. (zeertzjq) closes: vim/vim#15020 https://github.com/vim/vim/commit/63901e89638d683ecbc8e3323170dd485657fd1d
* vim-patch:9.1.0491: Cmdline pum doesn't work properly with 'rightleft' (#29355)zeertzjq2024-06-15
| | | | | | | | | | | Problem: Cmdline pum doesn't work properly with 'rightleft'. Solution: Don't use curwin->w_p_rl in cmdline mode in pum_redraw(). Use a static variable since pum_may_redraw() may be called in any mode. Also correct position of other popups with 'rightleft'. (zeertzjq) closes: vim/vim#15005 https://github.com/vim/vim/commit/883018feff43413813770dd1e13d4f950aa38524
* vim-patch:9.1.0488: Wrong padding for pum "kind" with 'rightleft' (#29352)zeertzjq2024-06-15
| | | | | | | | | | | | | | Problem: Wrong padding for pum "kind" with 'rightleft'. Solution: Fix off-by-one error (zeertzjq). The screen_fill() above is end-exclusive, and - With 'rightleft' it fills `pum_col - pum_base_width - n + 1` to `col`, so the next `col` should be `pum_col - pum_base_width - n`. - With 'norightleft' it fills `col` to `pum_col - pum_base_width + n - 1`, so the next `col` should be `pum_col - pum_base_width + n`. closes: vim/vim#15004 https://github.com/vim/vim/commit/a2324373eb1c3f1777bc40cb6dcd5e895a15fe10
* vim-patch:9.1.0485: Matched text shouldn't be highlighted in "kind" and "menu"zeertzjq2024-06-15
| | | | | | | | | | Problem: Matched text shouldn't be highlighted in "kind" and "menu". Solution: Pass hlf_T instead of the attribute. Fix indent. (zeertzjq) closes: vim/vim#14996 https://github.com/vim/vim/commit/afbe5359e981e5d19ad23c394aefe60395c3648e
* vim-patch:9.1.0480: fuzzy string matching executed when not neededzeertzjq2024-06-15
| | | | | | | | | | | | Problem: fuzzy string matching executed when not needed Solution: when no leader is available, can skip fuzzy logic, so return early (glepnir) closes: vim/vim#14986 https://github.com/vim/vim/commit/1c296026627d7ac8195e803b4c2393c21ae659b4 Co-authored-by: glepnir <glephunter@gmail.com>
* vim-patch:9.1.0479: fuzzy_match_str_with_pos() does unnecessary list operationszeertzjq2024-06-15
| | | | | | | | | | | | | Problem: fuzzy_match_str_with_pos() does unnecessary list operations. Solution: Use fuzzy_match() directly (zeertzjq). closes: vim/vim#14987 https://github.com/vim/vim/commit/2f95ca9fcef8495d60e298ac2cd6d702b90bfb18 N/A patch: vim-patch:9.1.0478: potential deref of NULL pointer in fuzzy_match_str_with_pos
* vim-patch:9.1.0476: Cannot see matched text in popup menuzeertzjq2024-06-15
| | | | | | | | | | | | Problem: Cannot see matched text in popup menu Solution: Introduce 2 new highlighting groups: PmenuMatch and PmenuMatchSel (glepnir) closes: vim/vim#14694 https://github.com/vim/vim/commit/40c1c3317d92f8c2adadf744fab72e4458e2a9fa Co-authored-by: glepnir <glephunter@gmail.com>
* vim-patch:9.1.0469: Cannot have buffer-local value for 'completeopt'zeertzjq2024-06-06
| | | | | | | | | | | | | | Problem: Cannot have buffer-local value for 'completeopt' (Nick Jensen). Solution: Make 'completeopt' global-local (zeertzjq). Also for some reason test Test_ColonEight_MultiByte seems to be failing sporadically now. Let's mark it as flaky. fixes: vim/vim#5487 closes: vim/vim#14922 https://github.com/vim/vim/commit/529b9ad62a0e843ee56ef609aef7e51b7dc8a4c8
* refactor: move shared messages to errors.h #26214Justin M. Keyes2024-06-01
|
* refactor: add win_T argument to setcursor_mayforce()Luuk van Baal2024-05-02
|
* fix(api): mark nvim__complete_set as experimental #28579Justin M. Keyes2024-04-30
| | | | | | | | Problem: nvim_complete_set was added in 5ed55ff14c8b7e346811cb6228bf63fb5106bae9 but needs more bake time. Solution: Rename it, mark it as experimental.
* fix(completion): improve popup window position (#26739)Raphael2024-04-25
|
* feat(api)!: nvim_open_win: noautocmd blocks all autocmds #28192Sean Dewar2024-04-14
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: noautocmd is confusing; despite its name, it doesn't block all autocommands (instead it blocks only those related to setting the buffer), and is commonly used by plugins to open windows while producing minimal side-effects. Solution: be consistent and block all autocommands when noautocmd is set. This includes WinNew (again), plus autocommands from entering the window (if enter is set) like WinEnter, WinLeave, TabEnter, .etc. See the discussion at https://github.com/neovim/neovim/pull/14659#issuecomment-2040029517 for more information. Remove win_set_buf's noautocmd argument, as it's no longer needed. NOTE: pum_create_float_preview sets noautocmd for win_set_buf, but all its callers already use block_autocmds. Despite that, pum_create_float_preview doesn't actually properly handle autocommands (it has no checks for whether those from win_enter or nvim_create_buf free the window). For now, ensure autocommands are blocked within it for correctness (in case it's ever called outside of a block_autocmds context; the function seems to have been refactored in #26739 anyway).
* refactor(options): remove `set_string_option_direct()`Famiu Haque2024-03-21
| | | | | | Problem: `set_string_option_direct()` contains a separate codepath specifically for setting string options. Not only is that unnecessary code duplication, but it's also limited to only string options. Solution: Replace `set_string_option_direct()` with `set_option_direct()` which calls `set_option()` under the hood. This reduces code duplication and allows directly setting an option of any type.
* fix(api/buffer): fix handling of viewport of non-current bufferbfredl2024-03-13
| | | | | | | | | | | A lot of functions in move.c only worked for curwin, alternatively took a `wp` arg but still only work if that happens to be curwin. Refactor those that are needed for update_topline(wp) to work for any window. fixes #27723 fixes #27720
* refactor: rename w_float_config to w_config #27419Will Hopkins2024-02-10
| | | Follows up on rename of `FloatConfig` to `WinConfig` in #27397.
* Merge pull request #27398 from bfredl/arena2bfredl2024-02-10
|\ | | | | refactor(api): use arena for more stuff
| * refactor(api): make cstr_as_string accept "const char*"bfredl2024-02-09
| | | | | | | | | | In the context a String inside an Object/Dictionary etc is consumed, it is considered to be read-only.
* | refactor: rename FloatConfig to WinConfig #27397Will Hopkins2024-02-09
|/ | | | | `FloatConfig` is no longer used only for floats, so the name is counterintuitive. Followup to #25550
* refactor(IWYU): fix headersdundargoc2024-01-11
| | | | | | Remove `export` pramgas from defs headers as it causes IWYU to believe that the definitions from the defs headers comes from main header, which is not what we really want.
* fix(pum): handle right-click menu repositioning with multigrid (#26975)zeertzjq2024-01-10
|
* refactor(options): remove `OPT_FREE` (#26963)Famiu Haque2024-01-10
| | | | | | Problem: `OPT_FREE` macro doesn't seem to do anything as `P_ALLOCED` already handles allocations. Solution: Remove `OPT_FREE`.
* refactor(options): use schar_T representation for fillchars and listcharsbfredl2024-01-08
| | | | | | | | | | | A bit big, but practically it was a lot simpler to change over all fillchars and all listchars at once, to not need to maintain two parallel implementations. This is mostly an internal refactor, but it also removes an arbitrary limitation: that 'fillchars' and 'listchars' values can only be single-codepoint characters. Now any character which fits into a single screen cell can be used.
* refactor: follow style guidedundargoc2023-12-30
|
* docs: small fixes (#26651)dundargoc2023-12-28
| | | | Co-authored-by: Gregory Anders <greg@gpanders.com> Co-authored-by: WillLillis <wlillis@umass.edu>
* refactor: run IWYU on entire repodundargoc2023-12-21
| | | | Reference: https://github.com/neovim/neovim/issues/6371.