Mercurial > vim
annotate runtime/ftplugin/perl.vim @ 29357:f4ff490d51a7 v9.0.0021
patch 9.0.0021: invalid memory access when adding word to spell word list
Commit: https://github.com/vim/vim/commit/5e59ea54c0c37c2f84770f068d95280069828774
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jul 1 22:26:20 2022 +0100
patch 9.0.0021: invalid memory access when adding word to spell word list
Problem: Invalid memory access when adding word with a control character to
the internal spell word list.
Solution: Disallow adding a word with control characters or a trailing
slash.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 01 Jul 2022 23:30:02 +0200 |
parents | d1fe80fb35e6 |
children | 828bcb1a37e7 |
rev | line source |
---|---|
7 | 1 " Vim filetype plugin file |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
2 " Language: Perl |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
3 " Maintainer: vim-perl <vim-perl@googlegroups.com> |
20115 | 4 " Homepage: https://github.com/vim-perl/vim-perl |
5 " Bugs/requests: https://github.com/vim-perl/vim-perl/issues | |
29150 | 6 " License: Vim License (see :help license) |
7 " Last Change: 2021 Nov 10 | |
7 | 8 |
9 if exists("b:did_ftplugin") | finish | endif | |
10 let b:did_ftplugin = 1 | |
11 | |
12 " Make sure the continuation lines below do not cause problems in | |
13 " compatibility mode. | |
14 let s:save_cpo = &cpo | |
15 set cpo-=C | |
16 | |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
17 setlocal formatoptions-=t |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
18 setlocal formatoptions+=crqol |
1698 | 19 setlocal keywordprg=perldoc\ -f |
7 | 20 |
21 setlocal comments=:# | |
22 setlocal commentstring=#%s | |
23 | |
24 " Provided by Ned Konz <ned at bike-nomad dot com> | |
25 "--------------------------------------------- | |
603 | 26 setlocal include=\\<\\(use\\\|require\\)\\> |
29150 | 27 " '+' is removed to support plugins in Catalyst or DBIx::Class |
28 " where the leading plus indicates a fully-qualified module name. | |
29 setlocal includeexpr=substitute(substitute(substitute(substitute(v:fname,'+','',''),'::','/','g'),'->\*','',''),'$','.pm','') | |
7 | 30 setlocal define=[^A-Za-z_] |
12499 | 31 setlocal iskeyword+=: |
7 | 32 |
33 " The following line changes a global variable but is necessary to make | |
12499 | 34 " gf and similar commands work. Thanks to Andrew Pimlott for pointing |
29150 | 35 " out the problem. |
36 let s:old_isfname = &isfname | |
7 | 37 set isfname+=: |
29150 | 38 let s:new_isfname = &isfname |
39 | |
40 augroup perl_global_options | |
41 au! | |
42 exe "au BufEnter * if &filetype == 'perl' | let &isfname = '" . s:new_isfname . "' | endif" | |
43 exe "au BufLeave * if &filetype == 'perl' | let &isfname = '" . s:old_isfname . "' | endif" | |
44 augroup END | |
45 | |
46 " Undo the stuff we changed. | |
47 let b:undo_ftplugin = "setlocal fo< kp< com< cms< inc< inex< def< isk<" . | |
48 \ " | let &isfname = '" . s:old_isfname . "'" | |
49 | |
50 if get(g:, 'perl_fold', 0) | |
51 setlocal foldmethod=syntax | |
52 let b:undo_ftplugin .= " | setlocal fdm<" | |
53 endif | |
7 | 54 |
55 " Set this once, globally. | |
56 if !exists("perlpath") | |
57 if executable("perl") | |
1621 | 58 try |
7 | 59 if &shellxquote != '"' |
60 let perlpath = system('perl -e "print join(q/,/,@INC)"') | |
61 else | |
62 let perlpath = system("perl -e 'print join(q/,/,@INC)'") | |
63 endif | |
64 let perlpath = substitute(perlpath,',.$',',,','') | |
1621 | 65 catch /E145:/ |
66 let perlpath = ".,," | |
67 endtry | |
7 | 68 else |
69 " If we can't call perl to get its path, just default to using the | |
70 " current directory and the directory of the current file. | |
71 let perlpath = ".,," | |
72 endif | |
73 endif | |
74 | |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
75 " Append perlpath to the existing path value, if it is set. Since we don't |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
76 " use += to do it because of the commas in perlpath, we have to handle the |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
77 " global / local settings, too. |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
78 if &l:path == "" |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
79 if &g:path == "" |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
80 let &l:path=perlpath |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
81 else |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
82 let &l:path=&g:path.",".perlpath |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
83 endif |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
84 else |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
85 let &l:path=&l:path.",".perlpath |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
86 endif |
29150 | 87 |
88 let b:undo_ftplugin .= " | setlocal pa<" | |
7 | 89 "--------------------------------------------- |
90 | |
29150 | 91 " Change the browse dialog to show mainly Perl-related files |
92 if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") | |
93 let b:browsefilter = "Perl Source Files (*.pl)\t*.pl\n" . | |
94 \ "Perl Modules (*.pm)\t*.pm\n" . | |
95 \ "Perl Documentation Files (*.pod)\t*.pod\n" . | |
96 \ "All Files (*.*)\t*.*\n" | |
97 let b:undo_ftplugin .= " | unlet! b:browsefilter" | |
98 endif | |
7 | 99 |
29150 | 100 " Proper matching for matchit plugin |
101 if exists("loaded_matchit") && !exists("b:match_words") | |
102 let b:match_skip = 's:comment\|string\|perlQQ\|perlShellCommand\|perlHereDoc\|perlSubstitution\|perlTranslation\|perlMatch\|perlFormatField' | |
103 let b:match_words = '\<if\>:\<elsif\>:\<else\>' | |
104 let b:undo_ftplugin .= " | unlet! b:match_words b:match_skip" | |
105 endif | |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
3410
diff
changeset
|
106 |
7 | 107 " Restore the saved compatibility options. |
108 let &cpo = s:save_cpo | |
29150 | 109 unlet s:save_cpo s:old_isfname s:new_isfname |