annotate runtime/compiler/icon.vim @ 34416:0a458b49e1e6 v9.1.0131

patch 9.1.0131: buffer-completion may not always find all matches Commit: https://github.com/vim/vim/commit/0dc0bff000fd804c6b0778ccc4554a4e4c82c8c9 Author: Christian Brabandt <cb@256bit.org> Date: Sat Feb 24 14:12:13 2024 +0100 patch 9.1.0131: buffer-completion may not always find all matches Problem: buffer-completion code too complicated and does not always find all matches (irisjae) Solution: do not try to anchor pattern to beginning of line or directory-separator, always return all matches Note: we are considering the non-fuzzy buffer-matching here. Currently, the buffer-completion code makes 2 attempts to match a pattern against the list of available patterns. First try is to match the pattern and anchor it to either the beginning of the file name or at a directory-separator (// or \\). When a match is found, Vim returns the matching buffers and does not try to find a match anywhere within a buffer name. So if you have opened two buffers like /tmp/Foobar.c and /tmp/MyFoobar.c using `:b Foo` will only complete to the first filename, but not the second (the same happens with `getcompletion('Foo', 'buffer')`). It may make sense, that completion priorities buffer names at directory boundaries, but it inconsistent, may cause confusion why a certain buffer name is not completed when typing `:b Foo<C-D>` which returns only a single file name and then pressing Enter (to switch to that buffer), Vim will error with 'E93: More than one match for Foo'). Similar things may happen when wiping the /tmp/Foobar.c pattern and afterwards the completion starts completing other buffers. So let's simplify the code and always match the pattern anywhere in the buffer name, do not try to favor matches at directory boundaries. This is also simplifies the code a bit, we do not need to run over the list of buffers several times, but only twice. fixes #13894 closes: #14082 Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Sat, 24 Feb 2024 14:30:03 +0100
parents 1e9e9d89f0ee
children e1df51f68736
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
29193
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Vim compiler file
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 " Compiler: Icon Compiler
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 " Maintainer: Doug Kearns <dougkearns@gmail.com>
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 " Last Change: 2022 Jun 16
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 if exists("current_compiler")
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 finish
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 endif
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 let current_compiler = "icont"
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 if exists(":CompilerSet") != 2 " older Vim always used :setlocal
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 command -nargs=* CompilerSet setlocal <args>
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 endif
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 let s:cpo_save = &cpo
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 set cpo&vim
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 CompilerSet makeprg=icont\ -s
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 CompilerSet errorformat=%-G%\\d%\\+\ errors%\\=,
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 \%ERun-time\ error\ %n,
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 \%ERun-time\ error\ %n\ in\ %m,
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 \%ZTraceback:,
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 \%+Coffending\ value:\ %.%#,
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 \%CFile\ %f;\ Line\ %l,
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 \%EFile\ %f;\ Line\ %l\ #\ %m,
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 \%EFile\ %f;\ %m,
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 \%E%f:%l:\ #\ %m,
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 \%E%f:\ %m,
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 \%+C%.%#,
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 \%-G%.%#
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 let &cpo = s:cpo_save
1e9e9d89f0ee Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 unlet s:cpo_save