Mirror of the Vim source from https://github.com/vim/vim
Revision | 98a88a884610aa911950623d7cce8d067feda66c (tree) |
---|---|
Time | 2006-03-21 06:59:49 |
Author | vimboss |
Commiter | vimboss |
updated for version 7.0230
@@ -1,4 +1,4 @@ | ||
1 | -*quickfix.txt* For Vim version 7.0aa. Last change: 2006 Mar 19 | |
1 | +*quickfix.txt* For Vim version 7.0aa. Last change: 2006 Mar 20 | |
2 | 2 | |
3 | 3 | |
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
@@ -878,6 +878,7 @@ | ||
878 | 878 | %W start of a multi-line warning message |
879 | 879 | %I start of a multi-line informational message |
880 | 880 | %A start of a multi-line message (unspecified type) |
881 | + %> for next line start with current pattern again |efm-%>| | |
881 | 882 | %C continuation of a multi-line message |
882 | 883 | %Z end of a multi-line message |
883 | 884 | These can be used with '+' and '-', see |efm-ignore| below. |
@@ -929,6 +930,17 @@ | ||
929 | 930 | it also hides line 7 which would trigger a separate error message otherwise. |
930 | 931 | Error format strings are always parsed pattern by pattern until the first |
931 | 932 | match occurs. |
933 | + *efm-%>* | |
934 | +The %> item can be used to avoid trying patterns that appear earlier in | |
935 | +'errorformat'. This is useful for patterns that match just about anything. | |
936 | +For example, if the error looks like this: | |
937 | + | |
938 | + Error in line 123 of foo.c: ~ | |
939 | + unknown variable "i" ~ | |
940 | + | |
941 | +This can be found with: > | |
942 | + :set efm=xxx,%E%>Error in line %l of %f:,%Z%m | |
943 | +Where "xxx" has a pattern that would also match the second line. | |
932 | 944 | |
933 | 945 | Important: There is no memory of what part of the errorformat matched before; |
934 | 946 | every line in the error file gets a complete new run through the error format |
@@ -1,4 +1,4 @@ | ||
1 | -*todo.txt* For Vim version 7.0aa. Last change: 2006 Mar 19 | |
1 | +*todo.txt* For Vim version 7.0aa. Last change: 2006 Mar 20 | |
2 | 2 | |
3 | 3 | |
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
@@ -30,15 +30,23 @@ | ||
30 | 30 | *known-bugs* |
31 | 31 | -------------------- Known bugs and current work ----------------------- |
32 | 32 | |
33 | -'errorformat': Add a flag %? to check for a match with the next item first. | |
34 | -Helps for continuation lines that may contain just about anything, e.g. an | |
35 | -error message. | |
36 | - error 99 in file foo.c line 1234: | |
37 | - something is wrong here | |
33 | +Links in docs to vimball docs. | |
38 | 34 | |
39 | -Gnome GUI: lots of error messages during startup. These go away when not | |
40 | -using the notebook for tab labels. Still similar error messages when moving | |
41 | -the toolbar to another location. | |
35 | +HTML indenting can be slow, find out why. | |
36 | +Add a function to get the current time in usec. reltime([start, [end]]) | |
37 | + reltime().sec == seconds, reltime().usec = microseconds | |
38 | + reltime(start) current time relative to [start] | |
39 | + echo timestring(reltime(start), 3) (3 is nr of digits after dot) | |
40 | + reltime(start, end) difference between start and end | |
41 | + | |
42 | +Include GetLatestVimScripts script? | |
43 | + | |
44 | +Adjust src/main.aap for installing manpages like in Makefile. | |
45 | + And for generating Vim.app for the Mac. | |
46 | + Install spell files with src/main.aap. | |
47 | + | |
48 | +Gnome2: When moving the toolbar out of the dock, so that it becomes floating, | |
49 | +it can no longer be moved. | |
42 | 50 | |
43 | 51 | Win32: Describe how to do debugging. (George Reilly) |
44 | 52 |
@@ -51,28 +59,8 @@ | ||
51 | 59 | - With 'nopaste' pasting is wrong, with 'paste' Command-V doesn't work. |
52 | 60 | (Alan Schmitt) |
53 | 61 | |
54 | -EMBEDDING: Make it possible to run Vim inside a window of another program. | |
55 | -For GTK Neil Bird has a patch to use Vim like a widget. | |
56 | - | |
57 | -Ctags still hasn't included the patch. Darren is looking for someone to do | |
58 | -maintenance. Is there another solution? | |
59 | - | |
60 | -HTML indenting can be slow, find out why. | |
61 | -Add a function to get the current time in usec. reltime([start, [end]]) | |
62 | - reltime().sec == seconds, reltime().usec = microseconds | |
63 | - reltime(start) current time relative to [start] | |
64 | - echo timestring(reltime(start), 3) (3 is nr of digits after dot) | |
65 | - reltime(start, end) difference between start and end | |
66 | -Profiling: | |
67 | - - :profile pause | |
68 | - - :profile resume | |
69 | - | |
70 | -Adjust src/main.aap for installing manpages like in Makefile. | |
71 | - And for generating Vim.app for the Mac. | |
72 | - Install spell files with src/main.aap. | |
73 | - | |
74 | -Add ":smap", Select mode mapping? Otherwise: ":sunmap", so that Visual mode | |
75 | -mappings for normal keys can be removed from Select mode. | |
62 | +Darren is including the patch in ctags. Test it when it's ready. Change | |
63 | +"typename" to "typeref" in C complete code. | |
76 | 64 | |
77 | 65 | Add more tests for all new functionality in Vim 7. Especially new functions. |
78 | 66 |
@@ -81,7 +69,6 @@ | ||
81 | 69 | |
82 | 70 | |
83 | 71 | Awaiting updated patches: |
84 | -7 Updated Ruby interface. (Ryan Paul) | |
85 | 72 | 8 Add ":n" to fnamemodify(): normalize path, remove "../" when possible. |
86 | 73 | Aric Blumer has a patch for this. |
87 | 74 | He will update the patch for 6.3. |
@@ -1446,7 +1433,6 @@ | ||
1446 | 1433 | 7 CTRL-] checks the highlight group for finding out what the tag is. |
1447 | 1434 | 7 Add an explanation how a list of words can be used to highlight misspelled |
1448 | 1435 | words. |
1449 | -7 Command line completion for ":find" should search in 'path'. | |
1450 | 1436 | 8 Add more command line completion for :syntax. |
1451 | 1437 | 8 Add more command line completion for :highlight. |
1452 | 1438 | 8 Add more command line completion for :sign. |
@@ -1,4 +1,4 @@ | ||
1 | -*version7.txt* For Vim version 7.0aa. Last change: 2006 Mar 18 | |
1 | +*version7.txt* For Vim version 7.0aa. Last change: 2006 Mar 20 | |
2 | 2 | |
3 | 3 | |
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
@@ -36,6 +36,7 @@ | ||
36 | 36 | Remote file explorer |new-netrw-explore| |
37 | 37 | Define an operator |new-define-operator| |
38 | 38 | Mapping to an expression |new-map-expression| |
39 | +Visual and Select mode mappings |new-map-select| | |
39 | 40 | Location list |new-location-list| |
40 | 41 | Various new items |new-items-7| |
41 | 42 |
@@ -143,6 +144,10 @@ | ||
143 | 144 | reported, relative to the function start. This also means that line numbers |
144 | 145 | for ":breakadd func" are different. |
145 | 146 | |
147 | +When defining a user command with |:command| the special items could be | |
148 | +abbreviated. This caused unexpected behavior, such as <li> being recognized | |
149 | +as <line1>. The items can no longer be abbreviated. | |
150 | + | |
146 | 151 | ============================================================================== |
147 | 152 | NEW FEATURES *new-7* |
148 | 153 |
@@ -161,8 +166,8 @@ | ||
161 | 166 | variable. Works for Numbers, Strings and composites of them. Then |eval()| |
162 | 167 | can be used to turn the string back into the variable value. |
163 | 168 | |
164 | -The |:let| command can now use ":let var += expr" like using ":let var = var + | |
165 | -expr". "-=" and ".=" works in a similar way. | |
169 | +The |:let| command can now use "+=". ":let var += expr" works like | |
170 | +":let var = var + expr". "-=" and ".=" works in a similar way. | |
166 | 171 | |
167 | 172 | With the |:profile| command you can find out where your function or script |
168 | 173 | wastes its time. |
@@ -493,6 +498,20 @@ | ||
493 | 498 | Also works for abbreviations. See |:map-<expr>| for the details. |
494 | 499 | |
495 | 500 | |
501 | +Visual and Select mode mappings *new-map-select* | |
502 | +------------------------------- | |
503 | + | |
504 | +Previously Visual mode mappings applied both to Visual and Select mode. With | |
505 | +a trick to have the mappings work in Select mode like they would in Visual | |
506 | +mode. | |
507 | + | |
508 | +Commands have been added to define mappings for Visual and Select mode | |
509 | +separately: |:xmap| and |:smap|. With the associated "noremap" and "unmap" | |
510 | +commands. | |
511 | + | |
512 | +The same is done for menus: |:xmenu|, |:smenu|, etc. | |
513 | + | |
514 | + | |
496 | 515 | Location list *new-location-list* |
497 | 516 | ------------- |
498 | 517 |
@@ -1103,6 +1122,13 @@ | ||
1103 | 1122 | window. |
1104 | 1123 | |
1105 | 1124 | Added the "%s" item to 'errorformat'. (Yegappan Lakshmanan) |
1125 | +Added the "%>" item to 'errorformat'. | |
1126 | + | |
1127 | +For 'errorformat' it was not possible to have a file name that contains the | |
1128 | +character that follows after "%f". For example, in "%f:%l:%m" the file name | |
1129 | +could not contain ":". Now include the first ":" where the rest of the | |
1130 | +pattern matches. In the example a ":" not followed by a line number is | |
1131 | +included in the file name. (suggested by Emanuele Giaquinta) | |
1106 | 1132 | |
1107 | 1133 | GTK GUI: use the GTK file dialog when it's available. Mix from patches by |
1108 | 1134 | Grahame Bowland and Evan Webb. |
@@ -1133,12 +1159,6 @@ | ||
1133 | 1159 | Win32: Balloons can have multiple lines if common controls supports it. |
1134 | 1160 | (Sergey Khorev) |
1135 | 1161 | |
1136 | -For 'errorformat' it was not possible to have a file name that contains the | |
1137 | -character that follows after "%f". For example, in "%f:%l:%m" the file name | |
1138 | -could not contain ":". Now include the first ":" where the rest of the | |
1139 | -pattern matches. In the example a ":" not followed by a line number is | |
1140 | -included in the file name. (suggested by Emanuele Giaquinta) | |
1141 | - | |
1142 | 1162 | For command-line completion the matches for various types of arguments are now |
1143 | 1163 | sorted: user commands, variables, syntax names, etc. |
1144 | 1164 |
@@ -1233,6 +1253,8 @@ | ||
1233 | 1253 | $VIM if it's set. Example provided by Mathias Michaelis. |
1234 | 1254 | Also create a vimtutor.bat batch file. |
1235 | 1255 | |
1256 | +The 'balloonexpr' option is now |global-local|. | |
1257 | + | |
1236 | 1258 | ============================================================================== |
1237 | 1259 | COMPILE TIME CHANGES *compile-changes-7* |
1238 | 1260 |
@@ -1384,9 +1406,6 @@ | ||
1384 | 1406 | VMS: Occasionally CR characters were inserted in the file. Expansion of |
1385 | 1407 | environment variables was not correct. (Zoltan Arpadffy) |
1386 | 1408 | |
1387 | -VMS: Improved low level char input (affects just console mode). (Zoltan | |
1388 | -Arpadffy) | |
1389 | - | |
1390 | 1409 | UTF-8: When 'delcombine' is set "dw" only deleted the last combining character |
1391 | 1410 | from the first character of the word. |
1392 | 1411 |
@@ -1733,6 +1752,9 @@ | ||
1733 | 1752 | Peek for a character to get any window resize events and fix 'columns' and |
1734 | 1753 | 'lines' to undo this. |
1735 | 1754 | |
1755 | +When using the GTK plug mechanism, resizing and focus was not working | |
1756 | +properly. (Neil Bird) | |
1757 | + | |
1736 | 1758 | After deleting files from the argument list a session file generated with |
1737 | 1759 | ":mksession" may contain invalid ":next" commands. |
1738 | 1760 |
@@ -0,0 +1,66 @@ | ||
1 | +*vimball.txt* Vimball Archiver Mar 20, 2006 | |
2 | +Author: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamily.AbizM> | |
3 | + (remove NOSPAM from Campbell's email first) | |
4 | +Copyright: (c) 2004-2006 by Charles E. Campbell, Jr. *Vimball-copyright* | |
5 | + The VIM LICENSE applies to Vimball.vim, and Vimball.txt | |
6 | + (see |copyright|) except use "Vimball" instead of "Vim". | |
7 | + No warranty, express or implied. | |
8 | + Use At-Your-Own-Risk! | |
9 | + | |
10 | +============================================================================== | |
11 | +1. Contents *vimball* *vimball-contents* | |
12 | + | |
13 | + 1. Contents......................................: |vimball-contents| | |
14 | + 2. Vimball Manual................................: |vimball-manual| | |
15 | + 3. Vimball History...............................: |vimball-history| | |
16 | + | |
17 | + | |
18 | +============================================================================== | |
19 | +2. Vimball Manual *vimball-manual* | |
20 | + | |
21 | + *:MkVimball* | |
22 | + :[range]MkVimball[!] filename | |
23 | + | |
24 | + This command takes lines holding a path to files to be included in | |
25 | + your vimball; as an example: > | |
26 | + plugin/something.vim | |
27 | + doc/something.txt | |
28 | +< using MkVimball on this range will create a file called | |
29 | + "filename.vba" which can be used by Vimball.vim to re-create these | |
30 | + files. If the "filename.vba" file already exists, then MkVimball | |
31 | + will issue a warning and not create the file. | |
32 | + | |
33 | + However, if you use the exclamation point (!), then MkVimball will | |
34 | + create the "filename.vba" file, overwriting it if it already exists. | |
35 | + This behavior resembles that for |:w|. | |
36 | + | |
37 | + *vimball-extract* | |
38 | + vim filename.vba | |
39 | + | |
40 | + Simply editing a Vimball will cause Vimball.vim to tell the user to | |
41 | + source the file to extract its contents. | |
42 | + | |
43 | + Extraction will only proceed if the first line of a putative vimball | |
44 | + file holds the "Vimball Archiver by Charles E. Campbell, Jr., Ph.D." | |
45 | + line. | |
46 | + | |
47 | + :VimballList *vimball-vimballlist* | |
48 | + | |
49 | + This command will tell Vimball to list the files in the archive, along | |
50 | + with their lengths in lines. | |
51 | + | |
52 | + | |
53 | +============================================================================== | |
54 | +3. Vimball History *vimball-history* | |
55 | + | |
56 | + 3 : Mar 20, 2006 * removed query, now requires sourcing to be | |
57 | + extracted (:so %). Message to that effect | |
58 | + included. | |
59 | + * :VimballList now shows files that would be | |
60 | + extracted. | |
61 | + 2 : Mar 20, 2006 * query, :UseVimball included | |
62 | + 1 : Mar 20, 2006 * initial release | |
63 | + | |
64 | + | |
65 | +============================================================================== | |
66 | +vim:tw=78:ts=8:ft=help:fdm=marker |
@@ -0,0 +1,256 @@ | ||
1 | +" vimball : construct a file containing both paths and files | |
2 | +" Author: Charles E. Campbell, Jr. | |
3 | +" Date: Mar 20, 2006 | |
4 | +" Version: 3 | |
5 | +" GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim | |
6 | +" Copyright: (c) 2004-2006 by Charles E. Campbell, Jr. | |
7 | +" The VIM LICENSE applies to Vimball.vim, and Vimball.txt | |
8 | +" (see |copyright|) except use "Vimball" instead of "Vim". | |
9 | +" No warranty, express or implied. | |
10 | +" *** *** Use At-Your-Own-Risk! *** *** | |
11 | + | |
12 | +" --------------------------------------------------------------------- | |
13 | +" Load Once: {{{1 | |
14 | +if &cp || exists("g:loaded_vimball") | |
15 | + finish | |
16 | +endif | |
17 | + | |
18 | +let s:keepcpo = &cpo | |
19 | +let g:loaded_vimball = "v3" | |
20 | +set cpo&vim | |
21 | + | |
22 | +" ------------------------------------------------------------------------------ | |
23 | +" Public Interface: {{{1 | |
24 | +com! -ra -na=+ -bang MkVimball call s:MkVimball(<line1>,<line2>,<bang>0,<f-args>) | |
25 | +com! -na=0 UseVimball call s:Vimball(1) | |
26 | +com! -na=0 VimballList call s:Vimball(0) | |
27 | +au BufReadPost *.vba echohl WarningMsg | echo "Source this file to extract it! (:so %)" | echohl None | |
28 | + | |
29 | +" ===================================================================== | |
30 | +" Functions: {{{1 | |
31 | + | |
32 | +" --------------------------------------------------------------------- | |
33 | +" MkVimball: creates a vimball given a list of paths to files {{{2 | |
34 | +" Vimball Format: | |
35 | +" path | |
36 | +" filesize | |
37 | +" [file] | |
38 | +" path | |
39 | +" filesize | |
40 | +" [file] | |
41 | +fun! s:MkVimball(line1,line2,writelevel,vimballname) range | |
42 | +" call Dfunc("MkVimball(line1=".a:line1." line2=".a:line2." writelevel=".a:writelevel." vimballname<".a:vimballname.">") | |
43 | + let vbname= substitute(a:vimballname,'\.[^.]*$','','e').'.vba' | |
44 | + if !a:writelevel && filereadable(vbname) | |
45 | + echohl Error | echoerr "(MkVimball) file<".vbname."> exists; use ! to insist" | echohl None | |
46 | +" call Dret("MkVimball : file<".vbname."> already exists; use ! to insist") | |
47 | + return | |
48 | + endif | |
49 | + | |
50 | + " user option bypass | |
51 | + let eikeep= &ei | |
52 | + set ei=all | |
53 | + | |
54 | + let home = substitute(&rtp,',.*$','','') | |
55 | + let curdir = getcwd() | |
56 | + exe "cd ".home | |
57 | + | |
58 | + " record current tab, initialize while loop index | |
59 | + let curtabnr = tabpagenr() | |
60 | + let linenr = a:line1 | |
61 | +" call Decho("curtabnr=".curtabnr) | |
62 | + | |
63 | + while linenr <= a:line2 | |
64 | + let svfile = getline(linenr) | |
65 | +" call Decho("svfile<".svfile.">") | |
66 | + | |
67 | + if !filereadable(svfile) | |
68 | + echohl Error | echo "unable to read file<".svfile.">" | echohl None | |
69 | + let &ei= eikeep | |
70 | + exe "cd ".curdir | |
71 | +" call Dret("MkVimball") | |
72 | + return | |
73 | + endif | |
74 | + | |
75 | + " create/switch to mkvimball tab | |
76 | + if !exists("vbtabnr") | |
77 | + tabnew | |
78 | + silent! file Vimball | |
79 | + let vbtabnr= tabpagenr() | |
80 | + else | |
81 | + exe "tabn ".vbtabnr | |
82 | + endif | |
83 | + | |
84 | + let lastline= line("$") + 1 | |
85 | + if lastline == 2 && getline("$") == "" | |
86 | + call setline(1,'" Vimball Archiver by Charles E. Campbell, Jr., Ph.D.') | |
87 | + call setline(2,'UseVimball') | |
88 | + call setline(3,'finish') | |
89 | + let lastline= 4 | |
90 | + endif | |
91 | + call setline(lastline ,svfile) | |
92 | + call setline(lastline+1,0) | |
93 | + exe "$r ".svfile | |
94 | + call setline(lastline+1,line("$") - lastline - 1) | |
95 | +" call Decho("lastline=".lastline." line$=".line("$")) | |
96 | + | |
97 | + " restore to normal tab | |
98 | + exe "tabn ".curtabnr | |
99 | + let linenr= linenr + 1 | |
100 | + endwhile | |
101 | + | |
102 | + " write the vimball | |
103 | + exe "tabn ".vbtabnr | |
104 | + exe "cd ".curdir | |
105 | + if a:really | |
106 | + if a:writelevel | |
107 | + exe "w! ".vbname | |
108 | + else | |
109 | + exe "w ".vbname | |
110 | + endif | |
111 | + endif | |
112 | +" call Decho("Vimball<".vbname."> created") | |
113 | + echo "Vimball<".vbname."> created" | |
114 | + | |
115 | + " remove the evidence | |
116 | + setlocal nomod bh=wipe | |
117 | + exe "tabn ".curtabnr | |
118 | + exe "tabc ".vbtabnr | |
119 | + | |
120 | + " restore options | |
121 | + let &ei= eikeep | |
122 | + | |
123 | +" call Dret("MkVimball") | |
124 | +endfun | |
125 | + | |
126 | +" --------------------------------------------------------------------- | |
127 | +" Vimball: {{{2 | |
128 | +fun! s:Vimball(really) | |
129 | +" call Dfunc("Vimball(really=".a:really.")") | |
130 | + | |
131 | + if getline(1) !~ '^" Vimball Archiver by Charles E. Campbell, Jr., Ph.D.$' | |
132 | + echoerr "(Vimball) The current file does not appear to be a Vimball!" | |
133 | +" call Dret("Vimball") | |
134 | + return | |
135 | + endif | |
136 | + | |
137 | + " initialize | |
138 | + let regakeep = @a | |
139 | + let eikeep = &ei | |
140 | + let vekeep = &ve | |
141 | + let makeep = getpos("'a") | |
142 | + let curtabnr = tabpagenr() | |
143 | + set ei=all ve=all | |
144 | + | |
145 | + " set up vimball tab | |
146 | + tabnew | |
147 | + silent! file Vimball | |
148 | + let vbtabnr= tabpagenr() | |
149 | + let didhelp= "" | |
150 | + | |
151 | + " go to vim plugin home | |
152 | + let home = substitute(&rtp,',.*$','','') | |
153 | + let curdir = getcwd() | |
154 | +" call Decho("exe cd ".home) | |
155 | + exe "cd ".home | |
156 | + let linenr = 4 | |
157 | + let filecnt = 0 | |
158 | + | |
159 | + " give title to listing of (extracted) files from Vimball Archive | |
160 | + if a:really | |
161 | + echohl Title | echomsg "Vimball Archive" | echohl None | |
162 | + else | |
163 | + echohl Title | echomsg "Vimball Archive Listing" | echohl None | |
164 | + endif | |
165 | + | |
166 | + " apportion vimball contents to various files | |
167 | +" call Decho("exe tabn ".curtabnr) | |
168 | + exe "tabn ".curtabnr | |
169 | +" call Decho("linenr=".linenr." line$=".line("$")) | |
170 | + while 1 < linenr && linenr < line("$") | |
171 | + let fname = getline(linenr) | |
172 | + let fsize = getline(linenr+1) | |
173 | + let filecnt = filecnt + 1 | |
174 | + if a:really | |
175 | + echomsg "extracted <".fname.">: ".fsize." lines" | |
176 | + else | |
177 | + echomsg "would extract <".fname.">: ".fsize." lines" | |
178 | + endif | |
179 | +" call Decho(linenr.": will extract file<".fname.">") | |
180 | +" call Decho((linenr+1).": fsize=".fsize) | |
181 | + | |
182 | + " make directories if they don't exist yet | |
183 | + let fnamebuf= fname | |
184 | + while fnamebuf =~ '/' | |
185 | + let dirname = substitute(fnamebuf,'/.*$','','e') | |
186 | + let fnamebuf = substitute(fnamebuf,'^.\{-}/\(.*\)$','\1','e') | |
187 | + if !isdirectory(dirname) | |
188 | +" call Decho("making <".dirname.">") | |
189 | + call mkdir(dirname) | |
190 | + endif | |
191 | + exe "cd ".dirname | |
192 | + endwhile | |
193 | + exe "cd ".home | |
194 | + | |
195 | + " grab specified qty of lines and place into "a" buffer | |
196 | + exe linenr | |
197 | + norm! jjma | |
198 | + exe (linenr + fsize + 1) | |
199 | + silent norm! "ay'a | |
200 | +" call Decho("yanked ".fsize." lines into register-a") | |
201 | + | |
202 | +" call Decho("didhelp<".didhelp."> fname<".fname.">") | |
203 | + if didhelp == "" && fname =~ 'doc/[^/]\+\.txt$' | |
204 | + let didhelp= substitute(fname,'^\(.*\<doc\)[/\\][^.]*\.txt$','\1','e') | |
205 | +" call Decho("didhelp<".didhelp.">") | |
206 | + endif | |
207 | + | |
208 | + " copy "a" buffer into tab | |
209 | +" call Decho('copy "a buffer into tab#'.vbtabnr) | |
210 | + exe "tabn ".vbtabnr | |
211 | + silent! %d | |
212 | + silent norm! "aPGdd1G | |
213 | +" call Decho("rega<".@a.">") | |
214 | + | |
215 | + " write tab to file | |
216 | +" call Decho("exe w! ".fname) | |
217 | + exe "silent w! ".fname | |
218 | + | |
219 | +" call Decho("exe tabn ".curtabnr) | |
220 | + exe "tabn ".curtabnr | |
221 | +" let oldlinenr = linenr " Decho | |
222 | + let linenr = linenr + fsize + 2 | |
223 | +" call Decho("update linenr= [linenr=".oldlinenr."] + [fsize=".fsize."] + 2 = ".linenr) | |
224 | + endwhile | |
225 | + | |
226 | + " set up help | |
227 | +" call Decho("about to set up help: didhelp<".didhelp.">") | |
228 | + if didhelp != "" | |
229 | +" call Decho("exe helptags ".home."/".didhelp) | |
230 | + exe "helptags ".home."/".didhelp | |
231 | + echomsg "did helptags" | |
232 | + endif | |
233 | + | |
234 | + " make sure a "Press ENTER..." prompt appears to keep the messages showing! | |
235 | + while filecnt < &ch | |
236 | + echomsg " " | |
237 | + let filecnt= filecnt + 1 | |
238 | + endwhile | |
239 | + | |
240 | + " restore events, delete tab and buffer | |
241 | + exe "tabn ".vbtabnr | |
242 | + setlocal nomod bh=wipe | |
243 | + exe "tabn ".curtabnr | |
244 | + exe "tabc ".vbtabnr | |
245 | + let &ei= eikeep | |
246 | + let @a = regakeep | |
247 | + if makeep[0] != 0 | |
248 | + " restore mark a | |
249 | +" call Decho("restore mark-a: makeep=".string(makeep)) | |
250 | + call setpos("'a",makeep) | |
251 | + ka | |
252 | + endif | |
253 | + exe "cd ".curdir | |
254 | + | |
255 | +" call Dret("Vimball") | |
256 | +endfun |
@@ -19382,7 +19382,7 @@ | ||
19382 | 19382 | } |
19383 | 19383 | } |
19384 | 19384 | #ifdef FEAT_PROFILE |
19385 | - if (do_profiling) | |
19385 | + if (do_profiling == PROF_YES) | |
19386 | 19386 | { |
19387 | 19387 | if (!fp->uf_profiling && has_profiling(FALSE, fp->uf_name, NULL)) |
19388 | 19388 | func_do_profile(fp); |
@@ -19417,7 +19417,8 @@ | ||
19417 | 19417 | } |
19418 | 19418 | |
19419 | 19419 | #ifdef FEAT_PROFILE |
19420 | - if (fp->uf_profiling || (fc.caller != NULL && &fc.caller->func->uf_profiling)) | |
19420 | + if (do_profiling == PROF_YES && (fp->uf_profiling | |
19421 | + || (fc.caller != NULL && &fc.caller->func->uf_profiling))) | |
19421 | 19422 | { |
19422 | 19423 | profile_end(&fp->uf_tm_start); |
19423 | 19424 | profile_sub_wait(&wait_start, &fp->uf_tm_start); |
@@ -19467,7 +19468,7 @@ | ||
19467 | 19468 | sourcing_lnum = save_sourcing_lnum; |
19468 | 19469 | current_SID = save_current_SID; |
19469 | 19470 | #ifdef FEAT_PROFILE |
19470 | - if (do_profiling) | |
19471 | + if (do_profiling == PROF_YES) | |
19471 | 19472 | script_prof_restore(&wait_start); |
19472 | 19473 | #endif |
19473 | 19474 |
@@ -19710,7 +19711,7 @@ | ||
19710 | 19711 | fcp->dbg_tick = debug_tick; |
19711 | 19712 | } |
19712 | 19713 | #ifdef FEAT_PROFILE |
19713 | - if (do_profiling) | |
19714 | + if (do_profiling == PROF_YES) | |
19714 | 19715 | func_line_end(cookie); |
19715 | 19716 | #endif |
19716 | 19717 |
@@ -19731,7 +19732,7 @@ | ||
19731 | 19732 | retval = vim_strsave(((char_u **)(gap->ga_data))[fcp->linenr++]); |
19732 | 19733 | sourcing_lnum = fcp->linenr; |
19733 | 19734 | #ifdef FEAT_PROFILE |
19734 | - if (do_profiling) | |
19735 | + if (do_profiling == PROF_YES) | |
19735 | 19736 | func_line_start(cookie); |
19736 | 19737 | #endif |
19737 | 19738 | } |
@@ -821,12 +821,22 @@ | ||
821 | 821 | EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR), |
822 | 822 | EX(CMD_smagic, "smagic", ex_submagic, |
823 | 823 | RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY), |
824 | +EX(CMD_smap, "smap", ex_map, | |
825 | + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), | |
826 | +EX(CMD_smapclear, "smapclear", ex_mapclear, | |
827 | + EXTRA|TRLBAR|CMDWIN), | |
828 | +EX(CMD_smenu, "smenu", ex_menu, | |
829 | + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), | |
824 | 830 | EX(CMD_snext, "snext", ex_next, |
825 | 831 | RANGE|NOTADR|BANG|FILES|EDITCMD|ARGOPT|TRLBAR), |
826 | 832 | EX(CMD_sniff, "sniff", ex_sniff, |
827 | 833 | EXTRA|TRLBAR), |
828 | 834 | EX(CMD_snomagic, "snomagic", ex_submagic, |
829 | 835 | RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY), |
836 | +EX(CMD_snoremap, "snoremap", ex_map, | |
837 | + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), | |
838 | +EX(CMD_snoremenu, "snoremenu", ex_menu, | |
839 | + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), | |
830 | 840 | EX(CMD_source, "source", ex_source, |
831 | 841 | BANG|FILE1|TRLBAR|SBOXOK|CMDWIN), |
832 | 842 | EX(CMD_sort, "sort", ex_sort, |
@@ -867,6 +877,10 @@ | ||
867 | 877 | BANG|TRLBAR|WORD1), |
868 | 878 | EX(CMD_sunhide, "sunhide", ex_buffer_all, |
869 | 879 | RANGE|NOTADR|COUNT|TRLBAR), |
880 | +EX(CMD_sunmap, "sunmap", ex_unmap, | |
881 | + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), | |
882 | +EX(CMD_sunmenu, "sunmenu", ex_menu, | |
883 | + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), | |
870 | 884 | EX(CMD_suspend, "suspend", ex_stop, |
871 | 885 | TRLBAR|BANG|CMDWIN), |
872 | 886 | EX(CMD_sview, "sview", ex_splitview, |
@@ -1035,6 +1049,20 @@ | ||
1035 | 1049 | RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR|CMDWIN), |
1036 | 1050 | EX(CMD_xall, "xall", do_wqall, |
1037 | 1051 | BANG|TRLBAR), |
1052 | +EX(CMD_xmap, "xmap", ex_map, | |
1053 | + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), | |
1054 | +EX(CMD_xmapclear, "xmapclear", ex_mapclear, | |
1055 | + EXTRA|TRLBAR|CMDWIN), | |
1056 | +EX(CMD_xmenu, "xmenu", ex_menu, | |
1057 | + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), | |
1058 | +EX(CMD_xnoremap, "xnoremap", ex_map, | |
1059 | + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), | |
1060 | +EX(CMD_xnoremenu, "xnoremenu", ex_menu, | |
1061 | + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), | |
1062 | +EX(CMD_xunmap, "xunmap", ex_unmap, | |
1063 | + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), | |
1064 | +EX(CMD_xunmenu, "xunmenu", ex_menu, | |
1065 | + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), | |
1038 | 1066 | EX(CMD_yank, "yank", ex_operators, |
1039 | 1067 | RANGE|WHOLEFOLD|REGSTR|COUNT|TRLBAR|CMDWIN), |
1040 | 1068 | EX(CMD_z, "z", ex_z, |
@@ -28,6 +28,8 @@ | ||
28 | 28 | char_u *text; |
29 | 29 | static char_u *result = NULL; |
30 | 30 | long winnr = 0; |
31 | + char_u *bexpr; | |
32 | + buf_T *save_curbuf; | |
31 | 33 | #ifdef FEAT_WINDOWS |
32 | 34 | win_T *cw; |
33 | 35 | #endif |
@@ -39,39 +41,51 @@ | ||
39 | 41 | return; |
40 | 42 | |
41 | 43 | #ifdef FEAT_EVAL |
42 | - if (*p_bexpr != NUL | |
43 | - && get_beval_info(balloonEval, TRUE, &wp, &lnum, &text, &col) == OK) | |
44 | + if (get_beval_info(balloonEval, TRUE, &wp, &lnum, &text, &col) == OK) | |
44 | 45 | { |
46 | + bexpr = (*wp->w_buffer->b_p_bexpr == NUL) ? p_bexpr | |
47 | + : wp->w_buffer->b_p_bexpr; | |
48 | + if (*bexpr != NUL) | |
49 | + { | |
45 | 50 | # ifdef FEAT_WINDOWS |
46 | - /* Convert window pointer to number. */ | |
47 | - for (cw = firstwin; cw != wp; cw = cw->w_next) | |
48 | - ++winnr; | |
51 | + /* Convert window pointer to number. */ | |
52 | + for (cw = firstwin; cw != wp; cw = cw->w_next) | |
53 | + ++winnr; | |
49 | 54 | # endif |
50 | 55 | |
51 | - set_vim_var_nr(VV_BEVAL_BUFNR, (long)wp->w_buffer->b_fnum); | |
52 | - set_vim_var_nr(VV_BEVAL_WINNR, winnr); | |
53 | - set_vim_var_nr(VV_BEVAL_LNUM, (long)lnum); | |
54 | - set_vim_var_nr(VV_BEVAL_COL, (long)(col + 1)); | |
55 | - set_vim_var_string(VV_BEVAL_TEXT, text, -1); | |
56 | - vim_free(text); | |
57 | - | |
58 | - use_sandbox = was_set_insecurely((char_u *)"balloonexpr", 0); | |
59 | - if (use_sandbox) | |
60 | - ++sandbox; | |
61 | - ++textlock; | |
56 | + set_vim_var_nr(VV_BEVAL_BUFNR, (long)wp->w_buffer->b_fnum); | |
57 | + set_vim_var_nr(VV_BEVAL_WINNR, winnr); | |
58 | + set_vim_var_nr(VV_BEVAL_LNUM, (long)lnum); | |
59 | + set_vim_var_nr(VV_BEVAL_COL, (long)(col + 1)); | |
60 | + set_vim_var_string(VV_BEVAL_TEXT, text, -1); | |
61 | + vim_free(text); | |
62 | 62 | |
63 | - vim_free(result); | |
64 | - result = eval_to_string(p_bexpr, NULL, TRUE); | |
63 | + /* | |
64 | + * Temporarily change the curbuf, so that we can determine whether | |
65 | + * the buffer-local balloonexpr option was set insecurly. | |
66 | + */ | |
67 | + save_curbuf = curbuf; | |
68 | + curbuf = wp->w_buffer; | |
69 | + use_sandbox = was_set_insecurely((char_u *)"balloonexpr", | |
70 | + *curbuf->b_p_bexpr == NUL ? 0 : OPT_LOCAL); | |
71 | + curbuf = save_curbuf; | |
72 | + if (use_sandbox) | |
73 | + ++sandbox; | |
74 | + ++textlock; | |
65 | 75 | |
66 | - if (use_sandbox) | |
67 | - --sandbox; | |
68 | - --textlock; | |
76 | + vim_free(result); | |
77 | + result = eval_to_string(bexpr, NULL, TRUE); | |
69 | 78 | |
70 | - set_vim_var_string(VV_BEVAL_TEXT, NULL, -1); | |
71 | - if (result != NULL && result[0] != NUL) | |
72 | - { | |
73 | - gui_mch_post_balloon(beval, result); | |
74 | - return; | |
79 | + if (use_sandbox) | |
80 | + --sandbox; | |
81 | + --textlock; | |
82 | + | |
83 | + set_vim_var_string(VV_BEVAL_TEXT, NULL, -1); | |
84 | + if (result != NULL && result[0] != NUL) | |
85 | + { | |
86 | + gui_mch_post_balloon(beval, result); | |
87 | + return; | |
88 | + } | |
75 | 89 | } |
76 | 90 | } |
77 | 91 | #endif |
@@ -806,9 +806,9 @@ | ||
806 | 806 | if (blink_state == BLINK_NONE) |
807 | 807 | gui_mch_start_blink(); |
808 | 808 | |
809 | - /* make sure keyboard input goes there */ | |
810 | - if (gtk_socket_id == 0) | |
811 | - gtk_widget_grab_focus(gui.drawarea); | |
809 | + /* make sure keyboard input goes to the draw area (if this is focus for a window) */ | |
810 | + if (widget != gui.drawarea) | |
811 | + gtk_widget_grab_focus(gui.drawarea); | |
812 | 812 | |
813 | 813 | return TRUE; |
814 | 814 | } |
@@ -2837,14 +2837,21 @@ | ||
2837 | 2837 | if (using_gnome && widget != NULL) |
2838 | 2838 | { |
2839 | 2839 | # ifdef HAVE_GTK2 |
2840 | + GtkWidget *parent; | |
2840 | 2841 | BonoboDockItem *dockitem; |
2841 | 2842 | |
2842 | - widget = gtk_widget_get_parent(widget); | |
2843 | - dockitem = BONOBO_DOCK_ITEM(widget); | |
2844 | - | |
2845 | - if (dockitem == NULL || dockitem->is_floating) | |
2846 | - return 0; | |
2847 | - item_orientation = bonobo_dock_item_get_orientation(dockitem); | |
2843 | + parent = gtk_widget_get_parent(widget); | |
2844 | + if (G_TYPE_FROM_INSTANCE(parent) == BONOBO_TYPE_DOCK_ITEM) | |
2845 | + { | |
2846 | + /* Only menu & toolbar are dock items. Could tabline be? | |
2847 | + * Seem to be only the 2 defined in GNOME */ | |
2848 | + widget = parent; | |
2849 | + dockitem = BONOBO_DOCK_ITEM(widget); | |
2850 | + | |
2851 | + if (dockitem == NULL || dockitem->is_floating) | |
2852 | + return 0; | |
2853 | + item_orientation = bonobo_dock_item_get_orientation(dockitem); | |
2854 | + } | |
2848 | 2855 | # else |
2849 | 2856 | GnomeDockItem *dockitem; |
2850 | 2857 |
@@ -2911,16 +2918,39 @@ | ||
2911 | 2918 | return height; |
2912 | 2919 | } |
2913 | 2920 | |
2921 | +/* This controls whether we can set the real window hints at | |
2922 | + * start-up when in a GtkPlug. | |
2923 | + * 0 = normal processing (default) | |
2924 | + * 1 = init. hints set, no-one's tried to reset since last check | |
2925 | + * 2 = init. hints set, attempt made to change hints | |
2926 | + */ | |
2927 | +static int init_window_hints_state = 0; | |
2928 | + | |
2914 | 2929 | static void |
2915 | -update_window_manager_hints(void) | |
2930 | +update_window_manager_hints(int force_width, int force_height) | |
2916 | 2931 | { |
2917 | 2932 | static int old_width = 0; |
2918 | 2933 | static int old_height = 0; |
2934 | + static int old_min_width = 0; | |
2935 | + static int old_min_height = 0; | |
2919 | 2936 | static int old_char_width = 0; |
2920 | 2937 | static int old_char_height = 0; |
2921 | 2938 | |
2922 | 2939 | int width; |
2923 | 2940 | int height; |
2941 | + int min_width; | |
2942 | + int min_height; | |
2943 | + | |
2944 | + /* At start-up, don't try to set the hints until the initial | |
2945 | + * values have been used (those that dictate our initial size) | |
2946 | + * Let forced (i.e., correct) values thruogh always. | |
2947 | + */ | |
2948 | + if (!(force_width && force_height) && init_window_hints_state > 0) | |
2949 | + { | |
2950 | + /* Don't do it! */ | |
2951 | + init_window_hints_state = 2; | |
2952 | + return; | |
2953 | + } | |
2924 | 2954 | |
2925 | 2955 | /* This also needs to be done when the main window isn't there yet, |
2926 | 2956 | * otherwise the hints don't work. */ |
@@ -2934,9 +2964,28 @@ | ||
2934 | 2964 | height += get_menu_tool_height(); |
2935 | 2965 | # endif |
2936 | 2966 | |
2967 | + /* GtkSockets use GtkPlug's [gui,mainwin] min-size hints to determine | |
2968 | + * their actual widget size. When we set our size ourselve (e.g., | |
2969 | + * 'set columns=' or init. -geom) we briefly set the min. to the size | |
2970 | + * we wish to be instead of the legitimate minimum so that we actually | |
2971 | + * resize correctly. | |
2972 | + */ | |
2973 | + if (force_width && force_height) | |
2974 | + { | |
2975 | + min_width = force_width; | |
2976 | + min_height = force_height; | |
2977 | + } | |
2978 | + else | |
2979 | + { | |
2980 | + min_width = width + MIN_COLUMNS * gui.char_width; | |
2981 | + min_height = height + MIN_LINES * gui.char_height; | |
2982 | + } | |
2983 | + | |
2937 | 2984 | /* Avoid an expose event when the size didn't change. */ |
2938 | 2985 | if (width != old_width |
2939 | 2986 | || height != old_height |
2987 | + || min_width != old_min_width | |
2988 | + || min_height != old_min_height | |
2940 | 2989 | || gui.char_width != old_char_width |
2941 | 2990 | || gui.char_height != old_char_height) |
2942 | 2991 | { |
@@ -2947,8 +2996,8 @@ | ||
2947 | 2996 | geometry.height_inc = gui.char_height; |
2948 | 2997 | geometry.base_width = width; |
2949 | 2998 | geometry.base_height = height; |
2950 | - geometry.min_width = width + MIN_COLUMNS * gui.char_width; | |
2951 | - geometry.min_height = height + MIN_LINES * gui.char_height; | |
2999 | + geometry.min_width = min_width; | |
3000 | + geometry.min_height = min_height; | |
2952 | 3001 | geometry_mask = GDK_HINT_BASE_SIZE|GDK_HINT_RESIZE_INC |
2953 | 3002 | |GDK_HINT_MIN_SIZE; |
2954 | 3003 | # ifdef HAVE_GTK2 |
@@ -2961,10 +3010,12 @@ | ||
2961 | 3010 | gtk_window_set_geometry_hints(GTK_WINDOW(gui.mainwin), gui.formwin, |
2962 | 3011 | &geometry, geometry_mask); |
2963 | 3012 | # endif |
2964 | - old_width = width; | |
2965 | - old_height = height; | |
2966 | - old_char_width = gui.char_width; | |
2967 | - old_char_height = gui.char_height; | |
3013 | + old_width = width; | |
3014 | + old_height = height; | |
3015 | + old_min_width = min_width; | |
3016 | + old_min_height = min_height; | |
3017 | + old_char_width = gui.char_width; | |
3018 | + old_char_height = gui.char_height; | |
2968 | 3019 | } |
2969 | 3020 | } |
2970 | 3021 |
@@ -3211,7 +3262,7 @@ | ||
3211 | 3262 | { |
3212 | 3263 | /* Note: this may cause a resize event */ |
3213 | 3264 | gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gui.tabline), showit); |
3214 | - update_window_manager_hints(); | |
3265 | + update_window_manager_hints(0, 0); | |
3215 | 3266 | #ifndef HAVE_GTK2 |
3216 | 3267 | showing_tabline = showit; |
3217 | 3268 | #endif |
@@ -3583,35 +3634,31 @@ | ||
3583 | 3634 | /* |
3584 | 3635 | * Use a Notebook for the tab pages labels. The labels are hidden by |
3585 | 3636 | * default. |
3586 | - * TODO: currently doesn't work for Gnome. | |
3587 | 3637 | */ |
3588 | - if (!using_gnome) | |
3589 | - { | |
3590 | - gui.tabline = gtk_notebook_new(); | |
3591 | - gtk_widget_show(gui.tabline); | |
3592 | - gtk_box_pack_start(GTK_BOX(vbox), gui.tabline, FALSE, FALSE, 0); | |
3593 | - gtk_notebook_set_show_border(GTK_NOTEBOOK(gui.tabline), FALSE); | |
3594 | - gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gui.tabline), FALSE); | |
3595 | - | |
3596 | - { | |
3597 | - GtkWidget *page, *label; | |
3598 | - | |
3599 | - /* Add the first tab. */ | |
3600 | - page = gtk_vbox_new(FALSE, 0); | |
3601 | - gtk_widget_show(page); | |
3602 | - gtk_container_add(GTK_CONTAINER(gui.tabline), page); | |
3603 | - label = gtk_label_new("-Empty-"); | |
3604 | - gtk_widget_show(label); | |
3605 | - gtk_notebook_set_tab_label(GTK_NOTEBOOK(gui.tabline), page, label); | |
3606 | - } | |
3607 | - gtk_signal_connect(GTK_OBJECT(gui.tabline), "switch_page", | |
3608 | - GTK_SIGNAL_FUNC(on_select_tab), NULL); | |
3609 | - | |
3610 | - /* Create a popup menu for the tab line and connect it. */ | |
3611 | - tabline_menu = create_tabline_menu(); | |
3612 | - gtk_signal_connect_object(GTK_OBJECT(gui.tabline), "button_press_event", | |
3613 | - GTK_SIGNAL_FUNC(on_tabline_menu), GTK_OBJECT(tabline_menu)); | |
3614 | - } | |
3638 | + gui.tabline = gtk_notebook_new(); | |
3639 | + gtk_widget_show(gui.tabline); | |
3640 | + gtk_box_pack_start(GTK_BOX(vbox), gui.tabline, FALSE, FALSE, 0); | |
3641 | + gtk_notebook_set_show_border(GTK_NOTEBOOK(gui.tabline), FALSE); | |
3642 | + gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gui.tabline), FALSE); | |
3643 | + | |
3644 | + { | |
3645 | + GtkWidget *page, *label; | |
3646 | + | |
3647 | + /* Add the first tab. */ | |
3648 | + page = gtk_vbox_new(FALSE, 0); | |
3649 | + gtk_widget_show(page); | |
3650 | + gtk_container_add(GTK_CONTAINER(gui.tabline), page); | |
3651 | + label = gtk_label_new("-Empty-"); | |
3652 | + gtk_widget_show(label); | |
3653 | + gtk_notebook_set_tab_label(GTK_NOTEBOOK(gui.tabline), page, label); | |
3654 | + } | |
3655 | + gtk_signal_connect(GTK_OBJECT(gui.tabline), "switch_page", | |
3656 | + GTK_SIGNAL_FUNC(on_select_tab), NULL); | |
3657 | + | |
3658 | + /* Create a popup menu for the tab line and connect it. */ | |
3659 | + tabline_menu = create_tabline_menu(); | |
3660 | + gtk_signal_connect_object(GTK_OBJECT(gui.tabline), "button_press_event", | |
3661 | + GTK_SIGNAL_FUNC(on_tabline_menu), GTK_OBJECT(tabline_menu)); | |
3615 | 3662 | #endif |
3616 | 3663 | |
3617 | 3664 | gui.formwin = gtk_form_new(); |
@@ -3705,10 +3752,30 @@ | ||
3705 | 3752 | GTK_SIGNAL_FUNC(enter_notify_event), NULL); |
3706 | 3753 | } |
3707 | 3754 | |
3708 | - gtk_signal_connect(GTK_OBJECT(gui.mainwin), "focus_out_event", | |
3709 | - GTK_SIGNAL_FUNC(focus_out_event), NULL); | |
3710 | - gtk_signal_connect(GTK_OBJECT(gui.mainwin), "focus_in_event", | |
3711 | - GTK_SIGNAL_FUNC(focus_in_event), NULL); | |
3755 | + /* Real windows can get focus ... GtkPlug, being a mere container can't, | |
3756 | + * only its widgets. Arguably, this could be common code and we not use | |
3757 | + * the window focus at all, but let's be safe. | |
3758 | + */ | |
3759 | + if (gtk_socket_id == 0) | |
3760 | + { | |
3761 | + gtk_signal_connect(GTK_OBJECT(gui.mainwin), "focus_out_event", | |
3762 | + GTK_SIGNAL_FUNC(focus_out_event), NULL); | |
3763 | + gtk_signal_connect(GTK_OBJECT(gui.mainwin), "focus_in_event", | |
3764 | + GTK_SIGNAL_FUNC(focus_in_event), NULL); | |
3765 | + } | |
3766 | + else | |
3767 | + { | |
3768 | + gtk_signal_connect(GTK_OBJECT(gui.drawarea), "focus_out_event", | |
3769 | + GTK_SIGNAL_FUNC(focus_out_event), NULL); | |
3770 | + gtk_signal_connect(GTK_OBJECT(gui.drawarea), "focus_in_event", | |
3771 | + GTK_SIGNAL_FUNC(focus_in_event), NULL); | |
3772 | +#ifdef FEAT_GUI_TABLINE | |
3773 | + gtk_signal_connect(GTK_OBJECT(gui.tabline), "focus_out_event", | |
3774 | + GTK_SIGNAL_FUNC(focus_out_event), NULL); | |
3775 | + gtk_signal_connect(GTK_OBJECT(gui.tabline), "focus_in_event", | |
3776 | + GTK_SIGNAL_FUNC(focus_in_event), NULL); | |
3777 | +#endif /* FEAT_GUI_TABLINE */ | |
3778 | + } | |
3712 | 3779 | |
3713 | 3780 | gtk_signal_connect(GTK_OBJECT(gui.drawarea), "motion_notify_event", |
3714 | 3781 | GTK_SIGNAL_FUNC(motion_notify_event), NULL); |
@@ -3793,8 +3860,17 @@ | ||
3793 | 3860 | form_configure_event(GtkWidget *widget, GdkEventConfigure *event, |
3794 | 3861 | gpointer data) |
3795 | 3862 | { |
3863 | + int usable_height = event->height; | |
3864 | + | |
3865 | + /* When in a GtkPlug, we can't guarantee valid heights (as a round | |
3866 | + * no. of char-heights), so we have to manually sanitise them. | |
3867 | + * Widths seem to sort themselves out, don't ask me why. | |
3868 | + */ | |
3869 | + if (gtk_socket_id != 0) | |
3870 | + usable_height -= (gui.char_height - (gui.char_height/2)); /* sic. */ | |
3871 | + | |
3796 | 3872 | gtk_form_freeze(GTK_FORM(gui.formwin)); |
3797 | - gui_resize_shell(event->width, event->height); | |
3873 | + gui_resize_shell(event->width, usable_height); | |
3798 | 3874 | gtk_form_thaw(GTK_FORM(gui.formwin)); |
3799 | 3875 | |
3800 | 3876 | return TRUE; |
@@ -3824,6 +3900,37 @@ | ||
3824 | 3900 | } |
3825 | 3901 | } |
3826 | 3902 | |
3903 | + | |
3904 | +/* | |
3905 | + * Bit of a hack to ensure we start GtkPlug windows with the correct window | |
3906 | + * hints (and thus the required size from -geom), but that after that we | |
3907 | + * put the hints back to normal (the actual minimum size) so we may | |
3908 | + * subsequently be resized smaller. GtkSocket (the parent end) uses the | |
3909 | + * plug's window 'min hints to set *it's* minum size, but that's also the | |
3910 | + * only way we have of making ourselves bigger (by set lines/columns). | |
3911 | + * Thus set hints at start-up to ensure correct init. size, then a | |
3912 | + * second after the final attempt to reset the real minimum hinst (done by | |
3913 | + * scrollbar init.), actually do the sttandard hinst and stop the timer. | |
3914 | + * We'll not let the default hints be set while this timer's active. | |
3915 | + */ | |
3916 | +/*ARGSUSED*/ | |
3917 | + static gboolean | |
3918 | +check_startup_plug_hints(gpointer data) | |
3919 | +{ | |
3920 | + if (init_window_hints_state == 1) | |
3921 | + { | |
3922 | + /* Safe to use normal hints now */ | |
3923 | + init_window_hints_state = 0; | |
3924 | + update_window_manager_hints(0, 0); | |
3925 | + return FALSE; /* stop timer */ | |
3926 | + } | |
3927 | + | |
3928 | + /* Keep on trying */ | |
3929 | + init_window_hints_state = 1; | |
3930 | + return TRUE; | |
3931 | +} | |
3932 | + | |
3933 | + | |
3827 | 3934 | /* |
3828 | 3935 | * Open the GUI window which was created by a call to gui_mch_init(). |
3829 | 3936 | */ |
@@ -3887,12 +3994,32 @@ | ||
3887 | 3994 | #endif |
3888 | 3995 | vim_free(gui.geom); |
3889 | 3996 | gui.geom = NULL; |
3997 | + | |
3998 | + /* From now until everyone's stopped trying to set the window hints | |
3999 | + * to their correct minimum values, stop them being set as we need | |
4000 | + * them to remain at our required size for the parent GtkSocket to | |
4001 | + * give us the right initial size. | |
4002 | + */ | |
4003 | + if (gtk_socket_id != 0 && (mask & WidthValue || mask & HeightValue)) | |
4004 | + { | |
4005 | + guint pixel_width = (guint)(gui_get_base_width() + Columns * gui.char_width); | |
4006 | + guint pixel_height = (guint)(gui_get_base_height() + Rows * gui.char_height); | |
4007 | + | |
4008 | +#ifdef HAVE_GTK2 | |
4009 | + pixel_width += get_menu_tool_width(); | |
4010 | + pixel_height += get_menu_tool_height(); | |
4011 | +#endif | |
4012 | + | |
4013 | + update_window_manager_hints(pixel_width, pixel_height); | |
4014 | + init_window_hints_state = 1; | |
4015 | + g_timeout_add(1000, check_startup_plug_hints, NULL); | |
4016 | + } | |
3890 | 4017 | } |
3891 | 4018 | |
3892 | 4019 | gtk_form_set_size(GTK_FORM(gui.formwin), |
3893 | 4020 | (guint)(gui_get_base_width() + Columns * gui.char_width), |
3894 | 4021 | (guint)(gui_get_base_height() + Rows * gui.char_height)); |
3895 | - update_window_manager_hints(); | |
4022 | + update_window_manager_hints(0, 0); | |
3896 | 4023 | |
3897 | 4024 | if (foreground_argument != NULL) |
3898 | 4025 | fg_pixel = gui_get_color((char_u *)foreground_argument); |
@@ -4125,17 +4252,25 @@ | ||
4125 | 4252 | /* give GTK+ a chance to put all widget's into place */ |
4126 | 4253 | gui_mch_update(); |
4127 | 4254 | |
4255 | +#ifndef HAVE_GTK2 | |
4128 | 4256 | /* this will cause the proper resizement to happen too */ |
4129 | - update_window_manager_hints(); | |
4130 | - | |
4131 | -#ifdef HAVE_GTK2 | |
4257 | + update_window_manager_hints(0, 0); | |
4258 | + | |
4259 | +#else /* HAVE_GTK2 */ | |
4260 | + /* this will cause the proper resizement to happen too */ | |
4261 | + if (gtk_socket_id == 0) | |
4262 | + update_window_manager_hints(0, 0); | |
4263 | + | |
4132 | 4264 | /* With GTK+ 2, changing the size of the form widget doesn't resize |
4133 | - * the window. So lets do it the other way around and resize the | |
4265 | + * the window. So let's do it the other way around and resize the | |
4134 | 4266 | * main window instead. */ |
4135 | 4267 | width += get_menu_tool_width(); |
4136 | 4268 | height += get_menu_tool_height(); |
4137 | 4269 | |
4138 | - gtk_window_resize(GTK_WINDOW(gui.mainwin), width, height); | |
4270 | + if (gtk_socket_id == 0) | |
4271 | + gtk_window_resize(GTK_WINDOW(gui.mainwin), width, height); | |
4272 | + else | |
4273 | + update_window_manager_hints(width, height); | |
4139 | 4274 | |
4140 | 4275 | #if 0 |
4141 | 4276 | if (!resize_idle_installed) |
@@ -4231,7 +4366,7 @@ | ||
4231 | 4366 | else |
4232 | 4367 | gtk_widget_hide(widget); |
4233 | 4368 | |
4234 | - update_window_manager_hints(); | |
4369 | + update_window_manager_hints(0, 0); | |
4235 | 4370 | } |
4236 | 4371 | } |
4237 | 4372 | #endif /* FEAT_MENU */ |
@@ -4262,7 +4397,7 @@ | ||
4262 | 4397 | else |
4263 | 4398 | gtk_widget_hide(widget); |
4264 | 4399 | |
4265 | - update_window_manager_hints(); | |
4400 | + update_window_manager_hints(0, 0); | |
4266 | 4401 | } |
4267 | 4402 | } |
4268 | 4403 | #endif /* FEAT_TOOLBAR */ |
@@ -4960,7 +5095,7 @@ | ||
4960 | 5095 | #endif /* !HAVE_GTK2 */ |
4961 | 5096 | |
4962 | 5097 | /* Preserve the logical dimensions of the screen. */ |
4963 | - update_window_manager_hints(); | |
5098 | + update_window_manager_hints(0, 0); | |
4964 | 5099 | |
4965 | 5100 | return OK; |
4966 | 5101 | } |
@@ -6577,7 +6712,7 @@ | ||
6577 | 6712 | else |
6578 | 6713 | gtk_widget_hide(sb->id); |
6579 | 6714 | |
6580 | - update_window_manager_hints(); | |
6715 | + update_window_manager_hints(0, 0); | |
6581 | 6716 | } |
6582 | 6717 | |
6583 | 6718 |
@@ -739,6 +739,7 @@ | ||
739 | 739 | switch (1 << i) |
740 | 740 | { |
741 | 741 | case MENU_VISUAL_MODE: |
742 | + case MENU_SELECT_MODE: | |
742 | 743 | case MENU_OP_PENDING_MODE: |
743 | 744 | case MENU_CMDLINE_MODE: |
744 | 745 | c = Ctrl_C; |
@@ -1464,8 +1465,14 @@ | ||
1464 | 1465 | switch (*cmd++) |
1465 | 1466 | { |
1466 | 1467 | case 'v': /* vmenu, vunmenu, vnoremenu */ |
1468 | + modes = MENU_VISUAL_MODE | MENU_SELECT_MODE; | |
1469 | + break; | |
1470 | + case 'x': /* xmenu, xunmenu, xnoremenu */ | |
1467 | 1471 | modes = MENU_VISUAL_MODE; |
1468 | 1472 | break; |
1473 | + case 's': /* smenu, sunmenu, snoremenu */ | |
1474 | + modes = MENU_SELECT_MODE; | |
1475 | + break; | |
1469 | 1476 | case 'o': /* omenu */ |
1470 | 1477 | modes = MENU_OP_PENDING_MODE; |
1471 | 1478 | break; |
@@ -1480,7 +1487,8 @@ | ||
1480 | 1487 | break; |
1481 | 1488 | case 'a': /* amenu */ |
1482 | 1489 | modes = MENU_INSERT_MODE | MENU_CMDLINE_MODE | MENU_NORMAL_MODE |
1483 | - | MENU_VISUAL_MODE | MENU_OP_PENDING_MODE; | |
1490 | + | MENU_VISUAL_MODE | MENU_SELECT_MODE | |
1491 | + | MENU_OP_PENDING_MODE; | |
1484 | 1492 | break; |
1485 | 1493 | case 'n': |
1486 | 1494 | if (*cmd != 'o') /* nmenu, not noremenu */ |
@@ -1494,7 +1502,7 @@ | ||
1494 | 1502 | if (forceit) /* menu!! */ |
1495 | 1503 | modes = MENU_INSERT_MODE | MENU_CMDLINE_MODE; |
1496 | 1504 | else /* menu */ |
1497 | - modes = MENU_NORMAL_MODE | MENU_VISUAL_MODE | |
1505 | + modes = MENU_NORMAL_MODE | MENU_VISUAL_MODE | MENU_SELECT_MODE | |
1498 | 1506 | | MENU_OP_PENDING_MODE; |
1499 | 1507 | } |
1500 | 1508 |
@@ -1545,7 +1553,12 @@ | ||
1545 | 1553 | idx = MENU_INDEX_CMDLINE; |
1546 | 1554 | #ifdef FEAT_VISUAL |
1547 | 1555 | else if (VIsual_active) |
1548 | - idx = MENU_INDEX_VISUAL; | |
1556 | + { | |
1557 | + if (VIsual_select) | |
1558 | + idx = MENU_INDEX_SELECT; | |
1559 | + else | |
1560 | + idx = MENU_INDEX_VISUAL; | |
1561 | + } | |
1549 | 1562 | #endif |
1550 | 1563 | else if (state == HITRETURN || state == ASKMORE) |
1551 | 1564 | idx = MENU_INDEX_CMDLINE; |
@@ -1712,7 +1725,11 @@ | ||
1712 | 1725 | { |
1713 | 1726 | #ifdef FEAT_VISUAL |
1714 | 1727 | if (VIsual_active) |
1728 | + { | |
1729 | + if (VIsual_select) | |
1730 | + return MENU_INDEX_SELECT; | |
1715 | 1731 | return MENU_INDEX_VISUAL; |
1732 | + } | |
1716 | 1733 | #endif |
1717 | 1734 | if (State & INSERT) |
1718 | 1735 | return MENU_INDEX_INSERT; |
@@ -139,7 +139,7 @@ | ||
139 | 139 | #endif |
140 | 140 | |
141 | 141 | #ifdef FEAT_PROFILE |
142 | - if (do_profiling && wtime != 0) | |
142 | + if (do_profiling == PROF_YES && wtime != 0) | |
143 | 143 | prof_inchar_enter(); |
144 | 144 | #endif |
145 | 145 |
@@ -199,7 +199,7 @@ | ||
199 | 199 | theend: |
200 | 200 | #endif |
201 | 201 | #ifdef FEAT_PROFILE |
202 | - if (do_profiling && wtime != 0) | |
202 | + if (do_profiling == PROF_YES && wtime != 0) | |
203 | 203 | prof_inchar_exit(); |
204 | 204 | #endif |
205 | 205 | return retval; |
@@ -473,7 +473,8 @@ | ||
473 | 473 | * selected area. There is no specific redraw command for this, |
474 | 474 | * just redraw all windows on the current buffer. */ |
475 | 475 | if (cbd->owned |
476 | - && get_real_state() == VISUAL | |
476 | + && (get_real_state() == VISUAL | |
477 | + || get_real_state() == SELECTMODE) | |
477 | 478 | && clip_isautosel() |
478 | 479 | && hl_attr(HLF_V) != hl_attr(HLF_VNC)) |
479 | 480 | redraw_curbuf_later(INVERTED_ALL); |
@@ -503,7 +504,8 @@ | ||
503 | 504 | * area. There is no specific redraw command for this, just redraw all |
504 | 505 | * windows on the current buffer. */ |
505 | 506 | if (was_owned |
506 | - && get_real_state() == VISUAL | |
507 | + && (get_real_state() == VISUAL | |
508 | + || get_real_state() == SELECTMODE) | |
507 | 509 | && clip_isautosel() |
508 | 510 | && hl_attr(HLF_V) != hl_attr(HLF_VNC)) |
509 | 511 | { |