Mercurial > vim
view runtime/syntax/plm.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 | 46763b01cd9a |
children |
line wrap: on
line source
" Vim syntax file " Language: PL/M " Maintainer: Philippe Coulonges <cphil@cphil.net> " Last change: 2003 May 11 " quit when a syntax file was already loaded if exists("b:current_syntax") finish endif " PL/M is a case insensitive language syn case ignore syn keyword plmTodo contained TODO FIXME XXX " String syn region plmString start=+'+ end=+'+ syn match plmOperator "[@=\+\-\*\/\<\>]" syn match plmIdentifier "\<[a-zA-Z_][a-zA-Z0-9_]*\>" syn match plmDelimiter "[();,]" syn region plmPreProc start="^\s*\$\s*" skip="\\$" end="$" " FIXME : No Number support for floats, as I'm working on an embedded " project that doesn't use any. syn match plmNumber "-\=\<\d\+\>" syn match plmNumber "\<[0-9a-fA-F]*[hH]*\>" " If you don't like tabs "syn match plmShowTab "\t" "syn match plmShowTabc "\t" "when wanted, highlight trailing white space if exists("c_space_errors") syn match plmSpaceError "\s*$" syn match plmSpaceError " \+\t"me=e-1 endif " " Use the same control variable as C language for I believe " users will want the same behavior if exists("c_comment_strings") " FIXME : don't work fine with c_comment_strings set, " which I don't care as I don't use " A comment can contain plmString, plmCharacter and plmNumber. " But a "*/" inside a plmString in a plmComment DOES end the comment! So we " need to use a special type of plmString: plmCommentString, which also ends on " "*/", and sees a "*" at the start of the line as comment again. syntax match plmCommentSkip contained "^\s*\*\($\|\s\+\)" syntax region plmCommentString contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=plmSpecial,plmCommentSkip syntax region plmComment2String contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=plmSpecial syntax region plmComment start="/\*" end="\*/" contains=plmTodo,plmCommentString,plmCharacter,plmNumber,plmFloat,plmSpaceError syntax match plmComment "//.*" contains=plmTodo,plmComment2String,plmCharacter,plmNumber,plmSpaceError else syn region plmComment start="/\*" end="\*/" contains=plmTodo,plmSpaceError syn match plmComment "//.*" contains=plmTodo,plmSpaceError endif syntax match plmCommentError "\*/" syn keyword plmReserved ADDRESS AND AT BASED BY BYTE CALL CASE syn keyword plmReserved DATA DECLARE DISABLE DO DWORD syn keyword plmReserved ELSE ENABLE END EOF EXTERNAL syn keyword plmReserved GO GOTO HALT IF INITIAL INTEGER INTERRUPT syn keyword plmReserved LABEL LITERALLY MINUS MOD NOT OR syn keyword plmReserved PLUS POINTER PROCEDURE PUBLIC syn keyword plmReserved REAL REENTRANT RETURN SELECTOR STRUCTURE syn keyword plmReserved THEN TO WHILE WORD XOR syn keyword plm386Reserved CHARINT HWORD LONGINT OFFSET QWORD SHORTINT syn keyword plmBuiltIn ABS ADJUSTRPL BLOCKINPUT BLOCKINWORD BLOCKOUTPUT syn keyword plmBuiltIn BLOCKOUTWORD BUILPTR CARRY CAUSEINTERRUPT CMPB syn keyword plmBuiltIn CMPW DEC DOUBLE FINDB FINDRB FINDRW FINDW FIX syn keyword plmBuiltIn FLAGS FLOAT GETREALERROR HIGH IABS INITREALMATHUNIT syn keyword plmBuiltIn INPUT INT INWORD LAST LOCKSET LENGTH LOW MOVB MOVE syn keyword plmBuiltIn MOVRB MOVRW MOVW NIL OUTPUT OUTWORD RESTOREREALSTATUS syn keyword plmBuiltIn ROL ROR SAL SAVEREALSTATUS SCL SCR SELECTOROF SETB syn keyword plmBuiltIn SETREALMODE SETW SHL SHR SIGN SIGNED SIZE SKIPB syn keyword plmBuiltIn SKIPRB SKIPRW SKIPW STACKBASE STACKPTR TIME SIZE syn keyword plmBuiltIn UNSIGN XLAT ZERO syn keyword plm386BuiltIn INTERRUPT SETINTERRUPT syn keyword plm286BuiltIn CLEARTASKSWITCHEDFLAG GETACCESSRIGHTS syn keyword plm286BuiltIn GETSEGMENTLIMIT LOCALTABLE MACHINESTATUS syn keyword plm286BuiltIn OFFSETOF PARITY RESTOREGLOBALTABLE syn keyword plm286BuiltIn RESTOREINTERRUPTTABLE SAVEGLOBALTABLE syn keyword plm286BuiltIn SAVEINTERRUPTTABLE SEGMENTREADABLE syn keyword plm286BuiltIn SEGMENTWRITABLE TASKREGISTER WAITFORINTERRUPT syn keyword plm386BuiltIn CONTROLREGISTER DEBUGREGISTER FINDHW syn keyword plm386BuiltIn FINDRHW INHWORD MOVBIT MOVRBIT MOVHW MOVRHW syn keyword plm386BuiltIn OUTHWORD SCANBIT SCANRBIT SETHW SHLD SHRD syn keyword plm386BuiltIn SKIPHW SKIPRHW TESTREGISTER syn keyword plm386w16BuiltIn BLOCKINDWORD BLOCKOUTDWORD CMPD FINDD syn keyword plm386w16BuiltIn FINDRD INDWORD MOVD MOVRD OUTDWORD syn keyword plm386w16BuiltIn SETD SKIPD SKIPRD syn sync lines=50 " Define the default highlighting. " Only when an item doesn't have highlighting yet " The default methods for highlighting. Can be overridden later " hi def link plmLabel Label " hi def link plmConditional Conditional " hi def link plmRepeat Repeat hi def link plmTodo Todo hi def link plmNumber Number hi def link plmOperator Operator hi def link plmDelimiter Operator "hi def link plmShowTab Error "hi def link plmShowTabc Error hi def link plmIdentifier Identifier hi def link plmBuiltIn Statement hi def link plm286BuiltIn Statement hi def link plm386BuiltIn Statement hi def link plm386w16BuiltIn Statement hi def link plmReserved Statement hi def link plm386Reserved Statement hi def link plmPreProc PreProc hi def link plmCommentError plmError hi def link plmCommentString plmString hi def link plmComment2String plmString hi def link plmCommentSkip plmComment hi def link plmString String hi def link plmComment Comment let b:current_syntax = "plm" " vim: ts=8 sw=2