To: vim_dev@googlegroups.com Subject: Patch 8.0.1734 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1734 Problem: Package directory not added to 'rtp' if prefix matches. Solution: Check the match is a full match. (Ozaki Kiichi, closes #2817) Also handle different ways of spelling a path. Files: src/testdir/test_packadd.vim, src/ex_cmds2.c *** ../vim-8.0.1733/src/testdir/test_packadd.vim 2018-02-04 17:47:37.929909714 +0100 --- src/testdir/test_packadd.vim 2018-04-18 21:56:13.268465733 +0200 *************** *** 40,45 **** --- 40,54 ---- call assert_match('/testdir/Xdir/pack/mine/opt/mytest\($\|,\)', &rtp) call assert_match('/testdir/Xdir/pack/mine/opt/mytest/after$', &rtp) + " NOTE: '/.../opt/myte' forwardly matches with '/.../opt/mytest' + call mkdir(fnamemodify(s:plugdir, ':h') . '/myte', 'p') + let rtp = &rtp + packadd myte + + " Check the path of 'myte' is added + call assert_true(len(&rtp) > len(rtp)) + call assert_match('/testdir/Xdir/pack/mine/opt/myte\($\|,\)', &rtp) + " Check exception call assert_fails("packadd directorynotfound", 'E919:') call assert_fails("packadd", 'E471:') *** ../vim-8.0.1733/src/ex_cmds2.c 2018-03-29 16:03:46.620035905 +0200 --- src/ex_cmds2.c 2018-04-18 22:06:03.856386433 +0200 *************** *** 3821,3830 **** static void add_pack_plugin(char_u *fname, void *cookie) { ! if (cookie != &APP_LOAD && strstr((char *)p_rtp, (char *)fname) == NULL) ! /* directory is not yet in 'runtimepath', add it */ ! if (add_pack_dir_to_rtp(fname) == FAIL) return; if (cookie != &APP_ADD_DIR) load_pack_plugin(fname); --- 3821,3850 ---- static void add_pack_plugin(char_u *fname, void *cookie) { ! if (cookie != &APP_LOAD) ! { ! char_u *buf = alloc(MAXPATHL); ! char_u *p; ! int found = FALSE; ! ! if (buf == NULL) return; + p = p_rtp; + while (*p != NUL) + { + copy_option_part(&p, buf, MAXPATHL, ","); + if (pathcmp((char *)buf, (char *)fname, -1) == 0) + { + found = TRUE; + break; + } + } + vim_free(buf); + if (!found) + /* directory is not yet in 'runtimepath', add it */ + if (add_pack_dir_to_rtp(fname) == FAIL) + return; + } if (cookie != &APP_ADD_DIR) load_pack_plugin(fname); *** ../vim-8.0.1733/src/version.c 2018-04-17 23:31:01.324223432 +0200 --- src/version.c 2018-04-18 22:16:18.300024019 +0200 *************** *** 764,765 **** --- 764,767 ---- { /* Add new patch number below this line */ + /**/ + 1734, /**/ -- hundred-and-one symptoms of being an internet addict: 218. Your spouse hands you a gift wrapped magnet with your PC's name on it and you accuse him or her of genocide. /// 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 ///