Mercurial > vim
view runtime/syntax/clipper.vim @ 33674:021e5bb88513 v9.0.2074
patch 9.0.2074: Completion menu may be wrong
Commit: https://github.com/vim/vim/commit/daef8c74375141974d61b85199b383017644978c
Author: Christian Brabandt <cb@256bit.org>
Date: Fri Oct 27 19:16:26 2023 +0200
patch 9.0.2074: Completion menu may be wrong
Problem: Completion menu may be wrong
Solution: Check for the original direction of the completion menu,
add more tests, make it work with 'noselect'
completion: move in right direction when filling completion_info()
When moving through the insert completion menu and switching directions,
we need to make sure we start at the correct position in the list and
move correctly forward/backwards through it, so that we do not skip
entries and the selected item points to the correct entry in the list
of completion entries generated by the completion_info() function.
The general case is this:
1) CTRL-X CTRL-N, we will traverse the list starting from
compl_first_match and then go forwards (using the cp->next pointer)
through the list (skipping the very first entry, which has the
CP_ORIGINAL_TEXT flag set (since that is the empty/non-selected entry
2) CTRL-X CTRL-P, we will traverse the list starting from
compl_first_match (which now points to the last entry). The previous
entry will have the CP_ORIGINAL_TEXT flag set, so we need to start
traversing the list from the second prev pointer.
There are in fact 2 special cases after starting the completion menu
with CTRL-X:
3) CTRL-N and then going backwards by pressing CTRL-P again.
compl_first_match will point to the same entry as in step 1 above,
but since compl_dir_foward() has been switched by pressing CTRL-P
to backwards we need to pretend to be in still in case 1 and still
traverse the list in forward direction using the cp_next pointer
4) CTRL-P and then going forwards by pressing CTRL-N again.
compl_first_match will point to the same entry as in step 2 above,
but since compl_dir_foward() has been switched by pressing CTRL-N
to forwards we need to pretend to be in still in case 2 and still
traverse the list in backward direction using the cp_prev pointer
For the 'noselect' case however, this is slightly different again. When
going backwards, we only need to go one cp_prev pointer back. And
resting of the direction works again slightly different. So we need to
take the noselect option into account when deciding in which direction
to iterate through the list of matches.
related: #13402
related: #12971
closes: #13408
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 27 Oct 2023 19:30:05 +0200 |
parents | 46763b01cd9a |
children |
line wrap: on
line source
" Vim syntax file: " Language: Clipper 5.2 & FlagShip " Maintainer: C R Zamana <zamana@zip.net> " Some things based on c.vim by Bram Moolenaar and pascal.vim by Mario Eusebio " Last Change: 2011 Dec 29 by Thilo Six " quit when a syntax file was already loaded if exists("b:current_syntax") finish endif let s:cpo_save = &cpo set cpo&vim " Exceptions for my "Very Own" (TM) user variables naming style. " If you don't like this, comment it syn match clipperUserVariable "\<[a,b,c,d,l,n,o,u,x][A-Z][A-Za-z0-9_]*\>" syn match clipperUserVariable "\<[a-z]\>" " Clipper is case insensitive ( see "exception" above ) syn case ignore " Clipper keywords ( in no particular order ) syn keyword clipperStatement ACCEPT APPEND BLANK FROM AVERAGE CALL CANCEL syn keyword clipperStatement CLEAR ALL GETS MEMORY TYPEAHEAD CLOSE syn keyword clipperStatement COMMIT CONTINUE SHARED NEW PICT syn keyword clipperStatement COPY FILE STRUCTURE STRU EXTE TO COUNT syn keyword clipperStatement CREATE FROM NIL syn keyword clipperStatement DELETE FILE DIR DISPLAY EJECT ERASE FIND GO syn keyword clipperStatement INDEX INPUT VALID WHEN syn keyword clipperStatement JOIN KEYBOARD LABEL FORM LIST LOCATE MENU TO syn keyword clipperStatement NOTE PACK QUIT READ syn keyword clipperStatement RECALL REINDEX RELEASE RENAME REPLACE REPORT syn keyword clipperStatement RETURN FORM RESTORE syn keyword clipperStatement RUN SAVE SEEK SELECT syn keyword clipperStatement SKIP SORT STORE SUM TEXT TOTAL TYPE UNLOCK syn keyword clipperStatement UPDATE USE WAIT ZAP syn keyword clipperStatement BEGIN SEQUENCE syn keyword clipperStatement SET ALTERNATE BELL CENTURY COLOR CONFIRM CONSOLE syn keyword clipperStatement CURSOR DATE DECIMALS DEFAULT DELETED DELIMITERS syn keyword clipperStatement DEVICE EPOCH ESCAPE EXACT EXCLUSIVE FILTER FIXED syn keyword clipperStatement FORMAT FUNCTION INTENSITY KEY MARGIN MESSAGE syn keyword clipperStatement ORDER PATH PRINTER PROCEDURE RELATION SCOREBOARD syn keyword clipperStatement SOFTSEEK TYPEAHEAD UNIQUE WRAP syn keyword clipperStatement BOX CLEAR GET PROMPT SAY ? ?? syn keyword clipperStatement DELETE TAG GO RTLINKCMD TMP DBLOCKINFO syn keyword clipperStatement DBEVALINFO DBFIELDINFO DBFILTERINFO DBFUNCTABLE syn keyword clipperStatement DBOPENINFO DBORDERCONDINFO DBORDERCREATEINF syn keyword clipperStatement DBORDERINFO DBRELINFO DBSCOPEINFO DBSORTINFO syn keyword clipperStatement DBSORTITEM DBTRANSINFO DBTRANSITEM WORKAREA " Conditionals syn keyword clipperConditional CASE OTHERWISE ENDCASE syn keyword clipperConditional IF ELSE ENDIF IIF IFDEF IFNDEF " Loops syn keyword clipperRepeat DO WHILE ENDDO syn keyword clipperRepeat FOR TO NEXT STEP " Visibility syn keyword clipperStorageClass ANNOUNCE STATIC syn keyword clipperStorageClass DECLARE EXTERNAL LOCAL MEMVAR PARAMETERS syn keyword clipperStorageClass PRIVATE PROCEDURE PUBLIC REQUEST STATIC syn keyword clipperStorageClass FIELD FUNCTION syn keyword clipperStorageClass EXIT PROCEDURE INIT PROCEDURE " Operators syn match clipperOperator "$\|%\|&\|+\|-\|->\|!" syn match clipperOperator "\.AND\.\|\.NOT\.\|\.OR\." syn match clipperOperator ":=\|<\|<=\|<>\|!=\|#\|=\|==\|>\|>=\|@" syn match clipperOperator "*" " Numbers syn match clipperNumber "\<\d\+\(u\=l\=\|lu\|f\)\>" " Includes syn region clipperIncluded contained start=+"+ skip=+\\\\\|\\"+ end=+"+ syn match clipperIncluded contained "<[^>]*>" syn match clipperInclude "^\s*#\s*include\>\s*["<]" contains=clipperIncluded " String and Character constants syn region clipperString start=+"+ end=+"+ syn region clipperString start=+'+ end=+'+ " Delimiters syn match ClipperDelimiters "[()]\|[\[\]]\|[{}]\|[||]" " Special syn match clipperLineContinuation ";" " This is from Bram Moolenaar: if exists("c_comment_strings") " A comment can contain cString, cCharacter and cNumber. " But a "*/" inside a cString in a clipperComment DOES end the comment! " So we need to use a special type of cString: clipperCommentString, which " also ends on "*/", and sees a "*" at the start of the line as comment " again. Unfortunately this doesn't very well work for // type of comments :-( syntax match clipperCommentSkip contained "^\s*\*\($\|\s\+\)" syntax region clipperCommentString contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=clipperCommentSkip syntax region clipperComment2String contained start=+"+ skip=+\\\\\|\\"+ end=+"+ end="$" syntax region clipperComment start="/\*" end="\*/" contains=clipperCommentString,clipperCharacter,clipperNumber,clipperString syntax match clipperComment "//.*" contains=clipperComment2String,clipperCharacter,clipperNumber else syn region clipperComment start="/\*" end="\*/" syn match clipperComment "//.*" endif syntax match clipperCommentError "\*/" " Lines beggining with an "*" are comments too syntax match clipperComment "^\*.*" " Define the default highlighting. " Only when an item doesn't have highlighting yet hi def link clipperConditional Conditional hi def link clipperRepeat Repeat hi def link clipperNumber Number hi def link clipperInclude Include hi def link clipperComment Comment hi def link clipperOperator Operator hi def link clipperStorageClass StorageClass hi def link clipperStatement Statement hi def link clipperString String hi def link clipperFunction Function hi def link clipperLineContinuation Special hi def link clipperDelimiters Delimiter hi def link clipperUserVariable Identifier let b:current_syntax = "clipper" let &cpo = s:cpo_save unlet s:cpo_save " vim: ts=8