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

c3fbaa086e

Co-authored-by: glepnir <glephunter@gmail.com>
This commit is contained in:
zeertzjq
2025-05-09 06:29:04 +08:00
parent ab5c15610f
commit 6b955af875

View File

@ -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.