To: vim_dev@googlegroups.com Subject: Patch 9.0.0544 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0544 Problem: Minor issues with setting a string option. Solution: Adjust the code, add a test. (closes #11192) Files: src/option.c, src/testdir/test_options.vim *** ../vim-9.0.0543/src/option.c 2022-09-22 12:48:47.614418502 +0100 --- src/option.c 2022-09-22 13:53:36.071281922 +0100 *************** *** 1323,1335 **** /* * Set 'keywordprg' to ":help" if an empty * value was passed to :set by the user. - * Misuse errbuf[] for the resulting string. */ if (varp == (char_u *)&p_kp && (*arg == NUL || *arg == ' ')) { - STRCPY(errbuf, ":help"); save_arg = arg; ! arg = (char_u *)errbuf; } /* * Convert 'backspace' number to string, for --- 1323,1333 ---- /* * Set 'keywordprg' to ":help" if an empty * value was passed to :set by the user. */ if (varp == (char_u *)&p_kp && (*arg == NUL || *arg == ' ')) { save_arg = arg; ! arg = (char_u *)":help"; } /* * Convert 'backspace' number to string, for *************** *** 1417,1423 **** * but do remove it for "\\\\machine\\path". * The reverse is found in ExpandOldSetting(). */ ! while (*arg && !VIM_ISWHITE(*arg)) { int i; --- 1415,1421 ---- * but do remove it for "\\\\machine\\path". * The reverse is found in ExpandOldSetting(). */ ! while (*arg != NUL && !VIM_ISWHITE(*arg)) { int i; *************** *** 1427,1433 **** && vim_isfilec(arg[1]) && !VIM_ISWHITE(arg[1]) && (arg[1] != '\\' ! || (s == newval && arg[2] != '\\'))) #endif ) ++arg; // remove backslash --- 1425,1431 ---- && vim_isfilec(arg[1]) && !VIM_ISWHITE(arg[1]) && (arg[1] != '\\' ! || (s == newval && arg[2] != '\\'))) #endif ) ++arg; // remove backslash *************** *** 1565,1572 **** } } ! if (save_arg != NULL) // number for 'whichwrap' ! arg = save_arg; } /* --- 1563,1570 ---- } } ! if (save_arg != NULL) ! arg = save_arg; // arg was temporarily changed, restore it } /* *** ../vim-9.0.0543/src/testdir/test_options.vim 2022-09-22 13:43:57.487406699 +0100 --- src/testdir/test_options.vim 2022-09-22 13:54:21.415266820 +0100 *************** *** 1343,1346 **** --- 1343,1360 ---- only! endfunc + " :set empty string for global 'keywordprg' falls back to ":help" + func Test_keywordprg_empty() + let k = &keywordprg + set keywordprg=man + call assert_equal('man', &keywordprg) + set keywordprg= + call assert_equal(':help', &keywordprg) + set keywordprg=man + call assert_equal('man', &keywordprg) + call assert_equal("\n keywordprg=:help", execute('set kp= kp?')) + let &keywordprg = k + endfunc + + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-9.0.0543/src/version.c 2022-09-22 13:43:57.491406698 +0100 --- src/version.c 2022-09-22 13:56:52.915213169 +0100 *************** *** 701,702 **** --- 701,704 ---- { /* Add new patch number below this line */ + /**/ + 544, /**/ -- Don't drink and drive. You might hit a bump and spill your beer. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///