From 6b955af8755b416067733d862d1d341ef6bb9cb4 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 9 May 2025 06:29:04 +0800 Subject: [PATCH] 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 --- src/nvim/insexpand.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c index 6c7bda843c..5f1b7f16e4 100644 --- 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.