patch 9.1.1428: completion: register completion needs cleanup Commit: https://github.com/vim/vim/commit/86d46a7018bb648fb27372329e6ddc274051067c Author: glepnir <glephun...@gmail.com> Date: Tue Jun 3 21:04:44 2025 +0200
patch 9.1.1428: completion: register completion needs cleanup Problem: completion: register completion needs cleanup Solution: slightly refactor get_register_completion() (glepnir) closes: #17432 Signed-off-by: glepnir <glephun...@gmail.com> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/src/insexpand.c b/src/insexpand.c index 9b5eec500..7ecac6e85 100644 --- a/src/insexpand.c +++ b/src/insexpand.c @@ -4905,11 +4905,11 @@ get_register_completion(void) int dir = compl_direction; yankreg_T *reg = NULL; void *reg_ptr = NULL; + int adding_mode = compl_status_adding(); for (int i = 0; i < NUM_REGISTERS; i++) { int regname = 0; - if (i == 0) regname = '"'; // unnamed register else if (i < 10) @@ -4935,14 +4935,14 @@ get_register_completion(void) reg = (yankreg_T *)reg_ptr; - if (compl_status_adding()) + for (int j = 0; j < reg->y_size; j++) { - for (int j = 0; j < reg->y_size; j++) - { - char_u *str = reg->y_array[j].string; - if (str == NULL) - continue; + char_u *str = reg->y_array[j].string; + if (str == NULL) + continue; + if (adding_mode) + { int str_len = (int)STRLEN(str); if (str_len == 0) continue; @@ -4953,19 +4953,13 @@ get_register_completion(void) : STRNCMP(str, compl_orig_text.string, compl_orig_text.length) == 0)) { - if (ins_compl_add_infercase(str, str_len, p_ic, NULL, dir, FALSE, 0) == OK) + if (ins_compl_add_infercase(str, str_len, p_ic, NULL, + dir, FALSE, 0) == OK) dir = FORWARD; } } - } - else - { - for (int j = 0; j < reg->y_size; j++) + else { - char_u *str = reg->y_array[j].string; - if (str == NULL) - continue; - // Calculate the safe end of string to avoid null byte issues char_u *str_end = str + STRLEN(str); char_u *p = str; diff --git a/src/version.c b/src/version.c index c9a1c16f7..7c3c4f12e 100644 --- a/src/version.c +++ b/src/version.c @@ -709,6 +709,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1428, /**/ 1427, /**/ -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1uMX6H-00FdjZ-V0%40256bit.org.