To: vim_dev@googlegroups.com Subject: Patch 8.2.2452 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2452 Problem: No completion for the 'filetype' option. Solution: Add filetype completion. (Martin Tournoij, closes #7747) Files: src/option.c, src/optiondefs.h, src/testdir/test_options.vim *** ../vim-8.2.2451/src/option.c 2021-01-04 12:41:49.507891351 +0100 --- src/option.c 2021-02-02 20:55:27.373613749 +0100 *************** *** 2419,2424 **** --- 2419,2426 ---- /* * Get a pointer to the flags used for the P_INSECURE flag of option * "opt_idx". For some local options a local flags field is used. + * NOTE: Caller must make sure that "curwin" is set to the window from which + * the option is used. */ static long_u * insecure_flag(int opt_idx, int opt_flags) *************** *** 6209,6214 **** --- 6211,6220 ---- else xp->xp_backslash = XP_BS_ONE; } + else if (p == (char_u *)&p_ft) + { + xp->xp_context = EXPAND_FILETYPE; + } else { xp->xp_context = EXPAND_FILES; *** ../vim-8.2.2451/src/optiondefs.h 2021-01-14 17:35:17.283416578 +0100 --- src/optiondefs.h 2021-02-02 20:53:56.457876465 +0100 *************** *** 946,952 **** (char_u *)FALSE, #endif (char_u *)0L} SCTX_INIT}, ! {"filetype", "ft", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB|P_NFNAME, (char_u *)&p_ft, PV_FT, {(char_u *)"", (char_u *)0L} SCTX_INIT}, --- 946,952 ---- (char_u *)FALSE, #endif (char_u *)0L} SCTX_INIT}, ! {"filetype", "ft", P_STRING|P_EXPAND|P_ALLOCED|P_VI_DEF|P_NOGLOB|P_NFNAME, (char_u *)&p_ft, PV_FT, {(char_u *)"", (char_u *)0L} SCTX_INIT}, *** ../vim-8.2.2451/src/testdir/test_options.vim 2021-02-01 18:39:43.327401074 +0100 --- src/testdir/test_options.vim 2021-02-02 20:53:56.457876465 +0100 *************** *** 332,337 **** --- 332,343 ---- call feedkeys(":set key=\\\"\", 'xt') call assert_equal('"set key=*****', @:) set key= + + " Expand values for 'filetype' + call feedkeys(":set filetype=sshdconfi\\\"\", 'xt') + call assert_equal('"set filetype=sshdconfig', @:) + call feedkeys(":set filetype=a\\\"\", 'xt') + call assert_equal('"set filetype=' .. getcompletion('a*', 'filetype')->join(), @:) endfunc func Test_set_errors() *** ../vim-8.2.2451/src/version.c 2021-02-01 20:50:33.810374133 +0100 --- src/version.c 2021-02-02 20:55:07.761670750 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2452, /**/ -- GALAHAD hurries to the door and pushes through it. As he leaves the room we CUT TO the reverse to show that he is now in a room full of bathing and romping GIRLIES, all innocent, wide-eyed and beautiful. They smile enchantingly at him as he tries to keep walking without being diverted by the lovely sights assaulting his eyeballs. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///