neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 6b955af8755b416067733d862d1d341ef6bb9cb4
parent ab5c15610f501a1d8b842fc3e75b053491eb45d7
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Fri,  9 May 2025 06:29:04 +0800

vim-patch:9.1.1373: 'completeopt' checking logic can be simplified

Problem:  Flag checking logic uses a temporary variable and multiple
          bitwise operations in insexpand.c
Solution: Consolidate into a single equality check using bitwise OR and
          comparison (glepnir)

closes: vim/vim#17276

https://github.com/vim/vim/commit/c3fbaa086e338486673d4cffbcbd18466ad2ac09

Co-authored-by: glepnir <glephunter@gmail.com>

Diffstat:
Msrc/nvim/insexpand.c | 3+--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c @@ -820,8 +820,7 @@ static inline void free_cptext(char *const *const cptext) /// Returns true if matches should be sorted based on proximity to the cursor. static bool is_nearest_active(void) { - unsigned flags = get_cot_flags(); - return (flags & kOptCotFlagNearest) && !(flags & kOptCotFlagFuzzy); + return (get_cot_flags() & (kOptCotFlagNearest|kOptCotFlagFuzzy)) == kOptCotFlagNearest; } /// Repositions a match in the completion list based on its proximity score.