diff options
author | Bram Moolenaar <Bram@vim.org> | 2005-10-03 22:02:18 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2005-10-03 22:02:18 +0000 |
commit | 1c7715dfe4f29be631b78699cbca786d30852886 (patch) | |
tree | dbfa5f54e9411291baef314b67e5f8f5cec595cc | |
parent | bb15b658647d8eca01e67df871f7cb5ed95e2534 (diff) | |
download | vim-git-1c7715dfe4f29be631b78699cbca786d30852886.tar.gz |
updated for version 7.0153
-rw-r--r-- | runtime/doc/eval.txt | 10 | ||||
-rw-r--r-- | runtime/doc/insert.txt | 23 | ||||
-rw-r--r-- | runtime/doc/options.txt | 22 | ||||
-rw-r--r-- | runtime/doc/starting.txt | 7 | ||||
-rw-r--r-- | runtime/doc/syntax.txt | 10 | ||||
-rw-r--r-- | runtime/doc/tags | 16 | ||||
-rw-r--r-- | runtime/menu.vim | 4 | ||||
-rw-r--r-- | src/Make_bc3.mak | 1 | ||||
-rw-r--r-- | src/Make_cyg.mak | 3 | ||||
-rw-r--r-- | src/Make_dice.mak | 4 | ||||
-rw-r--r-- | src/Make_manx.mak | 6 | ||||
-rw-r--r-- | src/Make_ming.mak | 1 | ||||
-rw-r--r-- | src/Make_mpw.mak | 135 | ||||
-rw-r--r-- | src/Make_os2.mak | 2 | ||||
-rw-r--r-- | src/Make_ro.mak | 5 | ||||
-rw-r--r-- | src/Make_sas.mak | 5 | ||||
-rw-r--r-- | src/Make_w16.mak | 1 | ||||
-rw-r--r-- | src/Makefile | 13 | ||||
-rw-r--r-- | src/edit.c | 243 | ||||
-rw-r--r-- | src/ex_getln.c | 6 | ||||
-rw-r--r-- | src/fileio.c | 2 | ||||
-rw-r--r-- | src/gui.c | 2 | ||||
-rw-r--r-- | src/option.c | 25 | ||||
-rw-r--r-- | src/option.h | 3 | ||||
-rw-r--r-- | src/screen.c | 11 | ||||
-rw-r--r-- | src/syntax.c | 6 | ||||
-rw-r--r-- | src/testdir/test32.in | 2 | ||||
-rw-r--r-- | src/version.h | 4 |
28 files changed, 528 insertions, 44 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index fa51c2a04..a06b6f65f 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.0aa. Last change: 2005 Sep 29 +*eval.txt* For Vim version 7.0aa. Last change: 2005 Oct 02 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1372,6 +1372,14 @@ v:progname Contains the name (with path removed) with which Vim was v:register The name of the register supplied to the last normal mode command. Empty if none were supplied. |getreg()| |setreg()| + *v:scrollstart* *scrollstart-variable* +v:scrollstart String describing the script or function that caused the + screen to scroll up. It's only set when it is empty, thus the + first reason is remembered. It is set to "Unknown" for a + typed command. + This can be used to find out why your script causes the + hit-enter prompt. + *v:servername* *servername-variable* v:servername The resulting registered |x11-clientserver| name if any. Read-only. diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index f668c0093..4b6d0eb6f 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -1,4 +1,4 @@ -*insert.txt* For Vim version 7.0aa. Last change: 2005 Sep 23 +*insert.txt* For Vim version 7.0aa. Last change: 2005 Oct 02 VIM REFERENCE MANUAL by Bram Moolenaar @@ -952,6 +952,27 @@ CTRL-P Find previous match for words that start with the other contexts unless a double CTRL-X is used. +INSERT COMPLETION POPUP MENU *ins-completion-menu* + +Vim can display the matches in a simplistic popup menu. + +The menu is used when: +- The 'completeopt' option contains "menu". +- The terminal supports at least 8 colors. +- There are at least two matches. + +While the menu is displayed these keys have a special meaning: +<CR> and <Enter>: Accept the currently selected match +<Up>: Select the previous match, as if CTRL-P was used +<Down>: Select the next match, as if CTRL-N was used + +The colors of the menu can be changed with these highlight groups: +Pmenu normal item |hl-Pmenu| +PmenuSel selected item |hl-PmenuSel| +PmenuSbar scrollbar |hl-PmenuSbar| +PmenuThumb thumb of the scrollbar |hl-PmenuThumb| + + Filetype-specific remarks for omni completion *compl-omni-filetypes* C *ft-c-omni* diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 34000948e..50bae207d 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 7.0aa. Last change: 2005 Sep 28 +*options.txt* For Vim version 7.0aa. Last change: 2005 Oct 02 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1683,6 +1683,18 @@ A jump table for the options with a short description can be found at |Q_op|. set completefunc=CompleteMonths < + *'completeopt'* *'cot'* +'completeopt' 'cot' string (default: "menu") + global + {not in Vi} + Options for Insert mode completion |ins-completion|. + Currently the only supported value is: + + menu Use a popup menu to show the possible completions. The + menu is only shown when there is more than one match and + sufficient colors are available. |ins-completion-menu| + + *'confirm'* *'cf'* *'noconfirm'* *'nocf'* 'confirm' 'cf' boolean (default off) global @@ -3382,7 +3394,9 @@ A jump table for the options with a short description can be found at |Q_op|. f:Folded,F:FoldColumn,A:DiffAdd, C:DiffChange,D:DiffDelete,T:DiffText, >:SignColumn,B:SpellBad,P:SpellCap, - R:SpellRare,L:SpellLocal") + R:SpellRare,L:SpellLocal, + +:Pmenu,=:PmenuSel, + x:PmenuSbar,X:PmenuThumb") global {not in Vi} This option can be used to set highlighting mode for various @@ -3423,6 +3437,10 @@ A jump table for the options with a short description can be found at |Q_op|. |hl-SpellCap| P word that should start with capital|spell| |hl-SpellRare| R rare word |spell| |hl-SpellLocal| L word from other region |spell| + |hl-Pmenu| + popup menu normal line + |hl-PmenuSel| = popup menu normal line + |hl-PmenuSbar| x popup menu scrollbar + |hl-PmenuThumb| X popup menu scrollbar thumb The display modes are: r reverse (termcap entry "mr" and "me") diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index 7335d30a0..dcd83b787 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -1,4 +1,4 @@ -*starting.txt* For Vim version 7.0aa. Last change: 2005 Jun 30 +*starting.txt* For Vim version 7.0aa. Last change: 2005 Oct 02 VIM REFERENCE MANUAL by Bram Moolenaar @@ -789,10 +789,11 @@ accordingly. Vim proceeds in this order: 4. Load the plugin scripts. *load-plugins* This does the same as the command: > - :runtime! plugin/*.vim + :runtime! plugin/**/*.vim < The result is that all directories in the 'runtimepath' option will be searched for the "plugin" sub-directory and all files ending in ".vim" - will be sourced (in alphabetical order per directory). + will be sourced (in alphabetical order per directory), also in + subdirectories. Loading plugins won't be done when: - The 'loadplugins' option was reset in a vimrc file. - The |--noplugin| command line argument is used. diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 021a158af..17bc63517 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 7.0aa. Last change: 2005 Sep 27 +*syntax.txt* For Vim version 7.0aa. Last change: 2005 Oct 02 VIM REFERENCE MANUAL by Bram Moolenaar @@ -3926,6 +3926,14 @@ NonText '~' and '@' at the end of the window, characters from doesn't fit at the end of the line). *hl-Normal* Normal normal text + *hl-Pmenu* +Pmenu Popup menu: normal item. + *hl-PmenuSel* +PmenuSel Popup menu: selected item. + *hl-PmenuSbar* +PmenuSbar Popup menu: scrollbar. + *hl-PmenuThumb* +PmenuThumb Popup menu: Thumb of the scrollbar. *hl-Question* Question |hit-enter| prompt and yes/no questions *hl-Search* diff --git a/runtime/doc/tags b/runtime/doc/tags index 44e189a3f..31c5f161d 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -120,10 +120,12 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'compatible' options.txt /*'compatible'* 'complete' options.txt /*'complete'* 'completefunc' options.txt /*'completefunc'* +'completeopt' options.txt /*'completeopt'* 'confirm' options.txt /*'confirm'* 'consk' options.txt /*'consk'* 'conskey' options.txt /*'conskey'* 'copyindent' options.txt /*'copyindent'* +'cot' options.txt /*'cot'* 'cp' options.txt /*'cp'* 'cpo' options.txt /*'cpo'* 'cpoptions' options.txt /*'cpoptions'* @@ -5353,6 +5355,10 @@ hl-ModeMsg syntax.txt /*hl-ModeMsg* hl-MoreMsg syntax.txt /*hl-MoreMsg* hl-NonText syntax.txt /*hl-NonText* hl-Normal syntax.txt /*hl-Normal* +hl-Pmenu syntax.txt /*hl-Pmenu* +hl-PmenuSbar syntax.txt /*hl-PmenuSbar* +hl-PmenuSel syntax.txt /*hl-PmenuSel* +hl-PmenuThumb syntax.txt /*hl-PmenuThumb* hl-Question syntax.txt /*hl-Question* hl-Scrollbar syntax.txt /*hl-Scrollbar* hl-Search syntax.txt /*hl-Search* @@ -5546,6 +5552,7 @@ inputrestore() eval.txt /*inputrestore()* inputsave() eval.txt /*inputsave()* inputsecret() eval.txt /*inputsecret()* ins-completion insert.txt /*ins-completion* +ins-completion-menu insert.txt /*ins-completion-menu* ins-expandtab insert.txt /*ins-expandtab* ins-reverse rileft.txt /*ins-reverse* ins-smarttab insert.txt /*ins-smarttab* @@ -6363,6 +6370,7 @@ scroll.txt scroll.txt /*scroll.txt* scrollbind-quickadj scroll.txt /*scrollbind-quickadj* scrollbind-relative scroll.txt /*scrollbind-relative* scrolling scroll.txt /*scrolling* +scrollstart-variable eval.txt /*scrollstart-variable* sdl.vim syntax.txt /*sdl.vim* search() eval.txt /*search()* search-commands pattern.txt /*search-commands* @@ -6948,6 +6956,7 @@ v:prevcount eval.txt /*v:prevcount* v:profiling eval.txt /*v:profiling* v:progname eval.txt /*v:progname* v:register eval.txt /*v:register* +v:scrollstart eval.txt /*v:scrollstart* v:servername eval.txt /*v:servername* v:shell_error eval.txt /*v:shell_error* v:statusmsg eval.txt /*v:statusmsg* @@ -7324,6 +7333,13 @@ zf fold.txt /*zf* zg spell.txt /*zg* zh scroll.txt /*zh* zi fold.txt /*zi* +zip zip.txt /*zip* +zip-contents zip.txt /*zip-contents* +zip-copyright zip.txt /*zip-copyright* +zip-history zip.txt /*zip-history* +zip-manual zip.txt /*zip-manual* +zip-usage zip.txt /*zip-usage* +zip.txt zip.txt /*zip.txt* zj fold.txt /*zj* zk fold.txt /*zk* zl scroll.txt /*zl* diff --git a/runtime/menu.vim b/runtime/menu.vim index f4ed1b528..1a221bff3 100644 --- a/runtime/menu.vim +++ b/runtime/menu.vim @@ -2,7 +2,7 @@ " You can also use this as a start for your own set of menus. " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2005 Aug 16 +" Last Change: 2005 Oct 01 " Note that ":an" (short for ":anoremenu") is often used to make a menu work " in all modes and avoid side effects from mappings defined by the user. @@ -902,7 +902,7 @@ if has("spell") endif let curcol = col('.') - let w = spellbadword() + let [w, a] = spellbadword() if col('.') > curcol " don't use word after the cursor let w = '' call cursor(0, curcol) " put the cursor back where it was diff --git a/src/Make_bc3.mak b/src/Make_bc3.mak index 207b861a8..20a9b1fee 100644 --- a/src/Make_bc3.mak +++ b/src/Make_bc3.mak @@ -80,6 +80,7 @@ EXE_dependencies = \ normal.obj \ ops.obj \ option.obj \ + popupmenu.obj \ quickfix.obj \ regexp.obj \ screen.obj \ diff --git a/src/Make_cyg.mak b/src/Make_cyg.mak index 880f29234..5879f1ddb 100644 --- a/src/Make_cyg.mak +++ b/src/Make_cyg.mak @@ -1,6 +1,6 @@ # # Makefile for VIM on Win32, using Cygnus gcc -# Last updated by Dan Sharp. Last Change: 2005 Jul 23 +# Last updated by Dan Sharp. Last Change: 2005 Oct 01 # # Also read INSTALLpc.txt! # @@ -421,6 +421,7 @@ OBJ = \ $(OUTDIR)/os_win32.o \ $(OUTDIR)/os_mswin.o \ $(OUTDIR)/pathdef.o \ + $(OUTDIR)/popupmenu.o \ $(OUTDIR)/quickfix.o \ $(OUTDIR)/regexp.o \ $(OUTDIR)/screen.o \ diff --git a/src/Make_dice.mak b/src/Make_dice.mak index fe74f520e..b4e1709ec 100644 --- a/src/Make_dice.mak +++ b/src/Make_dice.mak @@ -56,6 +56,7 @@ SRC = \ ops.c \ option.c \ os_amiga.c \ + popupmenu.c \ quickfix.c \ regexp.c \ screen.c \ @@ -99,6 +100,7 @@ OBJ = o/buffer.o \ o/ops.o \ o/option.o \ o/os_amiga.o \ + o/popupmenu.o \ o/quickfix.o \ o/regexp.o \ o/screen.o \ @@ -196,6 +198,8 @@ o/option.o: option.c $(SYMS) o/os_amiga.o: os_amiga.c $(SYMS) os_amiga.h +o/popupmenu.o: popupmenu.c $(SYMS) + o/quickfix.o: quickfix.c $(SYMS) o/regexp.o: regexp.c $(SYMS) regexp.h diff --git a/src/Make_manx.mak b/src/Make_manx.mak index 52b9e4833..46c001575 100644 --- a/src/Make_manx.mak +++ b/src/Make_manx.mak @@ -64,6 +64,7 @@ SRC = buffer.c \ ops.c \ option.c \ os_amiga.c \ + popupmenu.c \ quickfix.c \ regexp.c \ screen.c \ @@ -109,6 +110,7 @@ OBJ = obj/buffer.o \ obj/ops.o \ obj/option.o \ obj/os_amiga.o \ + obj/popupmenu.o \ obj/quickfix.o \ obj/regexp.o \ obj/screen.o \ @@ -152,6 +154,7 @@ PRO = proto/buffer.pro \ proto/ops.pro \ proto/option.pro \ proto/os_amiga.pro \ + proto/popupmenu.pro \ proto/quickfix.pro \ proto/regexp.pro \ proto/screen.pro \ @@ -303,6 +306,9 @@ obj/option.o: option.c obj/os_amiga.o: os_amiga.c $(CCSYM) $@ os_amiga.c +obj/popupmenu.o: popupmenu.c + $(CCSYM) $@ popupmenu.c + obj/quickfix.o: quickfix.c $(CCSYM) $@ quickfix.c diff --git a/src/Make_ming.mak b/src/Make_ming.mak index 9d78da56c..7b601cc68 100644 --- a/src/Make_ming.mak +++ b/src/Make_ming.mak @@ -389,6 +389,7 @@ OBJ = \ $(OUTDIR)/os_win32.o \ $(OUTDIR)/os_mswin.o \ $(OUTDIR)/pathdef.o \ + $(OUTDIR)/popupmenu.o \ $(OUTDIR)/quickfix.o \ $(OUTDIR)/regexp.o \ $(OUTDIR)/screen.o \ diff --git a/src/Make_mpw.mak b/src/Make_mpw.mak index 5be703a73..5955a60d9 100644 --- a/src/Make_mpw.mak +++ b/src/Make_mpw.mak @@ -52,6 +52,7 @@ SrcFiles = ¶ :src:option.c ¶ :src:os_mac.c ¶ :src:pty.c ¶ + :src:popupmenu.c ¶ :src:quickfix.c ¶ :src:regexp.c ¶ :src:screen.c ¶ @@ -105,6 +106,7 @@ ObjFiles-PPC = ¶ "{ObjDir}option.c.x" ¶ "{ObjDir}os_mac.c.x" ¶ "{ObjDir}pty.c.x" ¶ + "{ObjDir}popupmenu.c.x" ¶ "{ObjDir}quickfix.c.x" ¶ "{ObjDir}regexp.c.x" ¶ "{ObjDir}screen.c.x" ¶ @@ -189,6 +191,7 @@ VIm ÄÄ {ObjFiles-PPC} {LibFiles-PPC} {¥MondoBuild¥} "{ObjDir}option.c.x" Ä :src:option.c "{ObjDir}os_mac.c.x" Ä :src:os_mac.c "{ObjDir}pty.c.x" Ä :src:pty.c +"{ObjDir}popupmenu.c.x" Ä :src:popupmenu.c "{ObjDir}quickfix.c.x" Ä :src:quickfix.c "{ObjDir}regexp.c.x" Ä :src:regexp.c "{ObjDir}screen.c.x" Ä :src:screen.c @@ -276,6 +279,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -359,6 +363,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -442,6 +447,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -525,6 +531,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -608,6 +615,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -692,6 +700,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -775,6 +784,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -858,6 +868,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -941,6 +952,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -1024,6 +1036,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -1107,6 +1120,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -1190,6 +1204,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -1273,6 +1288,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -1354,6 +1370,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -1437,6 +1454,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -1520,6 +1538,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -1603,6 +1622,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -1686,6 +1706,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -1795,6 +1816,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -1879,6 +1901,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -1962,6 +1985,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -2045,6 +2069,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -2128,6 +2153,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -2211,6 +2237,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -2294,6 +2321,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -2378,6 +2406,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -2461,6 +2490,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -2544,6 +2574,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -2627,6 +2658,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -2710,6 +2742,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -2793,6 +2826,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -2876,6 +2910,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -2959,6 +2994,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -3042,6 +3078,91 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ + :src:proto:quickfix.pro ¶ + :src:proto:regexp.pro ¶ + :src:proto:screen.pro ¶ + :src:proto:search.pro ¶ + :src:proto:spell.pro ¶ + :src:proto:syntax.pro ¶ + :src:proto:tag.pro ¶ + :src:proto:term.pro ¶ + :src:proto:termlib.pro ¶ + :src:proto:ui.pro ¶ + :src:proto:undo.pro ¶ + :src:proto:version.pro ¶ + :src:proto:window.pro ¶ + :src:proto:if_python.pro ¶ + :src:proto:if_tcl.pro ¶ + :src:proto:if_ruby.pro ¶ + :src:proto:gui.pro ¶ + :src:proto:pty.pro ¶ + :src:proto:gui_gtk.pro ¶ + :src:proto:gui_gtk_x11.pro ¶ + :src:proto:gui_motif.pro ¶ + :src:proto:gui_athena.pro ¶ + :src:proto:gui_mac.pro ¶ + :src:proto:gui_x11.pro ¶ + :src:proto:workshop.pro ¶ + :src:proto:if_perl.pro ¶ + :src:proto:if_perlsfio.pro + +:obj:popupmenu.c.x Ä ¶ + :src:popupmenu.c ¶ + :src:vim.h ¶ + :src:auto:config.h ¶ + :src:feature.h ¶ + :src:os_unix.h ¶ + :src:os_mac.h ¶ + :src:workshop.h ¶ + :src:ascii.h ¶ + :src:keymap.h ¶ + :src:term.h ¶ + :src:macros.h ¶ + :src:structs.h ¶ + :src:globals.h ¶ + :src:option.h ¶ + :src:ex_cmds.h ¶ + :src:proto.h ¶ + :src:integration.h ¶ + :src:wsdebug.h ¶ + :src:regexp.h ¶ + :src:gui.h ¶ + :src:farsi.h ¶ + :src:proto:os_unix.pro ¶ + :src:proto:os_mac.pro ¶ + :src:proto:buffer.pro ¶ + :src:proto:charset.pro ¶ + :src:proto:if_cscope.pro ¶ + :src:proto:diff.pro ¶ + :src:proto:digraph.pro ¶ + :src:proto:edit.pro ¶ + :src:proto:eval.pro ¶ + :src:proto:ex_cmds.pro ¶ + :src:proto:ex_cmds2.pro ¶ + :src:proto:ex_docmd.pro ¶ + :src:proto:ex_eval.pro ¶ + :src:proto:ex_getln.pro ¶ + :src:proto:fileio.pro ¶ + :src:proto:fold.pro ¶ + :src:proto:getchar.pro ¶ + :src:proto:hardcopy.pro ¶ + :src:proto:hashtable.pro ¶ + :src:proto:hangulin.pro ¶ + :src:proto:main.pro ¶ + :src:proto:mark.pro ¶ + :src:proto:memfile.pro ¶ + :src:proto:memline.pro ¶ + :src:proto:menu.pro ¶ + :src:proto:message.pro ¶ + :src:proto:misc1.pro ¶ + :src:proto:misc2.pro ¶ + :src:proto:move.pro ¶ + :src:proto:multibyte.pro ¶ + :src:proto:normal.pro ¶ + :src:proto:ops.pro ¶ + :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -3125,6 +3246,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -3208,6 +3330,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -3291,6 +3414,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -3374,6 +3498,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -3457,6 +3582,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -3540,6 +3666,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -3623,6 +3750,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -3706,6 +3834,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -3790,6 +3919,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -3872,6 +4002,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -3955,6 +4086,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -4039,6 +4171,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -4122,6 +4255,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ @@ -4205,6 +4339,7 @@ Dependencies Ä $OutOfDate :src:proto:normal.pro ¶ :src:proto:ops.pro ¶ :src:proto:option.pro ¶ + :src:proto:popupmenu.pro ¶ :src:proto:quickfix.pro ¶ :src:proto:regexp.pro ¶ :src:proto:screen.pro ¶ diff --git a/src/Make_os2.mak b/src/Make_os2.mak index 2c4cdaf9e..1a64c113d 100644 --- a/src/Make_os2.mak +++ b/src/Make_os2.mak @@ -68,6 +68,7 @@ OBJ = \ normal.o \ ops.o \ option.o \ + popupmenu.o \ quickfix.o \ regexp.o \ screen.o \ @@ -140,6 +141,7 @@ mbyte.o: mbyte.c $(INCL) normal.o: normal.c $(INCL) ops.o: ops.c $(INCL) option.o: option.c $(INCL) +popupmenu.o: popupmenu.c $(INCL) quickfix.o: quickfix.c $(INCL) regexp.o: regexp.c $(INCL) screen.o: screen.c $(INCL) diff --git a/src/Make_ro.mak b/src/Make_ro.mak index 38e6324b0..1577409a1 100644 --- a/src/Make_ro.mak +++ b/src/Make_ro.mak @@ -15,7 +15,8 @@ OBJS = o.buffer o.charset o.diff o.digraph o.edit o.eval o.ex_cmds o.ex_cmds2 o.ex_docmd o.ex_eval o.ex_getln o.fileio o.fold o.getchar \ o.hardcopy o.hashtable o.main o.mark o.mbyte \ o.memfile o.memline o.menu o.message o.misc1 o.misc2 o.move \ - o.normal o.ops o.option o.quickfix o.regexp o.screen o.search \ + o.normal o.ops o.option o.popupmenu o.quickfix o.regexp o.screen \ + o.search \ o.spell o.syntax o.tag o.term o.termlib o.ui o.undo o.version \ o.window o.os_riscos o.swis o.gui o.gui_riscos @@ -104,6 +105,8 @@ o.os_riscos: c.os_riscos o.pty: c.pty +o.popupmenu: c.popupmenu + o.quickfix: c.quickfix o.regexp: c.regexp diff --git a/src/Make_sas.mak b/src/Make_sas.mak index 484f562ad..9caadd049 100644 --- a/src/Make_sas.mak +++ b/src/Make_sas.mak @@ -119,6 +119,7 @@ SRC = \ ops.c \ option.c \ os_amiga.c \ + popupmenu.c \ quickfix.c \ regexp.c \ screen.c \ @@ -163,6 +164,7 @@ OBJ = \ ops.o \ option.o \ os_amiga.o \ + popupmenu.o \ quickfix.o \ regexp.o \ screen.o \ @@ -207,6 +209,7 @@ PRO = \ proto/ops.pro \ proto/option.pro \ proto/os_amiga.pro \ + proto/popupmenu.pro \ proto/quickfix.pro \ proto/regexp.pro \ proto/screen.pro \ @@ -335,6 +338,8 @@ option.o: option.c proto/option.pro: option.c os_amiga.o: os_amiga.c proto/os_amiga.pro: os_amiga.c +popupmenu.o: popupmenu.c +proto/popupmenu.pro: popupmenu.c quickfix.o: quickfix.c proto/quickfix.pro: quickfix.c regexp.o: regexp.c diff --git a/src/Make_w16.mak b/src/Make_w16.mak index 42d15470a..598d72e6e 100644 --- a/src/Make_w16.mak +++ b/src/Make_w16.mak @@ -107,6 +107,7 @@ ObjFiles = \ $(INTDIR)\os_win16.obj\ $(INTDIR)\os_msdos.obj\ $(INTDIR)\os_mswin.obj\ + $(INTDIR)\popupmenu.obj\ $(INTDIR)\quickfix.obj\ $(INTDIR)\regexp.obj\ $(INTDIR)\screen.obj\ diff --git a/src/Makefile b/src/Makefile index 0340f796b..92ccafbda 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1371,6 +1371,7 @@ BASIC_SRC = \ option.c \ os_unix.c \ auto/pathdef.c \ + popupmenu.c \ quickfix.c \ regexp.c \ screen.c \ @@ -1441,6 +1442,7 @@ OBJ = \ objects/option.o \ objects/os_unix.o \ objects/pathdef.o \ + objects/popupmenu.o \ objects/quickfix.o \ objects/regexp.o \ objects/screen.o \ @@ -1500,6 +1502,7 @@ PRO_AUTO = \ ops.pro \ option.pro \ os_unix.pro \ + popupmenu.pro \ quickfix.pro \ regexp.pro \ screen.pro \ @@ -1611,14 +1614,19 @@ xxd/xxd$(EXEEXT): xxd/xxd.c # Generate the converted .mo files separately, it's no problem if this fails. languages: @if test -n "$(MAKEMO)" -a -f $(PODIR)/Makefile; then \ + $(MAKE) language-check; \ cd $(PODIR); \ - CC="$(CC)" $(MAKE) check; \ CC="$(CC)" $(MAKE) prefix=$(DESTDIR)$(prefix); \ fi -@if test -n "$(MAKEMO)" -a -f $(PODIR)/Makefile; then \ cd $(PODIR); CC="$(CC)" $(MAKE) prefix=$(DESTDIR)$(prefix) converted; \ fi +# Separate target to check the po files for valitidy, because it depends on +# ./vim. +language-check: $(VIMTARGET) + cd $(PODIR); $(MAKE) check VIM=../$(VIMTARGET) + # Update the *.po files for changes in the sources. Only run manually. update-po: cd $(PODIR); CC="$(CC)" $(MAKE) prefix=$(DESTDIR)$(prefix) update-po @@ -2457,6 +2465,9 @@ objects/py_getpath.o: $(PYTHON_CONFDIR)/getpath.c objects/pty.o: pty.c $(CCC) -o $@ pty.c +objects/popupmenu.o: popupmenu.c + $(CCC) -o $@ popupmenu.c + objects/quickfix.o: quickfix.c $(CCC) -o $@ quickfix.c diff --git a/src/edit.c b/src/edit.c index e4370fcc2..140c17f75 100644 --- a/src/edit.c +++ b/src/edit.c @@ -109,10 +109,14 @@ static void ins_ctrl_x __ARGS((void)); static int has_compl_option __ARGS((int dict_opt)); static void ins_compl_add_matches __ARGS((int num_matches, char_u **matches, int dir)); static int ins_compl_make_cyclic __ARGS((void)); +static void ins_compl_upd_pum __ARGS((void)); +static void ins_compl_del_pum __ARGS((void)); +static int pum_wanted __ARGS((void)); +static void ins_compl_show_pum __ARGS((void)); static void ins_compl_dictionaries __ARGS((char_u *dict, char_u *pat, int dir, int flags, int thesaurus)); static void ins_compl_free __ARGS((void)); static void ins_compl_clear __ARGS((void)); -static void ins_compl_prep __ARGS((int c)); +static int ins_compl_prep __ARGS((int c)); static buf_T *ins_compl_next_buf __ARGS((buf_T *buf, int flag)); static int ins_compl_get_exp __ARGS((pos_T *ini, int dir)); static void ins_compl_delete __ARGS((void)); @@ -659,10 +663,19 @@ edit(cmdchar, startln, count) #endif #ifdef FEAT_INS_EXPAND + /* When the popup menu is visible cursor keys change the selection. */ + if (c == K_UP && pum_visible()) + c = Ctrl_P; + if (c == K_DOWN && pum_visible()) + c = Ctrl_N; + /* Prepare for or stop CTRL-X mode. This doesn't do completion, but * it does fix up the text when finishing completion. */ if (c != K_IGNORE) - ins_compl_prep(c); + { + if (ins_compl_prep(c)) + continue; + } #endif /* CTRL-\ CTRL-N goes to Normal mode, @@ -1968,6 +1981,9 @@ ins_compl_add(str, len, fname, dir, flags) } while (match != NULL && match != compl_first_match); } + /* Remove any popup menu before changing the list of matches. */ + ins_compl_del_pum(); + /* * Allocate a new match structure. * Copy the values to the new match structure. @@ -2073,6 +2089,157 @@ ins_compl_make_cyclic() return count; } +static char_u **compl_match_array = NULL; +static int compl_match_arraysize; + +/* + * Update the screen and when there is any scrolling remove the popup menu. + */ + static void +ins_compl_upd_pum() +{ + int h; + + if (compl_match_array != NULL) + { + h = curwin->w_cline_height; + update_screen(0); + if (h != curwin->w_cline_height) + ins_compl_del_pum(); + } +} + +/* + * Remove any popup menu. + */ + static void +ins_compl_del_pum() +{ + if (compl_match_array != NULL) + { + pum_undisplay(); + vim_free(compl_match_array); + compl_match_array = NULL; + } +} + +/* + * Return TRUE if the popup menu should be displayed. + */ + static int +pum_wanted() +{ + compl_T *compl; + int i; + + /* 'completeopt' must contain "menu" */ + if (*p_cot == NUL) + return FALSE; + + /* The display looks bad on a B&W display. */ + if (t_colors < 8 +#ifdef FEAT_GUI + && !gui.in_use +#endif + ) + return FALSE; + + /* Don't display the popup menu if there are no matches or there is only + * one (ignoring the original text). */ + compl = compl_first_match; + i = 0; + do + { + if (compl == NULL + || ((compl->cp_flags & ORIGINAL_TEXT) == 0 && ++i == 2)) + break; + compl = compl->cp_next; + } while (compl != compl_first_match); + + return (i >= 2); +} + +/* + * Show the popup menu for the list of matches. + */ + static void +ins_compl_show_pum() +{ + compl_T *compl; + int i; + int cur = -1; + colnr_T col; + + if (!pum_wanted()) + return; + + /* Update the screen before drawing the popup menu over it. */ + update_screen(0); + + if (compl_match_array == NULL) + { + /* Need to build the popup menu list. */ + compl_match_arraysize = 0; + compl = compl_first_match; + do + { + if ((compl->cp_flags & ORIGINAL_TEXT) == 0) + ++compl_match_arraysize; + compl = compl->cp_next; + } while (compl != NULL && compl != compl_first_match); + compl_match_array = (char_u **)alloc((unsigned)(sizeof(char_u **) + * compl_match_arraysize)); + if (compl_match_array != NULL) + { + i = 0; + compl = compl_first_match; + do + { + if ((compl->cp_flags & ORIGINAL_TEXT) == 0) + { + if (compl == compl_shown_match) + cur = i; + compl_match_array[i++] = compl->cp_str; + } + compl = compl->cp_next; + } while (compl != NULL && compl != compl_first_match); + } + } + else + { + /* popup menu already exists, only need to find the current item.*/ + i = 0; + compl = compl_first_match; + do + { + if ((compl->cp_flags & ORIGINAL_TEXT) == 0) + { + if (compl == compl_shown_match) + { + cur = i; + break; + } + ++i; + } + compl = compl->cp_next; + } while (compl != NULL && compl != compl_first_match); + } + + if (compl_match_array != NULL) + { + /* Compute the screen column of the start of the completed text. + * Use the cursor to get all wrapping and other settings right. */ + col = curwin->w_cursor.col; + curwin->w_cursor.col = compl_col; + validate_cursor_col(); + pum_display(compl_match_array, compl_match_arraysize, cur, + curwin->w_cline_row + W_WINROW(curwin), + curwin->w_cline_height, + curwin->w_wcol + W_WINCOL(curwin)); + curwin->w_cursor.col = col; + } +} + #define DICT_FIRST (1) /* use just first element in "dict" */ #define DICT_EXACT (2) /* "dict" is the exact name of a file */ /* @@ -2277,6 +2444,10 @@ ins_compl_free() if (compl_first_match == NULL) return; + + ins_compl_del_pum(); + pum_clear(); + compl_curr_match = compl_first_match; do { @@ -2306,14 +2477,16 @@ ins_compl_clear() /* * Prepare for Insert mode completion, or stop it. * Called just after typing a character in Insert mode. + * Returns TRUE when the character is not to be inserted; */ - static void + static int ins_compl_prep(c) int c; { char_u *ptr; int temp; int want_cindent; + int retval = FALSE; /* Forget any previous 'special' messages if this is actually * a ^X mode key - bar ^R, in which case we wait to see what it gives us. @@ -2323,7 +2496,7 @@ ins_compl_prep(c) /* Ignore end of Select mode mapping */ if (c == K_SELECT) - return; + return retval; if (ctrl_x_mode == CTRL_X_NOT_DEFINED_YET) { @@ -2504,6 +2677,11 @@ ins_compl_prep(c) auto_format(FALSE, TRUE); + /* if the popup menu is displayed hitting Enter means accepting + * the selection without inserting anything. */ + if ((c == CAR || c == K_KENTER || c == NL) && pum_visible()) + retval = TRUE; + ins_compl_free(); compl_started = FALSE; compl_matches = 0; @@ -2534,6 +2712,8 @@ ins_compl_prep(c) compl_cont_status = 0; compl_cont_mode = 0; } + + return retval; } /* @@ -2890,8 +3070,8 @@ ins_compl_get_exp(ini, dir) { int flags = 0; - /* ctrl_x_mode == CTRL_X_WHOLE_LINE || word-wise search that has - * added a word that was at the beginning of the line */ + /* ctrl_x_mode == CTRL_X_WHOLE_LINE || word-wise search that + * has added a word that was at the beginning of the line */ if ( ctrl_x_mode == CTRL_X_WHOLE_LINE || (compl_cont_status & CONT_SOL)) found_new_match = search_for_exact_line(ins_buf, pos, @@ -2999,7 +3179,7 @@ ins_compl_get_exp(ini, dir) } } if (ins_compl_add_infercase(ptr, len, - ins_buf == curbuf ? NULL : ins_buf->b_sfname, + ins_buf == curbuf ? NULL : ins_buf->b_sfname, dir, flags) != NOTDONE) { found_new_match = OK; @@ -3009,22 +3189,35 @@ ins_compl_get_exp(ini, dir) p_scs = save_p_scs; p_ws = save_p_ws; } + /* check if compl_curr_match has changed, (e.g. other type of * expansion added somenthing) */ - if (compl_curr_match != old_match) + if (type != 0 && compl_curr_match != old_match) found_new_match = OK; /* break the loop for specialized modes (use 'complete' just for the * generic ctrl_x_mode == 0) or when we've found a new match */ if ((ctrl_x_mode != 0 && ctrl_x_mode != CTRL_X_WHOLE_LINE) || found_new_match != FAIL) - break; - - /* Mark a buffer scanned when it has been scanned completely */ - if (type == 0 || type == CTRL_X_PATH_PATTERNS) - ins_buf->b_scanned = TRUE; + { + if (got_int) + break; + if (pum_wanted() && type != -1) + /* Fill the popup menu as soon as possible. */ + ins_compl_check_keys(0); + if ((ctrl_x_mode != 0 && ctrl_x_mode != CTRL_X_WHOLE_LINE) + || compl_interrupted) + break; + compl_started = TRUE; + } + else + { + /* Mark a buffer scanned when it has been scanned completely */ + if (type == 0 || type == CTRL_X_PATH_PATTERNS) + ins_buf->b_scanned = TRUE; - compl_started = FALSE; + compl_started = FALSE; + } } compl_started = TRUE; @@ -3106,8 +3299,7 @@ ins_compl_next(allow_get_expansion) compl_pending = TRUE; if (allow_get_expansion) { - num_matches = ins_compl_get_exp(&compl_startpos, - compl_direction); + num_matches = ins_compl_get_exp(&compl_startpos, compl_direction); if (compl_pending) { if (compl_direction == compl_shows_dir) @@ -3123,9 +3315,15 @@ ins_compl_next(allow_get_expansion) if (!allow_get_expansion) { + /* may undisplay the popup menu first */ + ins_compl_upd_pum(); + /* Display the current match. */ update_screen(0); + /* display the updated popup menu */ + ins_compl_show_pum(); + /* Delete old text to be replaced, since we're still searching and * don't want to match ourselves! */ ins_compl_delete(); @@ -3593,6 +3791,9 @@ ins_complete(c) */ n = ins_compl_next(TRUE); + /* may undisplay the popup menu */ + ins_compl_upd_pum(); + if (n > 1) /* all matches have been found */ compl_matches = n; compl_curr_match = compl_shown_match; @@ -3671,8 +3872,8 @@ ins_complete(c) if (match != NULL) /* go up and assign all numbers which are not assigned * yet */ - for (match = match->cp_next; match - && match->cp_number == -1; + for (match = match->cp_next; + match != NULL && match->cp_number == -1; match = match->cp_next) match->cp_number = ++number; } @@ -3699,8 +3900,8 @@ ins_complete(c) } } - /* The match should always have a sequnce number now, this is just - * a safety check. */ + /* The match should always have a sequence number now, this is + * just a safety check. */ if (compl_curr_match->cp_number != -1) { /* Space for 10 text chars. + 2x10-digit no.s */ @@ -3733,6 +3934,8 @@ ins_complete(c) else msg_clr_cmdline(); /* necessary for "noshowmode" */ + ins_compl_show_pum(); + return OK; } diff --git a/src/ex_getln.c b/src/ex_getln.c index 2748915be..f92140adb 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -1289,7 +1289,7 @@ getcmdline(firstc, count, indent) goto cmdline_not_changed; case K_VER_SCROLLBAR: - if (!msg_scrolled) + if (msg_scrolled == 0) { gui_do_scroll(); redrawcmd(); @@ -1297,7 +1297,7 @@ getcmdline(firstc, count, indent) goto cmdline_not_changed; case K_HOR_SCROLLBAR: - if (!msg_scrolled) + if (msg_scrolled == 0) { gui_do_horiz_scroll(); redrawcmd(); @@ -2897,7 +2897,7 @@ redrawcmd() void compute_cmdrow() { - if (exmode_active || msg_scrolled) + if (exmode_active || msg_scrolled != 0) cmdline_row = Rows - 1; else cmdline_row = W_WINROW(lastwin) + lastwin->w_height diff --git a/src/fileio.c b/src/fileio.c index e74306196..f00e1ea75 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2193,7 +2193,7 @@ failed: #endif p = msg_trunc_attr(IObuff, FALSE, 0); if (read_stdin || read_buffer || restart_edit != 0 - || (msg_scrolled && !need_wait_return)) + || (msg_scrolled != 0 && !need_wait_return)) { /* Need to repeat the message after redrawing when: * - When reading from stdin (the screen will be cleared next). @@ -3492,7 +3492,7 @@ gui_drag_scrollbar(sb, value, still_dragging) ins_horscroll(); else if (State & CMDLINE) { - if (!msg_scrolled) + if (msg_scrolled == 0) { gui_do_horiz_scroll(); redrawcmdline(); diff --git a/src/option.c b/src/option.c index b3c80d6a4..4d7a95b1e 100644 --- a/src/option.c +++ b/src/option.c @@ -659,6 +659,15 @@ static struct vimoption {(char_u *)0L, (char_u *)0L} #endif }, + {"completeopt", "cot", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, +#ifdef FEAT_INS_EXPAND + (char_u *)&p_cot, PV_NONE, + {(char_u *)"menu", (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)0L, (char_u *)0L} +#endif + }, {"confirm", "cf", P_BOOL|P_VI_DEF, #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) (char_u *)&p_confirm, PV_NONE, @@ -1119,7 +1128,7 @@ static struct vimoption {(char_u *)FALSE, (char_u *)0L}}, {"highlight", "hl", P_STRING|P_VI_DEF|P_RCLR|P_COMMA|P_NODUP, (char_u *)&p_hl, PV_NONE, - {(char_u *)"8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal", + {(char_u *)"8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb", (char_u *)0L}}, {"history", "hi", P_NUM|P_VIM, (char_u *)&p_hi, PV_NONE, @@ -2608,12 +2617,15 @@ static char *(p_bufhidden_values[]) = {"hide", "unload", "delete", "wipe", NULL} static char *(p_bs_values[]) = {"indent", "eol", "start", NULL}; #ifdef FEAT_FOLDING static char *(p_fdm_values[]) = {"manual", "expr", "marker", "indent", "syntax", -#ifdef FEAT_DIFF +# ifdef FEAT_DIFF "diff", -#endif +# endif NULL}; static char *(p_fcl_values[]) = {"all", NULL}; #endif +#ifdef FEAT_INS_EXPAND +static char *(p_cot_values[]) = {"menu", NULL}; +#endif static void set_option_default __ARGS((int, int opt_flags, int compatible)); static void set_options_default __ARGS((int opt_flags)); @@ -5930,6 +5942,13 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, } } } + + /* 'completeopt' */ + else if (varp == &p_cot) + { + if (check_opt_strings(p_cot, p_cot_values, TRUE) != OK) + errmsg = e_invarg; + } #endif /* FEAT_INS_EXPAND */ diff --git a/src/option.h b/src/option.h index 3cfdd4fba..173919eda 100644 --- a/src/option.h +++ b/src/option.h @@ -384,6 +384,9 @@ EXTERN long p_ch; /* 'cmdheight' */ EXTERN int p_confirm; /* 'confirm' */ #endif EXTERN int p_cp; /* 'compatible' */ +#ifdef FEAT_INS_EXPAND +EXTERN char_u *p_cot; /* 'completeopt' */ +#endif EXTERN char_u *p_cpo; /* 'cpoptions' */ #ifdef FEAT_CSCOPE EXTERN char_u *p_csprg; /* 'cscopeprg' */ diff --git a/src/screen.c b/src/screen.c index fa1390424..1a2161f96 100644 --- a/src/screen.c +++ b/src/screen.c @@ -5296,7 +5296,13 @@ win_redr_status(wp) /* no status line, can only be last window */ redraw_cmdline = TRUE; } - else if (!redrawing()) + else if (!redrawing() +#ifdef FEAT_INS_EXPAND + /* don't update status line when popup menu is visible and may be + * drawn over it */ + || pum_visible() +#endif + ) { /* Don't redraw right now, do it later. */ wp->w_redr_status = TRUE; @@ -8534,6 +8540,9 @@ win_redr_ruler(wp, always) # endif if (edit_submode != NULL) return; + /* Don't draw the ruler when the popup menu is visible, it may overlap. */ + if (pum_visible()) + return; #endif #ifdef FEAT_STL_OPT diff --git a/src/syntax.c b/src/syntax.c index a04b81b34..ce2ff8852 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -6065,6 +6065,8 @@ static char *(highlight_init_both[]) = "VertSplit term=reverse cterm=reverse gui=reverse", "VisualNOS term=underline,bold cterm=underline,bold gui=underline,bold", "DiffText term=reverse cterm=bold ctermbg=Red gui=bold guibg=Red", + "PmenuThumb cterm=reverse gui=reverse", + "PmenuSbar ctermbg=Grey guibg=Grey", NULL }; @@ -6080,6 +6082,8 @@ static char *(highlight_init_light[]) = "SpellCap term=reverse ctermbg=LightBlue guisp=Blue gui=undercurl", "SpellRare term=reverse ctermbg=LightMagenta guisp=Magenta gui=undercurl", "SpellLocal term=underline ctermbg=Cyan guisp=DarkCyan gui=undercurl", + "Pmenu ctermbg=LightMagenta guibg=LightMagenta", + "PmenuSel ctermbg=LightGrey guibg=Grey", "SpecialKey term=bold ctermfg=DarkBlue guifg=Blue", "Title term=bold ctermfg=DarkMagenta gui=bold guifg=Magenta", "WarningMsg term=standout ctermfg=DarkRed guifg=Red", @@ -6107,6 +6111,8 @@ static char *(highlight_init_dark[]) = "SpellCap term=reverse ctermbg=Blue guisp=Blue gui=undercurl", "SpellRare term=reverse ctermbg=Magenta guisp=Magenta gui=undercurl", "SpellLocal term=underline ctermbg=Cyan guisp=Cyan gui=undercurl", + "Pmenu ctermbg=Magenta guibg=Magenta", + "PmenuSel ctermbg=Grey guibg=Grey", "Title term=bold ctermfg=LightMagenta gui=bold guifg=Magenta", "WarningMsg term=standout ctermfg=LightRed guifg=Red", "WildMenu term=standout ctermbg=Yellow ctermfg=Black guibg=Yellow guifg=Black", diff --git a/src/testdir/test32.in b/src/testdir/test32.in index 0d5405184..85d76ae40 100644 --- a/src/testdir/test32.in +++ b/src/testdir/test32.in @@ -23,10 +23,12 @@ Test for insert expansion STARTTEST :so small.vim :se nocp viminfo+=nviminfo cpt=.,w ff=unix | $-2,$w!Xtestfile | set ff& +:se cot= nO#include "Xtestfile" ru O + :se cpt=.,w,i kOM diff --git a/src/version.h b/src/version.h index 85bf690b5..3571032ce 100644 --- a/src/version.h +++ b/src/version.h @@ -36,5 +36,5 @@ #define VIM_VERSION_NODOT "vim70aa" #define VIM_VERSION_SHORT "7.0aa" #define VIM_VERSION_MEDIUM "7.0aa ALPHA" -#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Sep 30)" -#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Sep 30, compiled " +#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Oct 3)" +#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Oct 3, compiled " |