Mercurial > vim
annotate runtime/ftplugin/zig.vim @ 34596:5a8340e044f4 v9.1.0190
patch 9.1.0190: complete_info() returns wrong order of items
Commit: https://github.com/vim/vim/commit/8950bf7f8b85c1287d4e696965d88091fcc60594
Author: Girish Palya <girishji@gmail.com>
Date: Wed Mar 20 20:07:29 2024 +0100
patch 9.1.0190: complete_info() returns wrong order of items
Problem: complete_info() returns wrong order of items
(after v9.0.2018)
Solution: Revert Patch v9.0.2018
(Girish Palya)
bug fix: complete_info() gives wrong results
1) complete_info() reverses list of items during <c-p>
2) 'selected' item index is wrong during <c-p>
3) number of items returnd can be wrong
Solution:
- Decouple 'cp_number' from 'selected' index since they need not be
correlated
- Do not iterate the list backwards
- Add targeted tests
Regression introduced by https://github.com/vim/vim/commit/69fb5afb3bc9da24c2fb0eafb0027ba9c6502fc2
Following are unnecessary commits to patch problems from above:
https://github.com/vim/vim/commit/fef66301665027f1801a18d796f74584666f41ef
https://github.com/vim/vim/commit/daef8c74375141974d61b85199b383017644978c
All the tests from above commits are retained though.
fixes: #14204
closes: #14241
Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 20 Mar 2024 20:15:03 +0100 |
parents | bd3ee5abdd7a |
children | 3b6868b38118 |
rev | line source |
---|---|
31383 | 1 " Vim filetype plugin file |
2 " Language: Zig | |
3 " Upstream: https://github.com/ziglang/zig.vim | |
4 | |
5 " Only do this when not done yet for this buffer | |
6 if exists("b:did_ftplugin") | |
7 finish | |
8 endif | |
9 | |
10 let b:did_ftplugin = 1 | |
11 | |
12 let s:cpo_orig = &cpo | |
13 set cpo&vim | |
14 | |
15 compiler zig_build | |
16 | |
17 " Match Zig builtin fns | |
18 setlocal iskeyword+=@-@ | |
19 | |
32974
d46f974fd69e
runtime: Fix typos in various files
Christian Brabandt <cb@256bit.org>
parents:
31383
diff
changeset
|
20 " Recommended code style, no tabs and 4-space indentation |
31383 | 21 setlocal expandtab |
22 setlocal tabstop=8 | |
23 setlocal softtabstop=4 | |
24 setlocal shiftwidth=4 | |
25 | |
26 setlocal formatoptions-=t formatoptions+=croql | |
27 | |
28 setlocal suffixesadd=.zig,.zir | |
29 | |
30 if has('comments') | |
33617
f7351afc42cf
runtime(zig): Update Zig runtime files (#13388)
Christian Brabandt <cb@256bit.org>
parents:
33223
diff
changeset
|
31 setlocal comments=:///,://!,:// |
31383 | 32 setlocal commentstring=//\ %s |
33 endif | |
34 | |
35 if has('find_in_path') | |
36 let &l:includeexpr='substitute(v:fname, "^([^.])$", "\1.zig", "")' | |
37 let &l:include='\v(\@import>|\@cInclude>|^\s*\#\s*include)' | |
38 endif | |
39 | |
40 let &l:define='\v(<fn>|<const>|<var>|^\s*\#\s*define)' | |
41 | |
33223
def9fc5c92d1
patch 9.0.1886: Various Typos
Christian Brabandt <cb@256bit.org>
parents:
33203
diff
changeset
|
42 " Safety check: don't execute zig from current directory |
33096
828bcb1a37e7
patch 9.0.1833: [security] runtime file fixes
Christian Brabandt <cb@256bit.org>
parents:
32974
diff
changeset
|
43 if !exists('g:zig_std_dir') && exists('*json_decode') && |
33716
bd3ee5abdd7a
runtime(dist): centralize safe executable check and add vim library (#13413)
Christian Brabandt <cb@256bit.org>
parents:
33617
diff
changeset
|
44 \ executable('zig') && dist#vim#IsSafeExecutable('zig', 'zig') |
31383 | 45 silent let s:env = system('zig env') |
46 if v:shell_error == 0 | |
47 let g:zig_std_dir = json_decode(s:env)['std_dir'] | |
48 endif | |
49 unlet! s:env | |
50 endif | |
51 | |
52 if exists('g:zig_std_dir') | |
33617
f7351afc42cf
runtime(zig): Update Zig runtime files (#13388)
Christian Brabandt <cb@256bit.org>
parents:
33223
diff
changeset
|
53 let &l:path = g:zig_std_dir . ',' . &l:path |
31383 | 54 endif |
55 | |
56 let b:undo_ftplugin = | |
57 \ 'setl isk< et< ts< sts< sw< fo< sua< mp< com< cms< inex< inc< pa<' | |
58 | |
59 augroup vim-zig | |
60 autocmd! * <buffer> | |
61 autocmd BufWritePre <buffer> if get(g:, 'zig_fmt_autosave', 1) | call zig#fmt#Format() | endif | |
62 augroup END | |
63 | |
64 let b:undo_ftplugin .= '|au! vim-zig * <buffer>' | |
65 | |
66 let &cpo = s:cpo_orig | |
67 unlet s:cpo_orig | |
68 " vim: tabstop=8 shiftwidth=4 softtabstop=4 expandtab |