Compare commits

...

110 Commits

Author SHA1 Message Date
Bjorn Winckler 29745cf124 Snapshot 47 2009-07-16 20:08:56 +02:00
Bjorn Winckler 699de3c049 Change some logging messages 2009-07-16 14:35:27 +02:00
Bjorn Winckler 5560396666 Dialog sheet animation can no longer cause a crash
Explicitly force the sheet animation to be performed before passing the
result of the sheet on to the backend.  Before this patch the animation
was performed asynchronously and this could lead to a Vim controller
being released at the same time as the animation was being performed
since the animation took place in the default run loop mode.
2009-07-15 00:54:08 +02:00
Bjorn Winckler 8570b5df1f Merge upstream 2009-07-14 21:41:00 +02:00
vimboss 7391be3977 updated for version 7.2-234 2009-07-14 19:40:21 +00:00
vimboss 7068f9086c updated for version 7.2-233 2009-07-14 16:38:36 +00:00
vimboss af2e8b9e3b updated for version 7.2-232 2009-07-14 15:38:41 +00:00
vimboss 7d87f83e26 updated for version 7.2-231 2009-07-14 14:04:54 +00:00
vimboss eb6512ab82 updated for version 7.2-230 2009-07-14 11:44:30 +00:00
vimboss c2d5277fc9 updated for version 7.2-229 2009-07-14 10:20:22 +00:00
Bjorn Winckler e9d2694dce Snapshot 46 2009-07-11 00:34:33 +02:00
Bjorn Winckler 36154dd8c0 More normalization of filenames, use NFC
Apparently NTFS uses NFC so switch to NFC instead of using NFKC.
2009-07-10 19:01:28 +02:00
Bjorn Winckler 0d778b28a4 Merge upstream 2009-07-10 15:12:00 +02:00
vimboss fa7096a6ee updated for version 7.2-228 2009-07-10 13:11:26 +00:00
vimboss cc2b9e2245 updated for version 7.2-227 2009-07-09 18:13:49 +00:00
vimboss 2cd4c80953 updated for version 7.2-226 2009-07-09 18:06:49 +00:00
vimboss 8303ab1b1a updated for version 7.2-225 2009-07-09 16:24:19 +00:00
vimboss 3ef707c468 updated for version 7.2-224 2009-07-09 16:15:16 +00:00
vimboss b3ec0ad87a updated for version 7.2-223 2009-07-09 13:55:43 +00:00
Bjorn Winckler 4486bb71fb Replace NSLog() with ASLogXXX() 2009-07-07 21:01:13 +02:00
Bjorn Winckler 176ab5d393 Add simple logging facility (using ASL) 2009-07-07 18:34:32 +02:00
Bjorn Winckler aff8366139 Fix typo in help file 2009-07-03 14:46:23 +02:00
vimboss d05fb395d1 updated for version 7.2-222 2009-07-01 18:18:57 +00:00
vimboss e764e25045 updated for version 7.2-221 2009-07-01 16:04:58 +00:00
vimboss bd178a9659 updated for version 7.2-220 2009-07-01 15:13:56 +00:00
vimboss 5a5cd60221 updated for version 7.2-219 2009-07-01 14:13:18 +00:00
Kazuki Sakamoto 7c3e218035 Add NetBeans support 2009-06-26 06:32:14 +09:00
vimboss 760e36dc8b updated for version 7.2-218 2009-06-24 16:32:08 +00:00
vimboss 941e7a992d updated for version 7.2-217 2009-06-24 16:08:18 +00:00
vimboss 7108d56061 updated for version 7.2-216 2009-06-24 15:51:37 +00:00
vimboss d5a9cdd9c8 updated for version 7.2-215 2009-06-24 15:32:01 +00:00
vimboss 60ed6e1213 updated for version 7.2-214 2009-06-24 15:05:00 +00:00
vimboss d628c3711d updated for version 7.2-213 2009-06-24 14:50:12 +00:00
vimboss 3344f11140 updated for version 7.2-212 2009-06-24 14:41:19 +00:00
vimboss f047b3aa3e updated for version 7.2-211 2009-06-24 14:25:49 +00:00
vimboss 31ad5d0472 updated for version 7.2-210 2009-06-24 09:58:32 +00:00
Bjorn Winckler edbdca29e1 Normalize filenames to NFKC before opening
Vim does not cope very well with Unicode decomposed form NFD (i.e. it
does not normalize to composed form before rendering) which causes
problems since HFS+ stores filenames in NFD.  To work around this issue
normalize to compatibility form C before passing filenames to Vim.

(This is not a solution to the problem with NFD since files stored in
NFD will still be problematic but at least a user can work around this
issue by making sure files are in composed form before opening them.)
2009-06-23 20:38:39 +02:00
Bjorn Winckler 5433ca7d4c Support Quick Look for all known file extensions 2009-06-20 22:13:51 +02:00
Bjorn Winckler 816ac0a441 Change name of window menu items
Change "Next/Previous Tab" to "Select Next/Previous Tab" to keep titles
the same as in e.g. Safari.
2009-06-20 20:26:14 +02:00
Bjorn Winckler 90e4752df4 Update 'gfw' on Cmd--/Cmd-+ 2009-06-20 01:58:06 +02:00
Bjorn Winckler 0978ebc1c6 Add help on binding Cmd-keys 2009-06-20 00:14:09 +02:00
Bjorn Winckler f486bb41d6 Avoid exceptions in charRangeForRow::: 2009-06-19 23:09:03 +02:00
Bjorn Winckler 44227b9a93 Fix typo in comment 2009-06-18 21:08:43 +02:00
Bjorn Winckler ad02696d27 Merge upstream
Conflicts:
	src/buffer.c
	src/eval.c
	src/option.c
	src/vim.h
2009-06-16 18:30:00 +02:00
vimboss 87658a916a updated for version 7.2-209 2009-06-16 16:29:10 +00:00
vimboss 66299b9ed5 updated for version 7.2-208 2009-06-16 15:50:33 +00:00
vimboss fc072b7b61 updated for version 7.2-207 2009-06-16 15:22:12 +00:00
vimboss fef8272db2 updated for version 7.2-206 2009-06-16 14:57:26 +00:00
vimboss b04c78a6a0 updated for version 7.2-205 2009-06-16 14:44:48 +00:00
vimboss 99b7765c18 updated for version 7.2-204 2009-06-16 14:34:38 +00:00
vimboss c8e331a5f5 updated for version 7.2-203 2009-06-16 14:01:43 +00:00
vimboss 03f0a92f69 updated for version 7.2-202 2009-06-16 13:35:20 +00:00
vimboss ca96b60e9a updated for version 7.2-201 2009-06-16 13:23:06 +00:00
vimboss ea811731f0 updated for version 7.2-200 2009-06-16 13:12:07 +00:00
vimboss 11b068fc25 updated for version 7.2-199 2009-06-16 12:31:33 +00:00
vimboss 097577c351 updated for version 7.2-198 2009-06-16 09:07:49 +00:00
vimboss 250b62c9a8 updated for version 7.2-197 2009-06-10 16:15:40 +00:00
vimboss 54fea5fe67 updated for version 7.2-196 2009-06-03 20:08:14 +00:00
vimboss e63aad92b1 updated for version 7.2-195 2009-06-03 14:20:21 +00:00
vimboss 8ac99eed90 updated for version 7.2-194 2009-06-03 13:05:07 +00:00
vimboss 25b4e351c9 updated for version 7.2-193 2009-06-03 12:26:06 +00:00
vimboss 20da24a60c updated for version 7.2-192 2009-06-03 11:22:45 +00:00
vimboss 0873fb8f49 updated for version 7.2-191 2009-05-26 20:59:55 +00:00
vimboss 839717064f updated for version 7.2-190 2009-05-26 16:12:37 +00:00
vimboss cee529f197 updated for version 7.2-189 2009-05-26 09:02:10 +00:00
vimboss a3935654b8 updated for version 7.2-188 2009-05-24 11:40:58 +00:00
vimboss ff7ca495c1 updated for version 7.2-187 2009-05-23 12:28:15 +00:00
vimboss 335f08054d updated for version 7.2-186 2009-05-22 19:08:31 +00:00
vimboss fa0d5e0ba9 updated for version 7.2-185 2009-05-22 16:20:57 +00:00
vimboss 1f4d8dd8e1 updated for version 7.2-184 2009-05-21 21:27:43 +00:00
vimboss b465ee5bbe updated for version 7.2-183 2009-05-21 13:20:59 +00:00
vimboss 919b11d301 updated for version 7.2-182 2009-05-17 21:25:42 +00:00
vimboss f5cfc6a148 updated for version 7.2-181 2009-05-17 14:24:23 +00:00
vimboss 915fba8a25 updated for version 7.2-180 2009-05-17 11:33:22 +00:00
vimboss 6b64a62626 updated for version 7.2-179 2009-05-16 19:16:33 +00:00
vimboss 0ee0fbc2d4 updated for version 7.2-178 2009-05-16 19:07:03 +00:00
vimboss 8db81befc3 updated for version 7.2-177 2009-05-16 15:31:32 +00:00
vimboss 47b763090e updated for version 7.2-176 2009-05-16 14:41:10 +00:00
vimboss 99b962f986 updated for version 7.2-175 2009-05-16 14:16:02 +00:00
vimboss e6b7f4ff3b updated for version 7.2-174 2009-05-15 19:33:18 +00:00
vimboss 11f7764bd6 updated for version 7.2-173 2009-05-14 20:20:33 +00:00
vimboss 3f2fbccc21 updated for version 7.2-172 2009-05-14 20:01:05 +00:00
vimboss 84602997b6 updated for version 7.2-171 2009-05-14 19:51:46 +00:00
vimboss 19a1e1db6b updated for version 7.2-170 2009-05-13 18:48:16 +00:00
vimboss 0949ad4f8b updated for version 7.2-169 2009-05-13 16:56:33 +00:00
vimboss 8f5131b2d7 updated for version 7.2-168 2009-05-13 12:49:39 +00:00
vimboss 682e144672 updated for version 7.2-167fix 2009-05-13 12:15:37 +00:00
vimboss a05172e1db updated for version 7.2-168 2009-05-13 10:51:08 +00:00
Travis Jeffery 9b0f42ed24 Add reStructuredText as supported file type 2009-05-11 18:23:50 +02:00
vimboss 7b900cf55a updated for version 7.2-166 2009-04-29 16:47:23 +00:00
vimboss 82c9ce9eeb updated for version 7.2-165 2009-04-29 16:03:38 +00:00
vimboss 104a7e6484 updated for version 7.2-164 2009-04-29 15:41:40 +00:00
vimboss 1e2844207d updated for version 7.2-163 2009-04-29 10:05:51 +00:00
vimboss b39439f386 updated for version 7.2-162 2009-04-29 09:52:12 +00:00
vimboss 185e34337d updated for version 7.2-161 2009-04-29 09:02:44 +00:00
Bjorn Winckler e711158eed Update credits 2009-04-28 23:11:13 +02:00
Kazuki Sakamoto f43ffacda1 Move all IM code into frontend 2009-04-25 22:32:54 +09:00
vimboss 160f5fa78f updated for version 7.2-160 2009-04-22 16:45:21 +00:00
vimboss 7ebc297d1d updated for version 7.2-159 2009-04-22 15:53:09 +00:00
vimboss 3a9b07d2d2 updated for version 7.2-158 2009-04-22 15:45:05 +00:00
vimboss 86d424677a updated for version 7.2-157 2009-04-22 14:44:41 +00:00
vimboss 1666886eaa updated for version 7.2-156 2009-04-22 14:25:01 +00:00
vimboss 7f3a4e21e7 updated for version 7.2-155 2009-04-22 14:10:39 +00:00
vimboss 49b3032c6d updated for version 7.2-154 2009-04-22 13:58:46 +00:00
vimboss 153c893e9e updated for version 7.2-153 2009-04-22 13:39:36 +00:00
vimboss e07aeca8c3 updated for version 7.2-152 2009-04-22 12:44:48 +00:00
vimboss 788aadad0a updated for version 7.2-151 2009-04-22 11:52:33 +00:00
vimboss 396732e9af updated for version 7.2-150 2009-04-22 11:08:26 +00:00
vimboss 1c74207cd6 updated for version 7.2-149 2009-04-22 10:56:16 +00:00
Nicolas Weber eb9ece5bf1 Add markdown as supported file type 2009-04-19 22:29:27 -07:00
143 changed files with 7300 additions and 3873 deletions
-2
View File
@@ -683,9 +683,7 @@ LANG_GEN = \
runtime/spell/??/main.aap \
runtime/spell/yi/README.txt \
runtime/spell/main.aap \
runtime/spell/cleanadd.vim \
runtime/spell/*.vim \
runtime/spell/fixdup \
# generic language files, binary
LANG_GEN_BIN = \
+10 -2
View File
@@ -335,6 +335,8 @@ BufDelete Before deleting a buffer from the buffer list.
NOTE: When this autocommand is executed, the
current buffer "%" may be different from the
buffer being deleted "<afile>" and "<abuf>".
Don't change to another buffer, it will cause
problems.
*BufEnter*
BufEnter After entering a buffer. Useful for setting
options for a file type. Also executed when
@@ -397,6 +399,8 @@ BufUnload Before unloading a buffer. This is when the
NOTE: When this autocommand is executed, the
current buffer "%" may be different from the
buffer being unloaded "<afile>".
Don't change to another buffer, it will cause
problems.
*BufWinEnter*
BufWinEnter After a buffer is displayed in a window. This
can be when the buffer is loaded (after
@@ -428,6 +432,8 @@ BufWipeout Before completely deleting a buffer. The
NOTE: When this autocommand is executed, the
current buffer "%" may be different from the
buffer being deleted "<afile>".
Don't change to another buffer, it will cause
problems.
*BufWrite* *BufWritePre*
BufWrite or BufWritePre Before writing the whole buffer to a file.
*BufWriteCmd*
@@ -748,8 +754,10 @@ SwapExists Detected an existing swap file when starting
'a' abort, like hitting CTRL-C
When set to an empty string the user will be
asked, as if there was no SwapExists autocmd.
Note: Do not try to change the buffer, the
results are unpredictable.
*E812*
It is not allowed to change to another buffer,
change a buffer name or change directory
here.
*Syntax*
Syntax When the 'syntax' option has been set. The
pattern is matched against the syntax name.
+8 -1
View File
@@ -441,13 +441,20 @@ between files with almost the same name. If there are multiple matches,
those files with an extension that is in the 'suffixes' option are ignored.
The default is ".bak,~,.o,.h,.info,.swp,.obj", which means that files ending
in ".bak", "~", ".o", ".h", ".info", ".swp" and ".obj" are sometimes ignored.
It is impossible to ignore suffixes with two dots. Examples:
An empty entry, two consecutive commas, match a file name that does not
contain a ".", thus has no suffix. This is useful to ignore "prog" and prefer
"prog.c".
Examples:
pattern: files: match: ~
test* test.c test.h test.o test.c
test* test.h test.o test.h and test.o
test* test.i test.h test.c test.i and test.c
It is impossible to ignore suffixes with two dots.
If there is more than one matching file (after ignoring the ones matching
the 'suffixes' option) the first file name is inserted. You can see that
there is only one match when you type 'wildchar' twice and the completed
+2
View File
@@ -2414,6 +2414,7 @@ cursor({list})
When 'virtualedit' is used {off} specifies the offset in
screen columns from the start of the character. E.g., a
position within a <Tab> or after the last character.
Returns 0 when the position could be set, -1 otherwise.
deepcopy({expr}[, {noref}]) *deepcopy()* *E698*
@@ -4516,6 +4517,7 @@ rename({from}, {to}) *rename()*
should also work to move files across file systems. The
result is a Number, which is 0 if the file was renamed
successfully, and non-zero when the renaming failed.
NOTE: If {to} exists it is overwritten without warning.
This function is not available in the |sandbox|.
repeat({expr}, {count}) *repeat()*
+14 -1
View File
@@ -350,7 +350,7 @@ The color scheme uses the the system "Highlight Color", which can be changed in
the "Appearance" pane of the System Preferences. It also changes the
highlight color when a window becomes inactive.
If you have any comments regarding this colors cheme (is it better or worse
If you have any comments regarding this color scheme (is it better or worse
than the default?) then post them to |vim_mac|.
==============================================================================
@@ -573,12 +573,15 @@ Cmd-. Interrupt Vim. Unlike Ctrl-C which is sent as normal
interpreted) this sends a SIGINT signal to the Vim
process. Use this shortcut if the Vim process appears
to have locked up and is not responding to key presses.
This Cmd-key combination cannot be unmapped.
*Cmd-`* *<D-`>*
Cmd-` Cycle to the next window. On an American keyboard the
`-key is located under the Esc-key. On European
keyboards this key is often adjacent to the left
Shift-key and it may be not even be marked with "`".
This Cmd-key combination can only be unmapped via the
"Keyboard & Mouse" System Preferences.
*Cmd-Left* *<D-Left>*
Cmd-Left Move cursor to the beginning of the line
@@ -750,6 +753,16 @@ this makes Caps Lock "drop" key presses. To work around this problem go into
the "Keyboard & Mouse" System Preference and remap Caps Lock to Ctrl first
(click the "Modifier Keys..." button).
Scenario: ~
You have problems creating custom mappings involving the Cmd key.
Solution: ~
To bind to a key involving Cmd you use the "<D-..>" syntax. Many Cmd-key
mappings are already used by the menus so if your mapping doesn't work then
the solution is usually to first unmap the menu binding (see |macvim-menus|,
in particular read the end of that section). Also see the section on
|macvim-shortcuts| for some Cmd-key combinations which are not used by the
menus but still need to be freed up before they can be used in custom bindings.
Scenario: ~
You can't find the information on MacVim you thought should be in this manual
page.
+2 -7
View File
@@ -355,13 +355,8 @@ cscope version for Win32 see:
The DJGPP-built version from http://cscope.sourceforge.net is known to not
work with Vim.
There are a couple of hard-coded limitations:
1. The maximum number of cscope connections allowed is 8. Do you
really need more?
2. Doing a |:tjump| when |:cstag| searches the tag files is not
configurable (e.g., you can't do a tselect instead).
Hard-coded limitation: doing a |:tjump| when |:cstag| searches the tag files
is not configurable (e.g., you can't do a tselect instead).
==============================================================================
6. Suggested usage *cscope-suggestions*
+39 -58
View File
@@ -1,4 +1,4 @@
*if_mzsch.txt* For Vim version 7.2. Last change: 2008 Jun 28
*if_mzsch.txt* For Vim version 7.2. Last change: 2009 Jun 24
VIM REFERENCE MANUAL by Sergey Khorev
@@ -42,10 +42,6 @@ Note: On FreeBSD you should use the "drscheme" port.
*:mzfile* *:mzf*
:[range]mzf[ile] {file} Execute the MzScheme script in {file}. {not in Vi}
All statements are executed in the namespace of the
buffer that was current during :mzfile start.
If you want to access other namespaces, use
'parameterize'.
All of these commands do essentially the same thing - they execute a piece of
MzScheme code, with the "current range" set to the given line
@@ -54,8 +50,6 @@ range.
In the case of :mzscheme, the code to execute is in the command-line.
In the case of :mzfile, the code to execute is the contents of the given file.
Each buffer has its own MzScheme namespace. Global namespace is bound to
the "global-namespace" value from the 'vimext' module.
MzScheme interface defines exception exn:vim, derived from exn.
It is raised for various Vim errors.
@@ -79,40 +73,8 @@ To avoid clashes with MzScheme, consider using prefix when requiring module,
e.g.: >
:mzscheme (require (prefix vim- vimext))
<
All the examples below assume this naming scheme. Note that you need to do
this again for every buffer.
All the examples below assume this naming scheme.
The auto-instantiation can be achieved with autocommands, e.g. you can put
something like this in your .vimrc (EOFs should not have indentation): >
function s:MzRequire()
if has("mzscheme")
:mz << EOF
(require (prefix vim- vimext))
(let ((buf (vim-get-buff-by-name (vim-eval "expand(\"<afile>\")"))))
(when (and buf (not (eq? buf (vim-curr-buff))))
(parameterize ((current-namespace (vim-get-buff-namespace buf)))
(namespace-attach-module vim-global-namespace 'vimext)
(namespace-require '(prefix vim vimext)))))
EOF
endif
endfunction
function s:MzStartup()
if has("mzscheme")
au BufNew,BufNewFile,BufAdd,BufReadPre * :call s:MzRequire()
:mz << EOF
(current-library-collection-paths
(cons
(build-path (find-system-path 'addon-dir) (version) "collects")
(current-library-collection-paths)))
EOF
endif
endfunction
call s:MzStartup()
<
The global namespace just instantiated this module with the prefix "vimext:".
*mzscheme-sandbox*
When executed in the |sandbox|, access to some filesystem and Vim interface
procedures is restricted.
@@ -121,15 +83,20 @@ procedures is restricted.
2. Examples *mzscheme-examples*
>
:mzscheme (display "Hello")
:mz (display (string-append "Using MzScheme version " (version)))
:mzscheme (require (prefix vim- vimext)) ; for MzScheme < 4.x
:mzscheme (require (prefix-in vim- 'vimext)) ; MzScheme 4.x
:mzscheme (vim-set-buff-line 10 "This is line #10")
<
Inline script usage: >
function! <SID>SetFirstLine()
:mz << EOF
(display "!!!")
(require (prefix vim- vimext))
; for newer versions (require (prefix-in vim- 'vimext))
(vim-set-buff-line 1 "This is line #1")
(vim-beep)
EOF
EOF
endfunction
nmap <F9> :call <SID>SetFirstLine() <CR>
@@ -137,17 +104,33 @@ Inline script usage: >
File execution: >
:mzfile supascript.scm
<
Accessing the current buffer namespace from an MzScheme program running in
another buffer within |:mzfile|-executed script : >
; Move to the window below
(vim-command "wincmd j")
; execute in the context of buffer, to which window belongs
; assume that buffer has 'textstring' defined
(parameterize ((current-namespace
(vim-get-buff-namespace (vim-curr-buff))))
(eval '(vim-set-buff-line 1 textstring)))
Vim exception handling: >
:mz << EOF
(require (prefix vim- vimext))
; for newer versions (require (prefix-in vim- 'vimext))
(with-handlers
([exn:vim? (lambda (e) (display (exn-message e)))])
(vim-eval "nonsense-string"))
EOF
<
Auto-instantiation of vimext module (can be placed in your |vimrc|): >
function! MzRequire()
:redir => l:mzversion
:mz (version)
:redir END
if strpart(l:mzversion, 1, 1) < "4"
" MzScheme versions < 4.x:
:mz (require (prefix vim- vimext))
else
" newer versions:
:mz (require (prefix-in vim- 'vimext))
endif
endfunction
if has("mzscheme")
silent call MzRequire()
endif
<
==============================================================================
3. Threads *mzscheme-threads*
@@ -168,11 +151,11 @@ interface.
Common
------
(command {command-string}) Perform the vim ":Ex" style command.
(eval {expr-string}) Evaluate the vim expression to a string.
A |List| is turned into a string by
joining the items and inserting line
breaks.
NOTE clashes with MzScheme eval
(eval {expr-string}) Evaluate the vim expression into
respective MzScheme object: |Lists| are
represented as Scheme lists,
|Dictionaries| as hash tables.
NOTE the name clashes with MzScheme eval
(range-start) Start/End of the range passed with
(range-end) the Scheme command.
(beep) beep
@@ -186,7 +169,6 @@ Common
be set. The symbol 'global can be passed
as {buffer-or-window}. Then |:setglobal|
will be used.
global-namespace The MzScheme main namespace.
Buffers *mzscheme-buffer*
-------
@@ -228,7 +210,6 @@ Buffers *mzscheme-buffer*
if there is no such buffer.
(get-buff-by-num {buffernum}) Get a buffer by its number (return #f if
there is no buffer with this number).
(get-buff-namespace [buffer]) Get buffer namespace.
Windows *mzscheme-window*
------
@@ -250,7 +231,7 @@ Windows *mzscheme-window*
(set-cursor (line . col) [window]) Set cursor position.
==============================================================================
5. Dynamic loading *mzscheme-dynamic*
5. Dynamic loading *mzscheme-dynamic* *E815*
On MS-Windows the MzScheme libraries can be loaded dynamically. The |:version|
output then includes |+mzscheme/dyn|.
+8
View File
@@ -1448,6 +1448,14 @@ A jump table for the options with a short description can be found at |Q_op|.
autoselectml Like "autoselect", but for the modeless selection
only. Compare to the 'A' flag in 'guioptions'.
html When the clipboard contains HTML, use this when
pasting. When putting text on the clipboard, mark it
as HTML. This works to copy rendered HTML from
Firefox, paste it as raw HTML in Vim, select the HTML
in Vim and paste it in a rich edit box in Firefox.
Only supported for GTK version 2 and later.
Only available with the |+multi_byte| feature.
exclude:{pattern}
Defines a pattern that is matched against the name of
the terminal 'term'. If there is a match, no
+11
View File
@@ -511,6 +511,17 @@ N *+X11* Unix only: can restore window title |X11|
messages though. Use ":silent" in the command itself
to avoid that: ":silent menu .... :silent command".
*:uns* *:unsilent*
:uns[ilent] {command} Execute {command} not silently. Only makes a
difference when |:silent| was used to get to this
command.
Use this for giving a message even when |:silent| was
used. In this example |:silent| is used to avoid the
message about reading the file and |:unsilent| to be
able to list the first line of each file. >
:silent argdo unsilent echo expand('%') . ": " . getline(1)
<
*:verb* *:verbose*
:[count]verb[ose] {command}
Execute {command} with 'verbose' set to [count]. If
-27
View File
@@ -1,27 +0,0 @@
" Vim script to fix duplicate words in a .dic file vim: set ft=vim:
"
" Usage: Edit the .dic file and source this script.
let deleted = 0
" Start below the word count.
let lnum = 2
while lnum <= line('$')
let word = getline(lnum)
if word !~ '/'
if search('^' . word . '/', 'w') != 0
let deleted += 1
exe lnum . "d"
continue " don't increment lnum, it's already at the next word
endif
endif
let lnum += 1
endwhile
if deleted == 0
echomsg "No duplicate words found"
elseif deleted == 1
echomsg "Deleted 1 duplicate word"
else
echomsg printf("Deleted %d duplicate words", deleted)
endif
+1
View File
@@ -31,6 +31,7 @@ Matt Tolton\
Kaoru Yoshida\
Ron Olson\
Jonathon Mah\
Kazuki Sakamoto\
\i0 \
...and many others who have helped by reporting bugs etc.\
+1320 -7
View File
File diff suppressed because it is too large Load Diff
+90 -54
View File
@@ -153,6 +153,12 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
+ (void)initialize
{
static BOOL initDone = NO;
if (initDone) return;
initDone = YES;
ASLInit();
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:NO], MMNoWindowKey,
[NSNumber numberWithInt:64], MMTabMinWidthKey,
@@ -237,10 +243,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
// updated in MMBackend.m.
NSString *name = [NSString stringWithFormat:@"%@-connection",
[[NSBundle mainBundle] bundlePath]];
//NSLog(@"Registering connection with name '%@'", name);
if (![connection registerName:name]) {
NSLog(@"FATAL ERROR: Failed to register connection with name '%@'",
name);
ASLogCrit(@"Failed to register connection with name '%@'", name);
[connection release]; connection = nil;
}
@@ -249,7 +253,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
- (void)dealloc
{
//NSLog(@"MMAppController dealloc");
ASLogDebug(@"");
[connection release]; connection = nil;
[inputQueues release]; inputQueues = nil;
@@ -334,6 +338,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
[self scheduleVimControllerPreloadAfterDelay:2];
[self startWatchingVimDir];
}
ASLogInfo(@"MacVim finished launching");
}
- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender
@@ -378,12 +384,15 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
- (BOOL)applicationOpenUntitledFile:(NSApplication *)sender
{
ASLogDebug(@"Opening untitled window...");
[self newWindow:self];
return YES;
}
- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames
{
ASLogInfo(@"Opening files %@", filenames);
// Extract ODB/Xcode/Spotlight parameters from the current Apple event,
// sort the filenames, and then let openFiles:withArguments: do the heavy
// lifting.
@@ -517,20 +526,20 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
e = [vimControllers objectEnumerator];
id vc;
while ((vc = [e nextObject])) {
//NSLog(@"Terminate pid=%d", [vc pid]);
ASLogDebug(@"Terminate pid=%d", [vc pid]);
[vc sendMessage:TerminateNowMsgID data:nil];
}
e = [cachedVimControllers objectEnumerator];
while ((vc = [e nextObject])) {
//NSLog(@"Terminate pid=%d (cached)", [vc pid]);
ASLogDebug(@"Terminate pid=%d (cached)", [vc pid]);
[vc sendMessage:TerminateNowMsgID data:nil];
}
// If a Vim process is being preloaded as we quit we have to forcibly
// kill it since we have not established a connection yet.
if (preloadPid > 0) {
//NSLog(@"INCOMPLETE preloaded process: preloadPid=%d", preloadPid);
ASLogDebug(@"Kill incomplete preloaded process pid=%d", preloadPid);
kill(preloadPid, SIGKILL);
}
@@ -538,7 +547,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
e = [[pidArguments allKeys] objectEnumerator];
NSNumber *pidKey;
while ((pidKey = [e nextObject])) {
//NSLog(@"INCOMPLETE process: pid=%d", [pidKey intValue]);
ASLogDebug(@"Kill incomplete process pid=%d", [pidKey intValue]);
kill([pidKey intValue], SIGKILL);
}
@@ -551,6 +560,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
- (void)applicationWillTerminate:(NSNotification *)notification
{
ASLogInfo(@"Terminating MacVim...");
[self stopWatchingVimDir];
#ifdef MM_ENABLE_PLUGINS
@@ -585,7 +596,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
if (numChildProcesses <= 0)
break;
//NSLog(@"%d processes still left, sleep a bit...", numChildProcesses);
ASLogDebug(@"%d processes still left, hold on...", numChildProcesses);
// Run in NSConnectionReplyMode while waiting instead of calling e.g.
// usleep(). Otherwise incoming messages may clog up the DO queues and
@@ -600,8 +611,9 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
; // do nothing
}
if (numChildProcesses > 0)
NSLog(@"%d ZOMBIES left behind", numChildProcesses);
if (numChildProcesses > 0) {
ASLogNotice(@"%d zombies left behind", numChildProcesses);
}
}
+ (MMAppController *)sharedInstance
@@ -624,9 +636,14 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
- (void)removeVimController:(id)controller
{
ASLogDebug(@"Remove Vim controller pid=%d id=%d (processingFlag=%d)",
[controller pid], [controller identifier], processingFlag);
int idx = [vimControllers indexOfObject:controller];
if (NSNotFound == idx)
if (NSNotFound == idx) {
ASLogDebug(@"Controller not found, probably due to duplicate removal");
return;
}
[controller cleanup];
@@ -699,7 +716,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
[win setFrameTopLeftPoint:topLeft];
}
} else {
NSLog(@"[%s] WINDOW NOT ON SCREEN, don't constrain position", _cmd);
ASLogNotice(@"Window not on screen, don't constrain position");
}
}
@@ -819,6 +836,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
NSMutableDictionary *arguments = (args ? [[args mutableCopy] autorelease]
: [NSMutableDictionary dictionary]);
filenames = normalizeFilenames(filenames);
//
// a) Filter out any already open files
//
@@ -969,6 +988,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
- (IBAction)newWindow:(id)sender
{
ASLogDebug(@"Open new window");
// A cached controller requires no loading times and results in the new
// window popping up instantaneously. If the cache is empty it may take
// 1-2 seconds to start a new Vim process.
@@ -988,6 +1009,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
- (IBAction)fileOpen:(id)sender
{
ASLogDebug(@"Show file open panel");
NSString *dir = nil;
BOOL trackPwd = [[NSUserDefaults standardUserDefaults]
boolForKey:MMDialogsTrackPwdKey];
@@ -1007,6 +1030,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
- (IBAction)selectNextWindow:(id)sender
{
ASLogDebug(@"Select next window");
unsigned i, count = [vimControllers count];
if (!count) return;
@@ -1027,6 +1052,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
- (IBAction)selectPreviousWindow:(id)sender
{
ASLogDebug(@"Select previous window");
unsigned i, count = [vimControllers count];
if (!count) return;
@@ -1050,17 +1077,20 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
- (IBAction)orderFrontPreferencePanel:(id)sender
{
ASLogDebug(@"Show preferences panel");
[[MMPreferenceController sharedPrefsWindowController] showWindow:self];
}
- (IBAction)openWebsite:(id)sender
{
ASLogDebug(@"Open MacVim website");
[[NSWorkspace sharedWorkspace] openURL:
[NSURL URLWithString:MMWebsiteString]];
}
- (IBAction)showVimHelp:(id)sender
{
ASLogDebug(@"Open window with Vim help");
// Open a new window with the help window maximized.
[self launchVimProcessWithArguments:[NSArray arrayWithObjects:
@"-c", @":h gui_mac", @"-c", @":res", nil]];
@@ -1068,11 +1098,13 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
- (IBAction)zoomAll:(id)sender
{
ASLogDebug(@"Zoom all windows");
[NSApp makeWindowsPerform:@selector(performZoom:) inOrder:YES];
}
- (IBAction)atsuiButtonClicked:(id)sender
{
ASLogDebug(@"Toggle ATSUI renderer");
// This action is called when the user clicks the "use ATSUI renderer"
// button in the advanced preferences pane.
[self rebuildPreloadCache];
@@ -1080,6 +1112,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
- (IBAction)loginShellButtonClicked:(id)sender
{
ASLogDebug(@"Toggle login shell option");
// This action is called when the user clicks the "use login shell" button
// in the advanced preferences pane.
[self rebuildPreloadCache];
@@ -1087,6 +1120,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
- (IBAction)quickstartButtonClicked:(id)sender
{
ASLogDebug(@"Toggle Quickstart option");
if ([self maxPreloadCacheSize] > 0) {
[self scheduleVimControllerPreloadAfterDelay:1.0];
[self startWatchingVimDir];
@@ -1114,7 +1148,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
- (unsigned)connectBackend:(byref in id <MMBackendProtocol>)proxy pid:(int)pid
{
//NSLog(@"[%s] pid=%d", _cmd, pid);
ASLogDebug(@"pid=%d", pid);
[(NSDistantObject*)proxy setProtocolForProxy:@protocol(MMBackendProtocol)];
@@ -1139,17 +1173,17 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
- (oneway void)processInput:(in bycopy NSArray *)queue
forIdentifier:(unsigned)identifier
{
// NOTE: Input is not handled immediately since this is a distribued object
// call and as such can arrive at unpredictable times. Instead, queue the
// input and process it when the run loop is updated.
// NOTE: Input is not handled immediately since this is a distributed
// object call and as such can arrive at unpredictable times. Instead,
// queue the input and process it when the run loop is updated.
if (!(queue && identifier)) {
NSLog(@"[%s] Bad input for identifier=%d", _cmd, identifier);
ASLogWarn(@"Bad input for identifier=%d", identifier);
return;
}
//NSLog(@"[%s] QUEUE for identifier=%d: <<< %@>>>", _cmd, identifier,
// debugStringForMessageQueue(queue));
ASLogDebug(@"QUEUE for identifier=%d: <<< %@>>>", identifier,
debugStringForMessageQueue(queue));
NSNumber *key = [NSNumber numberWithUnsignedInt:identifier];
NSArray *q = [inputQueues objectForKey:key];
@@ -1195,11 +1229,12 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
error:(NSString **)error
{
if (![[pboard types] containsObject:NSStringPboardType]) {
NSLog(@"WARNING: Pasteboard contains no object of type "
"NSStringPboardType");
ASLogNotice(@"Pasteboard contains no NSStringPboardType");
return;
}
ASLogInfo(@"Open new window containing current selection");
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
BOOL openInCurrentWindow = [ud boolForKey:MMOpenInCurrentWindowKey];
MMVimController *vc;
@@ -1222,8 +1257,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
error:(NSString **)error
{
if (![[pboard types] containsObject:NSStringPboardType]) {
NSLog(@"WARNING: Pasteboard contains no object of type "
"NSStringPboardType");
ASLogNotice(@"Pasteboard contains no NSStringPboardType");
return;
}
@@ -1233,6 +1267,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
[NSCharacterSet whitespaceAndNewlineCharacterSet]];
string = [string stringByStandardizingPath];
ASLogInfo(@"Open new window with selected file: %@", string);
NSArray *filenames = [self filterFilesAndNotify:
[NSArray arrayWithObject:string]];
if ([filenames count] == 0)
@@ -1253,8 +1289,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
error:(NSString **)error
{
if (![[pboard types] containsObject:NSStringPboardType]) {
NSLog(@"WARNING: Pasteboard contains no object of type "
"NSStringPboardType");
ASLogNotice(@"Pasteboard contains no NSStringPboardType");
return;
}
@@ -1263,10 +1298,12 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
BOOL dirIndicator;
if (![[NSFileManager defaultManager] fileExistsAtPath:path
isDirectory:&dirIndicator]) {
NSLog(@"Invalid path. Cannot open new document at: %@", path);
ASLogNotice(@"Invalid path. Cannot open new document at: %@", path);
return;
}
ASLogInfo(@"Open new file at path=%@", path);
if (!dirIndicator)
path = [path stringByDeletingLastPathComponent];
@@ -1317,7 +1354,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
NSString *path = [[NSBundle mainBundle] pathForAuxiliaryExecutable:@"Vim"];
if (!path) {
NSLog(@"ERROR: Vim executable could not be found inside app bundle!");
ASLogCrit(@"Vim executable could not be found inside app bundle!");
return -1;
}
@@ -1356,8 +1393,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
[pidArguments setObject:[NSNull null]
forKey:[NSNumber numberWithInt:pid]];
} else {
NSLog(@"WARNING: %s%@ failed (useLoginShell=%d)", _cmd, args,
useLoginShell);
ASLogWarn(@"Failed to launch Vim process: args=%@, useLoginShell=%d",
args, useLoginShell);
}
return pid;
@@ -1465,8 +1502,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
#if 0
// Xcode sends this event to query MacVim which open files have been
// modified.
NSLog(@"reply:%@", reply);
NSLog(@"event:%@", event);
ASLogDebug(@"reply:%@", reply);
ASLogDebug(@"event:%@", event);
NSEnumerator *e = [vimControllers objectEnumerator];
id vc;
@@ -1577,10 +1614,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
- (int)findLaunchingProcessWithoutArguments
{
NSArray *keys = [pidArguments allKeysForObject:[NSNull null]];
if ([keys count] > 0) {
//NSLog(@"found launching process without arguments");
if ([keys count] > 0)
return [[keys objectAtIndex:0] intValue];
}
return -1;
}
@@ -1895,12 +1930,12 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
- (void)activateWhenNextWindowOpens
{
ASLogDebug(@"Activate MacVim when next window opens");
shouldActivateWhenNextWindowOpens = YES;
}
- (void)startWatchingVimDir
{
//NSLog(@"%s", _cmd);
#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4)
if (fsEventStream)
return;
@@ -1919,13 +1954,12 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
kCFRunLoopDefaultMode);
FSEventStreamStart(fsEventStream);
//NSLog(@"Started FS event stream");
ASLogDebug(@"Started FS event stream");
#endif
}
- (void)stopWatchingVimDir
{
//NSLog(@"%s", _cmd);
#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4)
if (NULL == FSEventStreamStop)
return; // FSEvent functions are weakly linked
@@ -1935,7 +1969,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
FSEventStreamInvalidate(fsEventStream);
FSEventStreamRelease(fsEventStream);
fsEventStream = NULL;
//NSLog(@"Stopped FS event stream");
ASLogDebug(@"Stopped FS event stream");
}
#endif
@@ -1943,7 +1977,6 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
- (void)handleFSEvent
{
//NSLog(@"%s", _cmd);
[self clearPreloadCacheWithCount:-1];
// Several FS events may arrive in quick succession so make sure to cancel
@@ -1957,8 +1990,12 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
// It is possible to set a user default to avoid loading the default font
// (this cuts down on startup time).
if (![[NSUserDefaults standardUserDefaults] boolForKey:MMLoadDefaultFontKey]
|| fontContainerRef)
|| fontContainerRef) {
ASLogInfo(@"Skip loading of the default font...");
return;
}
ASLogInfo(@"Loading the default font...");
// Load all fonts in the Resouces folder of the app bundle.
NSString *fontsFolder = [[NSBundle mainBundle] resourcePath];
@@ -1993,9 +2030,10 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
}
}
if (!fontContainerRef)
NSLog(@"WARNING: Failed to activate the default font (the app bundle "
"may be incomplete)");
if (!fontContainerRef) {
ASLogNotice(@"Failed to activate the default font (the app bundle "
"may be incomplete)");
}
}
- (int)executeInLoginShell:(NSString *)path arguments:(NSArray *)args
@@ -2017,8 +2055,6 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
if (!shell)
shell = @"/bin/bash";
//NSLog(@"shell = %@", shell);
// Bash needs the '-l' flag to launch a login shell. The user may add
// flags by setting a user default.
NSString *shellArgument = [ud stringForKey:MMLoginShellArgumentKey];
@@ -2029,8 +2065,6 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
shellArgument = nil;
}
//NSLog(@"shellArgument = %@", shellArgument);
// Build input string to pipe to the login shell.
NSMutableString *input = [NSMutableString stringWithFormat:
@"exec \"%@\"", path];
@@ -2095,7 +2129,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
if (close(ds[1]) == -1) return -1;
++numChildProcesses;
//NSLog(@"new process pid=%d (count=%d)", pid, numChildProcesses);
ASLogDebug(@"new process pid=%d (count=%d)", pid, numChildProcesses);
}
return pid;
@@ -2114,7 +2148,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
if (pid <= 0)
break;
//NSLog(@"WAIT for pid=%d complete", pid);
ASLogDebug(@"Wait for pid=%d complete", pid);
--numChildProcesses;
}
}
@@ -2129,7 +2163,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
// The processing flag is > 0 if this function is already on the call
// stack; < 0 if this function was also re-entered.
if (processingFlag != 0) {
NSLog(@"[%s] BUSY!", _cmd);
ASLogDebug(@"BUSY!");
processingFlag = -1;
return;
}
@@ -2172,9 +2206,9 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
}
}
if (i == count)
NSLog(@"[%s] WARNING: No Vim controller for identifier=%d",
_cmd, ukey);
if (i == count) {
ASLogWarn(@"No Vim controller for identifier=%d", ukey);
}
}
[queues release];
@@ -2193,6 +2227,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
- (void)addVimController:(MMVimController *)vc
{
ASLogDebug(@"Add Vim controller pid=%d id=%d", [vc pid], [vc identifier]);
int pid = [vc pid];
NSNumber *pidKey = [NSNumber numberWithInt:pid];
+1
View File
@@ -68,6 +68,7 @@ enum { MMMaxCellsPerChar = 2 };
- (void)setPreEditRow:(int)row column:(int)col;
- (void)setMouseShape:(int)shape;
- (void)setAntialias:(BOOL)state;
- (void)setImControl:(BOOL)enable;
- (BOOL)convertPoint:(NSPoint)point toRow:(int *)row column:(int *)column;
- (NSPoint)pointForRow:(int)row column:(int)col;
- (NSRect)rectForRow:(int)row column:(int)col numRows:(int)nr
+20 -37
View File
@@ -139,7 +139,7 @@ defaultLineHeightForFont(NSFont *font)
- (void)dealloc
{
LOG_DEALLOC
ASLogDebug(@"");
[self disposeAtsuStyles];
[font release]; font = nil;
@@ -324,6 +324,11 @@ defaultLineHeightForFont(NSFont *font)
antialias = state;
}
- (void)setImControl:(BOOL)enable
{
[helper setImControl:enable];
}
- (void)keyDown:(NSEvent *)event
{
[helper keyDown:event];
@@ -583,7 +588,7 @@ defaultLineHeightForFont(NSFont *font)
[self resizeContentImage];
#if MM_DEBUG_DRAWING
NSLog(@"====> BEGIN %s", _cmd);
ASLogDebug(@"====> BEGIN %s", _cmd);
#endif
[self beginDrawing];
@@ -594,7 +599,7 @@ defaultLineHeightForFont(NSFont *font)
if (ClearAllDrawType == type) {
#if MM_DEBUG_DRAWING
NSLog(@" Clear all");
ASLogDebug(@" Clear all");
#endif
[self clearAll];
} else if (ClearBlockDrawType == type) {
@@ -605,8 +610,8 @@ defaultLineHeightForFont(NSFont *font)
int col2 = *((int*)bytes); bytes += sizeof(int);
#if MM_DEBUG_DRAWING
NSLog(@" Clear block (%d,%d) -> (%d,%d)", row1, col1,
row2,col2);
ASLogDebug(@" Clear block (%d,%d) -> (%d,%d)", row1, col1,
row2,col2);
#endif
[self clearBlockFromRow:row1 column:col1
toRow:row2 column:col2
@@ -620,7 +625,7 @@ defaultLineHeightForFont(NSFont *font)
int right = *((int*)bytes); bytes += sizeof(int);
#if MM_DEBUG_DRAWING
NSLog(@" Delete %d line(s) from %d", count, row);
ASLogDebug(@" Delete %d line(s) from %d", count, row);
#endif
[self deleteLinesFromRow:row lineCount:count
scrollBottom:bot left:left right:right
@@ -642,8 +647,8 @@ defaultLineHeightForFont(NSFont *font)
freeWhenDone:NO];
bytes += len;
#if MM_DEBUG_DRAWING
NSLog(@" Draw string at (%d,%d) length=%d flags=%d fg=0x%x "
"bg=0x%x sp=0x%x", row, col, len, flags, fg, bg, sp);
ASLogDebug(@" Draw string at (%d,%d) length=%d flags=%d fg=0x%x "
"bg=0x%x sp=0x%x", row, col, len, flags, fg, bg, sp);
#endif
unichar *characters = malloc(sizeof(unichar) * [string length]);
[string getCharacters:characters];
@@ -667,7 +672,7 @@ defaultLineHeightForFont(NSFont *font)
int right = *((int*)bytes); bytes += sizeof(int);
#if MM_DEBUG_DRAWING
NSLog(@" Insert %d line(s) at row %d", count, row);
ASLogDebug(@" Insert %d line(s) at row %d", count, row);
#endif
[self insertLinesAtRow:row lineCount:count
scrollBottom:bot left:left right:right
@@ -680,7 +685,7 @@ defaultLineHeightForFont(NSFont *font)
int percent = *((int*)bytes); bytes += sizeof(int);
#if MM_DEBUG_DRAWING
NSLog(@" Draw cursor at (%d,%d)", row, col);
ASLogDebug(@" Draw cursor at (%d,%d)", row, col);
#endif
[helper setInsertionPointColor:[NSColor colorWithRgbInt:color]];
[self drawInsertionPointAtRow:row column:col shape:shape
@@ -693,8 +698,8 @@ defaultLineHeightForFont(NSFont *font)
/*int invert = *((int*)bytes);*/ bytes += sizeof(int);
#if MM_DEBUG_DRAWING
NSLog(@" Draw inverted rect: row=%d col=%d nrows=%d ncols=%d",
row, col, nr, nc);
ASLogDebug(@" Draw inverted rect: row=%d col=%d nrows=%d "
"ncols=%d", row, col, nr, nc);
#endif
[self drawInvertedRectAtRow:row column:col numRows:nr
numColumns:nc];
@@ -704,7 +709,7 @@ defaultLineHeightForFont(NSFont *font)
/*cursorRow = *((int*)bytes);*/ bytes += sizeof(int);
/*cursorCol = *((int*)bytes);*/ bytes += sizeof(int);
} else {
NSLog(@"WARNING: Unknown draw type (type=%d)", type);
ASLogWarn(@"Unknown draw type (type=%d)", type);
}
}
@@ -718,7 +723,7 @@ defaultLineHeightForFont(NSFont *font)
[self display];
#if MM_DEBUG_DRAWING
NSLog(@"<==== END %s", _cmd);
ASLogDebug(@"<==== END %s", _cmd);
#endif
}
@@ -775,24 +780,7 @@ defaultLineHeightForFont(NSFont *font)
- (void)changeFont:(id)sender
{
NSFont *newFont = [sender convertFont:font];
if (newFont) {
NSString *name = [newFont displayName];
unsigned len = [name lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
if (len > 0) {
NSMutableData *data = [NSMutableData data];
float pointSize = [newFont pointSize];
[data appendBytes:&pointSize length:sizeof(float)];
++len; // include NUL byte
[data appendBytes:&len length:sizeof(unsigned)];
[data appendBytes:[name UTF8String] length:len];
[[self vimController] sendMessage:SetFontMsgID data:data];
}
}
[helper changeFont:sender];
}
@@ -1044,7 +1032,6 @@ defaultLineHeightForFont(NSFont *font)
- (void)resizeContentImage
{
//NSLog(@"resizeContentImage");
[contentImage release];
contentImage = [[NSImage alloc] initWithSize:[self textAreaSize]];
[contentImage setFlipped:YES];
@@ -1102,8 +1089,6 @@ defaultLineHeightForFont(NSFont *font)
ATSUSetAttributes(style, sizeof(attribValues) / sizeof(attribValues[0]),
attribTags, attribSizes, attribValues);
// NSLog(@"drawString: %d", length);
ATSUCreateTextLayout(&layout);
ATSUSetTextPointerLocation(layout, string,
kATSUFromTextBeginning, kATSUToTextEnd,
@@ -1231,8 +1216,6 @@ defaultLineHeightForFont(NSFont *font)
NSRect rect = NSMakeRect(origin.x, origin.y,
cellSize.width, cellSize.height);
// NSLog(@"shape = %d, fraction: %d", shape, percent);
if (MMInsertionPointHorizontal == shape) {
int frac = (cellSize.height * percent + 99)/100;
rect.origin.y += rect.size.height - frac;
+9
View File
@@ -49,6 +49,9 @@
BOOL flushDisabled;
unsigned numWholeLineChanges;
unsigned offsetForDrawDataPrune;
BOOL imState;
CFSocketRef netbeansSocket;
CFRunLoopSourceRef netbeansRunLoopSource;
}
+ (MMBackend *)sharedInstance;
@@ -131,6 +134,12 @@
- (void)setWaitForAck:(BOOL)yn;
- (void)waitForConnectionAcknowledgement;
- (BOOL)imState;
- (void)setImState:(BOOL)activated;
- (void)messageFromNetbeans;
- (void)setNetbeansSocket:(int)socket;
@end
+163 -86
View File
@@ -157,16 +157,17 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
if (path)
actionDict = [[NSDictionary dictionaryWithContentsOfFile:path] retain];
if (!(colorDict && sysColorDict && actionDict))
NSLog(@"ERROR: Failed to load dictionaries.%@",
MMSymlinkWarningString);
if (!(colorDict && sysColorDict && actionDict)) {
ASLogNotice(@"Failed to load dictionaries.%@", MMSymlinkWarningString);
}
return self;
}
- (void)dealloc
{
//NSLog(@"%@ %s", [self className], _cmd);
ASLogDebug(@"");
[[NSNotificationCenter defaultCenter] removeObserver:self];
gui_mch_free_font(oldWideFont); oldWideFont = NOFONT;
@@ -282,8 +283,8 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
}
if (noErr != status) {
NSLog(@"ERROR: Failed to launch MacVim (path=%@).%@",
path, MMSymlinkWarningString);
ASLogCrit(@"Failed to launch MacVim (path=%@).%@",
path, MMSymlinkWarningString);
return NO;
}
#else
@@ -302,8 +303,8 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
objectForKey:@"CFBundleExecutable"];
NSString *path = [mainBundle pathForAuxiliaryExecutable:exeName];
if (!path) {
NSLog(@"ERROR: Could not find MacVim executable in bundle.%@",
MMSymlinkWarningString);
ASLogCrit(@"Could not find MacVim executable in bundle.%@",
MMSymlinkWarningString);
return NO;
}
@@ -322,7 +323,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
// NOTE: [self connection] will set 'connection' as a side-effect.
if (!connection) {
NSLog(@"WARNING: Timed-out waiting for GUI to launch.");
ASLogCrit(@"Timed-out waiting for GUI to launch.");
return NO;
}
}
@@ -345,8 +346,8 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
identifier = [appProxy connectBackend:self pid:pid];
return YES;
}
@catch (NSException *e) {
NSLog(@"Exception caught when trying to connect backend: \"%@\"", e);
@catch (NSException *ex) {
ASLogNotice(@"Connect backend failed: reason=%@", ex);
}
return NO;
@@ -505,16 +506,15 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
[self insertVimStateMessage];
@try {
//NSLog(@"[%s] Flushing (count=%d)", _cmd, [outputQueue count]);
ASLogDebug(@"Flushing queue: %@",
debugStringForMessageQueue(outputQueue));
[appProxy processInput:outputQueue forIdentifier:identifier];
}
@catch (NSException *e) {
NSLog(@"[%s] Exception caught: \"%@\"", _cmd, e);
NSLog(@"outputQueue(len:%d)=%@", [outputQueue count]/2,
outputQueue);
@catch (NSException *ex) {
ASLogNotice(@"processInput:forIdentifer failed: reason=%@", ex);
if (![connection isValid]) {
NSLog(@"WARNING! Connection is invalid, exit now!");
NSLog(@"waitForAck=%d got_int=%d", waitForAck, got_int);
ASLogNotice(@"Connection is invalid, exit now!");
ASLogDebug(@"waitForAck=%d got_int=%d", waitForAck, got_int);
mch_exit(-1);
}
}
@@ -575,10 +575,12 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
// Flush the entire queue in case a VimLeave autocommand added
// something to the queue.
[self queueMessage:CloseWindowMsgID data:nil];
ASLogDebug(@"Flush output queue before exit: %@",
debugStringForMessageQueue(outputQueue));
[appProxy processInput:outputQueue forIdentifier:identifier];
}
@catch (NSException *e) {
NSLog(@"Exception caught when sending CloseWindowMsgID: \"%@\"", e);
@catch (NSException *ex) {
ASLogNotice(@"CloseWindowMsgID send failed: reason=%@", ex);
}
// NOTE: If Cmd-w was pressed to close the window the menu is briefly
@@ -601,8 +603,6 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
- (void)selectTab:(int)index
{
//NSLog(@"%s%d", _cmd, index);
index -= 1;
NSData *data = [NSData dataWithBytes:&index length:sizeof(int)];
[self queueMessage:SelectTabMsgID data:data];
@@ -610,8 +610,6 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
- (void)updateTabBar
{
//NSLog(@"%s", _cmd);
NSMutableData *data = [NSMutableData data];
int idx = tabpage_index(curtab) - 1;
@@ -659,8 +657,6 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
- (void)setRows:(int)rows columns:(int)cols
{
//NSLog(@"[VimTask] setRows:%d columns:%d", rows, cols);
int dim[] = { rows, cols };
NSData *data = [NSData dataWithBytes:&dim length:2*sizeof(int)];
@@ -706,8 +702,8 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
[dialogReturn release]; dialogReturn = nil;
}
@catch (NSException *e) {
NSLog(@"[%s] Exception caught: \"%@\"", _cmd, e);
@catch (NSException *ex) {
ASLogNotice(@"Exception: reason=%@", ex);
}
return (char *)s;
@@ -715,6 +711,8 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
- (oneway void)setDialogReturn:(in bycopy id)obj
{
ASLogDebug(@"%@", obj);
// NOTE: This is called by
// - [MMVimController panelDidEnd:::], and
// - [MMVimController alertDidEnd:::],
@@ -759,8 +757,8 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
[dialogReturn release]; dialogReturn = nil;
}
@catch (NSException *e) {
NSLog(@"[%s] Exception caught: \"%@\"", _cmd, e);
@catch (NSException *ex) {
ASLogNotice(@"Exception: reason=%@", ex);
}
return retval;
@@ -981,7 +979,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
}
}
//NSLog(@"WARNING: No color with key %@ found.", stripKey);
ASLogNotice(@"No color with key %@ found.", stripKey);
return INVALCOLOR;
}
@@ -1195,7 +1193,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
- (oneway void)addReply:(in bycopy NSString *)reply
server:(in byref id <MMVimServerProtocol>)server
{
//NSLog(@"addReply:%@ server:%@", reply, (id)server);
ASLogDebug(@"reply=%@ server=%@", reply, (id)server);
// Replies might come at any time and in any order so we keep them in an
// array inside a dictionary with the send port used as key.
@@ -1217,7 +1215,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
- (void)addInput:(in bycopy NSString *)input
client:(in byref id <MMVimClientProtocol>)client
{
//NSLog(@"addInput:%@ client:%@", input, (id)client);
ASLogDebug(@"input=%@ client=%@", input, (id)client);
// NOTE: We don't call addInput: here because it differs from
// server_to_input_buf() in that it always sets the 'silent' flag and we
@@ -1247,7 +1245,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
NSString *connName = [self connectionNameFromServerName:svrName];
if ([svrConn registerName:connName]) {
//NSLog(@"Registered server with name: %@", svrName);
ASLogInfo(@"Registered server with name: %@", svrName);
// TODO: Set request/reply time-outs to something else?
//
@@ -1322,8 +1320,8 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
[proxy addInput:string client:self];
}
}
@catch (NSException *e) {
NSLog(@"WARNING: Caught exception in %s: \"%@\"", _cmd, e);
@catch (NSException *ex) {
ASLogNotice(@"Exception: reason=%@", ex);
return NO;
}
@@ -1341,8 +1339,8 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
@try {
list = [proxy serverList];
}
@catch (NSException *e) {
NSLog(@"Exception caught when listing servers: \"%@\"", e);
@catch (NSException *ex) {
ASLogNotice(@"serverList failed: reason=%@", ex);
}
} else {
EMSG(_("E???: No connection to MacVim, server listing not possible."));
@@ -1353,23 +1351,23 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
- (NSString *)peekForReplyOnPort:(int)port
{
//NSLog(@"%s%d", _cmd, port);
ASLogDebug(@"port=%d", port);
NSNumber *key = [NSNumber numberWithInt:port];
NSMutableArray *replies = [serverReplyDict objectForKey:key];
if (replies && [replies count]) {
//NSLog(@" %d replies, topmost is: %@", [replies count],
// [replies objectAtIndex:0]);
ASLogDebug(@" %d replies, topmost is: %@", [replies count],
[replies objectAtIndex:0]);
return [replies objectAtIndex:0];
}
//NSLog(@" No replies");
ASLogDebug(@" No replies");
return nil;
}
- (NSString *)waitForReplyOnPort:(int)port
{
//NSLog(@"%s%d", _cmd, port);
ASLogDebug(@"port=%d", port);
NSConnection *conn = [self connectionForServerPort:port];
if (!conn)
@@ -1390,7 +1388,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
if (replies) {
if ([replies count] > 0) {
reply = [[replies objectAtIndex:0] retain];
//NSLog(@" Got reply: %@", reply);
ASLogDebug(@" Got reply: %@", reply);
[replies removeObjectAtIndex:0];
[reply autorelease];
}
@@ -1407,12 +1405,12 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
id client = [clientProxyDict objectForKey:[NSNumber numberWithInt:port]];
if (client) {
@try {
//NSLog(@"sendReply:%@ toPort:%d", reply, port);
ASLogDebug(@"reply=%@ port=%d", reply, port);
[client addReply:reply server:self];
return YES;
}
@catch (NSException *e) {
NSLog(@"WARNING: Exception caught in %s: \"%@\"", _cmd, e);
@catch (NSException *ex) {
ASLogNotice(@"addReply:server: failed: reason=%@", ex);
}
} else {
EMSG2(_("E???: server2client failed; no client with id 0x%x"), port);
@@ -1438,12 +1436,12 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
while (waitForAck && !got_int && [connection isValid]) {
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
beforeDate:[NSDate distantFuture]];
//NSLog(@" waitForAck=%d got_int=%d isValid=%d",
// waitForAck, got_int, [connection isValid]);
ASLogDebug(@" waitForAck=%d got_int=%d isValid=%d",
waitForAck, got_int, [connection isValid]);
}
if (waitForAck) {
// Never received a connection acknowledgement, so die.
ASLogDebug(@"Never received a connection acknowledgement");
[[NSNotificationCenter defaultCenter] removeObserver:self];
[appProxy release]; appProxy = nil;
@@ -1453,15 +1451,71 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
exit(0);
}
ASLogInfo(@"Connection acknowledgement received");
[self processInputQueue];
}
- (oneway void)acknowledgeConnection
{
//NSLog(@"%s", _cmd);
ASLogDebug(@"");
waitForAck = NO;
}
- (BOOL)imState
{
return imState;
}
- (void)setImState:(BOOL)activated
{
imState = activated;
}
static void netbeansReadCallback(CFSocketRef s,
CFSocketCallBackType callbackType,
CFDataRef address,
const void *data,
void *info)
{
// NetBeans socket is readable.
[[MMBackend sharedInstance] messageFromNetbeans];
}
- (void)messageFromNetbeans
{
[inputQueue addObject:[NSNumber numberWithInt:NetBeansMsgID]];
[inputQueue addObject:[NSNull null]];
}
- (void)setNetbeansSocket:(int)socket
{
if (netbeansSocket) {
CFRelease(netbeansSocket);
netbeansSocket = NULL;
}
if (netbeansRunLoopSource) {
CFRunLoopSourceInvalidate(netbeansRunLoopSource);
netbeansRunLoopSource = NULL;
}
if (socket == -1)
return;
// Tell CFRunLoop that we are interested in NetBeans socket input.
netbeansSocket = CFSocketCreateWithNative(kCFAllocatorDefault,
socket,
kCFSocketReadCallBack,
&netbeansReadCallback,
NULL);
netbeansRunLoopSource = CFSocketCreateRunLoopSource(NULL,
netbeansSocket,
0);
CFRunLoopAddSource(CFRunLoopGetCurrent(),
netbeansRunLoopSource,
kCFRunLoopCommonModes);
}
@end // MMBackend
@@ -1592,12 +1646,11 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
if ([data isEqual:[NSNull null]])
data = nil;
//NSLog(@"(%d) %s:%s", i, _cmd, MessageStrings[msgid]);
ASLogDebug(@"(%d) %s", i, MessageStrings[msgid]);
[self handleInputEvent:msgid data:data];
}
[q release];
//NSLog(@"Clear input event queue");
}
- (void)handleInputEvent:(int)msgid data:(NSData *)data
@@ -1696,16 +1749,13 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
if (!data) return;
const void *bytes = [data bytes];
int idx = *((int*)bytes) + 1;
//NSLog(@"Selecting tab %d", idx);
send_tabline_event(idx);
} else if (CloseTabMsgID == msgid) {
if (!data) return;
const void *bytes = [data bytes];
int idx = *((int*)bytes) + 1;
//NSLog(@"Closing tab %d", idx);
send_tabline_menu_event(idx, TABLINE_MENU_CLOSE);
} else if (AddNewTabMsgID == msgid) {
//NSLog(@"Adding new tab");
send_tabline_menu_event(0, TABLINE_MENU_NEW);
} else if (DraggedTabMsgID == msgid) {
if (!data) return;
@@ -1746,7 +1796,6 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
// since we need to be able to determine where a message originated.
[self queueMessage:msgid data:d];
//NSLog(@"[VimTask] Resizing shell to %dx%d.", cols, rows);
gui_resize_shell(cols, rows);
} else if (ExecuteMenuMsgID == msgid) {
NSDictionary *attrs = [NSDictionary dictionaryWithData:data];
@@ -1784,8 +1833,16 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
[self handleOpenWithArguments:[NSDictionary dictionaryWithData:data]];
} else if (FindReplaceMsgID == msgid) {
[self handleFindReplace:[NSDictionary dictionaryWithData:data]];
} else if (ActivatedImMsgID == msgid) {
[self setImState:YES];
} else if (DeactivatedImMsgID == msgid) {
[self setImState:NO];
} else if (NetBeansMsgID == msgid) {
#ifdef FEAT_NETBEANS_INTG
messageFromNetbeansMacVim();
#endif
} else {
NSLog(@"WARNING: Unknown message received (msgid=%d)", msgid);
ASLogWarn(@"Unknown message received (msgid=%d)", msgid);
}
}
@@ -1852,7 +1909,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
NSString *specialString = [[MMBackend specialKeys]
objectForKey:key];
if (specialString && [specialString length] > 1) {
//NSLog(@"special key: %@", specialString);
//ASLogDebug(@"special key: %@", specialString);
int ikey = TO_SPECIAL([specialString characterAtIndex:0],
[specialString characterAtIndex:1]);
@@ -1947,8 +2004,8 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
return;
} else if (length > 0) {
unichar c = [key characterAtIndex:0];
//NSLog(@"non-special: %@ (hex=%x, mods=%d)", key,
// [key characterAtIndex:0], mods);
//ASLogDebug(@"non-special: %@ (hex=%x, mods=%d)", key,
// [key characterAtIndex:0], mods);
// HACK! In most circumstances the Ctrl and Shift modifiers should be
// cleared since they are already added to the key by the AppKit.
@@ -1958,7 +2015,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
|| 0x9 == c || 0xd == c || ESC == c) ) {
mods &= ~MOD_MASK_SHIFT;
mods &= ~MOD_MASK_CTRL;
//NSLog(@"clear shift ctrl");
//ASLogDebug(@"clear shift ctrl");
}
#ifdef FEAT_MBYTE
@@ -1972,14 +2029,14 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
if (chars && length > 0) {
if (mods) {
//NSLog(@"adding mods: %d", mods);
//ASLogDebug(@"adding mods: %d", mods);
modChars[0] = CSI;
modChars[1] = KS_MODIFIER;
modChars[2] = mods;
add_to_input_buf(modChars, 3);
}
//NSLog(@"add to input buf: 0x%x", chars[0]);
//ASLogDebug(@"add to input buf: 0x%x", chars[0]);
// TODO: Check for CSI bytes?
add_to_input_buf(chars, length);
}
@@ -1992,9 +2049,6 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
- (void)queueMessage:(int)msgid data:(NSData *)data
{
//if (msgid != EnableMenuItemMsgID)
// NSLog(@"queueMessage:%s", MessageStrings[msgid]);
[outputQueue addObject:[NSData dataWithBytes:&msgid length:sizeof(int)]];
if (data)
[outputQueue addObject:data];
@@ -2010,8 +2064,8 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
//
// NOTE: This is not called if a Vim controller invalidates its connection.
NSLog(@"WARNING[%s]: Main connection was lost before process had a chance "
"to terminate; preserving swap files.", _cmd);
ASLogNotice(@"Main connection was lost before process had a chance "
"to terminate; preserving swap files.");
getout_preserve_modified(1);
}
@@ -2116,7 +2170,6 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
break;
}
//NSLog(@"value %d -> %d", sb_info->value, value);
gui_drag_scrollbar(sb, value, isStillDragging);
if (updateKnob) {
@@ -2145,21 +2198,45 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
if (!data) return;
const void *bytes = [data bytes];
float pointSize = *((float*)bytes); bytes += sizeof(float);
//unsigned len = *((unsigned*)bytes); bytes += sizeof(unsigned);
bytes += sizeof(unsigned); // len not used
int pointSize = (int)*((float*)bytes); bytes += sizeof(float);
unsigned len = *((unsigned*)bytes); bytes += sizeof(unsigned);
NSMutableString *name = [NSMutableString stringWithUTF8String:bytes];
[name appendString:[NSString stringWithFormat:@":h%d", (int)pointSize]];
bytes += len;
[name appendString:[NSString stringWithFormat:@":h%d", pointSize]];
char_u *s = (char_u*)[name UTF8String];
unsigned wlen = *((unsigned*)bytes); bytes += sizeof(unsigned);
char_u *ws = NULL;
if (wlen > 0) {
NSMutableString *wname = [NSMutableString stringWithUTF8String:bytes];
bytes += wlen;
[wname appendString:[NSString stringWithFormat:@":h%d", pointSize]];
ws = (char_u*)[wname UTF8String];
}
#ifdef FEAT_MBYTE
s = CONVERT_FROM_UTF8(s);
if (ws) {
ws = CONVERT_FROM_UTF8(ws);
}
#endif
set_option_value((char_u*)"guifont", 0, s, 0);
if (ws && gui.wide_font != NOFONT) {
// NOTE: This message is sent on Cmd-+/Cmd-- and as such should only
// change the wide font if 'gfw' is non-empty (the frontend always has
// some wide font set, even if 'gfw' is empty).
set_option_value((char_u*)"guifontwide", 0, ws, 0);
}
#ifdef FEAT_MBYTE
if (ws) {
CONVERT_FROM_UTF8_FREE(ws);
}
CONVERT_FROM_UTF8_FREE(s);
#endif
@@ -2289,8 +2366,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
if (remotePath)
buf->b_odb_fname = [remotePath vimStringSave];
} else {
NSLog(@"WARNING: Could not find buffer '%@' for ODB editing.",
filename);
ASLogWarn(@"Could not find buffer '%@' for ODB editing.", filename);
}
}
#endif // FEAT_ODB_EDITOR
@@ -2329,7 +2405,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
// remoteTokenDescType ODB parameter
// remoteTokenData ODB parameter
//NSLog(@"%s%@ (starting=%d)", _cmd, args, starting);
ASLogDebug(@"args=%@ (starting=%d)", args, starting);
NSArray *filenames = [args objectForKey:@"filenames"];
int i, numFiles = filenames ? [filenames count] : 0;
@@ -2650,8 +2726,8 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
host:nil];
// Try alternate server...
if (!svrConn && alternateServerName) {
//NSLog(@" trying to connect to alternate server: %@",
// alternateServerName);
ASLogInfo(@" trying to connect to alternate server: %@",
alternateServerName);
connName = [self connectionNameFromServerName:alternateServerName];
svrConn = [NSConnection connectionWithRegisteredName:connName
host:nil];
@@ -2659,10 +2735,10 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
// Try looking for alternate servers...
if (!svrConn) {
//NSLog(@" looking for alternate servers...");
ASLogInfo(@" looking for alternate servers...");
NSString *alt = [self alternateServerNameForName:name];
if (alt != alternateServerName) {
//NSLog(@" found alternate server: %@", string);
ASLogInfo(@" found alternate server: %@", alt);
[alternateServerName release];
alternateServerName = [alt copy];
}
@@ -2670,8 +2746,8 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
// Try alternate server again...
if (!svrConn && alternateServerName) {
//NSLog(@" trying to connect to alternate server: %@",
// alternateServerName);
ASLogInfo(@" trying to connect to alternate server: %@",
alternateServerName);
connName = [self connectionNameFromServerName:alternateServerName];
svrConn = [NSConnection connectionWithRegisteredName:connName
host:nil];
@@ -2680,7 +2756,8 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
if (svrConn) {
[connectionNameDict setObject:svrConn forKey:connName];
//NSLog(@"Adding %@ as connection observer for %@", self, svrConn);
ASLogDebug(@"Adding %@ as connection observer for %@",
self, svrConn);
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(serverConnectionDidDie:)
name:NSConnectionDidDieNotification object:svrConn];
@@ -2706,11 +2783,11 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
- (void)serverConnectionDidDie:(NSNotification *)notification
{
//NSLog(@"%s%@", _cmd, notification);
ASLogDebug(@"notification=%@", notification);
NSConnection *svrConn = [notification object];
//NSLog(@"Removing %@ as connection observer from %@", self, svrConn);
ASLogDebug(@"Removing %@ as connection observer from %@", self, svrConn);
[[NSNotificationCenter defaultCenter]
removeObserver:self
name:NSConnectionDidDieNotification
+1 -2
View File
@@ -94,7 +94,7 @@
- (void)dealloc
{
LOG_DEALLOC
ASLogDebug(@"");
[[NSNotificationCenter defaultCenter] removeObserver:self];
@@ -308,7 +308,6 @@
- (void)centerView
{
NSRect outer = [self frame], inner = [view frame];
//NSLog(@"%s %@%@", _cmd, NSStringFromRect(outer), NSStringFromRect(inner));
NSPoint origin = NSMakePoint((outer.size.width - inner.size.width)/2,
(outer.size.height - inner.size.height)/2);
+5 -3
View File
@@ -50,6 +50,8 @@ static MMPlugInManager *plugInManager = nil;
- (void)dealloc
{
ASLogDebug(@"");
[plugInClasses release]; plugInClasses = nil;
[super dealloc];
}
@@ -123,13 +125,13 @@ static MMPlugInManager *plugInManager = nil;
if(currPrincipalClass && [self plugInClassIsValid:currPrincipalClass]) {
if ([currPrincipalClass initializePlugIn:
[MMPlugInAppMediator sharedAppMediator]]) {
//NSLog(@"Plug-in initialized: %@", currPath);
ASLogInfo(@"Plug-in initialized: %@", currPath);
[plugInClasses addObject:currPrincipalClass];
} else {
NSLog(@"Plug-in failed to initialize: %@", currPath);
ASLogErr(@"Plug-in failed to initialize: %@", currPath);
}
} else {
NSLog(@"Plug-in did not conform to protocol: %@", currPath);
ASLogErr(@"Plug-in did not conform to protocol: %@", currPath);
}
}
}
+4 -2
View File
@@ -115,6 +115,8 @@ NSString *kOdbEditorIdentifierWriteRoom = @"com.hogbaysoftware.WriteRoom";
- (void)dealloc
{
ASLogDebug(@"");
[supportedOdbEditors release]; supportedOdbEditors = nil;
[super dealloc];
}
@@ -383,7 +385,7 @@ NSString *kOdbEditorIdentifierWriteRoom = @"com.hogbaysoftware.WriteRoom";
[self setOdbEditorByName:kOdbEditorNameMacVim];
}
} else {
NSLog(@"Failed to install input manager, error is %d", err);
ASLogErr(@"Failed to install input manager, error is %d", err);
}
[au release];
@@ -402,7 +404,7 @@ NSString *kOdbEditorIdentifierWriteRoom = @"com.hogbaysoftware.WriteRoom";
initWithCommands:cmd];
OSStatus err = [au run];
if (err != errAuthorizationSuccess)
NSLog(@"Failed to uninstall input manager, error is %d", err);
ASLogErr(@"Failed to uninstall input manager, error is %d", err);
[au release];
[self updateIntegrationPane];
+42 -44
View File
@@ -84,7 +84,7 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
- (void)dealloc
{
LOG_DEALLOC
ASLogDebug(@"");
#if MM_USE_ROW_CACHE
if (rowCache) {
@@ -135,15 +135,13 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
withString:(NSString *)string
{
#if MM_TS_PARANOIA_LOG
NSLog(@"WARNING: calling %s on MMTextStorage is unsupported", _cmd);
ASLogWarn(@"Calling %s on MMTextStorage is unsupported", _cmd);
#endif
//[attribString replaceCharactersInRange:range withString:string];
}
- (void)setAttributes:(NSDictionary *)attributes range:(NSRange)range
{
//NSLog(@"%s%@", _cmd, NSStringFromRange(range));
// NOTE! This method must be implemented since the text system calls it
// constantly to 'fix attributes', apply font substitution, etc.
#if 0
@@ -185,7 +183,6 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
[attribString setAttributes:newAttr range:range];
} else {
//NSLog(@"NOT fixing font attribute!");
[attribString setAttributes:attributes range:range];
}
#endif
@@ -220,7 +217,7 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
{
NSLayoutManager *lm = [[self layoutManagers] objectAtIndex:0];
if (!lm) {
NSLog(@"WARNING: No layout manager available in call to %s", _cmd);
ASLogWarn(@"No layout manager available");
return;
}
@@ -253,9 +250,6 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
foregroundColor:(NSColor *)fg backgroundColor:(NSColor *)bg
specialColor:(NSColor *)sp
{
//NSLog(@"replaceString:atRow:%d column:%d withFlags:%d "
// "foreground:%@ background:%@ special:%@",
// row, col, flags, fg, bg, sp);
[self lazyResize:NO];
if (row < 0 || row >= maxRows || col < 0 || col >= maxColumns
@@ -278,7 +272,7 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
NSRange range = [self charRangeForRow:row column:&acol cells:&acells];
if (NSNotFound == range.location) {
#if MM_TS_PARANOIA_LOG
NSLog(@"INTERNAL ERROR [%s] Out of bounds", _cmd);
ASLogErr(@"INTERNAL ERROR: Out of bounds");
#endif
return;
}
@@ -344,13 +338,11 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
++changeInLength;
#if 0
} else if (acol == col - 1) {
NSLog(@"acol == col - 1");
[attribString replaceCharactersInRange:NSMakeRange(r.location,0)
withAttributedString:[emptyRowString
attributedSubstringFromRange:NSMakeRange(0,1)]];
++changeInLength;
} else if (acol == col + 1) {
NSLog(@"acol == col + 1");
[attribString replaceCharactersInRange:NSMakeRange(r.location-1,1)
withAttributedString:[emptyRowString
attributedSubstringFromRange:NSMakeRange(0,2)]];
@@ -360,8 +352,8 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
// NOTE: It seems that this never gets called. If it ever does,
// then there is another case to treat.
#if MM_TS_PARANOIA_LOG
NSLog(@"row=%d col=%d acol=%d cells=%d acells=%d", row, col, acol,
cells, acells);
ASLogWarn(@"row=%d col=%d acol=%d cells=%d acells=%d", row, col,
acol, cells, acells);
#endif
}
}
@@ -387,7 +379,6 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
scrollBottom:(int)bottom left:(int)left right:(int)right
color:(NSColor *)color
{
//NSLog(@"deleteLinesFromRow:%d lineCount:%d color:%@", row, count, color);
[self lazyResize:NO];
if (row < 0 || row+count > maxRows || bottom > maxRows || left < 0
@@ -407,7 +398,7 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
destRange = [self charRangeForRow:destRow column:&acol cells:&acells];
#if MM_TS_PARANOIA_LOG
if (acells != width || acol != left)
NSLog(@"INTERNAL ERROR [%s]", _cmd);
ASLogErr(@"INTERNAL ERROR");
#endif
acol = left; acells = width;
@@ -415,13 +406,13 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
cells:&acells];
#if MM_TS_PARANOIA_LOG
if (acells != width || acol != left)
NSLog(@"INTERNAL ERROR [%s]", _cmd);
ASLogErr(@"INTERNAL ERROR");
#endif
if (NSNotFound == destRange.location || NSNotFound == srcRange.location)
{
#if MM_TS_PARANOIA_LOG
NSLog(@"INTERNAL ERROR [%s] Out of bounds", _cmd);
ASLogErr(@"INTERNAL ERROR: Out of bounds");
#endif
return;
}
@@ -453,11 +444,11 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
destRange = [self charRangeForRow:destRow column:&acol cells:&acells];
#if MM_TS_PARANOIA_LOG
if (acells != width || acol != left)
NSLog(@"INTERNAL ERROR [%s]", _cmd);
ASLogErr(@"INTERNAL ERROR");
#endif
if (NSNotFound == destRange.location) {
#if MM_TS_PARANOIA_LOG
NSLog(@"INTERNAL ERROR [%s] Out of bounds", _cmd);
ASLogErr(@"INTERNAL ERROR: Out of bounds");
#endif
return;
}
@@ -485,7 +476,6 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
scrollBottom:(int)bottom left:(int)left right:(int)right
color:(NSColor *)color
{
//NSLog(@"insertLinesAtRow:%d lineCount:%d color:%@", row, count, color);
[self lazyResize:NO];
if (row < 0 || row+count > maxRows || bottom > maxRows || left < 0
@@ -506,19 +496,19 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
destRange = [self charRangeForRow:destRow column:&acol cells:&acells];
#if MM_TS_PARANOIA_LOG
if (acells != width || acol != left)
NSLog(@"INTERNAL ERROR [%s]", _cmd);
ASLogErr(@"INTERNAL ERROR");
#endif
acol = left; acells = width;
srcRange = [self charRangeForRow:srcRow column:&acol cells:&acells];
#if MM_TS_PARANOIA_LOG
if (acells != width || acol != left)
NSLog(@"INTERNAL ERROR [%s]", _cmd);
ASLogErr(@"INTERNAL ERROR");
#endif
if (NSNotFound == destRange.location || NSNotFound == srcRange.location)
{
#if MM_TS_PARANOIA_LOG
NSLog(@"INTERNAL ERROR [%s] Out of bounds", _cmd);
ASLogErr(@"INTERNAL ERROR: Out of bounds");
#endif
return;
}
@@ -549,11 +539,11 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
destRange = [self charRangeForRow:destRow column:&acol cells:&acells];
#if MM_TS_PARANOIA_LOG
if (acells != width || acol != left)
NSLog(@"INTERNAL ERROR [%s]", _cmd);
ASLogErr(@"INTERNAL ERROR");
#endif
if (NSNotFound == destRange.location) {
#if MM_TS_PARANOIA_LOG
NSLog(@"INTERNAL ERROR [%s] Out of bounds", _cmd);
ASLogErr(@"INTERNAL ERROR: Out of bounds");
#endif
return;
}
@@ -576,8 +566,6 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
- (void)clearBlockFromRow:(int)row1 column:(int)col1 toRow:(int)row2
column:(int)col2 color:(NSColor *)color
{
//NSLog(@"clearBlockFromRow:%d column:%d toRow:%d column:%d color:%@",
// row1, col1, row2, col2, color);
[self lazyResize:NO];
if (row1 < 0 || row2 >= maxRows || col1 < 0 || col2 > maxColumns)
@@ -598,11 +586,11 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
range = [self charRangeForRow:r column:&acol cells:&acells];
#if MM_TS_PARANOIA_LOG
if (acells != cells || acol != col1)
NSLog(@"INTERNAL ERROR [%s]", _cmd);
ASLogErr(@"INTERNAL ERROR");
#endif
if (NSNotFound == range.location) {
#if MM_TS_PARANOIA_LOG
NSLog(@"INTERNAL ERROR [%s] Out of bounds", _cmd);
ASLogErr(@"INTERNAL ERROR: Out of bounds");
#endif
return;
}
@@ -624,7 +612,6 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
- (void)clearAll
{
//NSLog(@"%s", _cmd);
[self lazyResize:YES];
}
@@ -683,7 +670,7 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
cellSize.height = linespace + [lm defaultLineHeightForFont:font];
} else {
// Should never happen, set some bogus value for cell height.
NSLog(@"WARNING: No layout manager available in call to %s", _cmd);
ASLogWarn(@"No layout manager available");
cellSize.height = linespace + 16.0;
}
@@ -1009,15 +996,16 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
return NSMakeRange(row*(actualColumns+1) + col, cells);
NSString *string = [attribString string];
unsigned stringLen = [string length];
NSRange r, range = { NSNotFound, 0 };
unsigned idx, rowEnd;
unsigned idx;
int i;
if (row < 0 || row >= actualRows || col < 0 || col >= actualColumns
|| col+cells > actualColumns) {
#if MM_TS_PARANOIA_LOG
NSLog(@"%s row=%d col=%d cells=%d is out of range (length=%d)",
_cmd, row, col, cells, [string length]);
ASLogErr(@"row=%d col=%d cells=%d is out of range (length=%d)",
row, col, cells, stringLen);
#endif
return range;
}
@@ -1029,12 +1017,12 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
for (i = 0; i < row; ++i, ++cache)
idx += cache->length;
rowEnd = idx + cache->length;
int rowEnd = idx + cache->length;
#else
// Locate the beginning of the row by scanning for EOL characters.
r.location = 0;
for (i = 0; i < row; ++i) {
r.length = [string length] - r.location;
r.length = stringLen - r.location;
r = [string rangeOfString:@"\n" options:NSLiteralSearch range:r];
if (NSNotFound == r.location)
return range;
@@ -1070,6 +1058,8 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
if (col > i) {
// Forward search
while (col > i) {
if (idx >= stringLen)
return NSMakeRange(NSNotFound, 0);
r = [string rangeOfComposedCharacterSequenceAtIndex:idx];
// Wide chars take up two display cells.
@@ -1084,6 +1074,8 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
} else if (col < i) {
// Backward search
while (col < i) {
if (idx-1 >= stringLen)
return NSMakeRange(NSNotFound, 0);
r = [string rangeOfComposedCharacterSequenceAtIndex:idx-1];
idx -= r.length;
--i;
@@ -1111,6 +1103,8 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
// Forward search
while (col > i) {
if (idx >= stringLen)
return NSMakeRange(NSNotFound, 0);
r = [string rangeOfComposedCharacterSequenceAtIndex:idx];
// Wide chars take up two display cells.
@@ -1131,6 +1125,8 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
#else
idx = r.location;
for (i = 0; i < col; ++i) {
if (idx >= stringLen)
return NSMakeRange(NSNotFound, 0);
r = [string rangeOfComposedCharacterSequenceAtIndex:idx];
// Wide chars take up two display cells.
@@ -1146,6 +1142,8 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
// Count the number of characters that cover the cells.
range.location = idx;
for (i = 0; i < cells; ++i) {
if (idx >= stringLen)
return NSMakeRange(NSNotFound, 0);
r = [string rangeOfComposedCharacterSequenceAtIndex:idx];
// Wide chars take up two display cells.
@@ -1163,20 +1161,20 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
#if MM_TS_PARANOIA_LOG
#if MM_USE_ROW_CACHE
if (range.location >= rowEnd-1) {
NSLog(@"INTERNAL ERROR [%s] : row=%d col=%d cells=%d --> range=%@",
_cmd, row, col, cells, NSStringFromRange(range));
ASLogErr(@"INTERNAL ERROR: row=%d col=%d cells=%d --> range=%@",
row, col, cells, NSStringFromRange(range));
range.location = rowEnd - 2;
range.length = 1;
} else if (NSMaxRange(range) >= rowEnd) {
NSLog(@"INTERNAL ERROR [%s] : row=%d col=%d cells=%d --> range=%@",
_cmd, row, col, cells, NSStringFromRange(range));
ASLogErr(@"INTERNAL ERROR: row=%d col=%d cells=%d --> range=%@",
row, col, cells, NSStringFromRange(range));
range.length = rowEnd - range.location - 1;
}
#endif
if (NSMaxRange(range) > [string length]) {
NSLog(@"INTERNAL ERROR [%s] : row=%d col=%d cells=%d --> range=%@",
_cmd, row, col, cells, NSStringFromRange(range));
if (NSMaxRange(range) > stringLen) {
ASLogErr(@"INTERNAL ERROR: row=%d col=%d cells=%d --> range=%@",
row, col, cells, NSStringFromRange(range));
range.location = NSNotFound;
range.length = 0;
}
+1
View File
@@ -32,6 +32,7 @@
- (void)performBatchDrawWithData:(NSData *)data;
- (void)setMouseShape:(int)shape;
- (void)setAntialias:(BOOL)antialias;
- (void)setImControl:(BOOL)enable;
//
// MMTextStorage methods
+23 -44
View File
@@ -63,10 +63,12 @@
NSTypesetter *typesetter = [[MMTypesetter alloc] init];
[lm setTypesetter:typesetter];
[typesetter release];
#if MM_USE_ROW_CACHE
} else if ([typesetterString isEqual:@"MMTypesetter2"]) {
NSTypesetter *typesetter = [[MMTypesetter2 alloc] init];
[lm setTypesetter:typesetter];
[typesetter release];
#endif // MM_USE_ROW_CACHE
} else {
// Only MMTypesetter supports different cell width multipliers.
[[NSUserDefaults standardUserDefaults]
@@ -110,7 +112,7 @@
- (void)dealloc
{
LOG_DEALLOC
ASLogDebug(@"");
if (invertRects) {
free(invertRects);
@@ -151,7 +153,7 @@
int cursorRow = -1, cursorCol = 0;
#if MM_DEBUG_DRAWING
NSLog(@"====> BEGIN %s", _cmd);
ASLogDebug(@"====> BEGIN %s", _cmd);
#endif
[textStorage beginEditing];
@@ -162,7 +164,7 @@
if (ClearAllDrawType == type) {
#if MM_DEBUG_DRAWING
NSLog(@" Clear all");
ASLogDebug(@" Clear all");
#endif
[textStorage clearAll];
} else if (ClearBlockDrawType == type) {
@@ -173,8 +175,8 @@
int col2 = *((int*)bytes); bytes += sizeof(int);
#if MM_DEBUG_DRAWING
NSLog(@" Clear block (%d,%d) -> (%d,%d)", row1, col1,
row2,col2);
ASLogDebug(@" Clear block (%d,%d) -> (%d,%d)", row1, col1,
row2,col2);
#endif
[textStorage clearBlockFromRow:row1 column:col1
toRow:row2 column:col2
@@ -188,7 +190,7 @@
int right = *((int*)bytes); bytes += sizeof(int);
#if MM_DEBUG_DRAWING
NSLog(@" Delete %d line(s) from %d", count, row);
ASLogDebug(@" Delete %d line(s) from %d", count, row);
#endif
[textStorage deleteLinesFromRow:row lineCount:count
scrollBottom:bot left:left right:right
@@ -208,9 +210,9 @@
bytes += len;
#if MM_DEBUG_DRAWING
NSLog(@" Draw string at (%d,%d) length=%d flags=%d fg=0x%x "
"bg=0x%x sp=0x%x (%@)", row, col, len, flags, fg, bg, sp,
len > 0 ? [string substringToIndex:1] : @"");
ASLogDebug(@" Draw string at (%d,%d) length=%d flags=%d fg=0x%x "
"bg=0x%x sp=0x%x (%@)", row, col, len, flags, fg, bg, sp,
len > 0 ? [string substringToIndex:1] : @"");
#endif
// NOTE: If this is a call to draw the (block) cursor, then cancel
// any previous request to draw the insertion point, or it might
@@ -235,7 +237,7 @@
int right = *((int*)bytes); bytes += sizeof(int);
#if MM_DEBUG_DRAWING
NSLog(@" Insert %d line(s) at row %d", count, row);
ASLogDebug(@" Insert %d line(s) at row %d", count, row);
#endif
[textStorage insertLinesAtRow:row lineCount:count
scrollBottom:bot left:left right:right
@@ -248,7 +250,7 @@
int percent = *((int*)bytes); bytes += sizeof(int);
#if MM_DEBUG_DRAWING
NSLog(@" Draw cursor at (%d,%d)", row, col);
ASLogDebug(@" Draw cursor at (%d,%d)", row, col);
#endif
[helper setInsertionPointColor:[NSColor colorWithRgbInt:color]];
[self drawInsertionPointAtRow:row column:col shape:shape
@@ -261,8 +263,8 @@
int invert = *((int*)bytes); bytes += sizeof(int);
#if MM_DEBUG_DRAWING
NSLog(@" Draw inverted rect: row=%d col=%d nrows=%d ncols=%d",
row, col, nr, nc);
ASLogDebug(@" Draw inverted rect: row=%d col=%d nrows=%d "
"ncols=%d", row, col, nr, nc);
#endif
[self drawInvertedRectAtRow:row column:col numRows:nr numColumns:nc
invert:invert];
@@ -270,7 +272,7 @@
cursorRow = *((int*)bytes); bytes += sizeof(int);
cursorCol = *((int*)bytes); bytes += sizeof(int);
} else {
NSLog(@"WARNING: Unknown draw type (type=%d)", type);
ASLogWarn(@"Unknown draw type (type=%d)", type);
}
}
@@ -291,7 +293,7 @@
[self display];
#if MM_DEBUG_DRAWING
NSLog(@"<==== END %s", _cmd);
ASLogDebug(@"<==== END %s", _cmd);
#endif
}
@@ -305,6 +307,11 @@
antialias = state;
}
- (void)setImControl:(BOOL)enable
{
[helper setImControl:enable];
}
- (NSFont *)font
{
return [(MMTextStorage*)[self textStorage] font];
@@ -444,9 +451,6 @@
if (row) *row = floor((point.y-origin.y-1) / cellSize.height);
if (column) *column = floor((point.x-origin.x-1) / cellSize.width);
//NSLog(@"convertPoint:%@ toRow:%d column:%d", NSStringFromPoint(point),
// *row, *column);
return YES;
}
@@ -617,10 +621,6 @@
// NOTE: We only draw the cursor once and rely on Vim to say when it
// should be drawn again.
shouldDrawInsertionPoint = NO;
//NSLog(@"%s draw insertion point %@ shape=%d color=%@", _cmd,
// NSStringFromRect(ipRect), insertionPointShape,
// [helper insertionPointColor]);
}
#if 0
@@ -808,28 +808,7 @@
- (void)changeFont:(id)sender
{
MMTextStorage *ts = (MMTextStorage*)[self textStorage];
if (!ts) return;
NSFont *oldFont = [ts font];
NSFont *newFont = [sender convertFont:oldFont];
if (newFont) {
NSString *name = [newFont displayName];
unsigned len = [name lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
if (len > 0) {
NSMutableData *data = [NSMutableData data];
float pointSize = [newFont pointSize];
[data appendBytes:&pointSize length:sizeof(float)];
++len; // include NUL byte
[data appendBytes:&len length:sizeof(unsigned)];
[data appendBytes:[name UTF8String] length:len];
[[self vimController] sendMessage:SetFontMsgID data:data];
}
}
[helper changeFont:sender];
}
- (void)resetCursorRects
+4
View File
@@ -39,6 +39,8 @@ enum {
NSMutableAttributedString *markedText;
int preEditRow;
int preEditColumn;
BOOL imControl;
BOOL imState;
}
- (void)setTextView:(id)view;
@@ -63,6 +65,7 @@ enum {
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender;
- (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender;
- (void)setMouseShape:(int)shape;
- (void)changeFont:(id)sender;
// Input Manager
- (BOOL)hasMarkedText;
@@ -79,5 +82,6 @@ enum {
- (NSRange)imRange;
- (void)setMarkedRange:(NSRange)range;
- (NSRect)firstRectForCharacterRange:(NSRange)range;
- (void)setImControl:(BOOL)enable;
@end
+77 -24
View File
@@ -40,6 +40,7 @@ static float MMDragAreaSize = 73.0f;
- (void)dispatchKeyEvent:(NSEvent *)event;
- (void)sendKeyDown:(const char *)chars length:(int)len modifiers:(int)flags
isARepeat:(BOOL)isARepeat;
- (void)checkImState;
- (void)hideMouseCursor;
- (void)startDragTimerWithInterval:(NSTimeInterval)t;
- (void)dragTimerFired:(NSTimer *)timer;
@@ -52,6 +53,8 @@ static float MMDragAreaSize = 73.0f;
- (void)dealloc
{
ASLogDebug(@"");
[insertionPointColor release]; insertionPointColor = nil;
[markedText release]; markedText = nil;
[markedTextAttributes release]; markedTextAttributes = nil;
@@ -80,7 +83,7 @@ static float MMDragAreaSize = 73.0f;
- (void)keyDown:(NSEvent *)event
{
//NSLog(@"%s %@", _cmd, event);
//ASLogDebug(@"%@", event);
// HACK! If control modifier is held, don't pass the event along to
// interpretKeyEvents: since some keys are bound to multiple commands which
// means doCommandBySelector: is called several times. Do the same for
@@ -91,6 +94,9 @@ static float MMDragAreaSize = 73.0f;
// TODO: Figure out a way to disable Cocoa key bindings entirely, without
// affecting input management.
if (imControl)
[self checkImState];
// When the Input Method is activated, some special key inputs
// should be treated as key inputs for Input Method.
if ([textView hasMarkedText]) {
@@ -136,7 +142,7 @@ static float MMDragAreaSize = 73.0f;
- (void)insertText:(id)string
{
//NSLog(@"%s %@", _cmd, string);
//ASLogDebug(@"%@", string);
// NOTE! This method is called for normal key presses but also for
// Option-key presses --- even when Ctrl is held as well as Option. When
// Ctrl is held, the AppKit translates the character to a Ctrl+key stroke,
@@ -174,8 +180,6 @@ static float MMDragAreaSize = 73.0f;
if ([string isKindOfClass:[NSAttributedString class]])
string = [string string];
//NSLog(@"send InsertTextMsgID: %@", string);
NSMutableData *data = [NSMutableData data];
int len = [string lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
int flags = [event modifierFlags] & 0xffff0000U;
@@ -191,7 +195,7 @@ static float MMDragAreaSize = 73.0f;
- (void)doCommandBySelector:(SEL)selector
{
//NSLog(@"%s %@", _cmd, NSStringFromSelector(selector));
//ASLogDebug(@"%@", NSStringFromSelector(selector));
// By ignoring the selector we effectively disable the key binding
// mechanism of Cocoa. Hopefully this is what the user will expect
// (pressing Ctrl+P would otherwise result in moveUp: instead of previous
@@ -230,7 +234,7 @@ static float MMDragAreaSize = 73.0f;
- (BOOL)performKeyEquivalent:(NSEvent *)event
{
//NSLog(@"%s %@", _cmd, event);
//ASLogDebug(@"%@", event);
// Called for Cmd+key keystrokes, function keys, arrow keys, page
// up/down, home, end.
//
@@ -238,6 +242,9 @@ static float MMDragAreaSize = 73.0f;
// passed to keyDown:. It seems as if the main menu consumes Cmd-key
// strokes, unless the key is a function key.
if (imControl)
[self checkImState];
// NOTE: If the event that triggered this method represents a function key
// down then we do nothing, otherwise the input method never gets the key
// stroke (some input methods use e.g. arrow keys). The function key down
@@ -282,8 +289,6 @@ static float MMDragAreaSize = 73.0f;
return YES;
}
//NSLog(@"%s%@", _cmd, event);
NSString *chars = [event characters];
int len = [unmodchars lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
NSMutableData *data = [NSMutableData data];
@@ -444,15 +449,11 @@ static float MMDragAreaSize = 73.0f;
[data appendBytes:&col length:sizeof(int)];
[[self vimController] sendMessage:MouseMovedMsgID data:data];
//NSLog(@"Moved %d %d\n", col, row);
}
}
- (void)mouseEntered:(NSEvent *)event
{
//NSLog(@"%s", _cmd);
// NOTE: This event is received even when the window is not key; thus we
// have to take care not to enable mouse moved events unless our window is
// key.
@@ -463,8 +464,6 @@ static float MMDragAreaSize = 73.0f;
- (void)mouseExited:(NSEvent *)event
{
//NSLog(@"%s", _cmd);
[[textView window] setAcceptsMouseMovedEvents:NO];
// NOTE: This event is received even when the window is not key; if the
@@ -480,8 +479,6 @@ static float MMDragAreaSize = 73.0f;
- (void)setFrame:(NSRect)frame
{
//NSLog(@"%s", _cmd);
// When the frame changes we also need to update the tracking rect.
[textView removeTrackingRect:trackingRectTag];
trackingRectTag = [textView addTrackingRect:[self trackingRect]
@@ -492,8 +489,6 @@ static float MMDragAreaSize = 73.0f;
- (void)viewDidMoveToWindow
{
//NSLog(@"%s (window=%@)", _cmd, [self window]);
// Set a tracking rect which covers the text.
// NOTE: While the mouse cursor is in this rect the view will receive
// 'mouseMoved:' events so that Vim can take care of updating the mouse
@@ -509,8 +504,6 @@ static float MMDragAreaSize = 73.0f;
- (void)viewWillMoveToWindow:(NSWindow *)newWindow
{
//NSLog(@"%s%@", _cmd, newWindow);
// Remove tracking rect if view moves or is removed.
if ([textView window] && trackingRectTag) {
[textView removeTrackingRect:trackingRectTag];
@@ -571,6 +564,40 @@ static float MMDragAreaSize = 73.0f;
[self setCursor];
}
- (void)changeFont:(id)sender
{
NSFont *newFont = [sender convertFont:[textView font]];
NSFont *newFontWide = [sender convertFont:[textView fontWide]];
if (newFont) {
NSString *name = [newFont displayName];
NSString *wideName = [newFontWide displayName];
unsigned len = [name lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
unsigned wideLen = [wideName lengthOfBytesUsingEncoding:
NSUTF8StringEncoding];
if (len > 0) {
NSMutableData *data = [NSMutableData data];
float pointSize = [newFont pointSize];
[data appendBytes:&pointSize length:sizeof(float)];
++len; // include NUL byte
[data appendBytes:&len length:sizeof(unsigned)];
[data appendBytes:[name UTF8String] length:len];
if (wideLen > 0) {
++wideLen; // include NUL byte
[data appendBytes:&wideLen length:sizeof(unsigned)];
[data appendBytes:[wideName UTF8String] length:wideLen];
} else {
[data appendBytes:&wideLen length:sizeof(unsigned)];
}
[[self vimController] sendMessage:SetFontMsgID data:data];
}
}
}
- (BOOL)hasMarkedText
{
return markedRange.length > 0 ? YES : NO;
@@ -723,6 +750,14 @@ static float MMDragAreaSize = 73.0f;
return rect;
}
- (void)setImControl:(BOOL)enable
{
// This flag corresponds to the (negation of the) 'imd' option. When
// enabled changes to the input method are detected and forwarded to the
// backend.
imControl = enable;
}
@end // MMTextViewHelper
@@ -757,8 +792,8 @@ static float MMDragAreaSize = 73.0f;
const char *bytes = 0;
int mods = [event modifierFlags];
//NSLog(@"%s chars[0]=0x%x unmodchars[0]=0x%x (chars=%@ unmodchars=%@)",
// _cmd, c, imc, chars, unmodchars);
//ASLogDebug(@"chars[0]=0x%x unmodchars[0]=0x%x (chars=%@ unmodchars=%@)",
// c, imc, chars, unmodchars);
if (' ' == imc && 0xa0 != c) {
// HACK! The AppKit turns <C-Space> into <C-@> which is not standard
@@ -806,11 +841,29 @@ static float MMDragAreaSize = 73.0f;
[self hideMouseCursor];
//NSLog(@"%s len=%d chars=0x%x", _cmd, len, chars[0]);
//ASLogDebug(@"len=%d chars=0x%x", len, chars[0]);
[[self vimController] sendMessage:KeyDownMsgID data:data];
}
}
- (void)checkImState
{
// IM is active whenever the current script is the system script and the
// system script isn't roman. (Hence IM can only be active when using
// non-roman scripts.)
// NOTE: The IM code is delegated to the frontend since calling it in the
// backend caused weird bugs (second dock icon appearing etc.).
SInt32 currentScript = GetScriptManagerVariable(smKeyScript);
SInt32 systemScript = GetScriptManagerVariable(smSysScript);
BOOL state = currentScript != smRoman && currentScript == systemScript;
if (imState != state) {
imState = state;
int msgid = state ? ActivatedImMsgID : DeactivatedImMsgID;
[[self vimController] sendMessage:msgid data:nil];
}
}
- (void)hideMouseCursor
{
// Check 'mousehide' option
@@ -887,7 +940,7 @@ static float MMDragAreaSize = 73.0f;
initWithImage:ibeamImage hotSpot:hotSpot];
}
if (!customIbeamCursor) {
NSLog(@"WARNING: Failed to load custom Ibeam cursor");
ASLogWarn(@"Failed to load custom Ibeam cursor");
customIbeamCursor = [NSCursor IBeamCursor];
}
}
+7 -4
View File
@@ -60,7 +60,6 @@
- (NSTypesetterControlCharacterAction)
actionForControlCharacterAtIndex:(unsigned)charIndex
{
//NSLog(@"%s%d", _cmd, charIndex);
/*NSTextStorage *ts = [[self layoutManager] textStorage];
if ('\n' == [[ts string] characterAtIndex:charIndex])
@@ -75,9 +74,9 @@
withAdvancements:(const float *)advancements
forStartOfGlyphRange:(NSRange)glyphRange
{
NSLog(@"setLocation:%@ withAdvancements:%f forStartOfGlyphRange:%@",
NSStringFromPoint(location), advancements ? *advancements : 0,
NSStringFromRange(glyphRange));
ASLogDebug(@"setLocation:%@ withAdvancements:%f forStartOfGlyphRange:%@",
NSStringFromPoint(location), advancements ? *advancements : 0,
NSStringFromRange(glyphRange));
[super setLocation:location withAdvancements:advancements
forStartOfGlyphRange:glyphRange];
}
@@ -89,6 +88,8 @@
#if MM_USE_ROW_CACHE
@implementation MMTypesetter2
//
@@ -188,3 +189,5 @@
@end // MMTypesetter2
#endif // MM_USE_ROW_CACHE
+88 -44
View File
@@ -162,7 +162,7 @@ static BOOL isUnsafeMessage(int msgid);
- (void)dealloc
{
LOG_DEALLOC
ASLogDebug(@"");
isInitialized = NO;
@@ -252,6 +252,9 @@ static BOOL isUnsafeMessage(int msgid);
- (void)dropFiles:(NSArray *)filenames forceOpen:(BOOL)force
{
filenames = normalizeFilenames(filenames);
ASLogInfo(@"filenames=%@ force=%d", filenames, force);
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
// Default to opening in tabs if layout is invalid or set to "windows".
@@ -274,6 +277,9 @@ static BOOL isUnsafeMessage(int msgid);
- (void)file:(NSString *)filename draggedToTabAtIndex:(NSUInteger)tabIndex
{
filename = normalizeFilename(filename);
ASLogInfo(@"filename=%@ index=%d", filename, tabIndex);
NSString *fnEsc = [filename stringByEscapingSpecialFilenameCharacters];
NSString *input = [NSString stringWithFormat:@"<C-\\><C-N>:silent "
"tabnext %d |"
@@ -283,6 +289,9 @@ static BOOL isUnsafeMessage(int msgid);
- (void)filesDraggedToTabBar:(NSArray *)filenames
{
filenames = normalizeFilenames(filenames);
ASLogInfo(@"%@", filenames);
NSUInteger i, count = [filenames count];
NSMutableString *input = [NSMutableString stringWithString:@"<C-\\><C-N>"
":silent! tabnext 9999"];
@@ -297,6 +306,7 @@ static BOOL isUnsafeMessage(int msgid);
- (void)dropString:(NSString *)string
{
ASLogInfo(@"%@", string);
int len = [string lengthOfBytesUsingEncoding:NSUTF8StringEncoding] + 1;
if (len > 0) {
NSMutableData *data = [NSMutableData data];
@@ -312,6 +322,8 @@ static BOOL isUnsafeMessage(int msgid);
{
if (!args) return;
ASLogDebug(@"args=%@", args);
[self sendMessage:OpenWithArgumentsMsgID data:[args dictionaryAsData]];
// HACK! Fool findUnusedEditor into thinking that this controller is not
@@ -328,17 +340,17 @@ static BOOL isUnsafeMessage(int msgid);
- (void)sendMessage:(int)msgid data:(NSData *)data
{
//NSLog(@"sendMessage:%s (isInitialized=%d)",
// MessageStrings[msgid], isInitialized);
ASLogDebug(@"msg=%s (isInitialized=%d)",
MessageStrings[msgid], isInitialized);
if (!isInitialized) return;
@try {
[backendProxy processInput:msgid data:data];
}
@catch (NSException *e) {
//NSLog(@"%@ %s Exception caught during DO call: %@",
// [self className], _cmd, e);
@catch (NSException *ex) {
ASLogNotice(@"processInput:data: failed: pid=%d id=%d msg=%s reason=%@",
pid, identifier, MessageStrings[msgid], ex);
}
}
@@ -350,6 +362,9 @@ static BOOL isUnsafeMessage(int msgid);
// ball forever. In almost all circumstances sendMessage:data: should be
// used instead.
ASLogDebug(@"msg=%s (isInitialized=%d)",
MessageStrings[msgid], isInitialized);
if (!isInitialized)
return NO;
@@ -364,8 +379,10 @@ static BOOL isUnsafeMessage(int msgid);
@try {
[backendProxy processInput:msgid data:data];
}
@catch (NSException *e) {
@catch (NSException *ex) {
sendOk = NO;
ASLogNotice(@"processInput:data: failed: pid=%d id=%d msg=%s reason=%@",
pid, identifier, MessageStrings[msgid], ex);
}
@finally {
[conn setRequestTimeout:oldTimeout];
@@ -376,6 +393,8 @@ static BOOL isUnsafeMessage(int msgid);
- (void)addVimInput:(NSString *)string
{
ASLogDebug(@"%@", string);
// This is a very general method of adding input to the Vim process. It is
// basically the same as calling remote_send() on the process (see
// ':h remote_send').
@@ -391,8 +410,12 @@ static BOOL isUnsafeMessage(int msgid);
@try {
eval = [backendProxy evaluateExpression:expr];
ASLogDebug(@"eval(%@)=%@", expr, eval);
}
@catch (NSException *ex) {
ASLogNotice(@"evaluateExpression: failed: pid=%d id=%d reason=%@",
pid, identifier, ex);
}
@catch (NSException *ex) { /* do nothing */ }
return eval;
}
@@ -405,7 +428,10 @@ static BOOL isUnsafeMessage(int msgid);
@try {
eval = [backendProxy evaluateExpressionCocoa:expr
errorString:errstr];
ASLogDebug(@"eval(%@)=%@", expr, eval);
} @catch (NSException *ex) {
ASLogNotice(@"evaluateExpressionCocoa: failed: pid=%d id=%d reason=%@",
pid, identifier, ex);
*errstr = [ex reason];
}
@@ -443,7 +469,7 @@ static BOOL isUnsafeMessage(int msgid);
[windowController processInputQueueDidFinish];
}
@catch (NSException *ex) {
NSLog(@"[%s] Caught exception (pid=%d): %@", _cmd, pid, ex);
ASLogNotice(@"Exception: pid=%d id=%d reason=%@", pid, identifier, ex);
}
}
@@ -453,7 +479,7 @@ static BOOL isUnsafeMessage(int msgid);
{
NSToolbarItem *item = [toolbarItemDict objectForKey:itemId];
if (!item) {
NSLog(@"WARNING: No toolbar item with id '%@'", itemId);
ASLogWarn(@"No toolbar item with id '%@'", itemId);
}
return item;
@@ -481,18 +507,16 @@ static BOOL isUnsafeMessage(int msgid);
unsigned i, count = [queue count];
if (count % 2) {
NSLog(@"WARNING: Uneven number of components (%d) in command "
"queue. Skipping...", count);
ASLogWarn(@"Uneven number of components (%d) in command queue. "
"Skipping...", count);
return;
}
//NSLog(@"======== %s BEGIN ========", _cmd);
for (i = 0; i < count; i += 2) {
NSData *value = [queue objectAtIndex:i];
NSData *data = [queue objectAtIndex:i+1];
int msgid = *((int*)[value bytes]);
//NSLog(@"%s%s", _cmd, MessageStrings[msgid]);
BOOL inDefaultMode = [[[NSRunLoop currentRunLoop] currentMode]
isEqual:NSDefaultRunLoopMode];
@@ -513,19 +537,19 @@ static BOOL isUnsafeMessage(int msgid);
if (!delayQueue)
delayQueue = [NSMutableArray array];
//NSLog(@"Adding unsafe message '%s' to delay queue (mode=%@)",
// MessageStrings[msgid],
// [[NSRunLoop currentRunLoop] currentMode]);
ASLogDebug(@"Adding unsafe message '%s' to delay queue (mode=%@)",
MessageStrings[msgid],
[[NSRunLoop currentRunLoop] currentMode]);
[delayQueue addObject:value];
[delayQueue addObject:data];
} else {
[self handleMessage:msgid data:data];
}
}
//NSLog(@"======== %s END ========", _cmd);
if (delayQueue) {
//NSLog(@" Flushing delay queue (%d items)", [delayQueue count]/2);
ASLogDebug(@" Flushing delay queue (%d items)",
[delayQueue count]/2);
[self performSelector:@selector(processInputQueue:)
withObject:delayQueue
afterDelay:0];
@@ -534,10 +558,6 @@ static BOOL isUnsafeMessage(int msgid);
- (void)handleMessage:(int)msgid data:(NSData *)data
{
//if (msgid != AddMenuMsgID && msgid != AddMenuItemMsgID &&
// msgid != EnableMenuItemMsgID)
// NSLog(@"%@ %s%s", [self className], _cmd, MessageStrings[msgid]);
if (OpenWindowMsgID == msgid) {
[windowController openWindow];
@@ -551,7 +571,6 @@ static BOOL isUnsafeMessage(int msgid);
#if 0 // NOTE: Tab selection is done inside updateTabsWithData:.
const void *bytes = [data bytes];
int idx = *((int*)bytes);
//NSLog(@"Selecting tab with index %d", idx);
[windowController selectTabWithIndex:idx];
#endif
} else if (UpdateTabBarMsgID == msgid) {
@@ -739,7 +758,6 @@ static BOOL isUnsafeMessage(int msgid);
[windowController adjustLinespace:linespace];
} else if (ActivateMsgID == msgid) {
//NSLog(@"ActivateMsgID");
[NSApp activateIgnoringOtherApps:YES];
[[windowController window] makeKeyAndOrderFront:self];
} else if (SetServerNameMsgID == msgid) {
@@ -788,10 +806,16 @@ static BOOL isUnsafeMessage(int msgid);
showWithText:[dict objectForKey:@"text"]
flags:[[dict objectForKey:@"flags"] intValue]];
}
} else if (ActivateKeyScriptID == msgid) {
} else if (ActivateKeyScriptMsgID == msgid) {
// NOTE: The IM code is delegated to the frontend since calling it in
// the backend caused weird bugs (second dock icon appearing etc.).
KeyScript(smKeySysScript);
} else if (DeactivateKeyScriptID == msgid) {
} else if (DeactivateKeyScriptMsgID == msgid) {
KeyScript(smKeyRoman);
} else if (EnableImControlMsgID == msgid) {
[[[windowController vimView] textView] setImControl:YES];
} else if (DisableImControlMsgID == msgid) {
[[[windowController vimView] textView] setImControl:NO];
} else if (BrowseForFileMsgID == msgid) {
NSDictionary *dict = [NSDictionary dictionaryWithData:data];
if (dict)
@@ -803,7 +827,7 @@ static BOOL isUnsafeMessage(int msgid);
// IMPORTANT: When adding a new message, make sure to update
// isUnsafeMessage() if necessary!
} else {
NSLog(@"WARNING: Unknown message received (msgid=%d)", msgid);
ASLogWarn(@"Unknown message received (msgid=%d)", msgid);
}
}
@@ -811,6 +835,14 @@ static BOOL isUnsafeMessage(int msgid);
context:(void *)context
{
NSString *path = (code == NSOKButton) ? [panel filename] : nil;
ASLogDebug(@"Open/save panel path=%@", path);
// NOTE! This causes the sheet animation to run its course BEFORE the rest
// of this function is executed. If we do not wait for the sheet to
// disappear before continuing it can happen that the controller is
// released from under us (i.e. we'll crash and burn) because this
// animation is otherwise performed in the default run loop mode!
[panel orderOut:self];
// NOTE! setDialogReturn: is a synchronous call so set a proper timeout to
// avoid waiting forever for it to finish. We make this a synchronous call
@@ -829,8 +861,8 @@ static BOOL isUnsafeMessage(int msgid);
[[NSDocumentController sharedDocumentController]
noteNewRecentFilePath:path];
}
@catch (NSException *e) {
NSLog(@"Exception caught in %s %@", _cmd, e);
@catch (NSException *ex) {
ASLogNotice(@"Exception: pid=%d id=%d reason=%@", pid, identifier, ex);
}
@finally {
[conn setRequestTimeout:oldTimeout];
@@ -850,11 +882,21 @@ static BOOL isUnsafeMessage(int msgid);
ret = [NSArray arrayWithObject:[NSNumber numberWithInt:code]];
}
ASLogDebug(@"Alert return=%@", ret);
// NOTE! This causes the sheet animation to run its course BEFORE the rest
// of this function is executed. If we do not wait for the sheet to
// disappear before continuing it can happen that the controller is
// released from under us (i.e. we'll crash and burn) because this
// animation is otherwise performed in the default run loop mode!
[[alert window] orderOut:self];
@try {
[backendProxy setDialogReturn:ret];
}
@catch (NSException *e) {
NSLog(@"Exception caught in %s %@", _cmd, e);
@catch (NSException *ex) {
ASLogNotice(@"setDialogReturn: failed: pid=%d id=%d reason=%@",
pid, identifier, ex);
}
}
@@ -1014,8 +1056,8 @@ static BOOL isUnsafeMessage(int msgid);
NSMenu *parent = [self parentMenuForDescriptor:desc];
if (!parent) {
NSLog(@"WARNING: Menu item '%@' has no parent",
[desc componentsJoinedByString:@"->"]);
ASLogWarn(@"Menu item '%@' has no parent",
[desc componentsJoinedByString:@"->"]);
return;
}
@@ -1077,8 +1119,8 @@ static BOOL isUnsafeMessage(int msgid);
NSMenuItem *item = [self menuItemForDescriptor:desc];
if (!item) {
NSLog(@"Failed to remove menu item, descriptor not found: %@",
[desc componentsJoinedByString:@"->"]);
ASLogWarn(@"Failed to remove menu item, descriptor not found: %@",
[desc componentsJoinedByString:@"->"]);
return;
}
@@ -1101,9 +1143,6 @@ static BOOL isUnsafeMessage(int msgid);
{
if (!(desc && [desc count] > 0)) return;
/*NSLog(@"%sable item %@", on ? "En" : "Dis",
[desc componentsJoinedByString:@"->"]);*/
NSString *rootName = [desc objectAtIndex:0];
if ([rootName isEqual:@"ToolBar"]) {
if (toolbar && [desc count] == 2) {
@@ -1143,10 +1182,10 @@ static BOOL isUnsafeMessage(int msgid);
img = nil;
}
if (!img) {
NSLog(@"WARNING: Could not find image with name '%@' to use as toolbar"
" image for identifier '%@';"
" using default toolbar icon '%@' instead.",
icon, title, MMDefaultToolbarImageName);
ASLogNotice(@"Could not find image with name '%@' to use as toolbar"
" image for identifier '%@';"
" using default toolbar icon '%@' instead.",
icon, title, MMDefaultToolbarImageName);
img = [NSImage imageNamed:MMDefaultToolbarImageName];
}
@@ -1233,12 +1272,14 @@ static BOOL isUnsafeMessage(int msgid);
- (void)connectionDidDie:(NSNotification *)notification
{
//NSLog(@"%@ %s%@", [self className], _cmd, notification);
ASLogDebug(@"%@", notification);
[self scheduleClose];
}
- (void)scheduleClose
{
ASLogDebug(@"pid=%d id=%d", pid, identifier);
// NOTE! This message can arrive at pretty much anytime, e.g. while
// the run loop is the 'event tracking' mode. This means that Cocoa may
// well be in the middle of processing some message while this message is
@@ -1389,8 +1430,11 @@ static BOOL isUnsafeMessage(int msgid);
@implementation MMAlert
- (void)dealloc
{
ASLogDebug(@"");
[textField release]; textField = nil;
[super dealloc];
}
+6 -21
View File
@@ -152,7 +152,7 @@ enum {
- (void)dealloc
{
LOG_DEALLOC
ASLogDebug(@"");
[tabBarControl release]; tabBarControl = nil;
[tabView release]; tabView = nil;
@@ -311,7 +311,7 @@ enum {
forTabViewItem:tvi];
break;
default:
NSLog(@"WARNING: Unknown tab info for index: %d", i);
ASLogWarn(@"Unknown tab info for index: %d", i);
}
[val release];
@@ -326,7 +326,6 @@ enum {
int i, count = [[self tabView] numberOfTabViewItems];
for (i = count-1; i >= tabIdx; --i) {
id tvi = [tabViewItems objectAtIndex:i];
//NSLog(@"Removing tab with index %d", i);
[[self tabView] removeTabViewItem:tvi];
}
vimTaskSelectedTab = NO;
@@ -336,11 +335,9 @@ enum {
- (void)selectTabWithIndex:(int)idx
{
//NSLog(@"%s%d", _cmd, idx);
NSArray *tabViewItems = [[self tabBarControl] representedTabViewItems];
if (idx < 0 || idx >= [tabViewItems count]) {
NSLog(@"WARNING: No tab with index %d exists.", idx);
ASLogWarn(@"No tab with index %d exists.", idx);
return;
}
@@ -376,8 +373,6 @@ enum {
- (void)createScrollbarWithIdentifier:(long)ident type:(int)type
{
//NSLog(@"Create scroller %d of type %d", ident, type);
MMScroller *scroller = [[MMScroller alloc] initWithIdentifier:ident
type:type];
[scroller setTarget:self];
@@ -390,8 +385,6 @@ enum {
- (BOOL)destroyScrollbarWithIdentifier:(long)ident
{
//NSLog(@"Destroy scroller %d", ident);
unsigned idx = 0;
MMScroller *scroller = [self scrollbarForIdentifier:ident index:&idx];
if (!scroller) return NO;
@@ -410,8 +403,6 @@ enum {
if (!scroller) return NO;
BOOL wasVisible = ![scroller isHidden];
//NSLog(@"%s scroller %d (was %svisible)", visible ? "Show" : "Hide",
// ident, wasVisible ? "" : "in");
[scroller setHidden:!visible];
// If a scroller was hidden or shown then the vim view must resize. This
@@ -423,8 +414,6 @@ enum {
identifier:(long)ident
{
MMScroller *scroller = [self scrollbarForIdentifier:ident index:NULL];
//NSLog(@"Set thumb value %.2f proportion %.2f for scroller %d",
// val, prop, ident);
[scroller setFloatValue:val knobProportion:prop];
[scroller setEnabled:prop != 1.f];
}
@@ -449,8 +438,6 @@ enum {
MMScroller *scroller = [self scrollbarForIdentifier:ident index:NULL];
NSRange range = NSMakeRange(pos, len);
if (!NSEqualRanges(range, [scroller range])) {
//NSLog(@"Set range %@ for scroller %d",
// NSStringFromRange(range), ident);
[scroller setRange:range];
// TODO! Should only do this once per update.
@@ -502,7 +489,6 @@ enum {
// on the tab. Instead of letting the tab bar close the tab, we return NO
// and pass a message on to Vim to let it handle the closing.
int idx = [self representedIndexOfTabViewItem:tabViewItem];
//NSLog(@"Closing tab with index %d", idx);
NSData *data = [NSData dataWithBytes:&idx length:sizeof(int)];
[vimController sendMessage:CloseTabMsgID data:data];
@@ -743,7 +729,6 @@ enum {
rect.size.height = 0;
}
//NSLog(@"set scroller #%d frame = %@", i, NSStringFromRect(rect));
NSRect oldRect = [scroller frame];
if (!NSEqualRects(oldRect, rect)) {
[scroller setFrame:rect];
@@ -856,9 +841,9 @@ enum {
int msgid = [self inLiveResize] ? LiveResizeMsgID
: SetTextDimensionsMsgID;
//NSLog(@"Notify Vim that text dimensions changed from %dx%d to %dx%d"
// " (%s)", cols, rows, constrained[1], constrained[0],
// MessageStrings[msgid]);
ASLogDebug(@"Notify Vim that text dimensions changed from %dx%d to "
"%dx%d (%s)", cols, rows, constrained[1], constrained[0],
MessageStrings[msgid]);
[vimController sendMessage:msgid data:data];
+3 -3
View File
@@ -63,7 +63,7 @@
- (void)dealloc
{
LOG_DEALLOC
ASLogDebug(@"");
// TODO: Is there any reason why we would want the following call?
//[tablineSeparator removeFromSuperviewWithoutNeedingDisplay];
@@ -144,10 +144,10 @@
{
NSScreen *screen = [self screen];
if (!screen) {
NSLog(@"[%s] WINDOW NOT ON SCREEN, zoom to main screen", _cmd);
ASLogNotice(@"Window not on screen, zoom to main screen");
screen = [NSScreen mainScreen];
if (!screen) {
NSLog(@"[%s] NO MAIN SCREEN, abort zoom", _cmd);
ASLogNotice(@"No main screen, abort zoom");
return;
}
}
+9 -8
View File
@@ -201,7 +201,7 @@
- (void)dealloc
{
LOG_DEALLOC
ASLogDebug(@"");
[decoratedWindow release]; decoratedWindow = nil;
[windowAutosaveKey release]; windowAutosaveKey = nil;
@@ -241,7 +241,7 @@
- (void)cleanup
{
//NSLog(@"%@ %s", [self className], _cmd);
ASLogDebug(@"%@ %s", [self className], _cmd);
if (fullscreenEnabled) {
// If we are closed while still in fullscreen, end fullscreen mode,
@@ -302,8 +302,8 @@
- (void)setTextDimensionsWithRows:(int)rows columns:(int)cols isLive:(BOOL)live
isReply:(BOOL)reply
{
//NSLog(@"setTextDimensionsWithRows:%d columns:%d isLive:%d isReply:%d",
// rows, cols, live, reply);
ASLogDebug(@"setTextDimensionsWithRows:%d columns:%d isLive:%d isReply:%d",
rows, cols, live, reply);
// NOTE: The only place where the (rows,columns) of the vim view are
// modified is here and when entering/leaving full-screen. Setting these
@@ -551,8 +551,8 @@
[[vimView textView] constrainRows:&constrained[0] columns:&constrained[1]
toSize:textViewSize];
//NSLog(@"End of live resize, notify Vim that text dimensions are %dx%d",
// constrained[1], constrained[0]);
ASLogDebug(@"End of live resize, notify Vim that text dimensions are %dx%d",
constrained[1], constrained[0]);
NSData *data = [NSData dataWithBytes:constrained length:2*sizeof(int)];
BOOL sendOk = [vimController sendMessageNow:SetTextDimensionsMsgID
@@ -998,8 +998,9 @@
@try {
reply = [backendProxy starRegisterToPasteboard:pb];
}
@catch (NSException *e) {
NSLog(@"WARNING: Caught exception in %s: \"%@\"", _cmd, e);
@catch (NSException *ex) {
ASLogNotice(@"starRegisterToPasteboard: failed: pid=%d reason=%@",
[vimController pid], ex);
}
}
+68 -2
View File
@@ -9,6 +9,7 @@
*/
#import <Cocoa/Cocoa.h>
#import <asl.h>
//
@@ -169,10 +170,15 @@ enum {
SetFullscreenColorMsgID,
ShowFindReplaceDialogMsgID,
FindReplaceMsgID,
ActivateKeyScriptID,
DeactivateKeyScriptID,
ActivateKeyScriptMsgID,
DeactivateKeyScriptMsgID,
EnableImControlMsgID,
DisableImControlMsgID,
ActivatedImMsgID,
DeactivatedImMsgID,
BrowseForFileMsgID,
ShowDialogMsgID,
NetBeansMsgID,
LastMsgID // NOTE: MUST BE LAST MESSAGE IN ENUM!
};
@@ -219,10 +225,18 @@ enum {
NSString *debugStringForMessageQueue(NSArray *queue);
// Shared user defaults (most user defaults are in Miscellaneous.h).
// Contrary to the user defaults in Miscellaneous.h these defaults are not
// intitialized to any default values. That is, unless the user sets them
// these keys will not be present in the user default database.
extern NSString *MMLogLevelKey;
extern NSString *MMLogToStdErrKey;
// Argument used to stop MacVim from opening an empty window on startup
// (techincally this is a user default but should not be used as such).
extern NSString *MMNoWindowKey;
// Vim pasteboard type (holds motion type + string)
extern NSString *VimPBoardType;
@@ -279,3 +293,55 @@ typedef int NSInteger;
typedef unsigned int NSUInteger;
# endif
#endif
// Logging related functions and macros.
//
// This is a very simplistic logging facility built on top of ASL. Two user
// defaults allow for changing the local log filter level (MMLogLevel) and
// whether logs should be sent to stderr (MMLogToStdErr). (These user defaults
// are only checked during startup.) The default is to block level 6 (info)
// and 7 (debug) logs and _not_ to send logs to stderr. Apart from this
// "syslog" (see "man syslog") can be used to modify the ASL filters (it is
// currently not possible to change the local filter at runtime). For example:
// Enable all logs to reach the ASL database (by default 'debug' and 'info'
// are filtered out, see "man syslogd"):
// $ sudo syslog -c syslogd -d
// Reset the ASL database filter:
// $ sudo syslog -c syslogd off
// Change the master filter to block logs less severe than errors:
// $ sudo syslog -c 0 -e
// Change per-process filter for running MacVim process to block logs less
// severe than warnings:
// $ syslog -c MacVim -w
//
// Note that there are four ASL filters:
// 1) The ASL database filter (syslog -c syslogd ...)
// 2) The master filter (syslog -c 0 ...)
// 3) The per-process filter (syslog -c PID ...)
// 4) The local filter (MMLogLevel)
//
// To view the logs, either use "Console.app" or the "syslog" command:
// $ syslog -w | grep Vim
// To get the logs to show up in Xcode enable the MMLogToStdErr user default.
extern int ASLogLevel;
void ASLInit();
#define ASLog(level, fmt, ...) \
if (level <= ASLogLevel) { \
asl_log(NULL, NULL, level, "%s@%d: %s", \
__PRETTY_FUNCTION__, __LINE__, \
[[NSString stringWithFormat:fmt, ##__VA_ARGS__] UTF8String]); \
}
// Note: These macros are used like ASLogErr(@"text num=%d", 42). Objective-C
// style specifiers (%@) are supported.
#define ASLogCrit(fmt, ...) ASLog(ASL_LEVEL_CRIT, fmt, ##__VA_ARGS__)
#define ASLogErr(fmt, ...) ASLog(ASL_LEVEL_ERR, fmt, ##__VA_ARGS__)
#define ASLogWarn(fmt, ...) ASLog(ASL_LEVEL_WARNING, fmt, ##__VA_ARGS__)
#define ASLogNotice(fmt, ...) ASLog(ASL_LEVEL_NOTICE, fmt, ##__VA_ARGS__)
#define ASLogInfo(fmt, ...) ASLog(ASL_LEVEL_INFO, fmt, ##__VA_ARGS__)
#define ASLogDebug(fmt, ...) ASLog(ASL_LEVEL_DEBUG, fmt, ##__VA_ARGS__)
+58 -3
View File
@@ -13,6 +13,7 @@
#import "MacVim.h"
char *MessageStrings[] =
{
"INVALID MESSAGE ID",
@@ -84,16 +85,24 @@ char *MessageStrings[] =
"SetFullscreenColorMsgID",
"ShowFindReplaceDialogMsgID",
"FindReplaceMsgID",
"ActivateKeyScriptID",
"DeactivateKeyScriptID",
"ActivateKeyScriptMsgID",
"DeactivateKeyScriptMsgID",
"EnableImControlMsgID",
"DisableImControlMsgID",
"ActivatedImMsgID",
"DeactivatedImMsgID",
"BrowseForFileMsgID",
"ShowDialogMsgID",
"NetBeansMsgID",
"END OF MESSAGE IDs" // NOTE: Must be last!
};
NSString *MMLogLevelKey = @"MMLogLevel";
NSString *MMLogToStdErrKey = @"MMLogToStdErr";
// Argument used to stop MacVim from opening an empty window on startup
// (techincally this is a user default but should not be used as such).
NSString *MMNoWindowKey = @"MMNoWindow";
@@ -101,6 +110,8 @@ NSString *MMNoWindowKey = @"MMNoWindow";
// Vim pasteboard type (holds motion type + string)
NSString *VimPBoardType = @"VimPBoardType";
int ASLogLevel = ASL_LEVEL_NOTICE;
// Create a string holding the labels of all messages in message queue for
@@ -111,7 +122,8 @@ debugStringForMessageQueue(NSArray *queue)
{
NSMutableString *s = [NSMutableString new];
unsigned i, count = [queue count];
int item = 0, menu = 0, enable = 0;
int item = 0, menu = 0, enable = 0, remove = 0;
int sets = 0, sett = 0, shows = 0, cres = 0, dess = 0;
for (i = 0; i < count; i += 2) {
NSData *value = [queue objectAtIndex:i];
int msgid = *((int*)[value bytes]);
@@ -120,11 +132,23 @@ debugStringForMessageQueue(NSArray *queue)
if (msgid == AddMenuItemMsgID) ++item;
else if (msgid == AddMenuMsgID) ++menu;
else if (msgid == EnableMenuItemMsgID) ++enable;
else if (msgid == RemoveMenuItemMsgID) ++remove;
else if (msgid == SetScrollbarPositionMsgID) ++sets;
else if (msgid == SetScrollbarThumbMsgID) ++sett;
else if (msgid == ShowScrollbarMsgID) ++shows;
else if (msgid == CreateScrollbarMsgID) ++cres;
else if (msgid == DestroyScrollbarMsgID) ++dess;
else [s appendFormat:@"%s ", MessageStrings[msgid]];
}
if (item > 0) [s appendFormat:@"AddMenuItemMsgID(%d) ", item];
if (menu > 0) [s appendFormat:@"AddMenuMsgID(%d) ", menu];
if (enable > 0) [s appendFormat:@"EnableMenuItemMsgID(%d) ", enable];
if (remove > 0) [s appendFormat:@"RemoveMenuItemMsgID(%d) ", remove];
if (sets > 0) [s appendFormat:@"SetScrollbarPositionMsgID(%d) ", sets];
if (sett > 0) [s appendFormat:@"SetScrollbarThumbMsgID(%d) ", sett];
if (shows > 0) [s appendFormat:@"ShowScrollbarMsgID(%d) ", shows];
if (cres > 0) [s appendFormat:@"CreateScrollbarMsgID(%d) ", cres];
if (dess > 0) [s appendFormat:@"DestroyScrollbarMsgID(%d) ", dess];
return [s autorelease];
}
@@ -239,3 +263,34 @@ debugStringForMessageQueue(NSArray *queue)
}
@end
void
ASLInit()
{
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
// Allow for changing the log level via user defaults. If no key is found
// the default log level will be used (which for ASL is to log everything
// up to ASL_LEVEL_NOTICE). This key is an integer which corresponds to
// the ASL_LEVEL_* macros (0 is most severe, 7 is debug level).
id logLevelObj = [ud objectForKey:MMLogLevelKey];
if (logLevelObj) {
int logLevel = [logLevelObj intValue];
if (logLevel < 0) logLevel = 0;
if (logLevel > ASL_LEVEL_DEBUG) logLevel = ASL_LEVEL_DEBUG;
ASLogLevel = logLevel;
asl_set_filter(NULL, ASL_FILTER_MASK_UPTO(logLevel));
}
// Allow for changing whether a copy of each log should be sent to stderr
// (this defaults to NO if this key is missing in the user defaults
// database). The above filter mask is applied to logs going to stderr,
// contrary to how "vanilla" ASL works.
BOOL logToStdErr = [ud boolForKey:MMLogToStdErrKey];
if (logToStdErr)
asl_add_log_file(NULL, 2); // The file descriptor for stderr is 2
}
+3 -3
View File
@@ -737,7 +737,7 @@
i386,
);
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 45;
CURRENT_PROJECT_VERSION = 47;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
@@ -778,7 +778,7 @@
buildSettings = {
ARCHS = "$(NATIVE_ARCH)";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 45;
CURRENT_PROJECT_VERSION = 47;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
@@ -810,7 +810,7 @@
buildSettings = {
ARCHS = "$(NATIVE_ARCH)";
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 45;
CURRENT_PROJECT_VERSION = 47;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
+10 -8
View File
@@ -12,14 +12,6 @@
#import <Cocoa/Cocoa.h>
#import "MacVim.h"
#define MM_LOG_DEALLOCATIONS 0
#if MM_LOG_DEALLOCATIONS
# define LOG_DEALLOC NSLog(@"%s %@", _cmd, [self className]);
#else
# define LOG_DEALLOC
#endif
// NSUserDefaults keys
@@ -135,3 +127,13 @@ enum {
// release it.
NSView *showHiddenFilesView();
// Convert filenames (which are in a variant of decomposed form, NFD, on HFS+)
// to normalization form C (NFC). (This is necessary because Vim does not
// automatically compose NFD.) For more information see:
// http://developer.apple.com/technotes/tn/tn1150.html
// http://developer.apple.com/technotes/tn/tn1150table.html
// http://developer.apple.com/qa/qa2001/qa1235.html
// http://www.unicode.org/reports/tr15/
NSString *normalizeFilename(NSString *filename);
NSArray *normalizeFilenames(NSArray *filenames);
+25
View File
@@ -290,3 +290,28 @@ showHiddenFilesView()
return button;
}
NSString *
normalizeFilename(NSString *filename)
{
return [filename precomposedStringWithCanonicalMapping];
}
NSArray *
normalizeFilenames(NSArray *filenames)
{
NSMutableArray *outnames = [NSMutableArray array];
if (!filenames)
return outnames;
unsigned i, count = [filenames count];
for (i = 0; i < count; ++i) {
NSString *nfkc = normalizeFilename([filenames objectAtIndex:i]);
[outnames addObject:nfkc];
}
return outnames;
}
+3 -1
View File
@@ -120,7 +120,7 @@ NSString *MMPlugInViewPboardType = @"MMPlugInViewPboardType";
if ((self = [super init]) == nil) return nil;
if (![NSBundle loadNibNamed:@"PlugInView" owner:self])
NSLog(@"Error loading PlugIn nib");
ASLogErr(@"Error loading PlugIn nib");
[titleField setStringValue:title];
@@ -196,6 +196,8 @@ NSString *MMPlugInViewPboardType = @"MMPlugInViewPboardType";
- (void)dealloc
{
ASLogDebug(@"");
[fillerView release]; fillerView = nil;
[super dealloc];
}
+1 -3
View File
@@ -98,7 +98,7 @@ static int MMPlugInArchMinorVersion = 0;
- (void)dealloc
{
//NSLog(@"%@ %s", [self className], _cmd);
ASLogDebug(@"");
[plugInViews release]; plugInViews = nil;
[instances release]; instances = nil;
@@ -126,8 +126,6 @@ static int MMPlugInArchMinorVersion = 0;
- (void)addPlugInView:(NSView *)view withTitle:(NSString *)title
{
//NSLog(@"%@ %s", [self className], _cmd);
// Do this here so that the drawer is never opened automatically when there
// are no plugin views.
if ([[NSUserDefaults standardUserDefaults]
+63 -37
View File
@@ -42,12 +42,11 @@ vimmenu_T *menu_for_descriptor(NSArray *desc);
* Parse the GUI related command-line arguments. Any arguments used are
* deleted from argv, and *argc is decremented accordingly. This is called
* when vim is started, whether or not the GUI has been started.
* NOTE: This function will be called twice if the Vim process forks.
*/
void
gui_mch_prepare(int *argc, char **argv)
{
//NSLog(@"gui_mch_prepare(argc=%d)", *argc);
// Set environment variables $VIM and $VIMRUNTIME
// NOTE! If vim_getenv is called with one of these as parameters before
// they have been set here, they will most likely end up with the wrong
@@ -74,6 +73,19 @@ gui_mch_prepare(int *argc, char **argv)
break;
}
}
#ifdef FEAT_NETBEANS_INTG
for (i = 0; i < *argc; ++i) {
if (strncmp(argv[i], "-nb", 3) == 0) {
usingNetbeans++;
netbeansArg = argv[i];
--*argc;
if (*argc > i)
mch_memmove(&argv[i], &argv[i+1], (*argc-i) * sizeof(char*));
break;
}
}
#endif
}
@@ -84,7 +96,6 @@ gui_mch_prepare(int *argc, char **argv)
int
gui_mch_init_check(void)
{
//NSLog(@"gui_mch_init_check()");
return OK;
}
@@ -96,7 +107,8 @@ gui_mch_init_check(void)
int
gui_mch_init(void)
{
//NSLog(@"gui_mch_init()");
ASLInit();
ASLogDebug(@"");
if (![[MMBackend sharedInstance] checkin]) {
// TODO: Kill the process if there is no terminal to fall back on,
@@ -138,7 +150,7 @@ gui_mch_init(void)
void
gui_mch_exit(int rc)
{
//NSLog(@"gui_mch_exit(rc=%d)", rc);
ASLogDebug(@"rc=%d", rc);
[[MMBackend sharedInstance] exit];
}
@@ -453,8 +465,7 @@ gui_mch_new_colors(void)
gui.def_back_pixel = gui.back_pixel;
gui.def_norm_pixel = gui.norm_pixel;
//NSLog(@"gui_mch_new_colors(back=%x, norm=%x)", gui.def_back_pixel,
// gui.def_norm_pixel);
ASLogDebug(@"back=%x norm=%x", gui.def_back_pixel, gui.def_norm_pixel);
[[MMBackend sharedInstance]
setDefaultColorsBackground:gui.def_back_pixel
@@ -921,7 +932,7 @@ gui_mch_free_font(font)
GuiFont font;
{
if (font != NOFONT) {
//NSLog(@"gui_mch_free_font(font=0x%x)", font);
ASLogDebug(@"font=0x%x", font);
[(id)font release];
}
}
@@ -940,8 +951,7 @@ gui_mch_retain_font(GuiFont font)
GuiFont
gui_mch_get_font(char_u *name, int giveErrorIfMissing)
{
//NSLog(@"gui_mch_get_font(name=%s, giveErrorIfMissing=%d)", name,
// giveErrorIfMissing);
ASLogDebug(@"name='%s' giveErrorIfMissing=%d", name, giveErrorIfMissing);
GuiFont font = gui_macvim_font_with_name(name);
if (font != NOFONT)
@@ -974,7 +984,7 @@ gui_mch_get_fontname(GuiFont font, char_u *name)
int
gui_mch_init_font(char_u *font_name, int fontset)
{
//NSLog(@"gui_mch_init_font(font_name=%s, fontset=%d)", font_name, fontset);
ASLogDebug(@"font_name='%s' fontset=%d", font_name, fontset);
if (font_name && STRCMP(font_name, "*") == 0) {
// :set gfn=* shows the font panel.
@@ -1226,14 +1236,14 @@ gui_mch_stop_blink(void)
void
gui_mch_getmouse(int *x, int *y)
{
//NSLog(@"gui_mch_getmouse()");
ASLogInfo(@"Not implemented!");
}
void
gui_mch_setmouse(int x, int y)
{
//NSLog(@"gui_mch_setmouse(x=%d, y=%d)", x, y);
ASLogInfo(@"Not implemented!");
}
@@ -1258,15 +1268,23 @@ im_set_position(int row, int col)
}
void
im_set_control(int enable)
{
// Tell frontend whether it should notify us when the input method changes
// or not (called when 'imd' is toggled).
int msgid = enable ? EnableImControlMsgID : DisableImControlMsgID;
[[MMBackend sharedInstance] queueMessage:msgid properties:nil];
}
void
im_set_active(int active)
{
// Set roman or the system script if 'active' is TRUE or FALSE,
// respectively.
SInt32 systemScript = GetScriptManagerVariable(smSysScript);
if (!p_imdisable && smRoman != systemScript) {
int msgid = active ? ActivateKeyScriptID : DeactivateKeyScriptID;
// Tell frontend to enable/disable IM (called e.g. when the mode changes).
if (!p_imdisable) {
int msgid = active ? ActivateKeyScriptMsgID : DeactivateKeyScriptMsgID;
[[MMBackend sharedInstance] setImState:active];
[[MMBackend sharedInstance] queueMessage:msgid properties:nil];
}
}
@@ -1275,13 +1293,7 @@ im_set_active(int active)
int
im_get_status(void)
{
// IM is active whenever the current script is the system script and the
// system script isn't roman. (Hence IM can only be active when using
// non-roman scripts.)
SInt32 currentScript = GetScriptManagerVariable(smKeyScript);
SInt32 systemScript = GetScriptManagerVariable(smSysScript);
return currentScript != smRoman && currentScript == systemScript;
return [[MMBackend sharedInstance] imState];
}
#endif // defined(USE_IM_CONTROL)
@@ -1409,8 +1421,8 @@ gui_mch_browse(
char_u *initdir,
char_u *filter)
{
//NSLog(@"gui_mch_browse(saving=%d, title=%s, dflt=%s, ext=%s, initdir=%s,"
// " filter=%s", saving, title, dflt, ext, initdir, filter);
ASLogDebug(@"saving=%d title='%s' dflt='%s' ext='%s' initdir='%s' "
"filter='%s'", saving, title, dflt, ext, initdir, filter);
// Ensure no data is on the output queue before presenting the dialog.
gui_macvim_force_flush();
@@ -1439,9 +1451,9 @@ gui_mch_dialog(
int dfltbutton,
char_u *textfield)
{
//NSLog(@"gui_mch_dialog(type=%d title=%s message=%s buttons=%s "
// "dfltbutton=%d textfield=%s)", type, title, message, buttons,
// dfltbutton, textfield);
ASLogDebug(@"type=%d title='%s' message='%s' buttons='%s' dfltbutton=%d "
"textfield='%s'", type, title, message, buttons, dfltbutton,
textfield);
// Ensure no data is on the output queue before presenting the dialog.
gui_macvim_force_flush();
@@ -1554,7 +1566,7 @@ gui_mch_get_rgb(guicolor_T pixel)
void
gui_mch_get_screen_dimensions(int *screen_w, int *screen_h)
{
//NSLog(@"gui_mch_get_screen_dimensions()");
ASLogDebug(@"Columns=%d Rows=%d", Columns, Rows);
*screen_w = Columns;
*screen_h = Rows;
}
@@ -1627,10 +1639,9 @@ gui_mch_set_shellsize(
int base_height,
int direction)
{
//NSLog(@"gui_mch_set_shellsize(width=%d, height=%d, min_width=%d,"
// " min_height=%d, base_width=%d, base_height=%d, direction=%d)",
// width, height, min_width, min_height, base_width, base_height,
// direction);
ASLogDebug(@"width=%d height=%d min_width=%d min_height=%d base_width=%d "
"base_height=%d direction=%d", width, height, min_width,
min_height, base_width, base_height, direction);
[[MMBackend sharedInstance] setRows:height columns:width];
}
@@ -1658,7 +1669,7 @@ gui_mch_set_winpos(int x, int y)
void
gui_mch_settitle(char_u *title, char_u *icon)
{
//NSLog(@"gui_mch_settitle(title=%s, icon=%s)", title, icon);
ASLogDebug(@"title='%s' icon='%s'", title, icon);
#ifdef FEAT_MBYTE
title = CONVERT_TO_UTF8(title);
@@ -2178,3 +2189,18 @@ static int vimModMaskToEventModifierFlags(int mods)
return flags;
}
// -- NetBeans Support ------------------------------------------------------
#ifdef FEAT_NETBEANS_INTG
/* Set NetBeans socket to CFRunLoop */
void
gui_macvim_set_netbeans_socket(int socket)
{
[[MMBackend sharedInstance] setNetbeansSocket:socket];
}
#endif // FEAT_NETBEANS_INTG
+4 -4
View File
@@ -97,8 +97,8 @@ an <silent> 9900.311 Window.Zoom\ All <Nop>
an <silent> 9900.320 Window.Toggle\ Full\ Screen\ Mode :set invfullscreen<CR>
an 9900.330 Window.-SEP1- <Nop>
" TODO! Grey out if no tabs are visible.
an <silent> 9900.340 Window.Previous\ Tab :tabprevious<CR>
an <silent> 9900.350 Window.Next\ Tab :tabnext<CR>
an <silent> 9900.340 Window.Select\ Next\ Tab :tabnext<CR>
an <silent> 9900.350 Window.Select\ Previous\ Tab :tabprevious<CR>
an 9900.360 Window.-SEP2- <Nop>
an <silent> 9900.370 Window.Bring\ All\ To\ Front <Nop>
@@ -257,8 +257,8 @@ macm Window.Minimize\ All key=<D-M-m> action=miniaturizeAll: alt=YES
macm Window.Zoom key=<D-C-z> action=performZoom:
macm Window.Zoom\ All key=<D-M-C-z> action=zoomAll: alt=YES
macm Window.Toggle\ Full\ Screen\ Mode key=<D-F>
macm Window.Previous\ Tab key=<D-{>
macm Window.Next\ Tab key=<D-}>
macm Window.Select\ Next\ Tab key=<D-}>
macm Window.Select\ Previous\ Tab key=<D-{>
macm Window.Bring\ All\ To\ Front action=arrangeInFront:
macm Help.MacVim\ Help key=<D-?>
+2
View File
@@ -104,6 +104,8 @@ vimIcons = {
'MacVim-vb': [u'VBASIC,VB', LINK],
'MacVim-yaml': [u'YAML,YAML,YML', SMALL],
'MacVim-gtd': [u'GTD', LINK],
'MacVim-markdown': [u'MARK\u2193,M\u2193', LINK], # down arrow
'MacVim-rst': [u'RST', LINK],
}
+31
View File
@@ -40,6 +40,37 @@
Sparkle supports updates in zip, tar, tbz, tgz, or dmg format.
-->
<item>
<title>Snapshot 47 released</title>
<description><![CDATA[
<h1>MacVim snapshot 47 released</h1>
<p> Changes since snapshot 45:
<ul>
<li> Markdown (Nico Weber) and reStructuredText (Travis Jeffery) are supported file types </li>
<li> The forever bouncing Dock icon bug should now really really be fixed (Kazuki Sakamoto) </li>
<li> Fixed bug when file name contained decomposed UTF8 characters </li>
<li> Quick Look should work for most/all supported filetypes now (although the preview is simple text and is not syntax highlighted) </li>
<li> Update the help file </li>
<li> 'guifontwide' is updated on Cmd-+/Cmd-- </li>
<li> The titles of the next/previous tab menu items now match other apps </li>
<li> Add NetBeans support (Kazuki Sakamoto) </li>
<li> Add simple logging facility </li>
<li> Fix a bug which could cause a crash when a dialog sheet was used </li>
<li> Update to latest Vim patches and runtime files </li>
</ul>
</p>
]]></description>
<pubDate>Fri, 16 Jul 2009 19:43 CET</pubDate>
<enclosure type="application/octet-stream"
url="http://newmacvim.muskokamug.org/mirror/files/MacVim-snapshot-47.tbz"
length="8200839"
sparkle:version="47"
sparkle:shortVersionString="7.2"
/>
</item>
<item>
<title>Snapshot 45 released</title>
<description><![CDATA[
+26
View File
@@ -115,8 +115,21 @@ ifndef MZSCHEME_VER
MZSCHEME_VER=205_000
endif
ifndef MZSCHEME_PRECISE_GC
MZSCHEME_PRECISE_GC=no
endif
# for version 4.x we need to generate byte-code for Scheme base
ifndef MZSCHEME_GENERATE_BASE
MZSCHEME_GENERATE_BASE=no
endif
ifeq (no,$(DYNAMIC_MZSCHEME))
ifeq (yes,$(MZSCHEME_PRECISE_GC))
MZSCHEME_LIB=-lmzsch$(MZSCHEME_VER)
else
MZSCHEME_LIB = -lmzsch$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
endif
# the modern MinGW can dynamically link to dlls directly.
# point MZSCHEME_DLLS to where you put libmzschXXXXXXX.dll and libgcXXXXXXX.dll
ifndef MZSCHEME_DLLS
@@ -410,6 +423,13 @@ endif
ifdef MZSCHEME
OBJ += $(OUTDIR)/if_mzsch.o
MZSCHEME_INCL = if_mzsch.h
ifeq (yes,$(MZSCHEME_GENERATE_BASE))
CFLAGS += -DINCLUDE_MZSCHEME_BASE
MZ_EXTRA_DEP += mzscheme_base.c
endif
ifeq (yes,$(MZSCHEME_PRECISE_GC))
CFLAGS += -DMZ_PRECISE_GC
endif
endif
ifdef PYTHON
OBJ += $(OUTDIR)/if_python.o
@@ -588,6 +608,12 @@ if_perl.c: if_perl.xs typemap
$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_INCL) $(NBDEBUG_SRC)
$(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o
$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) if_mzsch.h $(MZ_EXTRA_DEP)
$(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o
mzscheme_base.c:
$(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base
pathdef.c: $(INCL)
ifneq (sh.exe, $(SHELL))
@echo creating pathdef.c
+37 -9
View File
@@ -1,18 +1,18 @@
# Makefile for Vim on Win32 (Windows NT/2000/XP/2003 and Windows 95/98/Me)
# and Win64, using the Microsoft Visual C++ compilers. Known to work with
# VC5, VC6 (VS98), VC7.0 (VS2002), VC7.1 (VS2003), VC8 (VS2005),
# and VC9 (VS2008).
# VC9 (VS2008), and VC10 (VS2010).
#
# To build using other Windows compilers, see INSTALLpc.txt
#
# This makefile can build the console, GUI, OLE-enable, Perl-enabled and
# Python-enabled versions of vim for Win32 platforms.
# Python-enabled versions of Vim for Win32 platforms.
#
# The basic command line to build vim is:
# The basic command line to build Vim is:
#
# nmake -f Make_mvc.mak
#
# This will build the console version of vim with no additional interfaces.
# This will build the console version of Vim with no additional interfaces.
# To add features, define any of the following:
#
# !!!! After changing features do "nmake clean" first !!!!
@@ -34,6 +34,7 @@
# MZSCHEME=[Path to MzScheme directory]
# DYNAMIC_MZSCHEME=yes (to load the MzScheme DLLs dynamically)
# MZSCHEME_VER=[version, 205_000, ...]
# MZSCHEME_DEBUG=no
#
# Perl interface:
# PERL=[Path to Perl directory]
@@ -357,6 +358,9 @@ MSVCVER = 9.0
!if "$(_NMAKE_VER)" == "9.00.30729.01"
MSVCVER = 9.0
!endif
!if "$(_NMAKE_VER)" == "10.00.20506.01"
MSVCVER = 10.0
!endif
!endif
# Abort bulding VIM if version of VC is unrecognised.
@@ -371,7 +375,7 @@ MSVCVER = 9.0
!endif
# Convert processor ID to MVC-compatible number
!if ("$(MSVCVER)" != "8.0") && ("$(MSVCVER)" != "9.0")
!if ("$(MSVCVER)" != "8.0") && ("$(MSVCVER)" != "9.0") && ("$(MSVCVER)" != "10.0")
!if "$(CPUNR)" == "i386"
CPUARG = /G3
!elseif "$(CPUNR)" == "i486"
@@ -404,7 +408,7 @@ OPTFLAG = /O2
!else # MAXSPEED
OPTFLAG = /Ox
!endif
!if ("$(MSVCVER)" == "8.0") || ("$(MSVCVER)" == "9.0")
!if ("$(MSVCVER)" == "8.0") || ("$(MSVCVER)" == "9.0") || ("$(MSVCVER)" == "10.0")
# Use link time code generation if not worried about size
!if "$(OPTIMIZE)" != "SPACE"
OPTFLAG = $(OPTFLAG) /GL
@@ -621,15 +625,37 @@ PYTHON_LIB = $(PYTHON)\libs\python$(PYTHON_VER).lib
MZSCHEME_VER = 205_000
!endif
CFLAGS = $(CFLAGS) -DFEAT_MZSCHEME -I $(MZSCHEME)\include
!if EXIST("$(MZSCHEME)\collects\scheme\base.ss")
# for MzScheme 4.x we need to include byte code for basic Scheme stuff
MZSCHEME_EXTRA_DEP = mzscheme_base.c
CFLAGS = $(CFLAGS) -DINCLUDE_MZSCHEME_BASE
!endif
!if EXIST("$(MZSCHEME)\lib\msvc\libmzsch$(MZSCHEME_VER).lib") \
&& !EXIST("$(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib")
!message Building with Precise GC
MZSCHEME_PRECISE_GC = yes
CFLAGS = $(CFLAGS) -DMZ_PRECISE_GC
!endif
!if "$(DYNAMIC_MZSCHEME)" == "yes"
!if "$(MZSCHEME_PRECISE_GC)" == "yes"
!error MzScheme with Precise GC cannot be loaded dynamically
!endif
!message MzScheme DLLs will be loaded dynamically
CFLAGS = $(CFLAGS) -DDYNAMIC_MZSCHEME \
-DDYNAMIC_MZSCH_DLL=\"libmzsch$(MZSCHEME_VER).dll\" \
-DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
!else
!if "$(MZSCHEME_DEBUG)" == "yes"
CFLAGS = $(CFLAGS) -DMZSCHEME_FORCE_GC
!endif
!if "$(MZSCHEME_PRECISE_GC)" == "yes"
# Precise GC does not use separate dll
MZSCHEME_LIB = $(MZSCHEME)\lib\msvc\libmzsch$(MZSCHEME_VER).lib
!else
MZSCHEME_LIB = $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib \
$(MZSCHEME)\lib\msvc\libmzsch$(MZSCHEME_VER).lib
!endif
!endif
MZSCHEME_OBJ = $(OUTDIR)\if_mzsch.obj
!endif
@@ -770,7 +796,7 @@ LINKARGS2 = $(CON_LIB) $(GUI_LIB) $(LIBC) $(OLE_LIB) user32.lib $(SNIFF_LIB) \
# Report link time code generation progress if used.
!ifdef NODEBUG
!if ("$(MSVCVER)" == "8.0") || ("$(MSVCVER)" == "9.0")
!if ("$(MSVCVER)" == "8.0") || ("$(MSVCVER)" == "9.0") || ("$(MSVCVER)" == "10.0")
!if "$(OPTIMIZE)" != "SPACE"
LINKARGS1 = $(LINKARGS1) /LTCG:STATUS
!endif
@@ -930,9 +956,11 @@ $(OUTDIR)/if_perl.obj: $(OUTDIR) if_perl.c $(INCL)
$(OUTDIR)/if_perlsfio.obj: $(OUTDIR) if_perlsfio.c $(INCL)
$(CC) $(CFLAGS) $(PERL_INC) if_perlsfio.c
$(OUTDIR)/if_mzsch.obj: $(OUTDIR) if_mzsch.c $(INCL)
$(OUTDIR)/if_mzsch.obj: $(OUTDIR) if_mzsch.c $(INCL) $(MZSCHEME_EXTRA_DEP)
$(CC) $(CFLAGS) if_mzsch.c \
-DMZSCHEME_COLLECTS=\"$(MZSCHEME:\=\\)\\collects\"
mzscheme_base.c:
$(MZSCHEME)\mzc --c-mods mzscheme_base.c ++lib scheme/base
$(OUTDIR)/if_python.obj: $(OUTDIR) if_python.c $(INCL)
$(CC) $(CFLAGS) $(PYTHON_INC) if_python.c
@@ -1012,7 +1040,7 @@ $(OUTDIR)/window.obj: $(OUTDIR) window.c $(INCL)
$(OUTDIR)/xpm_w32.obj: $(OUTDIR) xpm_w32.c
$(CC) $(CFLAGS) $(XPM_INC) xpm_w32.c
$(OUTDIR)/vim.res: $(OUTDIR) vim.rc version.h tools.bmp tearoff.bmp \
$(OUTDIR)/vim.res: $(OUTDIR) vim.rc gvim.exe.mnf version.h tools.bmp tearoff.bmp \
vim.ico vim_error.ico vim_alert.ico vim_info.ico vim_quest.ico
$(RC) /l 0x409 /Fo$(OUTDIR)/vim.res $(RCFLAGS) vim.rc
+31 -14
View File
@@ -105,8 +105,8 @@
# 4. "make test" {{{1
# This is optional. This will run Vim scripts on a number of test
# files, and compare the produced output with the expected output.
# If all is well, you will get the "ALL DONE" message in the end. See
# below (search for "/^test").
# If all is well, you will get the "ALL DONE" message in the end. If a
# test fails you get "TEST FAILURE". See below (search for "/^test").
#
# 5. "make install" {{{1
# If the new Vim seems to be working OK you can install it and the
@@ -533,6 +533,11 @@ CClink = $(CC)
#CFLAGS = -g -DDEBUG -Wall -Wshadow -Wmissing-prototypes
#CFLAGS = -g -O2 '-DSTARTUPTIME="vimstartup"' -fno-strength-reduce -Wall -Wmissing-prototypes
# Use this with GCC to check for mistakes, unused arguments, etc.
#CFLAGS = -g -Wall -Wextra -Wmissing-prototypes -Wunreachable-code
#PYTHON_CFLAGS_EXTRA = -Wno-missing-field-initializers
#MZSCHEME_CFLAGS_EXTRA = -Wno-unreachable-code -Wno-unused-parameter
# EFENCE - Electric-Fence malloc debugging: catches memory accesses beyond
# allocated memory (and makes every malloc()/free() very slow).
# Electric Fence is free (search ftp sites).
@@ -551,7 +556,13 @@ CClink = $(CC)
# }}}
# LINT - for running lint
# For standard Unix lint
LINT = lint
LINT_OPTIONS = -beprxzF
# For splint
# It doesn't work well, crashes on include files and non-ascii characters.
#LINT = splint
#LINT_OPTIONS = +unixlib -weak -macrovarprefixexclude -showfunc -linelen 9999
# PROFILING - Uncomment the next two lines to do profiling with gcc and gprof.
# Might not work with GUI or Perl.
@@ -1275,16 +1286,16 @@ CPP_DEPEND = $(CC) -I$(srcdir) -M$(CPP_MM) \
# This is for cproto 3 patchlevel 8 or below
# __inline, __attribute__ and __extension__ are not recognized by cproto
# G_IMPLEMENT_INLINES is to avoid functions defined in glib/gutils.h.
NO_ATTR = -D__inline= -D__inline__= -DG_IMPLEMENT_INLINES \
-D"__attribute__\\(x\\)=" -D"__asm__\\(x\\)=" \
-D__extension__= -D__restrict="" \
-D__gnuc_va_list=char -D__builtin_va_list=char
#NO_ATTR = -D__inline= -D__inline__= -DG_IMPLEMENT_INLINES \
# -D"__attribute__\\(x\\)=" -D"__asm__\\(x\\)=" \
# -D__extension__= -D__restrict="" \
# -D__gnuc_va_list=char -D__builtin_va_list=char
#
# This is for cproto 3 patchlevel 9 or above (currently 4.6)
# This is for cproto 3 patchlevel 9 or above (currently 4.6, 4.7g)
# __inline and __attribute__ are now recognized by cproto
# -D"foo()=" is not supported by all compilers so do not use it
# NO_ATTR=
NO_ATTR=
#
# maybe the "/usr/bin/cc -E" has to be adjusted for some systems
# This is for cproto 3.5 patchlevel 3:
@@ -1448,6 +1459,7 @@ LINT_SRC = $(BASIC_SRC) $(GUI_SRC) $(HANGULIN_SRC) $(PYTHON_SRC) $(TCL_SRC) \
$(SNIFF_SRC) $(WORKSHOP_SRC) $(WSDEBUG_SRC) $(NETBEANS_SRC)
#LINT_SRC = $(SRC)
#LINT_SRC = $(ALL_SRC)
#LINT_SRC = $(BASIC_SRC)
OBJ = \
objects/buffer.o \
@@ -1753,7 +1765,8 @@ types.vim: $(TAGS_SRC) $(TAGS_INCL)
# messages. Don't worry about that.
# If there is a real error, there will be a difference between "test.out" and
# a "test99.ok" file.
# If everything is alright, the final message will be "ALL DONE".
# If everything is alright, the final message will be "ALL DONE". If not you
# get "TEST FAILURE".
#
test check:
$(MAKE) -f Makefile $(VIMTARGET)
@@ -2203,6 +2216,7 @@ clean celan: testclean
-rm -f $(TOOLS) auto/osdef.h auto/pathdef.c auto/if_perl.c
-rm -f conftest* *~ auto/link.sed
-rm -rf $(APPDIR)
-rm -rf mzscheme_base.c
if test -d $(PODIR); then \
cd $(PODIR); $(MAKE) prefix=$(DESTDIR)$(prefix) clean; \
fi
@@ -2288,12 +2302,12 @@ depend:
# Run lint. Clean up the *.ln files that are sometimes left behind.
lint:
lint $(LINT_OPTIONS) $(LINT_CFLAGS) $(LINT_EXTRA) $(LINT_SRC)
$(LINT) $(LINT_OPTIONS) $(LINT_CFLAGS) $(LINT_EXTRA) $(LINT_SRC)
-rm -f *.ln
# Check dosinst.c with lint.
lintinstall:
lint $(LINT_OPTIONS) -DWIN32 -DUNIX_LINT dosinst.c
$(LINT) $(LINT_OPTIONS) -DWIN32 -DUNIX_LINT dosinst.c
-rm -f dosinst.ln
###########################################################################
@@ -2445,8 +2459,11 @@ objects/if_cscope.o: if_cscope.c
objects/if_xcmdsrv.o: if_xcmdsrv.c
$(CCC) -o $@ if_xcmdsrv.c
objects/if_mzsch.o: if_mzsch.c
$(CCC) -o $@ if_mzsch.c
objects/if_mzsch.o: if_mzsch.c $(MZSCHEME_EXTRA)
$(CCC) -o $@ $(MZSCHEME_CFLAGS_EXTRA) if_mzsch.c
mzscheme_base.c:
$(MZSCHEME_MZC) --c-mods mzscheme_base.c ++lib scheme/base
objects/if_perl.o: auto/if_perl.c
$(CCC) -o $@ auto/if_perl.c
@@ -2455,7 +2472,7 @@ objects/if_perlsfio.o: if_perlsfio.c
$(CCC) -o $@ if_perlsfio.c
objects/if_python.o: if_python.c
$(CCC) -o $@ if_python.c
$(CCC) -o $@ $(PYTHON_CFLAGS_EXTRA) if_python.c
objects/if_ruby.o: if_ruby.c
$(CCC) -o $@ if_ruby.c
+171 -154
View File
@@ -20,20 +20,21 @@ static char THIS_FILE[] = __FILE__;
static BOOL g_bEnableVim = TRUE; // Vim enabled
static BOOL g_bDevStudioEditor = FALSE; // Open file in Dev Studio editor simultaneously
static BOOL g_bNewTabs = FALSE;
static int g_ChangeDir = CD_NONE; // CD after file open?
static void VimSetEnableState (BOOL bEnableState);
static BOOL VimOpenFile (BSTR& FileName, long LineNr);
static DISPID VimGetDispatchId (COleAutomationControl& VimOle, char* Method);
static void VimErrDiag (COleAutomationControl& VimOle);
static void VimChangeDir (COleAutomationControl& VimOle, DISPID DispatchId, BSTR& FileName);
static void DebugMsg (char* Msg, char* Arg = NULL);
static void VimSetEnableState(BOOL bEnableState);
static BOOL VimOpenFile(BSTR& FileName, long LineNr);
static DISPID VimGetDispatchId(COleAutomationControl& VimOle, char* Method);
static void VimErrDiag(COleAutomationControl& VimOle);
static void VimChangeDir(COleAutomationControl& VimOle, DISPID DispatchId, BSTR& FileName);
static void DebugMsg(char* Msg, char* Arg = NULL);
/////////////////////////////////////////////////////////////////////////////
// CCommands
CCommands::CCommands ()
CCommands::CCommands()
{
// m_pApplication == NULL; M$ Code generation bug!!!
m_pApplication = NULL;
@@ -41,17 +42,17 @@ CCommands::CCommands ()
m_pDebuggerEventsObj = NULL;
}
CCommands::~CCommands ()
CCommands::~CCommands()
{
ASSERT (m_pApplication != NULL);
ASSERT(m_pApplication != NULL);
if (m_pApplication)
{
m_pApplication->Release ();
m_pApplication->Release();
m_pApplication = NULL;
}
}
void CCommands::SetApplicationObject (IApplication * pApplication)
void CCommands::SetApplicationObject(IApplication * pApplication)
{
// This function assumes pApplication has already been AddRef'd
// for us, which CDSAddIn did in it's QueryInterface call
@@ -61,55 +62,57 @@ void CCommands::SetApplicationObject (IApplication * pApplication)
return;
// Create Application event handlers
XApplicationEventsObj::CreateInstance (&m_pApplicationEventsObj);
XApplicationEventsObj::CreateInstance(&m_pApplicationEventsObj);
if (! m_pApplicationEventsObj)
{
ReportInternalError ("XApplicationEventsObj::CreateInstance");
ReportInternalError("XApplicationEventsObj::CreateInstance");
return;
}
m_pApplicationEventsObj->AddRef ();
m_pApplicationEventsObj->Connect (m_pApplication);
m_pApplicationEventsObj->AddRef();
m_pApplicationEventsObj->Connect(m_pApplication);
m_pApplicationEventsObj->m_pCommands = this;
#ifdef NEVER
// Create Debugger event handler
CComPtr < IDispatch > pDebugger;
if (SUCCEEDED (m_pApplication->get_Debugger (&pDebugger))
if (SUCCEEDED(m_pApplication->get_Debugger(&pDebugger))
&& pDebugger != NULL)
{
XDebuggerEventsObj::CreateInstance (&m_pDebuggerEventsObj);
m_pDebuggerEventsObj->AddRef ();
m_pDebuggerEventsObj->Connect (pDebugger);
XDebuggerEventsObj::CreateInstance(&m_pDebuggerEventsObj);
m_pDebuggerEventsObj->AddRef();
m_pDebuggerEventsObj->Connect(pDebugger);
m_pDebuggerEventsObj->m_pCommands = this;
}
#endif
// Get settings from registry HKEY_CURRENT_USER\Software\Vim\VisVim
HKEY hAppKey = GetAppKey ("Vim");
HKEY hAppKey = GetAppKey("Vim");
if (hAppKey)
{
HKEY hSectionKey = GetSectionKey (hAppKey, "VisVim");
HKEY hSectionKey = GetSectionKey(hAppKey, "VisVim");
if (hSectionKey)
{
g_bEnableVim = GetRegistryInt (hSectionKey, "EnableVim",
g_bEnableVim = GetRegistryInt(hSectionKey, "EnableVim",
g_bEnableVim);
g_bDevStudioEditor = GetRegistryInt(hSectionKey,"DevStudioEditor",
g_bDevStudioEditor);
g_ChangeDir = GetRegistryInt (hSectionKey, "ChangeDir",
g_bDevStudioEditor = GetRegistryInt(hSectionKey,
"DevStudioEditor", g_bDevStudioEditor);
g_bNewTabs = GetRegistryInt(hSectionKey, "NewTabs",
g_bNewTabs);
g_ChangeDir = GetRegistryInt(hSectionKey, "ChangeDir",
g_ChangeDir);
RegCloseKey (hSectionKey);
RegCloseKey(hSectionKey);
}
RegCloseKey (hAppKey);
RegCloseKey(hAppKey);
}
}
void CCommands::UnadviseFromEvents ()
void CCommands::UnadviseFromEvents()
{
ASSERT (m_pApplicationEventsObj != NULL);
ASSERT(m_pApplicationEventsObj != NULL);
if (m_pApplicationEventsObj)
{
m_pApplicationEventsObj->Disconnect (m_pApplication);
m_pApplicationEventsObj->Release ();
m_pApplicationEventsObj->Disconnect(m_pApplication);
m_pApplicationEventsObj->Release();
m_pApplicationEventsObj = NULL;
}
@@ -121,10 +124,10 @@ void CCommands::UnadviseFromEvents ()
// unadvise from its events (thus the VERIFY_OK below--see
// stdafx.h).
CComPtr < IDispatch > pDebugger;
VERIFY_OK (m_pApplication->get_Debugger (&pDebugger));
ASSERT (pDebugger != NULL);
m_pDebuggerEventsObj->Disconnect (pDebugger);
m_pDebuggerEventsObj->Release ();
VERIFY_OK(m_pApplication->get_Debugger(&pDebugger));
ASSERT(pDebugger != NULL);
m_pDebuggerEventsObj->Disconnect(pDebugger);
m_pDebuggerEventsObj->Release();
m_pDebuggerEventsObj = NULL;
}
#endif
@@ -136,21 +139,21 @@ void CCommands::UnadviseFromEvents ()
// Application events
HRESULT CCommands::XApplicationEvents::BeforeBuildStart ()
HRESULT CCommands::XApplicationEvents::BeforeBuildStart()
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return S_OK;
}
HRESULT CCommands::XApplicationEvents::BuildFinish (long nNumErrors, long nNumWarnings)
HRESULT CCommands::XApplicationEvents::BuildFinish(long nNumErrors, long nNumWarnings)
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return S_OK;
}
HRESULT CCommands::XApplicationEvents::BeforeApplicationShutDown ()
HRESULT CCommands::XApplicationEvents::BeforeApplicationShutDown()
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return S_OK;
}
@@ -158,9 +161,9 @@ HRESULT CCommands::XApplicationEvents::BeforeApplicationShutDown ()
// is done.
// Vim gets called from here.
//
HRESULT CCommands::XApplicationEvents::DocumentOpen (IDispatch * theDocument)
HRESULT CCommands::XApplicationEvents::DocumentOpen(IDispatch * theDocument)
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
if (! g_bEnableVim)
// Vim not enabled or empty command line entered
@@ -169,7 +172,7 @@ HRESULT CCommands::XApplicationEvents::DocumentOpen (IDispatch * theDocument)
// First get the current file name and line number
// Get the document object
CComQIPtr < ITextDocument, &IID_ITextDocument > pDoc (theDocument);
CComQIPtr < ITextDocument, &IID_ITextDocument > pDoc(theDocument);
if (! pDoc)
return S_OK;
@@ -177,26 +180,26 @@ HRESULT CCommands::XApplicationEvents::DocumentOpen (IDispatch * theDocument)
long LineNr = -1;
// Get the document name
if (FAILED (pDoc->get_FullName (&FileName)))
if (FAILED(pDoc->get_FullName(&FileName)))
return S_OK;
LPDISPATCH pDispSel;
// Get a selection object dispatch pointer
if (SUCCEEDED (pDoc->get_Selection (&pDispSel)))
if (SUCCEEDED(pDoc->get_Selection(&pDispSel)))
{
// Get the selection object
CComQIPtr < ITextSelection, &IID_ITextSelection > pSel (pDispSel);
CComQIPtr < ITextSelection, &IID_ITextSelection > pSel(pDispSel);
if (pSel)
// Get the selection line number
pSel->get_CurrentLine (&LineNr);
pSel->get_CurrentLine(&LineNr);
pDispSel->Release ();
pDispSel->Release();
}
// Open the file in Vim and position to the current line
if (VimOpenFile (FileName, LineNr))
if (VimOpenFile(FileName, LineNr))
{
if (! g_bDevStudioEditor)
{
@@ -204,30 +207,30 @@ HRESULT CCommands::XApplicationEvents::DocumentOpen (IDispatch * theDocument)
CComVariant vSaveChanges = dsSaveChangesPrompt;
DsSaveStatus Saved;
pDoc->Close (vSaveChanges, &Saved);
pDoc->Close(vSaveChanges, &Saved);
}
}
// We're done here
SysFreeString (FileName);
SysFreeString(FileName);
return S_OK;
}
HRESULT CCommands::XApplicationEvents::BeforeDocumentClose (IDispatch * theDocument)
HRESULT CCommands::XApplicationEvents::BeforeDocumentClose(IDispatch * theDocument)
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return S_OK;
}
HRESULT CCommands::XApplicationEvents::DocumentSave (IDispatch * theDocument)
HRESULT CCommands::XApplicationEvents::DocumentSave(IDispatch * theDocument)
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return S_OK;
}
HRESULT CCommands::XApplicationEvents::NewDocument (IDispatch * theDocument)
HRESULT CCommands::XApplicationEvents::NewDocument(IDispatch * theDocument)
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
if (! g_bEnableVim)
// Vim not enabled or empty command line entered
@@ -235,19 +238,19 @@ HRESULT CCommands::XApplicationEvents::NewDocument (IDispatch * theDocument)
// First get the current file name and line number
CComQIPtr < ITextDocument, &IID_ITextDocument > pDoc (theDocument);
CComQIPtr < ITextDocument, &IID_ITextDocument > pDoc(theDocument);
if (! pDoc)
return S_OK;
BSTR FileName;
HRESULT hr;
hr = pDoc->get_FullName (&FileName);
if (FAILED (hr))
hr = pDoc->get_FullName(&FileName);
if (FAILED(hr))
return S_OK;
// Open the file in Vim and position to the current line
if (VimOpenFile (FileName, 0))
if (VimOpenFile(FileName, 0))
{
if (! g_bDevStudioEditor)
{
@@ -255,49 +258,49 @@ HRESULT CCommands::XApplicationEvents::NewDocument (IDispatch * theDocument)
CComVariant vSaveChanges = dsSaveChangesPrompt;
DsSaveStatus Saved;
pDoc->Close (vSaveChanges, &Saved);
pDoc->Close(vSaveChanges, &Saved);
}
}
SysFreeString (FileName);
SysFreeString(FileName);
return S_OK;
}
HRESULT CCommands::XApplicationEvents::WindowActivate (IDispatch * theWindow)
HRESULT CCommands::XApplicationEvents::WindowActivate(IDispatch * theWindow)
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return S_OK;
}
HRESULT CCommands::XApplicationEvents::WindowDeactivate (IDispatch * theWindow)
HRESULT CCommands::XApplicationEvents::WindowDeactivate(IDispatch * theWindow)
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return S_OK;
}
HRESULT CCommands::XApplicationEvents::WorkspaceOpen ()
HRESULT CCommands::XApplicationEvents::WorkspaceOpen()
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return S_OK;
}
HRESULT CCommands::XApplicationEvents::WorkspaceClose ()
HRESULT CCommands::XApplicationEvents::WorkspaceClose()
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return S_OK;
}
HRESULT CCommands::XApplicationEvents::NewWorkspace ()
HRESULT CCommands::XApplicationEvents::NewWorkspace()
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return S_OK;
}
// Debugger event
HRESULT CCommands::XDebuggerEvents::BreakpointHit (IDispatch * pBreakpoint)
HRESULT CCommands::XDebuggerEvents::BreakpointHit(IDispatch * pBreakpoint)
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return S_OK;
}
@@ -308,17 +311,18 @@ HRESULT CCommands::XDebuggerEvents::BreakpointHit (IDispatch * pBreakpoint)
class CMainDialog : public CDialog
{
public:
CMainDialog (CWnd * pParent = NULL); // Standard constructor
CMainDialog(CWnd * pParent = NULL); // Standard constructor
//{{AFX_DATA(CMainDialog)
enum { IDD = IDD_ADDINMAIN };
int m_ChangeDir;
BOOL m_bDevStudioEditor;
BOOL m_bNewTabs;
//}}AFX_DATA
//{{AFX_VIRTUAL(CMainDialog)
protected:
virtual void DoDataExchange (CDataExchange * pDX); // DDX/DDV support
virtual void DoDataExchange(CDataExchange * pDX); // DDX/DDV support
//}}AFX_VIRTUAL
protected:
@@ -326,100 +330,106 @@ class CMainDialog : public CDialog
afx_msg void OnEnable();
afx_msg void OnDisable();
//}}AFX_MSG
DECLARE_MESSAGE_MAP ()
DECLARE_MESSAGE_MAP()
};
CMainDialog::CMainDialog (CWnd * pParent /* =NULL */ )
: CDialog (CMainDialog::IDD, pParent)
CMainDialog::CMainDialog(CWnd * pParent /* =NULL */ )
: CDialog(CMainDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CMainDialog)
m_ChangeDir = -1;
m_bDevStudioEditor = FALSE;
m_bNewTabs = FALSE;
//}}AFX_DATA_INIT
}
void CMainDialog::DoDataExchange (CDataExchange * pDX)
void CMainDialog::DoDataExchange(CDataExchange * pDX)
{
CDialog::DoDataExchange (pDX);
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMainDialog)
DDX_Radio(pDX, IDC_CD_SOURCE_PATH, m_ChangeDir);
DDX_Check (pDX, IDC_DEVSTUDIO_EDITOR, m_bDevStudioEditor);
DDX_Check(pDX, IDC_DEVSTUDIO_EDITOR, m_bDevStudioEditor);
DDX_Check(pDX, IDC_NEW_TABS, m_bNewTabs);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP (CMainDialog, CDialog)
BEGIN_MESSAGE_MAP(CMainDialog, CDialog)
//{{AFX_MSG_MAP(CMainDialog)
//}}AFX_MSG_MAP
END_MESSAGE_MAP ()
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCommands methods
STDMETHODIMP CCommands::VisVimDialog ()
STDMETHODIMP CCommands::VisVimDialog()
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
// Use m_pApplication to access the Developer Studio Application
// object,
// and VERIFY_OK to see error strings in DEBUG builds of your add-in
// (see stdafx.h)
VERIFY_OK (m_pApplication->EnableModeless (VARIANT_FALSE));
VERIFY_OK(m_pApplication->EnableModeless(VARIANT_FALSE));
CMainDialog Dlg;
Dlg.m_bDevStudioEditor = g_bDevStudioEditor;
Dlg.m_bNewTabs = g_bNewTabs;
Dlg.m_ChangeDir = g_ChangeDir;
if (Dlg.DoModal () == IDOK)
if (Dlg.DoModal() == IDOK)
{
g_bDevStudioEditor = Dlg.m_bDevStudioEditor;
g_bNewTabs = Dlg.m_bNewTabs;
g_ChangeDir = Dlg.m_ChangeDir;
// Save settings to registry HKEY_CURRENT_USER\Software\Vim\VisVim
HKEY hAppKey = GetAppKey ("Vim");
HKEY hAppKey = GetAppKey("Vim");
if (hAppKey)
{
HKEY hSectionKey = GetSectionKey (hAppKey, "VisVim");
HKEY hSectionKey = GetSectionKey(hAppKey, "VisVim");
if (hSectionKey)
{
WriteRegistryInt (hSectionKey, "DevStudioEditor",
WriteRegistryInt(hSectionKey, "DevStudioEditor",
g_bDevStudioEditor);
WriteRegistryInt (hSectionKey, "ChangeDir", g_ChangeDir);
RegCloseKey (hSectionKey);
WriteRegistryInt(hSectionKey, "NewTabs",
g_bNewTabs);
WriteRegistryInt(hSectionKey, "ChangeDir", g_ChangeDir);
RegCloseKey(hSectionKey);
}
RegCloseKey (hAppKey);
RegCloseKey(hAppKey);
}
}
VERIFY_OK (m_pApplication->EnableModeless (VARIANT_TRUE));
VERIFY_OK(m_pApplication->EnableModeless(VARIANT_TRUE));
return S_OK;
}
STDMETHODIMP CCommands::VisVimEnable ()
STDMETHODIMP CCommands::VisVimEnable()
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
VimSetEnableState (true);
AFX_MANAGE_STATE(AfxGetStaticModuleState());
VimSetEnableState(true);
return S_OK;
}
STDMETHODIMP CCommands::VisVimDisable ()
STDMETHODIMP CCommands::VisVimDisable()
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
VimSetEnableState (false);
AFX_MANAGE_STATE(AfxGetStaticModuleState());
VimSetEnableState(false);
return S_OK;
}
STDMETHODIMP CCommands::VisVimToggle ()
STDMETHODIMP CCommands::VisVimToggle()
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
VimSetEnableState (! g_bEnableVim);
AFX_MANAGE_STATE(AfxGetStaticModuleState());
VimSetEnableState(! g_bEnableVim);
return S_OK;
}
STDMETHODIMP CCommands::VisVimLoad ()
STDMETHODIMP CCommands::VisVimLoad()
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
// Use m_pApplication to access the Developer Studio Application object,
// and VERIFY_OK to see error strings in DEBUG builds of your add-in
@@ -430,7 +440,7 @@ STDMETHODIMP CCommands::VisVimLoad ()
CComPtr < IDispatch > pDispDoc, pDispSel;
// Get a document object dispatch pointer
VERIFY_OK (m_pApplication->get_ActiveDocument (&pDispDoc));
VERIFY_OK(m_pApplication->get_ActiveDocument(&pDispDoc));
if (! pDispDoc)
return S_OK;
@@ -438,30 +448,30 @@ STDMETHODIMP CCommands::VisVimLoad ()
long LineNr = -1;
// Get the document object
CComQIPtr < ITextDocument, &IID_ITextDocument > pDoc (pDispDoc);
CComQIPtr < ITextDocument, &IID_ITextDocument > pDoc(pDispDoc);
if (! pDoc)
return S_OK;
// Get the document name
if (FAILED (pDoc->get_FullName (&FileName)))
if (FAILED(pDoc->get_FullName(&FileName)))
return S_OK;
// Get a selection object dispatch pointer
if (SUCCEEDED (pDoc->get_Selection (&pDispSel)))
if (SUCCEEDED(pDoc->get_Selection(&pDispSel)))
{
// Get the selection object
CComQIPtr < ITextSelection, &IID_ITextSelection > pSel (pDispSel);
CComQIPtr < ITextSelection, &IID_ITextSelection > pSel(pDispSel);
if (pSel)
// Get the selection line number
pSel->get_CurrentLine (&LineNr);
pSel->get_CurrentLine(&LineNr);
}
// Open the file in Vim
VimOpenFile (FileName, LineNr);
VimOpenFile(FileName, LineNr);
SysFreeString (FileName);
SysFreeString(FileName);
return S_OK;
}
@@ -472,16 +482,16 @@ STDMETHODIMP CCommands::VisVimLoad ()
// Set the enable state and save to registry
//
static void VimSetEnableState (BOOL bEnableState)
static void VimSetEnableState(BOOL bEnableState)
{
g_bEnableVim = bEnableState;
HKEY hAppKey = GetAppKey ("Vim");
HKEY hAppKey = GetAppKey("Vim");
if (hAppKey)
{
HKEY hSectionKey = GetSectionKey (hAppKey, "VisVim");
HKEY hSectionKey = GetSectionKey(hAppKey, "VisVim");
if (hSectionKey)
WriteRegistryInt (hSectionKey, "EnableVim", g_bEnableVim);
RegCloseKey (hAppKey);
WriteRegistryInt(hSectionKey, "EnableVim", g_bEnableVim);
RegCloseKey(hAppKey);
}
}
@@ -490,7 +500,7 @@ static void VimSetEnableState (BOOL bEnableState)
// letter.
// 'LineNr' must contain a valid line number or 0, e. g. for a new file
//
static BOOL VimOpenFile (BSTR& FileName, long LineNr)
static BOOL VimOpenFile(BSTR& FileName, long LineNr)
{
// OLE automation object for com. with Vim
@@ -507,7 +517,7 @@ static BOOL VimOpenFile (BSTR& FileName, long LineNr)
// Get a dispatch id for the SendKeys method of Vim;
// enables connection to Vim if necessary
DISPID DispatchId;
DispatchId = VimGetDispatchId (VimOle, "SendKeys");
DispatchId = VimGetDispatchId(VimOle, "SendKeys");
if (! DispatchId)
// OLE error, can't obtain dispatch id
goto OleError;
@@ -525,20 +535,28 @@ static BOOL VimOpenFile (BSTR& FileName, long LineNr)
#ifdef SINGLE_WINDOW
// Update the current file in Vim if it has been modified.
// Disabled, because it could write the file when you don't want to.
sprintf (VimCmd + 2, ":up\n");
sprintf(VimCmd + 2, ":up\n");
#endif
if (! VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf)))
if (! VimOle.Method(DispatchId, "s", TO_OLE_STR_BUF(VimCmd, Buf)))
goto OleError;
// Change Vim working directory to where the file is if desired
if (g_ChangeDir != CD_NONE)
VimChangeDir (VimOle, DispatchId, FileName);
VimChangeDir(VimOle, DispatchId, FileName);
// Make Vim open the file.
// In the filename convert all \ to /, put a \ before a space.
sprintf(VimCmd, ":drop ");
if (g_bNewTabs)
{
sprintf(VimCmd, ":tab drop ");
s = VimCmd + 11;
}
else
{
sprintf(VimCmd, ":drop ");
s = VimCmd + 6;
}
sprintf(FileNameTmp, "%S", (char *)FileName);
s = VimCmd + 6;
for (p = FileNameTmp; *p != '\0' && s < FileNameTmp + MAX_OLE_STR - 4;
++p)
if (*p == '\\')
@@ -552,20 +570,20 @@ static BOOL VimOpenFile (BSTR& FileName, long LineNr)
*s++ = '\n';
*s = '\0';
if (! VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf)))
if (! VimOle.Method(DispatchId, "s", TO_OLE_STR_BUF(VimCmd, Buf)))
goto OleError;
if (LineNr > 0)
{
// Goto line
sprintf (VimCmd, ":%d\n", LineNr);
if (! VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf)))
sprintf(VimCmd, ":%d\n", LineNr);
if (! VimOle.Method(DispatchId, "s", TO_OLE_STR_BUF(VimCmd, Buf)))
goto OleError;
}
// Make Vim come to the foreground
if (! VimOle.Method ("SetForeground"))
VimOle.ErrDiag ();
if (! VimOle.Method("SetForeground"))
VimOle.ErrDiag();
// We're done
return true;
@@ -573,7 +591,7 @@ static BOOL VimOpenFile (BSTR& FileName, long LineNr)
OleError:
// There was an OLE error
// Check if it's the "unknown class string" error
VimErrDiag (VimOle);
VimErrDiag(VimOle);
return false;
}
@@ -581,18 +599,18 @@ static BOOL VimOpenFile (BSTR& FileName, long LineNr)
// Create the Vim OLE object if necessary
// Returns a valid dispatch id or null on error
//
static DISPID VimGetDispatchId (COleAutomationControl& VimOle, char* Method)
static DISPID VimGetDispatchId(COleAutomationControl& VimOle, char* Method)
{
// Initialize Vim OLE connection if not already done
if (! VimOle.IsCreated ())
if (! VimOle.IsCreated())
{
if (! VimOle.CreateObject ("Vim.Application"))
if (! VimOle.CreateObject("Vim.Application"))
return NULL;
}
// Get the dispatch id for the SendKeys method.
// By doing this, we are checking if Vim is still there...
DISPID DispatchId = VimOle.GetDispatchId ("SendKeys");
DISPID DispatchId = VimOle.GetDispatchId("SendKeys");
if (! DispatchId)
{
// We can't get a dispatch id.
@@ -604,12 +622,12 @@ static DISPID VimGetDispatchId (COleAutomationControl& VimOle, char* Method)
// should not be kept long enough to allow the user to terminate Vim
// to avoid memory corruption (why the heck is there no system garbage
// collection for those damned OLE memory chunks???).
VimOle.DeleteObject ();
if (! VimOle.CreateObject ("Vim.Application"))
VimOle.DeleteObject();
if (! VimOle.CreateObject("Vim.Application"))
// If this create fails, it's time for an error msg
return NULL;
if (! (DispatchId = VimOle.GetDispatchId ("SendKeys")))
if (! (DispatchId = VimOle.GetDispatchId("SendKeys")))
// There is something wrong...
return NULL;
}
@@ -620,20 +638,20 @@ static DISPID VimGetDispatchId (COleAutomationControl& VimOle, char* Method)
// Output an error message for an OLE error
// Check on the classstring error, which probably means Vim wasn't registered.
//
static void VimErrDiag (COleAutomationControl& VimOle)
static void VimErrDiag(COleAutomationControl& VimOle)
{
SCODE sc = GetScode (VimOle.GetResult ());
SCODE sc = GetScode(VimOle.GetResult());
if (sc == CO_E_CLASSSTRING)
{
char Buf[256];
sprintf (Buf, "There is no registered OLE automation server named "
sprintf(Buf, "There is no registered OLE automation server named "
"\"Vim.Application\".\n"
"Use the OLE-enabled version of Vim with VisVim and "
"make sure to register Vim by running \"vim -register\".");
MessageBox (NULL, Buf, "OLE Error", MB_OK);
MessageBox(NULL, Buf, "OLE Error", MB_OK);
}
else
VimOle.ErrDiag ();
VimOle.ErrDiag();
}
// Change directory to the directory the file 'FileName' is in or it's parent
@@ -644,7 +662,7 @@ static void VimErrDiag (COleAutomationControl& VimOle)
// CD_SOURCE_PATH
// CD_SOURCE_PARENT
//
static void VimChangeDir (COleAutomationControl& VimOle, DISPID DispatchId, BSTR& FileName)
static void VimChangeDir(COleAutomationControl& VimOle, DISPID DispatchId, BSTR& FileName)
{
// Do a :cd first
@@ -655,7 +673,7 @@ static void VimChangeDir (COleAutomationControl& VimOle, DISPID DispatchId, BSTR
char DirUnix[_MAX_DIR * 2];
char *s, *t;
_splitpath (StrFileName, Drive, Dir, NULL, NULL);
_splitpath(StrFileName, Drive, Dir, NULL, NULL);
// Convert to Unix path name format, escape spaces.
t = DirUnix;
@@ -676,19 +694,18 @@ static void VimChangeDir (COleAutomationControl& VimOle, DISPID DispatchId, BSTR
OLECHAR Buf[MAX_OLE_STR];
char VimCmd[MAX_OLE_STR];
sprintf (VimCmd, ":cd %s%s%s\n", Drive, DirUnix,
sprintf(VimCmd, ":cd %s%s%s\n", Drive, DirUnix,
g_ChangeDir == CD_SOURCE_PARENT && DirUnix[1] ? ".." : "");
VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf));
VimOle.Method(DispatchId, "s", TO_OLE_STR_BUF(VimCmd, Buf));
}
#ifdef _DEBUG
// Print out a debug message
//
static void DebugMsg (char* Msg, char* Arg)
static void DebugMsg(char* Msg, char* Arg)
{
char Buf[400];
sprintf (Buf, Msg, Arg);
AfxMessageBox (Buf);
sprintf(Buf, Msg, Arg);
AfxMessageBox(Buf);
}
#endif
+1
View File
@@ -16,6 +16,7 @@
#define IDC_CD_SOURCE_PATH 1001
#define IDC_CD_SOURCE_PARENT 1002
#define IDC_CD_NONE 1003
#define IDC_NEW_TABS 1004
// Next default values for new objects
//
+3
View File
@@ -122,6 +122,9 @@ BEGIN
CONTROL "&Open file in DevStudio editor simultaneously",
IDC_DEVSTUDIO_EDITOR,"Button",BS_AUTOCHECKBOX | WS_GROUP |
WS_TABSTOP,7,7,153,10
CONTROL "Open files in new tabs",
IDC_NEW_TABS,"Button",BS_AUTOCHECKBOX | WS_GROUP |
WS_TABSTOP,7,21,153,10
GROUPBOX "Current directory",IDC_STATIC,7,35,164,58,WS_GROUP
CONTROL "Set to &source file path",IDC_CD_SOURCE_PATH,"Button",
BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,17,49,85,10
+512 -265
View File
File diff suppressed because it is too large Load Diff
+65 -62
View File
@@ -44,6 +44,7 @@ static int otherfile_buf __ARGS((buf_T *buf, char_u *ffname));
#ifdef FEAT_TITLE
static int ti_change __ARGS((char_u *str, char_u **last));
#endif
static int append_arg_number __ARGS((win_T *wp, char_u *buf, int buflen, int add_file));
static void free_buffer __ARGS((buf_T *));
static void free_buffer_stuff __ARGS((buf_T *buf, int free_options));
static void clear_wininfo __ARGS((buf_T *buf));
@@ -515,12 +516,11 @@ buf_clear_file(buf)
* buf_freeall() - free all things allocated for a buffer that are related to
* the file.
*/
/*ARGSUSED*/
void
buf_freeall(buf, del_buf, wipe_buf)
buf_T *buf;
int del_buf; /* buffer is going to be deleted */
int wipe_buf; /* buffer is going to be wiped out */
int del_buf UNUSED; /* buffer is going to be deleted */
int wipe_buf UNUSED; /* buffer is going to be wiped out */
{
#ifdef FEAT_AUTOCMD
int is_curbuf = (buf == curbuf);
@@ -1457,13 +1457,13 @@ enter_buffer(buf)
#ifdef FEAT_KEYMAP
if (curbuf->b_kmap_state & KEYMAP_INIT)
keymap_init();
(void)keymap_init();
#endif
#ifdef FEAT_SPELL
/* May need to set the spell language. Can only do this after the buffer
* has been properly setup. */
if (!curbuf->b_help && curwin->w_p_spell && *curbuf->b_p_spl != NUL)
did_set_spelllang(curbuf);
(void)did_set_spelllang(curbuf);
#endif
redraw_later(NOT_VALID);
@@ -1681,9 +1681,10 @@ buflist_new(ffname, sfname, lnum, flags)
buf->b_fname = buf->b_sfname;
#ifdef UNIX
if (st.st_dev == (dev_T)-1)
buf->b_dev = -1;
buf->b_dev_valid = FALSE;
else
{
buf->b_dev_valid = TRUE;
buf->b_dev = st.st_dev;
buf->b_ino = st.st_ino;
}
@@ -2028,13 +2029,12 @@ buflist_findname_stat(ffname, stp)
* Return fnum of the found buffer.
* Return < 0 for error.
*/
/*ARGSUSED*/
int
buflist_findpat(pattern, pattern_end, unlisted, diffmode)
char_u *pattern;
char_u *pattern_end; /* pointer to first char after pattern */
int unlisted; /* find unlisted buffers */
int diffmode; /* find diff-mode buffers only */
int diffmode UNUSED; /* find diff-mode buffers only */
{
buf_T *buf;
regprog_T *prog;
@@ -2439,11 +2439,10 @@ wininfo_other_tab_diff(wip)
* another tab page.
* Returns NULL when there isn't any info.
*/
/*ARGSUSED*/
static wininfo_T *
find_wininfo(buf, skip_diff_buffer)
buf_T *buf;
int skip_diff_buffer;
int skip_diff_buffer UNUSED;
{
wininfo_T *wip;
@@ -2520,7 +2519,7 @@ buflist_findfpos(buf)
buf_T *buf;
{
wininfo_T *wip;
static pos_T no_position = {1, 0};
static pos_T no_position = INIT_POS_T(1, 0, 0);
wip = find_wininfo(buf, FALSE);
if (wip != NULL)
@@ -2543,7 +2542,6 @@ buflist_findlnum(buf)
/*
* List all know file names (for :files and :buffers command).
*/
/*ARGSUSED*/
void
buflist_list(eap)
exarg_T *eap;
@@ -2581,8 +2579,8 @@ buflist_list(eap)
{
IObuff[len++] = ' ';
} while (--i > 0 && len < IOSIZE - 18);
vim_snprintf((char *)IObuff + len, IOSIZE - len, _("line %ld"),
buf == curbuf ? curwin->w_cursor.lnum
vim_snprintf((char *)IObuff + len, (size_t)(IOSIZE - len),
_("line %ld"), buf == curbuf ? curwin->w_cursor.lnum
: (long)buflist_findlnum(buf));
msg_outtrans(IObuff);
out_flush(); /* output one line at a time */
@@ -2696,9 +2694,10 @@ setfname(buf, ffname, sfname, message)
buf->b_fname = buf->b_sfname;
#ifdef UNIX
if (st.st_dev == (dev_T)-1)
buf->b_dev = -1;
buf->b_dev_valid = FALSE;
else
{
buf->b_dev_valid = TRUE;
buf->b_dev = st.st_dev;
buf->b_ino = st.st_ino;
}
@@ -2892,7 +2891,7 @@ otherfile_buf(buf, ffname
/* If no struct stat given, get it now */
if (stp == NULL)
{
if (buf->b_dev < 0 || mch_stat((char *)ffname, &st) < 0)
if (!buf->b_dev_valid || mch_stat((char *)ffname, &st) < 0)
st.st_dev = (dev_T)-1;
stp = &st;
}
@@ -2929,11 +2928,12 @@ buf_setino(buf)
if (buf->b_fname != NULL && mch_stat((char *)buf->b_fname, &st) >= 0)
{
buf->b_dev_valid = TRUE;
buf->b_dev = st.st_dev;
buf->b_ino = st.st_ino;
}
else
buf->b_dev = -1;
buf->b_dev_valid = FALSE;
}
/*
@@ -2944,7 +2944,7 @@ buf_same_ino(buf, stp)
buf_T *buf;
struct stat *stp;
{
return (buf->b_dev >= 0
return (buf->b_dev_valid
&& stp->st_dev == buf->b_dev
&& stp->st_ino == buf->b_ino);
}
@@ -2971,7 +2971,7 @@ fileinfo(fullname, shorthelp, dont_truncate)
if (fullname > 1) /* 2 CTRL-G: include buffer number */
{
sprintf((char *)buffer, "buf %d: ", curbuf->b_fnum);
vim_snprintf((char *)buffer, IOSIZE, "buf %d: ", curbuf->b_fnum);
p = buffer + STRLEN(buffer);
}
else
@@ -3045,11 +3045,12 @@ fileinfo(fullname, shorthelp, dont_truncate)
(long)curbuf->b_ml.ml_line_count,
n);
validate_virtcol();
col_print(buffer + STRLEN(buffer),
len = STRLEN(buffer);
col_print(buffer + len, IOSIZE - len,
(int)curwin->w_cursor.col + 1, (int)curwin->w_virtcol + 1);
}
(void)append_arg_number(curwin, buffer, !shortmess(SHM_FILE), IOSIZE);
(void)append_arg_number(curwin, buffer, IOSIZE, !shortmess(SHM_FILE));
if (dont_truncate)
{
@@ -3077,15 +3078,16 @@ fileinfo(fullname, shorthelp, dont_truncate)
}
void
col_print(buf, col, vcol)
col_print(buf, buflen, col, vcol)
char_u *buf;
size_t buflen;
int col;
int vcol;
{
if (col == vcol)
sprintf((char *)buf, "%d", col);
vim_snprintf((char *)buf, buflen, "%d", col);
else
sprintf((char *)buf, "%d-%d", col, vcol);
vim_snprintf((char *)buf, buflen, "%d-%d", col, vcol);
}
#if defined(FEAT_TITLE) || defined(PROTO)
@@ -3202,20 +3204,18 @@ maketitle()
if (p == buf + off)
/* must be a help buffer */
vim_strncpy(buf + off, (char_u *)_("help"),
IOSIZE - off - 1);
(size_t)(IOSIZE - off - 1));
else
*p = NUL;
/* translate unprintable chars */
p = transstr(buf + off);
vim_strncpy(buf + off, p, IOSIZE - off - 1);
vim_strncpy(buf + off, p, (size_t)(IOSIZE - off - 1));
vim_free(p);
STRCAT(buf, ")");
}
#ifndef FEAT_GUI_MACVIM
append_arg_number(curwin, buf, FALSE, IOSIZE);
#endif
append_arg_number(curwin, buf, IOSIZE, FALSE);
#if defined(FEAT_CLIENTSERVER)
if (serverName != NULL)
@@ -3352,14 +3352,13 @@ free_titles()
* If maxwidth is not zero, the string will be filled at any middle marker
* or truncated if too long, fillchar is used for all whitespace.
*/
/*ARGSUSED*/
int
build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, tabtab)
win_T *wp;
char_u *out; /* buffer to write into != NameBuff */
size_t outlen; /* length of out[] */
char_u *fmt;
int use_sandbox; /* "fmt" was set insecurely, use sandbox */
int use_sandbox UNUSED; /* "fmt" was set insecurely, use sandbox */
int fillchar;
int maxwidth;
struct stl_hlrec *hltab; /* return: HL attributes (can be NULL) */
@@ -3530,7 +3529,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
n = (long)(p - t) - item[groupitem[groupdepth]].maxwid + 1;
*t = '<';
mch_memmove(t + 1, t + n, p - (t + n));
mch_memmove(t + 1, t + n, (size_t)(p - (t + n)));
p = p - n + 1;
#ifdef FEAT_MBYTE
/* Fill up space left over by half a double-wide char. */
@@ -3560,7 +3559,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
else
{
/* fill by inserting characters */
mch_memmove(t + n - l, t, p - t);
mch_memmove(t + n - l, t, (size_t)(p - t));
l = n - l;
if (p + l >= out + outlen)
l = (long)((out + outlen) - p - 1);
@@ -3696,7 +3695,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
p = t;
#ifdef FEAT_EVAL
sprintf((char *)tmp, "%d", curbuf->b_fnum);
vim_snprintf((char *)tmp, sizeof(tmp), "%d", curbuf->b_fnum);
set_internal_string_var((char_u *)"actual_curbuf", tmp);
o_curbuf = curbuf;
@@ -3763,13 +3762,13 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
case STL_ALTPERCENT:
str = tmp;
get_rel_pos(wp, str);
get_rel_pos(wp, str, TMPLEN);
break;
case STL_ARGLISTSTAT:
fillable = FALSE;
tmp[0] = 0;
if (append_arg_number(wp, tmp, FALSE, (int)sizeof(tmp)))
if (append_arg_number(wp, tmp, (int)sizeof(tmp), FALSE))
str = tmp;
break;
@@ -3804,7 +3803,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
case STL_BYTEVAL_X:
base = 'X';
case STL_BYTEVAL:
if (wp->w_cursor.col > STRLEN(linecont))
if (wp->w_cursor.col > (colnr_T)STRLEN(linecont))
num = 0;
else
{
@@ -3977,7 +3976,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
if (zeropad)
*t++ = '0';
*t++ = '*';
*t++ = nbase == 16 ? base : (nbase == 8 ? 'o' : 'd');
*t++ = nbase == 16 ? base : (char_u)(nbase == 8 ? 'o' : 'd');
*t = 0;
for (n = num, l = 1; n >= nbase; n /= nbase)
@@ -4170,13 +4169,14 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
#if defined(FEAT_STL_OPT) || defined(FEAT_CMDL_INFO) \
|| defined(FEAT_GUI_TABLINE) || defined(PROTO)
/*
* Get relative cursor position in window into "str[]", in the form 99%, using
* "Top", "Bot" or "All" when appropriate.
* Get relative cursor position in window into "buf[buflen]", in the form 99%,
* using "Top", "Bot" or "All" when appropriate.
*/
void
get_rel_pos(wp, str)
get_rel_pos(wp, buf, buflen)
win_T *wp;
char_u *str;
char_u *buf;
int buflen;
{
long above; /* number of lines above window */
long below; /* number of lines below window */
@@ -4187,34 +4187,35 @@ get_rel_pos(wp, str)
#endif
below = wp->w_buffer->b_ml.ml_line_count - wp->w_botline + 1;
if (below <= 0)
STRCPY(str, above == 0 ? _("All") : _("Bot"));
vim_strncpy(buf, (char_u *)(above == 0 ? _("All") : _("Bot")),
(size_t)(buflen - 1));
else if (above <= 0)
STRCPY(str, _("Top"));
vim_strncpy(buf, (char_u *)_("Top"), (size_t)(buflen - 1));
else
sprintf((char *)str, "%2d%%", above > 1000000L
vim_snprintf((char *)buf, (size_t)buflen, "%2d%%", above > 1000000L
? (int)(above / ((above + below) / 100L))
: (int)(above * 100L / (above + below)));
}
#endif
/*
* Append (file 2 of 8) to 'buf', if editing more than one file.
* Append (file 2 of 8) to "buf[buflen]", if editing more than one file.
* Return TRUE if it was appended.
*/
int
append_arg_number(wp, buf, add_file, maxlen)
static int
append_arg_number(wp, buf, buflen, add_file)
win_T *wp;
char_u *buf;
int buflen;
int add_file; /* Add "file" before the arg number */
int maxlen; /* maximum nr of chars in buf or zero*/
{
char_u *p;
if (ARGCOUNT <= 1) /* nothing to do */
return FALSE;
p = buf + STRLEN(buf); /* go to the end of the buffer */
if (maxlen && p - buf + 35 >= maxlen) /* getting too long */
p = buf + STRLEN(buf); /* go to the end of the buffer */
if (p - buf + 35 >= buflen) /* getting too long */
return FALSE;
*p++ = ' ';
*p++ = '(';
@@ -4223,7 +4224,8 @@ append_arg_number(wp, buf, add_file, maxlen)
STRCPY(p, "file ");
p += 5;
}
sprintf((char *)p, wp->w_arg_idx_invalid ? "(%d) of %d)"
vim_snprintf((char *)p, (size_t)(buflen - (p - buf)),
wp->w_arg_idx_invalid ? "(%d) of %d)"
: "%d of %d)", wp->w_arg_idx + 1, ARGCOUNT);
return TRUE;
}
@@ -4279,10 +4281,9 @@ fix_fname(fname)
* Make "ffname" a full file name, set "sfname" to "ffname" if not NULL.
* "ffname" becomes a pointer to allocated memory (or NULL).
*/
/*ARGSUSED*/
void
fname_expand(buf, ffname, sfname)
buf_T *buf;
buf_T *buf UNUSED;
char_u **ffname;
char_u **sfname;
{
@@ -5006,7 +5007,7 @@ read_viminfo_bufferlist(virp, writing)
if (tab != NULL)
{
*tab++ = '\0';
col = atoi((char *)tab);
col = (colnr_T)atoi((char *)tab);
tab = vim_strrchr(xline, '\t');
if (tab != NULL)
{
@@ -5044,6 +5045,7 @@ write_viminfo_bufferlist(fp)
#endif
char_u *line;
int max_buffers;
size_t len;
if (find_viminfo_parameter('%') == NULL)
return;
@@ -5052,7 +5054,8 @@ write_viminfo_bufferlist(fp)
max_buffers = get_viminfo_parameter('%');
/* Allocate room for the file name, lnum and col. */
line = alloc(MAXPATHL + 40);
#define LINE_BUF_LEN (MAXPATHL + 40)
line = alloc(LINE_BUF_LEN);
if (line == NULL)
return;
@@ -5078,7 +5081,8 @@ write_viminfo_bufferlist(fp)
break;
putc('%', fp);
home_replace(NULL, buf->b_ffname, line, MAXPATHL, TRUE);
sprintf((char *)line + STRLEN(line), "\t%ld\t%d",
len = STRLEN(line);
vim_snprintf((char *)line + len, len - LINE_BUF_LEN, "\t%ld\t%d",
(long)buf->b_last_cursor.lnum,
buf->b_last_cursor.col);
viminfo_writestring(fp, line);
@@ -5236,7 +5240,7 @@ buf_addsign(buf, id, lnum, typenr)
return;
}
int
linenr_T
buf_change_sign_type(buf, markId, typenr)
buf_T *buf; /* buffer to store sign in */
int markId; /* sign ID */
@@ -5253,10 +5257,10 @@ buf_change_sign_type(buf, markId, typenr)
}
}
return 0;
return (linenr_T)0;
}
int_u
int
buf_getsigntype(buf, lnum, type)
buf_T *buf;
linenr_T lnum;
@@ -5575,11 +5579,10 @@ buf_contents_changed(buf)
* this buffer. Call this to wipe out a temp buffer that does not contain any
* marks.
*/
/*ARGSUSED*/
void
wipe_buffer(buf, aucmd)
buf_T *buf;
int aucmd; /* When TRUE trigger autocommands. */
int aucmd UNUSED; /* When TRUE trigger autocommands. */
{
if (buf->b_fnum == top_file_num - 1)
--top_file_num;
+13 -14
View File
@@ -17,7 +17,7 @@ static int win_chartabsize __ARGS((win_T *wp, char_u *p, colnr_T col));
static int win_nolbr_chartabsize __ARGS((win_T *wp, char_u *s, colnr_T col, int *headp));
#endif
static int nr2hex __ARGS((int c));
static unsigned nr2hex __ARGS((unsigned c));
static int chartab_initialized = FALSE;
@@ -664,7 +664,7 @@ transchar_hex(buf, c)
}
#endif
buf[++i] = nr2hex((unsigned)c >> 4);
buf[++i] = nr2hex(c);
buf[++i] = nr2hex((unsigned)c);
buf[++i] = '>';
buf[++i] = NUL;
}
@@ -674,9 +674,9 @@ transchar_hex(buf, c)
* Lower case letters are used to avoid the confusion of <F1> being 0xf1 or
* function key 1.
*/
static int
static unsigned
nr2hex(c)
int c;
unsigned c;
{
if ((c & 0xf) <= 9)
return (c & 0xf) + '0';
@@ -884,7 +884,7 @@ vim_iswordc(c)
if (c >= 0x100)
{
if (enc_dbcs != 0)
return dbcs_class((unsigned)c >> 8, c & 0xff) >= 2;
return dbcs_class((unsigned)c >> 8, (unsigned)(c & 0xff)) >= 2;
if (enc_utf8)
return utf_class(c) >= 2;
}
@@ -1026,13 +1026,12 @@ lbr_chartabsize_adv(s, col)
* string at start of line. Warning: *headp is only set if it's a non-zero
* value, init to 0 before calling.
*/
/*ARGSUSED*/
int
win_lbr_chartabsize(wp, s, col, headp)
win_T *wp;
char_u *s;
colnr_T col;
int *headp;
int *headp UNUSED;
{
#ifdef FEAT_LINEBREAK
int c;
@@ -1090,7 +1089,7 @@ win_lbr_chartabsize(wp, s, col, headp)
*/
numberextra = win_col_off(wp);
col2 = col;
colmax = W_WIDTH(wp) - numberextra;
colmax = (colnr_T)(W_WIDTH(wp) - numberextra);
if (col >= colmax)
{
n = colmax + win_col_off2(wp);
@@ -1201,17 +1200,17 @@ in_win_border(wp, vcol)
win_T *wp;
colnr_T vcol;
{
colnr_T width1; /* width of first line (after line number) */
colnr_T width2; /* width of further lines */
int width1; /* width of first line (after line number) */
int width2; /* width of further lines */
#ifdef FEAT_VERTSPLIT
if (wp->w_width == 0) /* there is no border */
return FALSE;
#endif
width1 = W_WIDTH(wp) - win_col_off(wp);
if (vcol < width1 - 1)
if ((int)vcol < width1 - 1)
return FALSE;
if (vcol == width1 - 1)
if ((int)vcol == width1 - 1)
return TRUE;
width2 = width1 + win_col_off2(wp);
return ((vcol - width1) % width2 == width2 - 1);
@@ -1396,13 +1395,13 @@ getvvcol(wp, pos, start, cursor, end)
# ifdef FEAT_MBYTE
/* Cannot put the cursor on part of a wide character. */
ptr = ml_get_buf(wp->w_buffer, pos->lnum, FALSE);
if (pos->col < STRLEN(ptr))
if (pos->col < (colnr_T)STRLEN(ptr))
{
int c = (*mb_ptr2char)(ptr + pos->col);
if (c != TAB && vim_isprintc(c))
{
endadd = char2cells(c) - 1;
endadd = (colnr_T)(char2cells(c) - 1);
if (coladd > endadd) /* past end of line */
endadd = 0;
else
+6
View File
@@ -30,12 +30,18 @@
/* Define when __DATE__ " " __TIME__ can be used */
#undef HAVE_DATE_TIME
/* Define when __attribute__((unused)) can be used */
#undef HAVE_ATTRIBUTE_UNUSED
/* defined always when using configure */
#undef UNIX
/* Defined to the size of an int */
#undef SIZEOF_INT
/* Define when wchar_t is only 2 bytes. */
#undef SMALL_WCHAR_T
/*
* If we cannot trust one of the following from the libraries, we use our
* own safe but probably slower vim_memmove().
+2
View File
@@ -41,6 +41,8 @@ MZSCHEME_SRC = @MZSCHEME_SRC@
MZSCHEME_OBJ = @MZSCHEME_OBJ@
MZSCHEME_CFLAGS = @MZSCHEME_CFLAGS@
MZSCHEME_PRO = @MZSCHEME_PRO@
MZSCHEME_EXTRA = @MZSCHEME_EXTRA@
MZSCHEME_MZC = @MZSCHEME_MZC@
PERL = @vi_cv_path_perl@
PERLLIB = @vi_cv_perllib@
+82 -22
View File
@@ -423,7 +423,7 @@ if test "$enable_mzschemeinterp" = "yes"; then
AC_MSG_RESULT("$PLTHOME")
vi_cv_path_mzscheme_pfx="$PLTHOME"
else
AC_MSG_RESULT("not set")
AC_MSG_RESULT(not set)
dnl -- try to find MzScheme executable
AC_PATH_PROG(vi_cv_path_mzscheme, mzscheme)
@@ -439,14 +439,16 @@ if test "$enable_mzschemeinterp" = "yes"; then
if test "X$vi_cv_path_mzscheme" != "X"; then
dnl -- find where MzScheme thinks it was installed
AC_CACHE_CHECK(MzScheme install prefix,vi_cv_path_mzscheme_pfx,
[ vi_cv_path_mzscheme_pfx=`
${vi_cv_path_mzscheme} -evm \
"(display (simplify-path \
dnl different versions of MzScheme differ in command line processing
dnl use universal approach
echo "(display (simplify-path \
(build-path (call-with-values \
(lambda () (split-path (find-system-path (quote exec-file)))) \
(lambda (base name must-be-dir?) base)) (quote up))))"` ])
dnl Remove a trailing slash.
vi_cv_path_mzscheme_pfx=`echo "$vi_cv_path_mzscheme_pfx" | sed 's+/$++'`
(lambda (base name must-be-dir?) base)) (quote up))))" > mzdirs.scm
dnl Remove a trailing slash
[ vi_cv_path_mzscheme_pfx=`${vi_cv_path_mzscheme} -r mzdirs.scm | \
sed -e 's+/$++'` ])
rm -f mzdirs.scm
fi
fi
fi
@@ -455,16 +457,24 @@ if test "$enable_mzschemeinterp" = "yes"; then
if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include)
if test -f $vi_cv_path_mzscheme_pfx/include/scheme.h; then
AC_MSG_RESULT("yes")
SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT("no")
AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/plt/include)
AC_MSG_RESULT(no)
AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/plt)
if test -f $vi_cv_path_mzscheme_pfx/include/plt/scheme.h; then
AC_MSG_RESULT("yes")
SCHEME_INC=/plt
AC_MSG_RESULT(yes)
SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/plt
else
AC_MSG_RESULT("no")
vi_cv_path_mzscheme_pfx=
AC_MSG_RESULT(no)
AC_MSG_CHECKING(if scheme.h can be found in /usr/include/plt/)
if test -f /usr/include/plt/scheme.h; then
AC_MSG_RESULT(yes)
SCHEME_INC=/usr/include/plt
else
AC_MSG_RESULT(no)
vi_cv_path_mzscheme_pfx=
fi
fi
fi
fi
@@ -472,23 +482,38 @@ if test "$enable_mzschemeinterp" = "yes"; then
if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
if test "x$MACOSX" = "xyes"; then
MZSCHEME_LIBS="-framework PLT_MzScheme"
elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"; then
MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"
MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"; then
MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme.a ${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"
else
MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme -lmzgc"
dnl Using shared objects
if test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.so"; then
MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme3m"
MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
else
MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme -lmzgc"
fi
if test "$GCC" = yes; then
dnl Make Vim remember the path to the library. For when it's not in
dnl $LD_LIBRARY_PATH.
MZSCHEME_LIBS="$MZSCHEME_LIBS -Wl,-rpath -Wl,${vi_cv_path_mzscheme_pfx}/lib"
MZSCHEME_LIBS="${MZSCHEME_LIBS} -Wl,-rpath -Wl,${vi_cv_path_mzscheme_pfx}/lib"
elif test "`(uname) 2>/dev/null`" = SunOS &&
uname -r | grep '^5' >/dev/null; then
MZSCHEME_LIBS="$MZSCHEME_LIBS -R ${vi_cv_path_mzscheme_pfx}/lib"
MZSCHEME_LIBS="${MZSCHEME_LIBS} -R ${vi_cv_path_mzscheme_pfx}/lib"
fi
fi
if test -d $vi_cv_path_mzscheme_pfx/lib/plt/collects; then
SCHEME_COLLECTS=lib/plt/
fi
MZSCHEME_CFLAGS="-I${vi_cv_path_mzscheme_pfx}/include${SCHEME_INC} \
if test -f "${vi_cv_path_mzscheme_pfx}/${SCHEME_COLLECTS}collects/scheme/base.ss" ; then
dnl need to generate bytecode for MzScheme base
MZSCHEME_EXTRA="mzscheme_base.c"
MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DINCLUDE_MZSCHEME_BASE"
MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc"
fi
MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -I${SCHEME_INC} \
-DMZSCHEME_COLLECTS='\"${vi_cv_path_mzscheme_pfx}/${SCHEME_COLLECTS}collects\"'"
MZSCHEME_SRC="if_mzsch.c"
MZSCHEME_OBJ="objects/if_mzsch.o"
@@ -500,6 +525,8 @@ if test "$enable_mzschemeinterp" = "yes"; then
AC_SUBST(MZSCHEME_PRO)
AC_SUBST(MZSCHEME_LIBS)
AC_SUBST(MZSCHEME_CFLAGS)
AC_SUBST(MZSCHEME_EXTRA)
AC_SUBST(MZSCHEME_MZC)
fi
@@ -1202,6 +1229,28 @@ else
LDFLAGS="$ac_save_LDFLAGS"
AC_MSG_CHECKING(size of wchar_t is 2 bytes)
AC_CACHE_VAL(ac_cv_small_wchar_t,
[AC_TRY_RUN([
#include <X11/Xlib.h>
#if STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
#endif
main()
{
if (sizeof(wchar_t) <= 2)
exit(1);
exit(0);
}],
ac_cv_small_wchar_t="no",
ac_cv_small_wchar_t="yes",
AC_MSG_ERROR(failed to compile test program))])
AC_MSG_RESULT($ac_cv_small_wchar_t)
if test "x$ac_cv_small_wchar_t" = "xyes" ; then
AC_DEFINE(SMALL_WCHAR_T)
fi
fi
fi
@@ -2103,6 +2152,11 @@ AC_TRY_COMPILE([#include <stdio.h>], [printf("(" __DATE__ " " __TIME__ ")");],
AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DATE_TIME),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(whether __attribute__((unused)) is allowed)
AC_TRY_COMPILE([#include <stdio.h>], [int x __attribute__((unused));],
AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ATTRIBUTE_UNUSED),
AC_MSG_RESULT(no))
dnl Checks for header files.
AC_CHECK_HEADER(elf.h, HAS_ELF=1)
dnl AC_CHECK_HEADER(dwarf.h, SVR4=1)
@@ -2131,7 +2185,7 @@ AC_CHECK_HEADERS(stdarg.h stdlib.h string.h sys/select.h sys/utsname.h \
sys/stream.h termios.h libc.h sys/statfs.h \
poll.h sys/poll.h pwd.h utime.h sys/param.h libintl.h \
libgen.h util/debug.h util/msg18n.h frame.h \
sys/acl.h sys/access.h sys/sysctl.h sys/sysinfo.h wchar.h wctype.h)
sys/acl.h sys/access.h sys/sysinfo.h wchar.h wctype.h)
dnl sys/ptem.h depends on sys/stream.h on Solaris
AC_CHECK_HEADERS(sys/ptem.h, [], [],
@@ -2139,6 +2193,12 @@ AC_CHECK_HEADERS(sys/ptem.h, [], [],
# include <sys/stream.h>
#endif])
dnl sys/sysctl.h depends on sys/param.h on OpenBSD
AC_CHECK_HEADERS(sys/sysctl.h, [], [],
[#if defined HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif])
dnl pthread_np.h may exist but can only be used after including pthread.h
AC_MSG_CHECKING([for pthread_np.h])
@@ -2906,7 +2966,6 @@ main()
AC_MSG_RESULT($ac_cv_sizeof_int)
AC_DEFINE_UNQUOTED(SIZEOF_INT, $ac_cv_sizeof_int)
dnl Check for memmove() before bcopy(), makes memmove() be used when both are
dnl present, fixes problem with incompatibility between Solaris 2.4 and 2.5.
@@ -2988,7 +3047,7 @@ dnl Check if X_LOCALE should be defined.
if test "$enable_multibyte" = "yes"; then
cflags_save=$CFLAGS
ldflags_save=$LDFLAGS
if test -n "$x_includes" ; then
if test "x$x_includes" != "xNONE" ; then
CFLAGS="$CFLAGS -I$x_includes"
LDFLAGS="$X_LIBS $LDFLAGS -lX11"
AC_MSG_CHECKING(whether X_LOCALE needed)
@@ -3004,7 +3063,7 @@ fi
dnl Link with xpg4, it is said to make Korean locale working
AC_CHECK_LIB(xpg4, _xpg4_setrunelocale, [LIBS="$LIBS -lxpg4"],,)
dnl Check how we can run ctags
dnl Check how we can run ctags. Default to "ctags" when nothing works.
dnl --version for Exuberant ctags (preferred)
dnl Add --fields=+S to get function signatures for omni completion.
dnl -t for typedefs (many ctags have this)
@@ -3016,6 +3075,7 @@ test -f tags && mv tags tags.save
if (eval ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then
TAGPRG="ctags -I INIT+ --fields=+S"
else
TAGPRG="ctags"
(eval etags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags"
(eval etags -c /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags -c"
(eval ctags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags"
+14 -11
View File
@@ -652,10 +652,9 @@ diff_write(buf, fname)
* The buffers are written to a file, also for unmodified buffers (the file
* could have been produced by autocommands, e.g. the netrw plugin).
*/
/*ARGSUSED*/
void
ex_diffupdate(eap)
exarg_T *eap; /* can be NULL, it's not used */
exarg_T *eap UNUSED; /* can be NULL */
{
buf_T *buf;
int idx_orig;
@@ -827,6 +826,7 @@ diff_file(tmp_orig, tmp_new, tmp_diff)
char_u *tmp_diff;
{
char_u *cmd;
size_t len;
#ifdef FEAT_EVAL
if (*p_dex != NUL)
@@ -835,8 +835,9 @@ diff_file(tmp_orig, tmp_new, tmp_diff)
else
#endif
{
cmd = alloc((unsigned)(STRLEN(tmp_orig) + STRLEN(tmp_new)
+ STRLEN(tmp_diff) + STRLEN(p_srr) + 27));
len = STRLEN(tmp_orig) + STRLEN(tmp_new)
+ STRLEN(tmp_diff) + STRLEN(p_srr) + 27;
cmd = alloc((unsigned)len);
if (cmd != NULL)
{
/* We don't want $DIFF_OPTIONS to get in the way. */
@@ -846,7 +847,7 @@ diff_file(tmp_orig, tmp_new, tmp_diff)
/* Build the diff command and execute it. Always use -a, binary
* differences are of no use. Ignore errors, diff returns
* non-zero when differences have been found. */
sprintf((char *)cmd, "diff %s%s%s%s%s %s",
vim_snprintf((char *)cmd, len, "diff %s%s%s%s%s %s",
diff_a_works == FALSE ? "" : "-a ",
#if defined(MSWIN) || defined(MSDOS)
diff_bin_works == TRUE ? "--binary " : "",
@@ -856,7 +857,7 @@ diff_file(tmp_orig, tmp_new, tmp_diff)
(diff_flags & DIFF_IWHITE) ? "-b " : "",
(diff_flags & DIFF_ICASE) ? "-i " : "",
tmp_orig, tmp_new);
append_redir(cmd, p_srr, tmp_diff);
append_redir(cmd, (int)len, p_srr, tmp_diff);
#ifdef FEAT_AUTOCMD
block_autocmds(); /* Avoid ShellCmdPost stuff */
#endif
@@ -881,6 +882,7 @@ ex_diffpatch(eap)
char_u *tmp_orig; /* name of original temp file */
char_u *tmp_new; /* name of patched temp file */
char_u *buf = NULL;
size_t buflen;
win_T *old_curwin = curwin;
char_u *newname = NULL; /* name of patched file buffer */
#ifdef UNIX
@@ -920,11 +922,12 @@ ex_diffpatch(eap)
/* Get the absolute path of the patchfile, changing directory below. */
fullname = FullName_save(eap->arg, FALSE);
#endif
buf = alloc((unsigned)(STRLEN(tmp_orig) + (
buflen = STRLEN(tmp_orig) + (
# ifdef UNIX
fullname != NULL ? STRLEN(fullname) :
# endif
STRLEN(eap->arg)) + STRLEN(tmp_new) + 16));
STRLEN(eap->arg)) + STRLEN(tmp_new) + 16;
buf = alloc((unsigned)buflen);
if (buf == NULL)
goto theend;
@@ -961,7 +964,8 @@ ex_diffpatch(eap)
{
/* Build the patch command and execute it. Ignore errors. Switch to
* cooked mode to allow the user to respond to prompts. */
sprintf((char *)buf, "patch -o %s %s < \"%s\"", tmp_new, tmp_orig,
vim_snprintf((char *)buf, buflen, "patch -o %s %s < \"%s\"",
tmp_new, tmp_orig,
# ifdef UNIX
fullname != NULL ? fullname :
# endif
@@ -1089,10 +1093,9 @@ ex_diffsplit(eap)
/*
* Set options to show difs for the current window.
*/
/*ARGSUSED*/
void
ex_diffthis(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
/* Set 'diff', 'scrollbind' on and 'wrap' off. */
diff_win_options(curwin, TRUE);
+16 -9
View File
@@ -32,7 +32,7 @@ static int getexactdigraph __ARGS((int, int, int));
static void printdigraph __ARGS((digr_T *));
/* digraphs added by the user */
static garray_T user_digraphs = {0, 0, sizeof(digr_T), 10, NULL};
static garray_T user_digraphs = {0, 0, (int)sizeof(digr_T), 10, NULL};
/*
* Note: Characters marked with XX are not included literally, because some
@@ -2371,10 +2371,10 @@ printdigraph(dp)
}
else
#endif
*p++ = dp->result;
*p++ = (char_u)dp->result;
if (char2cells(dp->result) == 1)
*p++ = ' ';
sprintf((char *)p, " %3d", dp->result);
vim_snprintf((char *)p, sizeof(buf) - (p - buf), " %3d", dp->result);
msg_outtrans(buf);
}
}
@@ -2395,7 +2395,10 @@ typedef struct
static void keymap_unload __ARGS((void));
/*
* Set up key mapping tables for the 'keymap' option
* Set up key mapping tables for the 'keymap' option.
* Returns NULL if OK, an error message for failure. This only needs to be
* used when setting the option, not later when the value has already been
* checked.
*/
char_u *
keymap_init()
@@ -2412,25 +2415,29 @@ keymap_init()
else
{
char_u *buf;
size_t buflen;
/* Source the keymap file. It will contain a ":loadkeymap" command
* which will call ex_loadkeymap() below. */
buf = alloc((unsigned)(STRLEN(curbuf->b_p_keymap)
buflen = STRLEN(curbuf->b_p_keymap)
# ifdef FEAT_MBYTE
+ STRLEN(p_enc)
+ STRLEN(p_enc)
# endif
+ 14));
+ 14;
buf = alloc((unsigned)buflen);
if (buf == NULL)
return e_outofmem;
# ifdef FEAT_MBYTE
/* try finding "keymap/'keymap'_'encoding'.vim" in 'runtimepath' */
sprintf((char *)buf, "keymap/%s_%s.vim", curbuf->b_p_keymap, p_enc);
vim_snprintf((char *)buf, buflen, "keymap/%s_%s.vim",
curbuf->b_p_keymap, p_enc);
if (source_runtime(buf, FALSE) == FAIL)
# endif
{
/* try finding "keymap/'keymap'.vim" in 'runtimepath' */
sprintf((char *)buf, "keymap/%s.vim", curbuf->b_p_keymap);
vim_snprintf((char *)buf, buflen, "keymap/%s.vim",
curbuf->b_p_keymap);
if (source_runtime(buf, FALSE) == FAIL)
{
vim_free(buf);
+69 -55
View File
@@ -57,7 +57,7 @@ static char *ctrl_x_msgs[] =
N_(" Keyword Local completion (^N^P)"),
};
static char_u e_hitend[] = N_("Hit end of paragraph");
static char e_hitend[] = N_("Hit end of paragraph");
/*
* Structure used to store one match for insert completion.
@@ -114,6 +114,10 @@ static int compl_restarting = FALSE; /* don't insert match */
* FALSE the word to be completed must be located. */
static int compl_started = FALSE;
/* Set when doing something for completion that may call edit() recursively,
* which is not allowed. */
static int compl_busy = FALSE;
static int compl_matches = 0;
static char_u *compl_pattern = NULL;
static int compl_direction = FORWARD;
@@ -165,7 +169,7 @@ static int ins_compl_pum_key __ARGS((int c));
static int ins_compl_key2count __ARGS((int c));
static int ins_compl_use_match __ARGS((int c));
static int ins_complete __ARGS((int c));
static int quote_meta __ARGS((char_u *dest, char_u *str, int len));
static unsigned quote_meta __ARGS((char_u *dest, char_u *str, int len));
#endif /* FEAT_INS_EXPAND */
#define BACKSPACE_CHAR 1
@@ -306,7 +310,7 @@ edit(cmdchar, startln, count)
int c = 0;
char_u *ptr;
int lastc;
colnr_T mincol;
int mincol;
static linenr_T o_lnum = 0;
int i;
int did_backspace = TRUE; /* previous char was backspace */
@@ -346,7 +350,7 @@ edit(cmdchar, startln, count)
#ifdef FEAT_INS_EXPAND
/* Don't allow recursive insert mode when busy with completion. */
if (compl_started || pum_visible())
if (compl_started || compl_busy || pum_visible())
{
EMSG(_(e_secure));
return FALSE;
@@ -387,7 +391,7 @@ edit(cmdchar, startln, count)
if (startln)
Insstart.col = 0;
}
Insstart_textlen = linetabsize(ml_get_curline());
Insstart_textlen = (colnr_T)linetabsize(ml_get_curline());
Insstart_blank_vcol = MAXCOL;
if (!did_ai)
ai_col = 0;
@@ -653,7 +657,7 @@ edit(cmdchar, startln, count)
mincol = curwin->w_wcol;
validate_cursor_col();
if ((int)curwin->w_wcol < (int)mincol - curbuf->b_p_ts
if ((int)curwin->w_wcol < mincol - curbuf->b_p_ts
&& curwin->w_wrow == W_WINROW(curwin)
+ curwin->w_height - 1 - p_so
&& (curwin->w_cursor.lnum != curwin->w_topline
@@ -753,7 +757,7 @@ edit(cmdchar, startln, count)
* there is nothing to add, CTRL-L works like CTRL-P then. */
if (c == Ctrl_L
&& (ctrl_x_mode != CTRL_X_WHOLE_LINE
|| STRLEN(compl_shown_match->cp_str)
|| (int)STRLEN(compl_shown_match->cp_str)
> curwin->w_cursor.col - compl_col))
{
ins_compl_addfrommatch();
@@ -1340,8 +1344,10 @@ doESCkey:
goto normalchar;
docomplete:
compl_busy = TRUE;
if (ins_complete(c) == FAIL)
compl_cont_status = 0;
compl_busy = FALSE;
break;
#endif /* FEAT_INS_EXPAND */
@@ -1443,10 +1449,9 @@ force_cindent:
* Only redraw when there are no characters available. This speeds up
* inserting sequences of characters (e.g., for CTRL-R).
*/
/*ARGSUSED*/
static void
ins_redraw(ready)
int ready; /* not busy with something */
int ready UNUSED; /* not busy with something */
{
if (!char_avail())
{
@@ -1773,7 +1778,7 @@ change_indent(type, amount, round, replaced, call_changed_bytes)
* Compute the screen column where the cursor should be.
*/
vcol = get_indent() - vcol;
curwin->w_virtcol = (vcol < 0) ? 0 : vcol;
curwin->w_virtcol = (colnr_T)((vcol < 0) ? 0 : vcol);
/*
* Advance the cursor until we reach the right screen column.
@@ -1800,9 +1805,9 @@ change_indent(type, amount, round, replaced, call_changed_bytes)
*/
if (vcol != (int)curwin->w_virtcol)
{
curwin->w_cursor.col = new_cursor_col;
curwin->w_cursor.col = (colnr_T)new_cursor_col;
i = (int)curwin->w_virtcol - vcol;
ptr = alloc(i + 1);
ptr = alloc((unsigned)(i + 1));
if (ptr != NULL)
{
new_cursor_col += i;
@@ -1826,7 +1831,7 @@ change_indent(type, amount, round, replaced, call_changed_bytes)
if (new_cursor_col <= 0)
curwin->w_cursor.col = 0;
else
curwin->w_cursor.col = new_cursor_col;
curwin->w_cursor.col = (colnr_T)new_cursor_col;
curwin->w_set_curswant = TRUE;
changed_cline_bef_curs();
@@ -1958,15 +1963,14 @@ backspace_until_column(col)
* Only matters when there are composing characters.
* Return TRUE when something was deleted.
*/
/*ARGSUSED*/
static int
del_char_after_col(limit_col)
int limit_col;
int limit_col UNUSED;
{
#ifdef FEAT_MBYTE
if (enc_utf8 && limit_col >= 0)
{
int ecol = curwin->w_cursor.col + 1;
colnr_T ecol = curwin->w_cursor.col + 1;
/* Make sure the cursor is at the start of a character, but
* skip forward again when going too far back because of a
@@ -1982,7 +1986,7 @@ del_char_after_col(limit_col)
}
if (*ml_get_cursor() == NUL || curwin->w_cursor.col == ecol)
return FALSE;
del_bytes((long)(ecol - curwin->w_cursor.col), FALSE, TRUE);
del_bytes((long)((int)ecol - curwin->w_cursor.col), FALSE, TRUE);
}
else
#endif
@@ -2201,7 +2205,7 @@ ins_compl_add_infercase(str, len, icase, fname, dir, flags)
actual_compl_length = compl_length;
/* Allocate wide character array for the completion and fill it. */
wca = (int *)alloc(actual_len * sizeof(int));
wca = (int *)alloc((unsigned)(actual_len * sizeof(int)));
if (wca != NULL)
{
p = str;
@@ -2580,7 +2584,7 @@ ins_compl_make_cyclic()
*/
void
set_completion(startcol, list)
int startcol;
colnr_T startcol;
list_T *list;
{
/* If already doing completions stop it. */
@@ -2591,10 +2595,10 @@ set_completion(startcol, list)
if (stop_arrow() == FAIL)
return;
if (startcol > (int)curwin->w_cursor.col)
if (startcol > curwin->w_cursor.col)
startcol = curwin->w_cursor.col;
compl_col = startcol;
compl_length = curwin->w_cursor.col - startcol;
compl_length = (int)curwin->w_cursor.col - (int)startcol;
/* compl_pattern doesn't need to be set */
compl_orig_text = vim_strnsave(ml_get_curline() + compl_col, compl_length);
if (compl_orig_text == NULL || ins_compl_add(compl_orig_text,
@@ -2860,7 +2864,6 @@ ins_compl_dictionaries(dict_start, pat, flags, thesaurus)
regmatch_T regmatch;
char_u **files;
int count;
int i;
int save_p_scs;
int dir = compl_direction;
@@ -2892,17 +2895,18 @@ ins_compl_dictionaries(dict_start, pat, flags, thesaurus)
if (ctrl_x_mode == CTRL_X_WHOLE_LINE)
{
char_u *pat_esc = vim_strsave_escaped(pat, (char_u *)"\\");
size_t len;
if (pat_esc == NULL)
goto theend;
i = (int)STRLEN(pat_esc) + 10;
ptr = alloc(i);
len = STRLEN(pat_esc) + 10;
ptr = alloc((unsigned)len);
if (ptr == NULL)
{
vim_free(pat_esc);
goto theend;
}
vim_snprintf((char *)ptr, i, "^\\s*\\zs\\V%s", pat_esc);
vim_snprintf((char *)ptr, len, "^\\s*\\zs\\V%s", pat_esc);
regmatch.regprog = vim_regcomp(ptr, RE_MAGIC);
vim_free(pat_esc);
vim_free(ptr);
@@ -2993,7 +2997,7 @@ ins_compl_files(count, files, thesaurus, flags, regmatch, buf, dir)
{
vim_snprintf((char *)IObuff, IOSIZE,
_("Scanning dictionary: %s"), (char *)files[i]);
msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R));
(void)msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R));
}
if (fp != NULL)
@@ -3174,6 +3178,7 @@ ins_compl_free()
vim_free(match);
} while (compl_curr_match != NULL && compl_curr_match != compl_first_match);
compl_first_match = compl_curr_match = NULL;
compl_shown_match = NULL;
}
static void
@@ -3311,7 +3316,7 @@ ins_compl_new_leader()
static int
ins_compl_len()
{
int off = curwin->w_cursor.col - compl_col;
int off = (int)curwin->w_cursor.col - (int)compl_col;
if (off < 0)
return 0;
@@ -3347,7 +3352,7 @@ ins_compl_addleader(c)
vim_free(compl_leader);
compl_leader = vim_strnsave(ml_get_curline() + compl_col,
curwin->w_cursor.col - compl_col);
(int)(curwin->w_cursor.col - compl_col));
if (compl_leader != NULL)
ins_compl_new_leader();
}
@@ -3395,7 +3400,7 @@ ins_compl_set_original_text(str)
ins_compl_addfrommatch()
{
char_u *p;
int len = curwin->w_cursor.col - compl_col;
int len = (int)curwin->w_cursor.col - (int)compl_col;
int c;
compl_T *cp;
@@ -3961,7 +3966,7 @@ ins_compl_get_exp(ini)
: ins_buf->b_sfname == NULL
? (char *)ins_buf->b_fname
: (char *)ins_buf->b_sfname);
msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R));
(void)msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R));
}
else if (*e_cpt == NUL)
break;
@@ -3990,8 +3995,8 @@ ins_compl_get_exp(ini)
else if (*e_cpt == ']' || *e_cpt == 't')
{
type = CTRL_X_TAGS;
sprintf((char*)IObuff, _("Scanning tags."));
msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R));
vim_snprintf((char *)IObuff, IOSIZE, _("Scanning tags."));
(void)msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R));
}
else
type = -1;
@@ -4089,7 +4094,7 @@ ins_compl_get_exp(ini)
case CTRL_X_SPELL:
#ifdef FEAT_SPELL
num_matches = expand_spelling(first_match_pos.lnum,
first_match_pos.col, compl_pattern, &matches);
compl_pattern, &matches);
if (num_matches > 0)
ins_compl_add_matches(num_matches, matches, p_ic);
#endif
@@ -4799,10 +4804,9 @@ ins_complete(c)
{
char_u *prefix = (char_u *)"\\<";
/* we need 3 extra chars, 1 for the NUL and
* 2 >= strlen(prefix) -- Acevedo */
/* we need up to 2 extra chars for the prefix */
compl_pattern = alloc(quote_meta(NULL, line + compl_col,
compl_length) + 3);
compl_length) + 2);
if (compl_pattern == NULL)
return FAIL;
if (!vim_iswordp(line + compl_col)
@@ -4877,7 +4881,7 @@ ins_complete(c)
else
{
compl_pattern = alloc(quote_meta(NULL, line + compl_col,
compl_length) + 3);
compl_length) + 2);
if (compl_pattern == NULL)
return FAIL;
STRCPY((char *)compl_pattern, "\\<");
@@ -4959,7 +4963,7 @@ ins_complete(c)
if (col < 0)
col = curs_col;
compl_col = col;
if ((colnr_T)compl_col > curs_col)
if (compl_col > curs_col)
compl_col = curs_col;
/* Setup variables for completion. Need to obtain "line" again,
@@ -5232,15 +5236,15 @@ ins_complete(c)
* a backslash) the metachars, and dest would be NUL terminated.
* Returns the length (needed) of dest
*/
static int
static unsigned
quote_meta(dest, src, len)
char_u *dest;
char_u *src;
int len;
{
int m;
unsigned m = (unsigned)len + 1; /* one extra for the NUL */
for (m = len; --len >= 0; src++)
for ( ; --len >= 0; src++)
{
switch (*src)
{
@@ -6069,7 +6073,7 @@ auto_format(trailblank, prev_line)
* in 'formatoptions' and there is a single character before the cursor.
* Otherwise the line would be broken and when typing another non-white
* next they are not joined back together. */
wasatend = (pos.col == STRLEN(old));
wasatend = (pos.col == (colnr_T)STRLEN(old));
if (*old != NUL && !trailblank && wasatend)
{
dec_cursor();
@@ -6246,7 +6250,7 @@ redo_literal(c)
* three digits. */
if (VIM_ISDIGIT(c))
{
sprintf((char *)buf, "%03d", c);
vim_snprintf((char *)buf, sizeof(buf), "%03d", c);
AppendToRedobuff(buf);
}
else
@@ -6320,7 +6324,7 @@ stop_arrow()
ins_need_undo = FALSE;
}
Insstart = curwin->w_cursor; /* new insertion starts here */
Insstart_textlen = linetabsize(ml_get_curline());
Insstart_textlen = (colnr_T)linetabsize(ml_get_curline());
ai_col = 0;
#ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)
@@ -6423,13 +6427,17 @@ stop_insert(end_insert_pos, esc)
/* If we just did an auto-indent, remove the white space from the end
* of the line, and put the cursor back.
* Do this when ESC was used or moving the cursor up/down. */
* Do this when ESC was used or moving the cursor up/down.
* Check for the old position still being valid, just in case the text
* got changed unexpectedly. */
if (did_ai && (esc || (vim_strchr(p_cpo, CPO_INDENT) == NULL
&& curwin->w_cursor.lnum != end_insert_pos->lnum)))
&& curwin->w_cursor.lnum != end_insert_pos->lnum))
&& end_insert_pos->lnum <= curbuf->b_ml.ml_line_count)
{
pos_T tpos = curwin->w_cursor;
curwin->w_cursor = *end_insert_pos;
check_cursor_col(); /* make sure it is not past the line */
for (;;)
{
if (gchar_cursor() == NUL && curwin->w_cursor.col > 0)
@@ -6437,7 +6445,8 @@ stop_insert(end_insert_pos, esc)
cc = gchar_cursor();
if (!vim_iswhite(cc))
break;
(void)del_char(TRUE);
if (del_char(TRUE) == FAIL)
break; /* should not happen */
}
if (curwin->w_cursor.lnum != tpos.lnum)
curwin->w_cursor = tpos;
@@ -6449,10 +6458,11 @@ stop_insert(end_insert_pos, esc)
* deleted characters. */
if (VIsual_active && VIsual.lnum == curwin->w_cursor.lnum)
{
cc = (int)STRLEN(ml_get_curline());
if (VIsual.col > (colnr_T)cc)
int len = (int)STRLEN(ml_get_curline());
if (VIsual.col > len)
{
VIsual.col = cc;
VIsual.col = len;
# ifdef FEAT_VIRTUALEDIT
VIsual.coladd = 0;
# endif
@@ -8311,6 +8321,7 @@ ins_bs(c, mode, inserted_space_p)
linenr_T lnum;
int cc;
int temp = 0; /* init for GCC */
colnr_T save_col;
colnr_T mincol;
int did_backspace = FALSE;
int in_indent;
@@ -8468,13 +8479,13 @@ ins_bs(c, mode, inserted_space_p)
*/
while (cc > 0)
{
temp = curwin->w_cursor.col;
save_col = curwin->w_cursor.col;
#ifdef FEAT_MBYTE
mb_replace_pop_ins(cc);
#else
ins_char(cc);
#endif
curwin->w_cursor.col = temp;
curwin->w_cursor.col = save_col;
cc = replace_pop();
}
/* restore the characters that NL replaced */
@@ -8506,11 +8517,11 @@ ins_bs(c, mode, inserted_space_p)
#endif
)
{
temp = curwin->w_cursor.col;
save_col = curwin->w_cursor.col;
beginline(BL_WHITE);
if (curwin->w_cursor.col < (colnr_T)temp)
mincol = curwin->w_cursor.col;
curwin->w_cursor.col = temp;
curwin->w_cursor.col = save_col;
}
/*
@@ -8984,7 +8995,10 @@ ins_right()
foldOpenCursor();
#endif
undisplay_dollar();
if (gchar_cursor() != NUL || virtual_active()
if (gchar_cursor() != NUL
#ifdef FEAT_VIRTUALEDIT
|| virtual_active()
#endif
)
{
start_arrow(&curwin->w_cursor);
+198 -292
View File
File diff suppressed because it is too large Load Diff
+274 -71
View File
@@ -43,10 +43,9 @@ static int
/*
* ":ascii" and "ga".
*/
/*ARGSUSED*/
void
do_ascii(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
int c;
int cval;
@@ -87,13 +86,14 @@ do_ascii(eap)
))
{
transchar_nonprint(buf3, c);
sprintf(buf1, " <%s>", (char *)buf3);
vim_snprintf(buf1, sizeof(buf1), " <%s>", (char *)buf3);
}
else
buf1[0] = NUL;
#ifndef EBCDIC
if (c >= 0x80)
sprintf(buf2, " <M-%s>", transchar(c & 0x7f));
vim_snprintf(buf2, sizeof(buf2), " <M-%s>",
(char *)transchar(c & 0x7f));
else
#endif
buf2[0] = NUL;
@@ -358,7 +358,7 @@ ex_sort(eap)
linenr_T lnum;
long maxlen = 0;
sorti_T *nrs;
size_t count = eap->line2 - eap->line1 + 1;
size_t count = (size_t)(eap->line2 - eap->line1 + 1);
size_t i;
char_u *p;
char_u *s;
@@ -957,7 +957,7 @@ do_bang(addr_count, eap, forceit, do_in, do_out)
}
len += (int)STRLEN(prevcmd);
}
if ((t = alloc(len)) == NULL)
if ((t = alloc((unsigned)len)) == NULL)
{
vim_free(newcmd);
return;
@@ -1548,7 +1548,7 @@ make_filter_cmd(cmd, itmp, otmp)
* redirecting input and/or output.
*/
if (itmp != NULL || otmp != NULL)
sprintf((char *)buf, "(%s)", (char *)cmd);
vim_snprintf((char *)buf, len, "(%s)", (char *)cmd);
else
STRCPY(buf, cmd);
if (itmp != NULL)
@@ -1597,37 +1597,41 @@ make_filter_cmd(cmd, itmp, otmp)
}
#endif
if (otmp != NULL)
append_redir(buf, p_srr, otmp);
append_redir(buf, (int)len, p_srr, otmp);
return buf;
}
/*
* Append output redirection for file "fname" to the end of string buffer "buf"
* Append output redirection for file "fname" to the end of string buffer
* "buf[buflen]"
* Works with the 'shellredir' and 'shellpipe' options.
* The caller should make sure that there is enough room:
* STRLEN(opt) + STRLEN(fname) + 3
*/
void
append_redir(buf, opt, fname)
append_redir(buf, buflen, opt, fname)
char_u *buf;
int buflen;
char_u *opt;
char_u *fname;
{
char_u *p;
char_u *end;
buf += STRLEN(buf);
end = buf + STRLEN(buf);
/* find "%s", skipping "%%" */
for (p = opt; (p = vim_strchr(p, '%')) != NULL; ++p)
if (p[1] == 's')
break;
if (p != NULL)
{
*buf = ' '; /* not really needed? Not with sh, ksh or bash */
sprintf((char *)buf + 1, (char *)opt, (char *)fname);
*end = ' '; /* not really needed? Not with sh, ksh or bash */
vim_snprintf((char *)end + 1, (size_t)(buflen - (end + 1 - buf)),
(char *)opt, (char *)fname);
}
else
sprintf((char *)buf,
vim_snprintf((char *)end, (size_t)(buflen - (end - buf)),
#ifdef FEAT_QUICKFIX
# ifndef RISCOS
opt != p_sp ? " %s%s" :
@@ -1789,7 +1793,7 @@ write_viminfo(file, forceit)
* overwrite a user's viminfo file after a "su root", with a
* viminfo file that the user can't read.
*/
st_old.st_dev = 0;
st_old.st_dev = (dev_t)0;
st_old.st_ino = 0;
st_old.st_mode = 0600;
if (mch_stat((char *)fname, &st_old) == 0
@@ -2251,12 +2255,11 @@ viminfo_readline(virp)
*
* Return the string in allocated memory (NULL when out of memory).
*/
/*ARGSUSED*/
char_u *
viminfo_readstring(virp, off, convert)
vir_T *virp;
int off; /* offset for virp->vir_line */
int convert; /* convert the string */
int convert UNUSED; /* convert the string */
{
char_u *retval;
char_u *s, *d;
@@ -2368,10 +2371,9 @@ viminfo_writestring(fd, p)
* ^? ^H
* not ^? ^?
*/
/*ARGSUSED*/
void
do_fixdel(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
char_u *p;
@@ -2390,7 +2392,8 @@ print_line_no_prefix(lnum, use_number, list)
if (curwin->w_p_nu || use_number)
{
sprintf((char *)numbuf, "%*ld ", number_width(curwin), (long)lnum);
vim_snprintf((char *)numbuf, sizeof(numbuf),
"%*ld ", number_width(curwin), (long)lnum);
msg_puts_attr(numbuf, hl_attr(HLF_N)); /* Highlight line nrs */
}
msg_prt_line(ml_get(lnum), list);
@@ -2732,7 +2735,6 @@ theend:
* May set eap->forceit if a dialog says it's OK to overwrite.
* Return OK if it's OK, FAIL if it is not.
*/
/*ARGSUSED*/
static int
check_overwrite(eap, buf, fname, ffname, other)
exarg_T *eap;
@@ -3715,7 +3717,7 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin)
/* If the window options were changed may need to set the spell language.
* Can only do this after the buffer has been properly setup. */
if (did_get_winopts && curwin->w_p_spell && *curbuf->b_p_spl != NUL)
did_set_spelllang(curbuf);
(void)did_set_spelllang(curbuf);
#endif
if (command == NULL)
@@ -3788,7 +3790,7 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin)
#ifdef FEAT_KEYMAP
if (curbuf->b_kmap_state & KEYMAP_INIT)
keymap_init();
(void)keymap_init();
#endif
--RedrawingDisabled;
@@ -4011,6 +4013,9 @@ ex_change(eap)
break;
ml_delete(eap->line1, FALSE);
}
/* make sure the cursor is not beyond the end of the file now */
check_cursor_lnum();
deleted_lines_mark(eap->line1, (long)(eap->line2 - lnum));
/* ":append" on the line above the deleted lines. */
@@ -4036,8 +4041,10 @@ ex_z(eap)
bigness = curwin->w_height;
else if (firstwin == lastwin)
bigness = curwin->w_p_scr * 2;
#ifdef FEAT_WINDOWS
else
bigness = curwin->w_height - 3;
#endif
if (bigness < 1)
bigness = 1;
@@ -4486,7 +4493,7 @@ do_sub(eap)
char_u *p1;
int did_sub = FALSE;
int lastone;
unsigned len, needed_len;
int len, copy_len, needed_len;
long nmatch_tl = 0; /* nr of lines matched below lnum */
int do_again; /* do it again after joining lines */
int skip_match = FALSE;
@@ -4631,6 +4638,8 @@ do_sub(eap)
if (do_ask)
{
int typed = 0;
/* change State to CONFIRM, so that the mouse works
* properly */
save_State = State;
@@ -4669,7 +4678,7 @@ do_sub(eap)
resp = getexmodeline('?', NULL, 0);
if (resp != NULL)
{
i = *resp;
typed = *resp;
vim_free(resp);
}
}
@@ -4721,7 +4730,7 @@ do_sub(eap)
#endif
++no_mapping; /* don't map this key */
++allow_keys; /* allow special keys */
i = plain_vgetc();
typed = plain_vgetc();
--allow_keys;
--no_mapping;
@@ -4732,35 +4741,35 @@ do_sub(eap)
}
need_wait_return = FALSE; /* no hit-return prompt */
if (i == 'q' || i == ESC || i == Ctrl_C
if (typed == 'q' || typed == ESC || typed == Ctrl_C
#ifdef UNIX
|| i == intr_char
|| typed == intr_char
#endif
)
{
got_quit = TRUE;
break;
}
if (i == 'n')
if (typed == 'n')
break;
if (i == 'y')
if (typed == 'y')
break;
if (i == 'l')
if (typed == 'l')
{
/* last: replace and then stop */
do_all = FALSE;
line2 = lnum;
break;
}
if (i == 'a')
if (typed == 'a')
{
do_ask = FALSE;
break;
}
#ifdef FEAT_INS_EXPAND
if (i == Ctrl_E)
if (typed == Ctrl_E)
scrollup_clamp();
else if (i == Ctrl_Y)
else if (typed == Ctrl_Y)
scrolldown_clamp();
#endif
}
@@ -4771,7 +4780,7 @@ do_sub(eap)
if (vim_strchr(p_cpo, CPO_UNDO) != NULL)
--no_u_sync;
if (i == 'n')
if (typed == 'n')
{
/* For a multi-line match, put matchcol at the NUL at
* the end of the line and set nmatch to one, so that
@@ -4822,9 +4831,9 @@ do_sub(eap)
p1 = ml_get(sub_firstlnum + nmatch - 1);
nmatch_tl += nmatch - 1;
}
i = regmatch.startpos[0].col - copycol;
needed_len = i + ((unsigned)STRLEN(p1) - regmatch.endpos[0].col)
+ sublen + 1;
copy_len = regmatch.startpos[0].col - copycol;
needed_len = copy_len + ((unsigned)STRLEN(p1)
- regmatch.endpos[0].col) + sublen + 1;
if (new_start == NULL)
{
/*
@@ -4847,7 +4856,7 @@ do_sub(eap)
*/
len = (unsigned)STRLEN(new_start);
needed_len += len;
if (needed_len > new_start_len)
if (needed_len > (int)new_start_len)
{
new_start_len = needed_len + 50;
if ((p1 = alloc_check(new_start_len)) == NULL)
@@ -4865,8 +4874,8 @@ do_sub(eap)
/*
* copy the text up to the part that matched
*/
mch_memmove(new_end, sub_firstline + copycol, (size_t)i);
new_end += i;
mch_memmove(new_end, sub_firstline + copycol, (size_t)copy_len);
new_end += copy_len;
(void)vim_regsub_multi(&regmatch,
sub_firstlnum - regmatch.startpos[0].lnum,
@@ -5790,7 +5799,7 @@ find_help_tags(arg, num_matches, matches, keep_lang)
* Recognize a few exceptions to the rule. Some strings that contain '*'
* with "star". Otherwise '*' is recognized as a wildcard.
*/
for (i = sizeof(mtable) / sizeof(char *); --i >= 0; )
for (i = (int)(sizeof(mtable) / sizeof(char *)); --i >= 0; )
if (STRCMP(arg, mtable[i]) == 0)
{
STRCPY(d, rtable[i]);
@@ -6114,10 +6123,9 @@ fix_help_buffer()
/*
* ":exusage"
*/
/*ARGSUSED*/
void
ex_exusage(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
do_cmdline_cmd((char_u *)"help ex-cmd-index");
}
@@ -6125,10 +6133,9 @@ ex_exusage(eap)
/*
* ":viusage"
*/
/*ARGSUSED*/
void
ex_viusage(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
do_cmdline_cmd((char_u *)"help normal-index");
}
@@ -6540,9 +6547,47 @@ struct sign
static sign_T *first_sign = NULL;
static int last_sign_typenr = MAX_TYPENR; /* is decremented */
static int sign_cmd_idx __ARGS((char_u *begin_cmd, char_u *end_cmd));
static void sign_list_defined __ARGS((sign_T *sp));
static void sign_undefine __ARGS((sign_T *sp, sign_T *sp_prev));
static char *cmds[] = {
"define",
#define SIGNCMD_DEFINE 0
"undefine",
#define SIGNCMD_UNDEFINE 1
"list",
#define SIGNCMD_LIST 2
"place",
#define SIGNCMD_PLACE 3
"unplace",
#define SIGNCMD_UNPLACE 4
"jump",
#define SIGNCMD_JUMP 5
NULL
#define SIGNCMD_LAST 6
};
/*
* Find index of a ":sign" subcmd from its name.
* "*end_cmd" must be writable.
*/
static int
sign_cmd_idx(begin_cmd, end_cmd)
char_u *begin_cmd; /* begin of sign subcmd */
char_u *end_cmd; /* just after sign subcmd */
{
int idx;
char save = *end_cmd;
*end_cmd = NUL;
for (idx = 0; ; ++idx)
if (cmds[idx] == NULL || STRCMP(begin_cmd, cmds[idx]) == 0)
break;
*end_cmd = save;
return idx;
}
/*
* ":sign" command
*/
@@ -6556,35 +6601,14 @@ ex_sign(eap)
sign_T *sp;
sign_T *sp_prev;
buf_T *buf;
static char *cmds[] = {
"define",
#define SIGNCMD_DEFINE 0
"undefine",
#define SIGNCMD_UNDEFINE 1
"list",
#define SIGNCMD_LIST 2
"place",
#define SIGNCMD_PLACE 3
"unplace",
#define SIGNCMD_UNPLACE 4
"jump",
#define SIGNCMD_JUMP 5
#define SIGNCMD_LAST 6
};
/* Parse the subcommand. */
p = skiptowhite(arg);
if (*p != NUL)
*p++ = NUL;
for (idx = 0; ; ++idx)
idx = sign_cmd_idx(arg, p);
if (idx == SIGNCMD_LAST)
{
if (idx == SIGNCMD_LAST)
{
EMSG2(_("E160: Unknown sign command: %s"), arg);
return;
}
if (STRCMP(arg, cmds[idx]) == 0)
break;
EMSG2(_("E160: Unknown sign command: %s"), arg);
return;
}
arg = skipwhite(p);
@@ -7110,6 +7134,185 @@ free_signs()
}
#endif
#if defined(FEAT_CMDL_COMPL) || defined(PROTO)
static enum
{
EXP_SUBCMD, /* expand :sign sub-commands */
EXP_DEFINE, /* expand :sign define {name} args */
EXP_PLACE, /* expand :sign place {id} args */
EXP_UNPLACE, /* expand :sign unplace" */
EXP_SIGN_NAMES /* expand with name of placed signs */
} expand_what;
/*
* Function given to ExpandGeneric() to obtain the sign command
* expansion.
*/
char_u *
get_sign_name(xp, idx)
expand_T *xp UNUSED;
int idx;
{
sign_T *sp;
int current_idx;
switch (expand_what)
{
case EXP_SUBCMD:
return (char_u *)cmds[idx];
case EXP_DEFINE:
{
char *define_arg[] =
{
"icon=", "linehl=", "text=", "texthl=", NULL
};
return (char_u *)define_arg[idx];
}
case EXP_PLACE:
{
char *place_arg[] =
{
"line=", "name=", "file=", "buffer=", NULL
};
return (char_u *)place_arg[idx];
}
case EXP_UNPLACE:
{
char *unplace_arg[] = { "file=", "buffer=", NULL };
return (char_u *)unplace_arg[idx];
}
case EXP_SIGN_NAMES:
/* Complete with name of signs already defined */
current_idx = 0;
for (sp = first_sign; sp != NULL; sp = sp->sn_next)
if (current_idx++ == idx)
return sp->sn_name;
return NULL;
default:
return NULL;
}
}
/*
* Handle command line completion for :sign command.
*/
void
set_context_in_sign_cmd(xp, arg)
expand_T *xp;
char_u *arg;
{
char_u *p;
char_u *end_subcmd;
char_u *last;
int cmd_idx;
char_u *begin_subcmd_args;
/* Default: expand subcommands. */
xp->xp_context = EXPAND_SIGN;
expand_what = EXP_SUBCMD;
xp->xp_pattern = arg;
end_subcmd = skiptowhite(arg);
if (*end_subcmd == NUL)
/* expand subcmd name
* :sign {subcmd}<CTRL-D>*/
return;
cmd_idx = sign_cmd_idx(arg, end_subcmd);
/* :sign {subcmd} {subcmd_args}
* |
* begin_subcmd_args */
begin_subcmd_args = skipwhite(end_subcmd);
p = skiptowhite(begin_subcmd_args);
if (*p == NUL)
{
/*
* Expand first argument of subcmd when possible.
* For ":jump {id}" and ":unplace {id}", we could
* possibly expand the ids of all signs already placed.
*/
xp->xp_pattern = begin_subcmd_args;
switch (cmd_idx)
{
case SIGNCMD_LIST:
case SIGNCMD_UNDEFINE:
/* :sign list <CTRL-D>
* :sign undefine <CTRL-D> */
expand_what = EXP_SIGN_NAMES;
break;
default:
xp->xp_context = EXPAND_NOTHING;
}
return;
}
/* expand last argument of subcmd */
/* :sign define {name} {args}...
* |
* p */
/* Loop until reaching last argument. */
do
{
p = skipwhite(p);
last = p;
p = skiptowhite(p);
} while (*p != NUL);
p = vim_strchr(last, '=');
/* :sign define {name} {args}... {last}=
* | |
* last p */
if (p == NUL)
{
/* Expand last argument name (before equal sign). */
xp->xp_pattern = last;
switch (cmd_idx)
{
case SIGNCMD_DEFINE:
expand_what = EXP_DEFINE;
break;
case SIGNCMD_PLACE:
expand_what = EXP_PLACE;
break;
case SIGNCMD_JUMP:
case SIGNCMD_UNPLACE:
expand_what = EXP_UNPLACE;
break;
default:
xp->xp_context = EXPAND_NOTHING;
}
}
else
{
/* Expand last argument value (after equal sign). */
xp->xp_pattern = p + 1;
switch (cmd_idx)
{
case SIGNCMD_DEFINE:
if (STRNCMP(last, "texthl", p - last) == 0 ||
STRNCMP(last, "linehl", p - last) == 0)
xp->xp_context = EXPAND_HIGHLIGHT;
else if (STRNCMP(last, "icon", p - last) == 0)
xp->xp_context = EXPAND_FILES;
else
xp->xp_context = EXPAND_NOTHING;
break;
case SIGNCMD_PLACE:
if (STRNCMP(last, "name", p - last) == 0)
expand_what = EXP_SIGN_NAMES;
else
xp->xp_context = EXPAND_NOTHING;
break;
default:
xp->xp_context = EXPAND_NOTHING;
}
}
}
#endif
#endif
#if defined(FEAT_GUI) || defined(FEAT_CLIENTSERVER) || defined(PROTO)
+2
View File
@@ -995,6 +995,8 @@ EX(CMD_unmap, "unmap", ex_unmap,
BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
EX(CMD_unmenu, "unmenu", ex_menu,
BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
EX(CMD_unsilent, "unsilent", ex_wrongmodifier,
NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN),
EX(CMD_update, "update", ex_update,
RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR),
EX(CMD_vglobal, "vglobal", ex_global,
+17 -24
View File
@@ -28,7 +28,8 @@ typedef struct scriptitem_S
{
char_u *sn_name;
# ifdef UNIX
int sn_dev;
int sn_dev_valid;
dev_t sn_dev;
ino_t sn_ino;
# endif
# ifdef FEAT_PROFILE
@@ -680,10 +681,9 @@ ex_breakdel(eap)
/*
* ":breaklist".
*/
/*ARGSUSED*/
void
ex_breaklist(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
struct debuggy *bp;
int i;
@@ -1342,14 +1342,13 @@ autowrite_all()
/*
* return TRUE if buffer was changed and cannot be abandoned.
*/
/*ARGSUSED*/
int
check_changed(buf, checkaw, mult_win, forceit, allbuf)
buf_T *buf;
int checkaw; /* do autowrite if buffer was changed */
int mult_win; /* check also when several wins for the buf */
int forceit;
int allbuf; /* may write all buffers */
int allbuf UNUSED; /* may write all buffers */
{
if ( !forceit
&& bufIsChanged(buf)
@@ -1832,12 +1831,11 @@ set_arglist(str)
*
* Return FAIL for failure, OK otherwise.
*/
/*ARGSUSED*/
static int
do_arglist(str, what, after)
char_u *str;
int what;
int after; /* 0 means before first one */
int what UNUSED;
int after UNUSED; /* 0 means before first one */
{
garray_T new_ga;
int exp_count;
@@ -2622,11 +2620,10 @@ ex_runtime(eap)
static void source_callback __ARGS((char_u *fname, void *cookie));
/*ARGSUSED*/
static void
source_callback(fname, cookie)
char_u *fname;
void *cookie;
void *cookie UNUSED;
{
(void)do_source(fname, FALSE, DOSO_NONE);
}
@@ -2753,10 +2750,9 @@ do_in_runtimepath(name, all, callback, cookie)
/*
* ":options"
*/
/*ARGSUSED*/
void
ex_options(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
cmd_source((char_u *)SYS_OPTWIN_FILE, NULL);
}
@@ -3127,7 +3123,7 @@ do_source(fname, check_other, is_vimrc)
/* Compare dev/ino when possible, it catches symbolic
* links. Also compare file names, the inode may change
* when the file was edited. */
((stat_ok && si->sn_dev != -1)
((stat_ok && si->sn_dev_valid)
&& (si->sn_dev == st.st_dev
&& si->sn_ino == st.st_ino)) ||
# endif
@@ -3154,11 +3150,12 @@ do_source(fname, check_other, is_vimrc)
# ifdef UNIX
if (stat_ok)
{
si->sn_dev_valid = TRUE;
si->sn_dev = st.st_dev;
si->sn_ino = st.st_ino;
}
else
si->sn_dev = -1;
si->sn_dev_valid = FALSE;
# endif
/* Allocate the local script variables to use for this script. */
@@ -3263,10 +3260,9 @@ theend:
/*
* ":scriptnames"
*/
/*ARGSUSED*/
void
ex_scriptnames(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
int i;
@@ -3390,12 +3386,11 @@ fgets_cr(s, n, stream)
* Return a pointer to the line in allocated memory.
* Return NULL for end-of-file or some error.
*/
/* ARGSUSED */
char_u *
getsourceline(c, cookie, indent)
int c; /* not used */
int c UNUSED;
void *cookie;
int indent; /* not used */
int indent UNUSED;
{
struct source_cookie *sp = (struct source_cookie *)cookie;
char_u *line;
@@ -3446,7 +3441,7 @@ getsourceline(c, cookie, indent)
p = skipwhite(sp->nextline);
if (*p != '\\')
break;
s = alloc((int)(STRLEN(line) + STRLEN(p)));
s = alloc((unsigned)(STRLEN(line) + STRLEN(p)));
if (s == NULL) /* out of memory */
break;
STRCPY(s, line);
@@ -3722,10 +3717,9 @@ script_line_end()
* ":scriptencoding": Set encoding conversion for a sourced script.
* Without the multi-byte feature it's simply ignored.
*/
/*ARGSUSED*/
void
ex_scriptencoding(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
#ifdef FEAT_MBYTE
struct source_cookie *sp;
@@ -4174,10 +4168,9 @@ ex_language(eap)
* Function given to ExpandGeneric() to obtain the possible arguments of the
* ":language" command.
*/
/*ARGSUSED*/
char_u *
get_lang_arg(xp, idx)
expand_T *xp;
expand_T *xp UNUSED;
int idx;
{
if (idx == 0)
+71 -71
View File
@@ -1585,11 +1585,10 @@ free_cmdlines(gap)
* If "fgetline" is get_loop_line(), return TRUE if the getline it uses equals
* "func". * Otherwise return TRUE when "fgetline" equals "func".
*/
/*ARGSUSED*/
int
getline_equal(fgetline, cookie, func)
char_u *(*fgetline) __ARGS((int, void *, int));
void *cookie; /* argument for fgetline() */
void *cookie UNUSED; /* argument for fgetline() */
char_u *(*func) __ARGS((int, void *, int));
{
#ifdef FEAT_EVAL
@@ -1617,10 +1616,9 @@ getline_equal(fgetline, cookie, func)
* If "fgetline" is get_loop_line(), return the cookie used by the original
* getline function. Otherwise return "cookie".
*/
/*ARGSUSED*/
void *
getline_cookie(fgetline, cookie)
char_u *(*fgetline) __ARGS((int, void *, int));
char_u *(*fgetline) __ARGS((int, void *, int)) UNUSED;
void *cookie; /* argument for fgetline() */
{
# ifdef FEAT_EVAL
@@ -1686,8 +1684,8 @@ do_one_cmd(cmdlinep, sourcing,
char_u *errormsg = NULL; /* error message */
exarg_T ea; /* Ex command arguments */
long verbose_save = -1;
int save_msg_scroll = 0;
int did_silent = 0;
int save_msg_scroll = msg_scroll;
int save_msg_silent = -1;
int did_esilent = 0;
#ifdef HAVE_SANDBOX
int did_sandbox = FALSE;
@@ -1865,9 +1863,9 @@ do_one_cmd(cmdlinep, sourcing,
}
if (!checkforcmd(&ea.cmd, "silent", 3))
break;
++did_silent;
if (save_msg_silent == -1)
save_msg_silent = msg_silent;
++msg_silent;
save_msg_scroll = msg_scroll;
if (*ea.cmd == '!' && !vim_iswhite(ea.cmd[-1]))
{
/* ":silent!", but not "silent !cmd" */
@@ -1895,6 +1893,13 @@ do_one_cmd(cmdlinep, sourcing,
#endif
continue;
case 'u': if (!checkforcmd(&ea.cmd, "unsilent", 3))
break;
if (save_msg_silent == -1)
save_msg_silent = msg_silent;
msg_silent = 0;
continue;
case 'v': if (checkforcmd(&ea.cmd, "vertical", 4))
{
#ifdef FEAT_VERTSPLIT
@@ -2693,19 +2698,23 @@ doend:
cmdmod = save_cmdmod;
if (did_silent > 0)
if (save_msg_silent != -1)
{
/* messages could be enabled for a serious error, need to check if the
* counters don't become negative */
msg_silent -= did_silent;
if (msg_silent < 0)
msg_silent = 0;
if (!did_emsg)
msg_silent = save_msg_silent;
emsg_silent -= did_esilent;
if (emsg_silent < 0)
emsg_silent = 0;
/* Restore msg_scroll, it's set by file I/O commands, even when no
* message is actually displayed. */
msg_scroll = save_msg_scroll;
/* "silent reg" or "silent echo x" inside "redir" leaves msg_col
* somewhere in the line. Put it back in the first column. */
if (redirecting())
msg_col = 0;
}
#ifdef HAVE_SANDBOX
@@ -2739,7 +2748,7 @@ checkforcmd(pp, cmd, len)
int i;
for (i = 0; cmd[i] != NUL; ++i)
if (cmd[i] != (*pp)[i])
if (((char_u *)cmd)[i] != (*pp)[i])
break;
if (i >= len && !isalpha((*pp)[i]))
{
@@ -2756,11 +2765,10 @@ checkforcmd(pp, cmd, len)
* "full" is set to TRUE if the whole command name matched.
* Returns NULL for an ambiguous user command.
*/
/*ARGSUSED*/
static char_u *
find_command(eap, full)
exarg_T *eap;
int *full;
int *full UNUSED;
{
int len;
char_u *p;
@@ -2805,7 +2813,7 @@ find_command(eap, full)
/* Check for ":dl", ":dell", etc. to ":deletel": that's
* :delete with the 'l' flag. Same for 'p'. */
for (i = 0; i < len; ++i)
if (eap->cmd[i] != "delete"[i])
if (eap->cmd[i] != ((char_u *)"delete")[i])
break;
if (i == len - 1)
{
@@ -2992,6 +3000,7 @@ static struct cmdmod
{"silent", 3, FALSE},
{"tab", 3, TRUE},
{"topleft", 2, FALSE},
{"unsilent", 3, FALSE},
{"verbose", 4, TRUE},
{"vertical", 4, FALSE},
};
@@ -3009,7 +3018,7 @@ modifier_len(cmd)
if (VIM_ISDIGIT(*cmd))
p = skipwhite(skipdigits(cmd));
for (i = 0; i < sizeof(cmdmods) / sizeof(struct cmdmod); ++i)
for (i = 0; i < (int)(sizeof(cmdmods) / sizeof(struct cmdmod)); ++i)
{
for (j = 0; p[j] != NUL; ++j)
if (p[j] != cmdmods[i].name[j])
@@ -3037,7 +3046,7 @@ cmd_exists(name)
char_u *p;
/* Check command modifiers. */
for (i = 0; i < sizeof(cmdmods) / sizeof(struct cmdmod); ++i)
for (i = 0; i < (int)(sizeof(cmdmods) / sizeof(struct cmdmod)); ++i)
{
for (j = 0; name[j] != NUL; ++j)
if (name[j] != cmdmods[i].name[j])
@@ -3692,7 +3701,14 @@ set_one_cmd_context(xp, buff)
break;
#ifdef FEAT_CSCOPE
case CMD_cscope:
set_context_in_cscope_cmd(xp, arg);
case CMD_lcscope:
case CMD_scscope:
set_context_in_cscope_cmd(xp, arg, ea.cmdidx);
break;
#endif
#ifdef FEAT_SIGNS
case CMD_sign:
set_context_in_sign_cmd(xp, arg);
break;
#endif
#ifdef FEAT_LISTCMDS
@@ -3829,7 +3845,7 @@ skip_range(cmd, ctx)
char_u *cmd;
int *ctx; /* pointer to xp_context or NULL */
{
int delim;
unsigned delim;
while (vim_strchr((char_u *)" \t0123456789.$%'/?-+,;", *cmd) != NULL)
{
@@ -5059,10 +5075,9 @@ check_more(message, forceit)
/*
* Function given to ExpandGeneric() to obtain the list of command names.
*/
/*ARGSUSED*/
char_u *
get_command_name(xp, idx)
expand_T *xp;
expand_T *xp UNUSED;
int idx;
{
if (idx >= (int)CMD_SIZE)
@@ -5229,6 +5244,9 @@ static struct
{EXPAND_MENUS, "menu"},
{EXPAND_SETTINGS, "option"},
{EXPAND_SHELLCMD, "shellcmd"},
#if defined(FEAT_SIGNS)
{EXPAND_SIGN, "sign"},
#endif
{EXPAND_TAGS, "tag"},
{EXPAND_TAGS_LISTFILES, "tag_listfiles"},
{EXPAND_USER_VARS, "var"},
@@ -5576,10 +5594,9 @@ ex_command(eap)
* ":comclear"
* Clear all user commands, global and for current buffer.
*/
/*ARGSUSED*/
void
ex_comclear(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
uc_clear(&ucmds);
uc_clear(&curbuf->b_ucmds);
@@ -6075,10 +6092,9 @@ get_user_command_name(idx)
/*
* Function given to ExpandGeneric() to obtain the list of user command names.
*/
/*ARGSUSED*/
char_u *
get_user_commands(xp, idx)
expand_T *xp;
expand_T *xp UNUSED;
int idx;
{
if (idx < curbuf->b_ucmds.ga_len)
@@ -6093,17 +6109,16 @@ get_user_commands(xp, idx)
* Function given to ExpandGeneric() to obtain the list of user command
* attributes.
*/
/*ARGSUSED*/
char_u *
get_user_cmd_flags(xp, idx)
expand_T *xp;
expand_T *xp UNUSED;
int idx;
{
static char *user_cmd_flags[] =
{"bang", "bar", "buffer", "complete", "count",
"nargs", "range", "register"};
if (idx >= sizeof(user_cmd_flags) / sizeof(user_cmd_flags[0]))
if (idx >= (int)(sizeof(user_cmd_flags) / sizeof(user_cmd_flags[0])))
return NULL;
return (char_u *)user_cmd_flags[idx];
}
@@ -6111,15 +6126,14 @@ get_user_cmd_flags(xp, idx)
/*
* Function given to ExpandGeneric() to obtain the list of values for -nargs.
*/
/*ARGSUSED*/
char_u *
get_user_cmd_nargs(xp, idx)
expand_T *xp;
expand_T *xp UNUSED;
int idx;
{
static char *user_cmd_nargs[] = {"0", "1", "*", "?", "+"};
if (idx >= sizeof(user_cmd_nargs) / sizeof(user_cmd_nargs[0]))
if (idx >= (int)(sizeof(user_cmd_nargs) / sizeof(user_cmd_nargs[0])))
return NULL;
return (char_u *)user_cmd_nargs[idx];
}
@@ -6127,10 +6141,9 @@ get_user_cmd_nargs(xp, idx)
/*
* Function given to ExpandGeneric() to obtain the list of values for -complete.
*/
/*ARGSUSED*/
char_u *
get_user_cmd_complete(xp, idx)
expand_T *xp;
expand_T *xp UNUSED;
int idx;
{
return (char_u *)command_complete[idx].name;
@@ -6308,10 +6321,9 @@ ex_quit(eap)
/*
* ":cquit".
*/
/*ARGSUSED*/
static void
ex_cquit(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
getout(1); /* this does not always pass on the exit code to the Manx
compiler. why? */
@@ -6753,10 +6765,9 @@ ex_goto(eap)
/*
* ":shell".
*/
/*ARGSUSED*/
static void
ex_shell(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
do_shell(NULL, 0);
}
@@ -7061,10 +7072,9 @@ alist_slash_adjust()
/*
* ":preserve".
*/
/*ARGSUSED*/
static void
ex_preserve(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
curbuf->b_flags |= BF_PRESERVED;
ml_preserve(curbuf, TRUE);
@@ -7296,10 +7306,9 @@ ex_tabmove(eap)
/*
* :tabs command: List tabs and their contents.
*/
/*ARGSUSED*/
static void
ex_tabs(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
tabpage_T *tp;
win_T *wp;
@@ -7486,7 +7495,6 @@ ex_edit(eap)
/*
* ":edit <file>" command and alikes.
*/
/*ARGSUSED*/
void
do_exedit(eap, old_curwin)
exarg_T *eap;
@@ -7699,10 +7707,9 @@ ex_popup(eap)
}
#endif
/*ARGSUSED*/
static void
ex_swapname(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
if (curbuf->b_ml.ml_mfp == NULL || curbuf->b_ml.ml_mfp->mf_fname == NULL)
MSG(_("No swap file"));
@@ -7715,10 +7722,9 @@ ex_swapname(eap)
* offset.
* (1998-11-02 16:21:01 R. Edward Ralston <eralston@computer.org>)
*/
/*ARGSUSED*/
static void
ex_syncbind(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
#ifdef FEAT_SCROLLBIND
win_T *wp;
@@ -7859,10 +7865,10 @@ ex_read(eap)
if (*ml_get(lnum) == NUL && u_savedel(lnum, 1L) == OK)
{
ml_delete(lnum, FALSE);
deleted_lines_mark(lnum, 1L);
if (curwin->w_cursor.lnum > 1
&& curwin->w_cursor.lnum >= lnum)
--curwin->w_cursor.lnum;
deleted_lines_mark(lnum, 1L);
}
}
redraw_curbuf_later(VALID);
@@ -7978,7 +7984,7 @@ ex_cd(eap)
shorten_fnames(TRUE);
/* Echo the new current directory if the command was typed. */
if (KeyTyped)
if (KeyTyped || p_verbose >= 5)
ex_pwd(eap);
}
vim_free(tofree);
@@ -7988,10 +7994,9 @@ ex_cd(eap)
/*
* ":pwd".
*/
/*ARGSUSED*/
static void
ex_pwd(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
if (mch_dirname(NameBuff, MAXPATHL) == OK)
{
@@ -8422,10 +8427,9 @@ ex_bang(eap)
/*
* ":undo".
*/
/*ARGSUSED*/
static void
ex_undo(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
if (eap->addr_count == 1) /* :undo 123 */
undo_time(eap->line2, FALSE, TRUE);
@@ -8436,10 +8440,9 @@ ex_undo(eap)
/*
* ":redo".
*/
/*ARGSUSED*/
static void
ex_redo(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
u_redo(1);
}
@@ -8447,7 +8450,6 @@ ex_redo(eap)
/*
* ":earlier" and ":later".
*/
/*ARGSUSED*/
static void
ex_later(eap)
exarg_T *eap;
@@ -8632,10 +8634,9 @@ ex_redraw(eap)
/*
* ":redrawstatus": force redraw of status line(s)
*/
/*ARGSUSED*/
static void
ex_redrawstatus(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
#if defined(FEAT_WINDOWS)
int r = RedrawingDisabled;
@@ -8712,6 +8713,8 @@ ex_mkrc(eap)
}
#ifdef FEAT_SESSION
/* Use the short file name until ":lcd" is used. We also don't use the
* short file name when 'acd' is set, that is checked later. */
did_lcd = FALSE;
/* ":mkview" or ":mkview 9": generate file name with 'viewdir' */
@@ -8896,11 +8899,10 @@ theend:
#if ((defined(FEAT_SESSION) || defined(FEAT_EVAL)) && defined(vim_mkdir)) \
|| defined(PROTO)
/*ARGSUSED*/
int
vim_mkdir_emsg(name, prot)
char_u *name;
int prot;
int prot UNUSED;
{
if (vim_mkdir(name, prot) != 0)
{
@@ -9171,10 +9173,9 @@ ex_startinsert(eap)
/*
* ":stopinsert"
*/
/*ARGSUSED*/
static void
ex_stopinsert(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
restart_edit = 0;
stop_insert_mode = TRUE;
@@ -9448,9 +9449,8 @@ find_cmdline_var(src, usedlen)
# define SPEC_CLIENT 9
#endif
};
#define SPEC_COUNT (sizeof(spec_str) / sizeof(char *))
for (i = 0; i < SPEC_COUNT; ++i)
for (i = 0; i < (int)(sizeof(spec_str) / sizeof(char *)); ++i)
{
len = (int)STRLEN(spec_str[i]);
if (STRNCMP(src, spec_str[i], len) == 0)
@@ -9801,7 +9801,7 @@ arg_all()
}
/* allocate memory */
retval = alloc(len + 1);
retval = alloc((unsigned)len + 1);
if (retval == NULL)
break;
}
@@ -10610,6 +10610,9 @@ ses_fname(fd, buf, flagp)
if (buf->b_sfname != NULL
&& flagp == &ssop_flags
&& (ssop_flags & (SSOP_CURDIR | SSOP_SESDIR))
#ifdef FEAT_AUTOCHDIR
&& !p_acd
#endif
&& !did_lcd)
name = buf->b_sfname;
else
@@ -10976,10 +10979,9 @@ ex_setfiletype(eap)
}
#endif
/*ARGSUSED*/
static void
ex_digraphs(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
#ifdef FEAT_DIGRAPHS
if (*eap->arg != NUL)
@@ -11013,10 +11015,9 @@ ex_set(eap)
/*
* ":nohlsearch"
*/
/*ARGSUSED*/
static void
ex_nohlsearch(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
no_hlsearch = TRUE;
redraw_all_later(SOME_VALID);
@@ -11095,10 +11096,9 @@ ex_match(eap)
/*
* ":X": Get crypt key
*/
/*ARGSUSED*/
static void
ex_X(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
(void)get_crypt_key(TRUE, TRUE);
}
+7 -2
View File
@@ -60,7 +60,9 @@ static char_u *get_end_emsg __ARGS((struct condstack *cstack));
#else
/* Values used for the Vim release. */
# define THROW_ON_ERROR TRUE
# define THROW_ON_ERROR_TRUE
# define THROW_ON_INTERRUPT TRUE
# define THROW_ON_INTERRUPT_TRUE
#endif
static void catch_exception __ARGS((except_T *excp));
@@ -1320,16 +1322,20 @@ do_throw(cstack)
* and reset the did_emsg or got_int flag, so this won't happen again at
* the next surrounding try conditional.
*/
#ifndef THROW_ON_ERROR_TRUE
if (did_emsg && !THROW_ON_ERROR)
{
inactivate_try = TRUE;
did_emsg = FALSE;
}
#endif
#ifndef THROW_ON_INTERRUPT_TRUE
if (got_int && !THROW_ON_INTERRUPT)
{
inactivate_try = TRUE;
got_int = FALSE;
}
#endif
idx = cleanup_conditionals(cstack, 0, inactivate_try);
if (idx >= 0)
{
@@ -2254,10 +2260,9 @@ rewind_conditionals(cstack, idx, cond_type, cond_level)
/*
* ":endfunction" when not after a ":function"
*/
/*ARGSUSED*/
void
ex_endfunction(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
EMSG(_("E193: :endfunction not inside a function"));
}
+18 -16
View File
@@ -140,11 +140,10 @@ static int ex_window __ARGS((void));
* Return pointer to allocated string if there is a commandline, NULL
* otherwise.
*/
/*ARGSUSED*/
char_u *
getcmdline(firstc, count, indent)
int firstc;
long count; /* only used for incremental search */
long count UNUSED; /* only used for incremental search */
int indent; /* indent for inside conditionals */
{
int c;
@@ -325,7 +324,7 @@ getcmdline(firstc, count, indent)
#endif
#ifdef FEAT_DIGRAPHS
do_digraph(-1); /* init digraph typahead */
do_digraph(-1); /* init digraph typeahead */
#endif
/*
@@ -2113,11 +2112,10 @@ correct_cmdspos(idx, cells)
/*
* Get an Ex command line for the ":" command.
*/
/* ARGSUSED */
char_u *
getexline(c, dummy, indent)
getexline(c, cookie, indent)
int c; /* normally ':', NUL for ":append" */
void *dummy; /* cookie not used */
void *cookie UNUSED;
int indent; /* indent for inside conditionals */
{
/* When executing a register, remove ':' that's in front of each line. */
@@ -2132,12 +2130,11 @@ getexline(c, dummy, indent)
* mappings or abbreviations.
* Returns a string in allocated memory or NULL.
*/
/* ARGSUSED */
char_u *
getexmodeline(promptc, dummy, indent)
getexmodeline(promptc, cookie, indent)
int promptc; /* normally ':', NUL for ":append" and '?' for
:s prompt */
void *dummy; /* cookie not used */
void *cookie UNUSED;
int indent; /* indent for inside conditionals */
{
garray_T line_ga;
@@ -3832,11 +3829,10 @@ tilde_replace(orig_pat, num_files, files)
* Returns EXPAND_NOTHING when the character that triggered expansion should
* be inserted like a normal character.
*/
/*ARGSUSED*/
static int
showmatches(xp, wildmenu)
expand_T *xp;
int wildmenu;
int wildmenu UNUSED;
{
#define L_SHOWFILE(m) (showtail ? sm_gettail(files_found[m]) : files_found[m])
int num_files;
@@ -4521,6 +4517,9 @@ ExpandFromContext(xp, pat, num_file, file, options)
#ifdef FEAT_CSCOPE
{EXPAND_CSCOPE, get_cscope_name, TRUE},
#endif
#ifdef FEAT_SIGNS
{EXPAND_SIGN, get_sign_name, TRUE},
#endif
#if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
&& (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE))
{EXPAND_LANGUAGE, get_lang_arg, TRUE},
@@ -4537,7 +4536,7 @@ ExpandFromContext(xp, pat, num_file, file, options)
* right function to do the expansion.
*/
ret = FAIL;
for (i = 0; i < sizeof(tab) / sizeof(struct expgen); ++i)
for (i = 0; i < (int)(sizeof(tab) / sizeof(struct expgen)); ++i)
if (xp->xp_context == tab[i].context)
{
if (tab[i].ic)
@@ -4878,14 +4877,14 @@ ExpandUserList(xp, num_file, file)
/* Loop over the items in the list. */
for (li = retlist->lv_first; li != NULL; li = li->li_next)
{
if (li->li_tv.v_type != VAR_STRING)
continue; /* Skip non-string items */
if (li->li_tv.v_type != VAR_STRING || li->li_tv.vval.v_string == NULL)
continue; /* Skip non-string items and empty strings */
if (ga_grow(&ga, 1) == FAIL)
break;
((char_u **)ga.ga_data)[ga.ga_len] =
vim_strsave(li->li_tv.vval.v_string);
vim_strsave(li->li_tv.vval.v_string);
++ga.ga_len;
}
list_unref(retlist);
@@ -5689,7 +5688,7 @@ ex_history(eap)
histype1 = get_histtype(arg);
if (histype1 == -1)
{
if (STRICMP(arg, "all") == 0)
if (STRNICMP(arg, "all", STRLEN(arg)) == 0)
{
histype1 = 0;
histype2 = HIST_COUNT-1;
@@ -6076,6 +6075,9 @@ ex_window()
set_option_value((char_u *)"bt", 0L, (char_u *)"nofile", OPT_LOCAL);
set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
curbuf->b_p_ma = TRUE;
#ifdef FEAT_FOLDING
curwin->w_p_fen = FALSE;
#endif
# ifdef FEAT_RIGHTLEFT
curwin->w_p_rl = cmdmsg_rl;
cmdmsg_rl = FALSE;
+8 -7
View File
@@ -103,7 +103,8 @@ toF_Xor_X_(c)
case F_HE:
tempc = _HE;
if (p_ri && (curwin->w_cursor.col+1 < STRLEN(ml_get_curline())))
if (p_ri && (curwin->w_cursor.col + 1
< (colnr_T)STRLEN(ml_get_curline())))
{
inc_cursor();
@@ -344,7 +345,7 @@ put_curr_and_l_to_X(c)
if (curwin->w_p_rl && p_ri)
return;
if ( (curwin->w_cursor.col < STRLEN(ml_get_curline())))
if ((curwin->w_cursor.col < (colnr_T)STRLEN(ml_get_curline())))
{
if ((p_ri && curwin->w_cursor.col) || !p_ri)
{
@@ -565,7 +566,7 @@ chg_c_to_X_or_X ()
tempc = gchar_cursor();
if (curwin->w_cursor.col+1 < STRLEN(ml_get_curline()))
if (curwin->w_cursor.col + 1 < (colnr_T)STRLEN(ml_get_curline()))
{
inc_cursor();
@@ -594,8 +595,8 @@ chg_l_to_X_orX_ ()
{
int tempc;
if (!curwin->w_cursor.col &&
(curwin->w_cursor.col+1 == STRLEN(ml_get_curline())))
if (curwin->w_cursor.col != 0 &&
(curwin->w_cursor.col + 1 == (colnr_T)STRLEN(ml_get_curline())))
return;
if (!curwin->w_cursor.col && p_ri)
@@ -663,8 +664,8 @@ chg_l_toXor_X ()
{
int tempc;
if (!curwin->w_cursor.col &&
(curwin->w_cursor.col+1 == STRLEN(ml_get_curline())))
if (curwin->w_cursor.col != 0 &&
(curwin->w_cursor.col + 1 == (colnr_T)STRLEN(ml_get_curline())))
return;
if (!curwin->w_cursor.col && p_ri)
+3 -2
View File
@@ -1200,10 +1200,11 @@
#endif
/*
* The Netbeans features currently only work with Motif and GTK and Win32.
* The Netbeans features currently only work with Motif, GTK, Win32 and MacVim.
* It also requires +listcmds and +eval.
*/
#if ((!defined(FEAT_GUI_MOTIF) && !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_W32)) \
#if ((!defined(FEAT_GUI_MOTIF) && !defined(FEAT_GUI_GTK) \
&& !defined(FEAT_GUI_W32) && !defined(FEAT_GUI_MACVIM)) \
|| !defined(FEAT_LISTCMDS) || !defined(FEAT_EVAL)) \
&& defined(FEAT_NETBEANS_INTG)
# undef FEAT_NETBEANS_INTG
+151 -90
View File
@@ -710,7 +710,8 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags)
#endif
#ifdef UNIX
/* Set swap file protection bits after creating it. */
if (swap_mode > 0 && curbuf->b_ml.ml_mfp->mf_fname != NULL)
if (swap_mode > 0 && curbuf->b_ml.ml_mfp != NULL
&& curbuf->b_ml.ml_mfp->mf_fname != NULL)
(void)mch_setperm(curbuf->b_ml.ml_mfp->mf_fname, (long)swap_mode);
#endif
}
@@ -3498,7 +3499,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit,
if (mch_stat((char *)IObuff, &st) < 0
|| st.st_uid != st_old.st_uid
|| st.st_gid != st_old.st_gid
|| st.st_mode != perm)
|| (long)st.st_mode != perm)
backup_copy = TRUE;
# endif
/* Close the file before removing it, on MS-Windows we
@@ -4416,7 +4417,7 @@ restore_backup:
# endif
buf_setino(buf);
}
else if (buf->b_dev < 0)
else if (!buf->b_dev_valid)
/* Set the inode when creating a new file. */
buf_setino(buf);
#endif
@@ -4828,6 +4829,8 @@ set_rw_fname(fname, sfname)
char_u *sfname;
{
#ifdef FEAT_AUTOCMD
buf_T *buf = curbuf;
/* It's like the unnamed buffer is deleted.... */
if (curbuf->b_p_bl)
apply_autocmds(EVENT_BUFDELETE, NULL, NULL, FALSE, curbuf);
@@ -4836,6 +4839,12 @@ set_rw_fname(fname, sfname)
if (aborting()) /* autocmds may abort script processing */
return FAIL;
# endif
if (curbuf != buf)
{
/* We are in another buffer now, don't do the renaming. */
EMSG(_(e_auchangedbuf));
return FAIL;
}
#endif
if (setfname(curbuf, fname, sfname, FALSE) == OK)
@@ -5968,7 +5977,7 @@ buf_modname(shortname, fname, ext, prepend_dot)
else if (*ext == '.')
#endif
{
if (s - ptr > (size_t)8)
if ((size_t)(s - ptr) > (size_t)8)
{
s = ptr + 8;
*s = '\0';
@@ -6474,11 +6483,10 @@ move_lines(frombuf, tobuf)
* return 2 if a message has been displayed.
* return 0 otherwise.
*/
/*ARGSUSED*/
int
buf_check_timestamp(buf, focus)
buf_T *buf;
int focus; /* called for GUI focus event */
int focus UNUSED; /* called for GUI focus event */
{
struct stat st;
int stat_res;
@@ -6634,7 +6642,10 @@ buf_check_timestamp(buf, focus)
mesg = _("W16: Warning: Mode of file \"%s\" has changed since editing started");
mesg2 = _("See \":help W16\" for more info.");
}
/* Else: only timestamp changed, ignored */
else
/* Only timestamp changed, store it to avoid a warning
* in check_mtime() later. */
buf->b_mtime_read = buf->b_mtime;
}
}
}
@@ -6884,10 +6895,11 @@ buf_reload(buf, orig_mode)
#endif
#ifdef FEAT_FOLDING
{
win_T *wp;
win_T *wp;
tabpage_T *tp;
/* Update folds unless they are defined manually. */
FOR_ALL_WINDOWS(wp)
FOR_ALL_TAB_WINDOWS(tp, wp)
if (wp->w_buffer == curwin->w_buffer
&& !foldmethodIsManual(wp))
foldUpdateAll(wp);
@@ -6905,12 +6917,11 @@ buf_reload(buf, orig_mode)
/* Careful: autocommands may have made "buf" invalid! */
}
/*ARGSUSED*/
void
buf_store_time(buf, st, fname)
buf_T *buf;
struct stat *st;
char_u *fname;
char_u *fname UNUSED;
{
buf->b_mtime = (long)st->st_mtime;
buf->b_orig_size = (size_t)st->st_size;
@@ -6973,10 +6984,9 @@ vim_deltempdir()
* The returned pointer is to allocated memory.
* The returned pointer is NULL if no valid name was found.
*/
/*ARGSUSED*/
char_u *
vim_tempname(extra_char)
int extra_char; /* character to use in the name instead of '?' */
int extra_char UNUSED; /* char to use in the name instead of '?' */
{
#ifdef USE_TMPNAM
char_u itmp[L_tmpnam]; /* use tmpnam() */
@@ -7005,7 +7015,7 @@ vim_tempname(extra_char)
/*
* Try the entries in TEMPDIRNAMES to create the temp directory.
*/
for (i = 0; i < sizeof(tempdirs) / sizeof(char *); ++i)
for (i = 0; i < (int)(sizeof(tempdirs) / sizeof(char *)); ++i)
{
/* expand $TMP, leave room for "/v1100000/999999999" */
expand_env((char_u *)tempdirs[i], itmp, TEMPNAMELEN - 20);
@@ -8397,7 +8407,7 @@ ex_doautoall(eap)
/* Execute the modeline settings, but don't set window-local
* options if we are using the current window for another buffer. */
do_modelines(aco.save_curwin == NULL ? OPT_NOWIN : 0);
do_modelines(curwin == aucmd_win ? OPT_NOWIN : 0);
/* restore the current window */
aucmd_restbuf(&aco);
@@ -8413,8 +8423,8 @@ ex_doautoall(eap)
/*
* Prepare for executing autocommands for (hidden) buffer "buf".
* Search a window for the current buffer. Save the cursor position and
* screen offset.
* Search for a visible window containing the current buffer. If there isn't
* one then use "aucmd_win".
* Set "curbuf" and "curwin" to match "buf".
* When FEAT_AUTOCMD is not defined another version is used, see below.
*/
@@ -8424,8 +8434,9 @@ aucmd_prepbuf(aco, buf)
buf_T *buf; /* new curbuf */
{
win_T *win;
aco->new_curbuf = buf;
#ifdef FEAT_WINDOWS
int save_ea;
#endif
/* Find a window that is for the new buffer */
if (buf == curbuf) /* be quick when buf is curbuf */
@@ -8439,42 +8450,51 @@ aucmd_prepbuf(aco, buf)
win = NULL;
#endif
/*
* Prefer to use an existing window for the buffer, it has the least side
* effects (esp. if "buf" is curbuf).
* Otherwise, use curwin for "buf". It might make some items in the
* window invalid. At least save the cursor and topline.
*/
/* Allocate "aucmd_win" when needed. If this fails (out of memory) fall
* back to using the current window. */
if (win == NULL && aucmd_win == NULL)
{
win_alloc_aucmd_win();
if (aucmd_win == NULL)
win = curwin;
}
aco->save_curwin = curwin;
aco->save_curbuf = curbuf;
if (win != NULL)
{
/* there is a window for "buf", make it the curwin */
aco->save_curwin = curwin;
/* There is a window for "buf" in the current tab page, make it the
* curwin. This is preferred, it has the least side effects (esp. if
* "buf" is curbuf). */
curwin = win;
aco->save_buf = win->w_buffer;
aco->new_curwin = win;
}
else
{
/* there is no window for "buf", use curwin */
aco->save_curwin = NULL;
aco->save_buf = curbuf;
--curbuf->b_nwindows;
curwin->w_buffer = buf;
/* There is no window for "buf", use "aucmd_win". To minimize the side
* effects, insert it in a the current tab page.
* Anything related to a window (e.g., setting folds) may have
* unexpected results. */
aucmd_win->w_buffer = buf;
++buf->b_nwindows;
win_init_empty(aucmd_win); /* set cursor and topline to safe values */
/* save cursor and topline, set them to safe values */
aco->save_cursor = curwin->w_cursor;
curwin->w_cursor.lnum = 1;
curwin->w_cursor.col = 0;
aco->save_topline = curwin->w_topline;
curwin->w_topline = 1;
#ifdef FEAT_DIFF
aco->save_topfill = curwin->w_topfill;
curwin->w_topfill = 0;
#ifdef FEAT_WINDOWS
/* Split the current window, put the aucmd_win in the upper half.
* We don't want the BufEnter or WinEnter autocommands. */
block_autocmds();
make_snapshot(SNAP_AUCMD_IDX);
save_ea = p_ea;
p_ea = FALSE;
(void)win_split_ins(0, WSP_TOP, aucmd_win, 0);
(void)win_comp_pos(); /* recompute window positions */
p_ea = save_ea;
unblock_autocmds();
#endif
curwin = aucmd_win;
}
curbuf = buf;
aco->new_curwin = curwin;
aco->new_curbuf = curbuf;
}
/*
@@ -8486,21 +8506,88 @@ aucmd_prepbuf(aco, buf)
aucmd_restbuf(aco)
aco_save_T *aco; /* structure holding saved values */
{
if (aco->save_curwin != NULL)
#ifdef FEAT_WINDOWS
int dummy;
#endif
if (aco->new_curwin == aucmd_win)
{
--curbuf->b_nwindows;
#ifdef FEAT_WINDOWS
/* Find "aucmd_win", it can't be closed, but it may be in another tab
* page. Do not trigger autocommands here. */
block_autocmds();
if (curwin != aucmd_win)
{
tabpage_T *tp;
win_T *wp;
FOR_ALL_TAB_WINDOWS(tp, wp)
{
if (wp == aucmd_win)
{
if (tp != curtab)
goto_tabpage_tp(tp);
win_goto(aucmd_win);
break;
}
}
}
/* Remove the window and frame from the tree of frames. */
(void)winframe_remove(curwin, &dummy, NULL);
win_remove(curwin, NULL);
last_status(FALSE); /* may need to remove last status line */
restore_snapshot(SNAP_AUCMD_IDX, FALSE);
(void)win_comp_pos(); /* recompute window positions */
unblock_autocmds();
if (win_valid(aco->save_curwin))
curwin = aco->save_curwin;
else
/* Hmm, original window disappeared. Just use the first one. */
curwin = firstwin;
# ifdef FEAT_EVAL
vars_clear(&aucmd_win->w_vars.dv_hashtab); /* free all w: variables */
# endif
#else
curwin = aco->save_curwin;
#endif
curbuf = curwin->w_buffer;
/* the buffer contents may have changed */
check_cursor();
if (curwin->w_topline > curbuf->b_ml.ml_line_count)
{
curwin->w_topline = curbuf->b_ml.ml_line_count;
#ifdef FEAT_DIFF
curwin->w_topfill = 0;
#endif
}
#if defined(FEAT_GUI)
/* Hide the scrollbars from the aucmd_win and update. */
gui_mch_enable_scrollbar(&aucmd_win->w_scrollbars[SBAR_LEFT], FALSE);
gui_mch_enable_scrollbar(&aucmd_win->w_scrollbars[SBAR_RIGHT], FALSE);
gui_may_update_scrollbars();
#endif
}
else
{
/* restore curwin */
#ifdef FEAT_WINDOWS
if (win_valid(aco->save_curwin))
#endif
{
/* restore the buffer which was previously edited by curwin, if
* it's still the same window and it's valid */
/* Restore the buffer which was previously edited by curwin, if
* it was chagned, we are still the same window and the buffer is
* valid. */
if (curwin == aco->new_curwin
&& buf_valid(aco->save_buf)
&& aco->save_buf->b_ml.ml_mfp != NULL)
&& curbuf != aco->new_curbuf
&& buf_valid(aco->new_curbuf)
&& aco->new_curbuf->b_ml.ml_mfp != NULL)
{
--curbuf->b_nwindows;
curbuf = aco->save_buf;
curbuf = aco->new_curbuf;
curwin->w_buffer = curbuf;
++curbuf->b_nwindows;
}
@@ -8509,34 +8596,6 @@ aucmd_restbuf(aco)
curbuf = curwin->w_buffer;
}
}
else
{
/* restore buffer for curwin if it still exists and is loaded */
if (buf_valid(aco->save_buf) && aco->save_buf->b_ml.ml_mfp != NULL)
{
--curbuf->b_nwindows;
curbuf = aco->save_buf;
curwin->w_buffer = curbuf;
++curbuf->b_nwindows;
curwin->w_cursor = aco->save_cursor;
check_cursor();
/* check topline < line_count, in case lines got deleted */
if (aco->save_topline <= curbuf->b_ml.ml_line_count)
{
curwin->w_topline = aco->save_topline;
#ifdef FEAT_DIFF
curwin->w_topfill = aco->save_topfill;
#endif
}
else
{
curwin->w_topline = curbuf->b_ml.ml_line_count;
#ifdef FEAT_DIFF
curwin->w_topfill = 0;
#endif
}
}
}
}
static int autocmd_nested = FALSE;
@@ -8822,9 +8881,11 @@ apply_autocmds_group(event, fname, fname_io, force, group, buf, eap)
else
{
sfname = vim_strsave(fname);
/* Don't try expanding FileType, Syntax, WindowID or QuickFixCmd* */
/* Don't try expanding FileType, Syntax, FuncUndefined, WindowID or
* QuickFixCmd* */
if (event == EVENT_FILETYPE
|| event == EVENT_SYNTAX
|| event == EVENT_FUNCUNDEFINED
|| event == EVENT_REMOTEREPLY
|| event == EVENT_SPELLFILEMISSING
|| event == EVENT_QUICKFIXCMDPRE
@@ -9123,12 +9184,11 @@ auto_next_pat(apc, stop_at_last)
* Called by do_cmdline() to get the next line for ":if".
* Returns allocated string, or NULL for end of autocommands.
*/
/* ARGSUSED */
static char_u *
getnextac(c, cookie, indent)
int c; /* not used */
int c UNUSED;
void *cookie;
int indent; /* not used */
int indent UNUSED;
{
AutoPatCmd *acp = (AutoPatCmd *)cookie;
char_u *retval;
@@ -9239,10 +9299,9 @@ has_autocmd(event, sfname, buf)
* Function given to ExpandGeneric() to obtain the list of autocommand group
* names.
*/
/*ARGSUSED*/
char_u *
get_augroup_name(xp, idx)
expand_T *xp;
expand_T *xp UNUSED;
int idx;
{
if (idx == augroups.ga_len) /* add "END" add the end */
@@ -9308,10 +9367,9 @@ set_context_in_autocmd(xp, arg, doautocmd)
/*
* Function given to ExpandGeneric() to obtain the list of event names.
*/
/*ARGSUSED*/
char_u *
get_event_name(xp, idx)
expand_T *xp;
expand_T *xp UNUSED;
int idx;
{
if (idx < augroups.ga_len) /* First list group names, if wanted */
@@ -9452,9 +9510,11 @@ aucmd_prepbuf(aco, buf)
aco_save_T *aco; /* structure to save values in */
buf_T *buf; /* new curbuf */
{
aco->save_buf = curbuf;
aco->save_curbuf = curbuf;
--curbuf->b_nwindows;
curbuf = buf;
curwin->w_buffer = buf;
++curbuf->b_nwindows;
}
/*
@@ -9465,8 +9525,10 @@ aucmd_prepbuf(aco, buf)
aucmd_restbuf(aco)
aco_save_T *aco; /* structure holding saved values */
{
curbuf = aco->save_buf;
--curbuf->b_nwindows;
curbuf = aco->save_curbuf;
curwin->w_buffer = curbuf;
++curbuf->b_nwindows;
}
#endif /* FEAT_AUTOCMD */
@@ -9623,13 +9685,12 @@ match_file_list(list, sfname, ffname)
*
* Returns NULL when out of memory.
*/
/*ARGSUSED*/
char_u *
file_pat_to_reg_pat(pat, pat_end, allow_dirs, no_bslash)
char_u *pat;
char_u *pat_end; /* first char after pattern or NULL */
char *allow_dirs; /* Result passed back out in here */
int no_bslash; /* Don't use a backward slash as pathsep */
int no_bslash UNUSED; /* Don't use a backward slash as pathsep */
{
int size;
char_u *endp;
+15 -10
View File
@@ -1309,6 +1309,9 @@ save_typebuf()
return OK;
}
static int old_char = -1; /* character put back by vungetc() */
static int old_mod_mask; /* mod_mask for ungotten character */
#if defined(FEAT_EVAL) || defined(FEAT_EX_EXTRA) || defined(PROTO)
/*
@@ -1323,6 +1326,10 @@ save_typeahead(tp)
if (!tp->typebuf_valid)
typebuf = tp->save_typebuf;
tp->old_char = old_char;
tp->old_mod_mask = old_mod_mask;
old_char = -1;
tp->save_stuffbuff = stuffbuff;
stuffbuff.bh_first.b_next = NULL;
# ifdef USE_INPUT_BUF
@@ -1344,6 +1351,9 @@ restore_typeahead(tp)
typebuf = tp->save_typebuf;
}
old_char = tp->old_char;
old_mod_mask = tp->old_mod_mask;
free_buff(&stuffbuff);
stuffbuff = tp->save_stuffbuff;
# ifdef USE_INPUT_BUF
@@ -1499,9 +1509,6 @@ updatescript(c)
#define KL_PART_KEY -1 /* keylen value for incomplete key-code */
#define KL_PART_MAP -2 /* keylen value for incomplete mapping */
static int old_char = -1; /* character put back by vungetc() */
static int old_mod_mask; /* mod_mask for ungotten character */
/*
* Get the next input character.
* Can return a special key or a multi-byte character.
@@ -3701,11 +3708,10 @@ get_map_mode(cmdp, forceit)
* Clear all mappings or abbreviations.
* 'abbr' should be FALSE for mappings, TRUE for abbreviations.
*/
/*ARGSUSED*/
void
map_clear(cmdp, arg, forceit, abbr)
char_u *cmdp;
char_u *arg;
char_u *arg UNUSED;
int forceit;
int abbr;
{
@@ -3734,13 +3740,12 @@ map_clear(cmdp, arg, forceit, abbr)
/*
* Clear all mappings in "mode".
*/
/*ARGSUSED*/
void
map_clear_int(buf, mode, local, abbr)
buf_T *buf; /* buffer for local mappings */
int mode; /* mode in which to delete */
int local; /* TRUE for buffer-local mappings */
int abbr; /* TRUE for abbreviations */
buf_T *buf UNUSED; /* buffer for local mappings */
int mode; /* mode in which to delete */
int local UNUSED; /* TRUE for buffer-local mappings */
int abbr; /* TRUE for abbreviations */
{
mapblock_T *mp, **mpp;
int hash;
+12 -4
View File
@@ -509,6 +509,7 @@ EXTERN VimClipboard clip_plus; /* CLIPBOARD selection in X11 */
EXTERN int clip_unnamed INIT(= FALSE);
EXTERN int clip_autoselect INIT(= FALSE);
EXTERN int clip_autoselectml INIT(= FALSE);
EXTERN int clip_html INIT(= FALSE);
EXTERN regprog_T *clip_exclude_prog INIT(= NULL);
#endif
@@ -524,7 +525,7 @@ EXTERN win_T *lastwin; /* last window */
EXTERN win_T *prevwin INIT(= NULL); /* previous window */
# define W_NEXT(wp) ((wp)->w_next)
# define FOR_ALL_WINDOWS(wp) for (wp = firstwin; wp != NULL; wp = wp->w_next)
#define FOR_ALL_TAB_WINDOWS(tp, wp) \
# define FOR_ALL_TAB_WINDOWS(tp, wp) \
for ((tp) = first_tabpage; (tp) != NULL; (tp) = (tp)->tp_next) \
for ((wp) = ((tp) == curtab) \
? firstwin : (tp)->tp_firstwin; (wp); (wp) = (wp)->w_next)
@@ -538,6 +539,10 @@ EXTERN win_T *prevwin INIT(= NULL); /* previous window */
EXTERN win_T *curwin; /* currently active window */
#ifdef FEAT_AUTOCMD
EXTERN win_T *aucmd_win; /* window used in aucmd_prepbuf() */
#endif
/*
* The window layout is kept in a tree of frames. topframe points to the top
* of the tree.
@@ -718,7 +723,7 @@ EXTERN int can_si_back INIT(= FALSE);
EXTERN pos_T saved_cursor /* w_cursor before formatting text. */
# ifdef DO_INIT
= INIT_POS_T
= INIT_POS_T(0, 0, 0)
# endif
;
@@ -810,11 +815,14 @@ EXTERN vimconv_T output_conv; /* type of output conversion */
*/
/* length of char in bytes, including following composing chars */
EXTERN int (*mb_ptr2len) __ARGS((char_u *p)) INIT(= latin_ptr2len);
/* idem, with limit on string length */
EXTERN int (*mb_ptr2len_len) __ARGS((char_u *p, int size)) INIT(= latin_ptr2len_len);
/* byte length of char */
EXTERN int (*mb_char2len) __ARGS((int c)) INIT(= latin_char2len);
/* convert char to bytes, return the length */
EXTERN int (*mb_char2bytes) __ARGS((int c, char_u *buf)) INIT(= latin_char2bytes);
EXTERN int (*mb_ptr2cells) __ARGS((char_u *p)) INIT(= latin_ptr2cells);
EXTERN int (*mb_ptr2cells_len) __ARGS((char_u *p, int size)) INIT(= latin_ptr2cells_len);
EXTERN int (*mb_char2cells) __ARGS((int c)) INIT(= latin_char2cells);
EXTERN int (*mb_off2cells) __ARGS((unsigned off, unsigned max_off)) INIT(= latin_off2cells);
EXTERN int (*mb_ptr2char) __ARGS((char_u *p)) INIT(= latin_ptr2char);
@@ -960,7 +968,7 @@ EXTERN struct buffheader stuffbuff /* stuff buffer */
;
EXTERN typebuf_T typebuf /* typeahead buffer */
#ifdef DO_INIT
= {NULL, NULL}
= {NULL, NULL, 0, 0, 0, 0, 0, 0, 0}
#endif
;
#ifdef FEAT_EX_EXTRA
@@ -1039,7 +1047,7 @@ EXTERN char_u *autocmd_match INIT(= NULL); /* name for <amatch> on cmdline */
EXTERN int did_cursorhold INIT(= FALSE); /* set when CursorHold t'gerd */
EXTERN pos_T last_cursormoved /* for CursorMoved event */
# ifdef DO_INIT
= INIT_POS_T
= INIT_POS_T(0, 0, 0)
# endif
;
#endif
+26 -17
View File
@@ -683,11 +683,10 @@ gui_shell_closed()
* Return OK when able to set the font. When it failed FAIL is returned and
* the fonts are unchanged.
*/
/*ARGSUSED*/
int
gui_init_font(font_list, fontset)
char_u *font_list;
int fontset;
int fontset UNUSED;
{
#define FONTLEN 320
char_u font_name[FONTLEN];
@@ -976,7 +975,7 @@ gui_update_cursor(force, clear_selection)
guicolor_T fg, bg;
if (
# ifdef HAVE_GTK2
# if defined(HAVE_GTK2) && !defined(FEAT_HANGULIN)
preedit_get_status()
# else
im_get_status()
@@ -1155,10 +1154,9 @@ gui_position_menu()
* Position the various GUI components (text area, menu). The vertical
* scrollbars are NOT handled here. See gui_update_scrollbars().
*/
/*ARGSUSED*/
static void
gui_position_components(total_width)
int total_width;
int total_width UNUSED;
{
int text_area_x;
int text_area_y;
@@ -1392,10 +1390,9 @@ gui_get_shellsize()
* If "fit_to_display" is TRUE then the size may be reduced to fit the window
* on the screen.
*/
/*ARGSUSED*/
void
gui_set_shellsize(mustset, fit_to_display, direction)
int mustset; /* set by the user */
int mustset UNUSED; /* set by the user */
int fit_to_display;
int direction; /* RESIZE_HOR, RESIZE_VER */
{
@@ -3141,10 +3138,9 @@ static int prev_which_scrollbars[3];
* If "oldval" is not NULL, "oldval" is the previous value, the new value is
* in p_go.
*/
/*ARGSUSED*/
void
gui_init_which_components(oldval)
char_u *oldval;
char_u *oldval UNUSED;
{
#ifdef FEAT_MENU
static int prev_menu_is_active = -1;
@@ -3904,6 +3900,21 @@ gui_drag_scrollbar(sb, value, still_dragging)
* Scrollbar stuff:
*/
/*
* Called when something in the window layout has changed.
*/
void
gui_may_update_scrollbars()
{
if (gui.in_use && starting == 0)
{
out_flush();
gui_init_which_components(NULL);
gui_update_scrollbars(TRUE);
}
need_mouse_correct = TRUE;
}
void
gui_update_scrollbars(force)
int force; /* Force all scrollbars to get updated */
@@ -4433,7 +4444,7 @@ gui_do_horiz_scroll()
if (curwin->w_p_wrap)
return FALSE;
if (curwin->w_leftcol == scrollbar_value)
if ((long_u)curwin->w_leftcol == scrollbar_value)
return FALSE;
curwin->w_leftcol = (colnr_T)scrollbar_value;
@@ -4446,7 +4457,7 @@ gui_do_horiz_scroll()
&& longest_lnum < curwin->w_botline
&& !virtual_active())
{
if (scrollbar_value > scroll_line_len(curwin->w_cursor.lnum))
if (scrollbar_value > (long_u)scroll_line_len(curwin->w_cursor.lnum))
{
curwin->w_cursor.lnum = longest_lnum;
curwin->w_cursor.col = 0;
@@ -4692,11 +4703,10 @@ gui_mouse_correct()
/*
* Find window where the mouse pointer "y" coordinate is in.
*/
/*ARGSUSED*/
static win_T *
xy2win(x, y)
int x;
int y;
int x UNUSED;
int y UNUSED;
{
#ifdef FEAT_WINDOWS
int row;
@@ -5150,11 +5160,10 @@ gui_wingoto_xy(x, y)
* of dropped files, they will be freed in this function, and caller can't use
* fnames after call this function.
*/
/*ARGSUSED*/
void
gui_handle_drop(x, y, modifiers, fnames, count)
int x;
int y;
int x UNUSED;
int y UNUSED;
int_u modifiers;
char_u **fnames;
int count;
+37 -54
View File
@@ -829,7 +829,7 @@ SFsetText(path)
text.format = FMT8BIT;
#ifdef XtNinternational
if (_XawTextFormat((TextWidget)selFileField) == XawFmtWide)
if ((unsigned long)_XawTextFormat((TextWidget)selFileField) == XawFmtWide)
{
XawTextReplace(selFileField, (XawTextPosition)0,
(XawTextPosition)WcsLen((wchar_t *)&SFtextBuffer[0]), &text);
@@ -851,17 +851,15 @@ SFsetText(path)
#endif
}
/* ARGSUSED */
static void
SFbuttonPressList(w, n, event)
Widget w;
int n;
XButtonPressedEvent *event;
Widget w UNUSED;
int n UNUSED;
XButtonPressedEvent *event UNUSED;
{
SFbuttonPressed = 1;
}
/* ARGSUSED */
static void
SFbuttonReleaseList(w, n, event)
Widget w;
@@ -989,11 +987,10 @@ SFcheckFiles(dir)
return result;
}
/* ARGSUSED */
static void
SFdirModTimer(cl, id)
XtPointer cl;
XtIntervalId *id;
XtPointer cl UNUSED;
XtIntervalId *id UNUSED;
{
static int n = -1;
static int f = 0;
@@ -1596,11 +1593,10 @@ SFscrollTimerInterval()
static void SFscrollTimer __ARGS((XtPointer p, XtIntervalId *id));
/* ARGSUSED */
static void
SFscrollTimer(p, id)
XtPointer p;
XtIntervalId *id;
XtIntervalId *id UNUSED;
{
SFDir *dir;
int save;
@@ -1695,10 +1691,9 @@ SFnewInvertEntry(n, event)
}
}
/* ARGSUSED */
static void
SFenterList(w, n, event)
Widget w;
Widget w UNUSED;
int n;
XEnterWindowEvent *event;
{
@@ -1719,12 +1714,11 @@ SFenterList(w, n, event)
}
}
/* ARGSUSED */
static void
SFleaveList(w, n, event)
Widget w;
Widget w UNUSED;
int n;
XEvent *event;
XEvent *event UNUSED;
{
if (SFcurrentInvert[n] != -1)
{
@@ -1733,10 +1727,9 @@ SFleaveList(w, n, event)
}
}
/* ARGSUSED */
static void
SFmotionList(w, n, event)
Widget w;
Widget w UNUSED;
int n;
XMotionEvent *event;
{
@@ -1754,7 +1747,6 @@ SFmotionList(w, n, event)
}
}
/* ARGSUSED */
static void
SFvFloatSliderMovedCallback(w, n, fnew)
Widget w;
@@ -1767,10 +1759,9 @@ SFvFloatSliderMovedCallback(w, n, fnew)
SFvSliderMovedCallback(w, (int)(long)n, nw);
}
/* ARGSUSED */
static void
SFvSliderMovedCallback(w, n, nw)
Widget w;
Widget w UNUSED;
int n;
int nw;
{
@@ -1853,10 +1844,9 @@ SFvSliderMovedCallback(w, n, nw)
}
}
/* ARGSUSED */
static void
SFvAreaSelectedCallback(w, n, pnew)
Widget w;
Widget w;
XtPointer n;
XtPointer pnew;
{
@@ -1914,10 +1904,9 @@ SFvAreaSelectedCallback(w, n, pnew)
SFvSliderMovedCallback(w, (int)(long)n, nw);
}
/* ARGSUSED */
static void
SFhSliderMovedCallback(w, n, nw)
Widget w;
Widget w UNUSED;
XtPointer n;
XtPointer nw;
{
@@ -1933,10 +1922,9 @@ SFhSliderMovedCallback(w, n, nw)
SFdrawList((int)(long)n, SF_DO_NOT_SCROLL);
}
/* ARGSUSED */
static void
SFhAreaSelectedCallback(w, n, pnew)
Widget w;
Widget w;
XtPointer n;
XtPointer pnew;
{
@@ -1994,11 +1982,10 @@ SFhAreaSelectedCallback(w, n, pnew)
}
}
/* ARGSUSED */
static void
SFpathSliderMovedCallback(w, client_data, nw)
Widget w;
XtPointer client_data;
Widget w UNUSED;
XtPointer client_data UNUSED;
XtPointer nw;
{
SFDir *dir;
@@ -2031,11 +2018,10 @@ SFpathSliderMovedCallback(w, client_data, nw)
XawTextSetInsertionPoint(selFileField, pos);
}
/* ARGSUSED */
static void
SFpathAreaSelectedCallback(w, client_data, pnew)
Widget w;
XtPointer client_data;
XtPointer client_data UNUSED;
XtPointer pnew;
{
int nw = (int)(long)pnew;
@@ -2206,13 +2192,12 @@ static char *oneLineTextEditTranslations = "\
static void SFexposeList __ARGS((Widget w, XtPointer n, XEvent *event, Boolean *cont));
/* ARGSUSED */
static void
SFexposeList(w, n, event, cont)
Widget w;
Widget w UNUSED;
XtPointer n;
XEvent *event;
Boolean *cont;
Boolean *cont UNUSED;
{
if ((event->type == NoExpose) || event->xexpose.count)
return;
@@ -2222,13 +2207,12 @@ SFexposeList(w, n, event, cont)
static void SFmodVerifyCallback __ARGS((Widget w, XtPointer client_data, XEvent *event, Boolean *cont));
/* ARGSUSED */
static void
SFmodVerifyCallback(w, client_data, event, cont)
Widget w;
XtPointer client_data;
Widget w UNUSED;
XtPointer client_data UNUSED;
XEvent *event;
Boolean *cont;
Boolean *cont UNUSED;
{
char buf[2];
@@ -2241,11 +2225,11 @@ SFmodVerifyCallback(w, client_data, event, cont)
static void SFokCallback __ARGS((Widget w, XtPointer cl, XtPointer cd));
/* ARGSUSED */
static void
SFokCallback(w, cl, cd)
Widget w;
XtPointer cl, cd;
Widget w UNUSED;
XtPointer cl UNUSED;
XtPointer cd UNUSED;
{
SFstatus = SEL_FILE_OK;
}
@@ -2258,11 +2242,11 @@ static XtCallbackRec SFokSelect[] =
static void SFcancelCallback __ARGS((Widget w, XtPointer cl, XtPointer cd));
/* ARGSUSED */
static void
SFcancelCallback(w, cl, cd)
Widget w;
XtPointer cl, cd;
Widget w UNUSED;
XtPointer cl UNUSED;
XtPointer cd UNUSED;
{
SFstatus = SEL_FILE_CANCEL;
}
@@ -2275,16 +2259,15 @@ static XtCallbackRec SFcancelSelect[] =
static void SFdismissAction __ARGS((Widget w, XEvent *event, String *params, Cardinal *num_params));
/* ARGSUSED */
static void
SFdismissAction(w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
Widget w UNUSED;
XEvent *event;
String *params UNUSED;
Cardinal *num_params UNUSED;
{
if (event->type == ClientMessage &&
event->xclient.data.l[0] != SFwmDeleteWindow)
if (event->type == ClientMessage
&& (Atom)event->xclient.data.l[0] != SFwmDeleteWindow)
return;
SFstatus = SEL_FILE_CANCEL;
@@ -2703,7 +2686,7 @@ SFcreateWidgets(toplevel, prompt, ok, cancel)
SFtextChanged()
{
#if defined(FEAT_XFONTSET) && defined(XtNinternational)
if (_XawTextFormat((TextWidget)selFileField) == XawFmtWide)
if ((unsigned long)_XawTextFormat((TextWidget)selFileField) == XawFmtWide)
{
wchar_t *wcbuf=(wchar_t *)SFtextBuffer;
@@ -2749,7 +2732,7 @@ SFgetText()
#if defined(FEAT_XFONTSET) && defined(XtNinternational)
char *buf;
if (_XawTextFormat((TextWidget)selFileField) == XawFmtWide)
if ((unsigned long)_XawTextFormat((TextWidget)selFileField) == XawFmtWide)
{
wchar_t *wcbuf;
int mbslength;
+34 -45
View File
@@ -198,10 +198,13 @@ ScrollbarClassRec vim_scrollbarClassRec =
/* extension */ NULL
},
{ /* simple fields */
/* change_sensitive */ XtInheritChangeSensitive
/* change_sensitive */ XtInheritChangeSensitive,
#ifndef OLDXAW
/* extension */ NULL
#endif
},
{ /* scrollbar fields */
/* ignore */ 0
/* empty */ 0
}
};
@@ -241,7 +244,8 @@ FillArea(sbw, top, bottom, fill, draw_shadow)
if (bottom <= 0 || bottom <= top)
return;
if ((sw = sbw->scrollbar.shadow_width) < 0)
sw = sbw->scrollbar.shadow_width;
if (sw < 0)
sw = 0;
margin = MARGIN (sbw);
floor = sbw->scrollbar.length - margin + 2;
@@ -516,13 +520,12 @@ SetDimensions(sbw)
}
}
/* ARGSUSED */
static void
Initialize(request, new, args, num_args)
Widget request; /* what the client asked for */
Widget request UNUSED; /* what the client asked for */
Widget new; /* what we're going to give him */
ArgList args;
Cardinal *num_args;
ArgList args UNUSED;
Cardinal *num_args UNUSED;
{
ScrollbarWidget sbw = (ScrollbarWidget) new;
@@ -556,14 +559,13 @@ Realize(w, valueMask, attributes)
(w, valueMask, attributes);
}
/* ARGSUSED */
static Boolean
SetValues(current, request, desired, args, num_args)
Widget current, /* what I am */
request, /* what he wants me to be */
desired; /* what I will become */
ArgList args;
Cardinal *num_args;
Widget current; /* what I am */
Widget request UNUSED; /* what he wants me to be */
Widget desired; /* what I will become */
ArgList args UNUSED;
Cardinal *num_args UNUSED;
{
ScrollbarWidget sbw = (ScrollbarWidget) current;
ScrollbarWidget dsbw = (ScrollbarWidget) desired;
@@ -609,7 +611,6 @@ Resize(w)
}
/* ARGSUSED */
static void
Redisplay(w, event, region)
Widget w;
@@ -789,11 +790,10 @@ HandleThumb(w, event, params, num_params)
}
}
/* ARGSUSED */
static void
RepeatNotify(client_data, idp)
XtPointer client_data;
XtIntervalId *idp;
XtIntervalId *idp UNUSED;
{
ScrollbarWidget sbw = (ScrollbarWidget) client_data;
int call_data;
@@ -839,46 +839,42 @@ FloatInRange(num, small, big)
return (num < small) ? small : ((num > big) ? big : num);
}
/* ARGSUSED */
static void
ScrollOneLineUp(w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
String *params UNUSED;
Cardinal *num_params UNUSED;
{
ScrollSome(w, event, -ONE_LINE_DATA);
}
/* ARGSUSED */
static void
ScrollOneLineDown(w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
String *params UNUSED;
Cardinal *num_params UNUSED;
{
ScrollSome(w, event, ONE_LINE_DATA);
}
/* ARGSUSED */
static void
ScrollPageDown(w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
String *params UNUSED;
Cardinal *num_params UNUSED;
{
ScrollSome(w, event, ONE_PAGE_DATA);
}
/* ARGSUSED */
static void
ScrollPageUp(w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
String *params UNUSED;
Cardinal *num_params UNUSED;
{
ScrollSome(w, event, -ONE_PAGE_DATA);
}
@@ -901,13 +897,12 @@ ScrollSome(w, event, call_data)
XtCallCallbacks(w, XtNscrollProc, (XtPointer)call_data);
}
/* ARGSUSED */
static void
NotifyScroll(w, event, params, num_params)
Widget w;
XEvent *event;
String *params;
Cardinal *num_params;
String *params UNUSED;
Cardinal *num_params UNUSED;
{
ScrollbarWidget sbw = (ScrollbarWidget) w;
Position x, y, loc;
@@ -991,13 +986,12 @@ NotifyScroll(w, event, params, num_params)
delay, RepeatNotify, (XtPointer)w);
}
/* ARGSUSED */
static void
EndScroll(w, event, params, num_params)
Widget w;
XEvent *event; /* unused */
String *params; /* unused */
Cardinal *num_params; /* unused */
XEvent *event UNUSED;
String *params UNUSED;
Cardinal *num_params UNUSED;
{
ScrollbarWidget sbw = (ScrollbarWidget) w;
@@ -1023,13 +1017,12 @@ FractionLoc(sbw, x, y)
return PICKLENGTH(sbw, x / width, y / height);
}
/* ARGSUSED */
static void
MoveThumb(w, event, params, num_params)
Widget w;
XEvent *event;
String *params; /* unused */
Cardinal *num_params; /* unused */
String *params UNUSED;
Cardinal *num_params UNUSED;
{
ScrollbarWidget sbw = (ScrollbarWidget)w;
Position x, y;
@@ -1069,13 +1062,12 @@ MoveThumb(w, event, params, num_params)
}
/* ARGSUSED */
static void
NotifyThumb(w, event, params, num_params)
Widget w;
XEvent *event;
String *params; /* unused */
Cardinal *num_params; /* unused */
String *params UNUSED;
Cardinal *num_params UNUSED;
{
ScrollbarWidget sbw = (ScrollbarWidget)w;
/* Use a union to avoid a warning for the weird conversion from float to
@@ -1096,7 +1088,6 @@ NotifyThumb(w, event, params, num_params)
XtCallCallbacks(w, XtNjumpProc, (XtPointer)&sbw->scrollbar.top);
}
/* ARGSUSED */
static void
AllocTopShadowGC(w)
Widget w;
@@ -1110,7 +1101,6 @@ AllocTopShadowGC(w)
sbw->scrollbar.top_shadow_GC = XtGetGC(w, valuemask, &myXGCV);
}
/* ARGSUSED */
static void
AllocBotShadowGC(w)
Widget w;
@@ -1124,11 +1114,10 @@ AllocBotShadowGC(w)
sbw->scrollbar.bot_shadow_GC = XtGetGC(w, valuemask, &myXGCV);
}
/* ARGSUSED */
static void
_Xaw3dDrawShadows(gw, event, region, out)
Widget gw;
XEvent *event;
XEvent *event UNUSED;
Region region;
int out;
{
+29 -44
View File
@@ -86,10 +86,9 @@ static int puller_width = 0;
* Scrollbar callback (XtNjumpProc) for when the scrollbar is dragged with the
* left or middle mouse button.
*/
/* ARGSUSED */
static void
gui_athena_scroll_cb_jump(w, client_data, call_data)
Widget w;
Widget w UNUSED;
XtPointer client_data, call_data;
{
scrollbar_T *sb, *sb_info;
@@ -122,10 +121,9 @@ gui_athena_scroll_cb_jump(w, client_data, call_data)
* Scrollbar callback (XtNscrollProc) for paging up or down with the left or
* right mouse buttons.
*/
/* ARGSUSED */
static void
gui_athena_scroll_cb_scroll(w, client_data, call_data)
Widget w;
Widget w UNUSED;
XtPointer client_data, call_data;
{
scrollbar_T *sb, *sb_info;
@@ -492,7 +490,7 @@ get_toolbar_pixmap(menu, sen)
if (menu->icon_builtin || gui_find_bitmap(menu->name, buf, "xpm") == FAIL)
{
if (menu->iconidx >= 0 && menu->iconidx
< (sizeof(built_in_pixmaps) / sizeof(built_in_pixmaps[0])))
< (int)(sizeof(built_in_pixmaps) / sizeof(built_in_pixmaps[0])))
xpm = built_in_pixmaps[menu->iconidx];
else
xpm = tb_blank_xpm;
@@ -763,7 +761,7 @@ athena_calculate_ins_pos(widget)
XtGetValues(XtParent(widget), args, n);
retval = num_children;
for (i = 0; i < num_children; ++i)
for (i = 0; i < (int)num_children; ++i)
{
Widget current = children[i];
vimmenu_T *menu = NULL;
@@ -780,11 +778,10 @@ athena_calculate_ins_pos(widget)
return retval;
}
/* ARGSUSED */
void
gui_mch_add_menu(menu, idx)
vimmenu_T *menu;
int idx;
int idx UNUSED;
{
char_u *pullright_name;
Dimension height, space, border;
@@ -869,7 +866,7 @@ gui_mch_add_menu(menu, idx)
XtVaGetValues(parent->submenu_id, XtNchildren, &children,
XtNnumChildren, &num_children,
NULL);
for (i = 0; i < num_children; ++i)
for (i = 0; i < (int)num_children; ++i)
{
XtVaSetValues(children[i],
XtNrightMargin, puller_width,
@@ -913,7 +910,7 @@ gui_athena_menu_has_submenus(id, ignore)
XtVaGetValues(id, XtNchildren, &children,
XtNnumChildren, &num_children,
NULL);
for (i = 0; i < num_children; ++i)
for (i = 0; i < (int)num_children; ++i)
{
if (children[i] == ignore)
continue;
@@ -1175,11 +1172,10 @@ make_pull_name(name)
return pname;
}
/* ARGSUSED */
void
gui_mch_add_menu_item(menu, idx)
vimmenu_T *menu;
int idx;
int idx UNUSED;
{
vimmenu_T *parent = menu->parent;
@@ -1444,7 +1440,7 @@ gui_mch_compute_toolbar_height()
XtNchildren, &children,
XtNnumChildren, &numChildren,
NULL);
for (i = 0; i < numChildren; i++)
for (i = 0; i < (int)numChildren; i++)
{
whgt = 0;
@@ -1473,10 +1469,9 @@ gui_mch_get_toolbar_colors(bgp, fgp, bsp, tsp, hsp)
#endif
/* ARGSUSED */
void
gui_mch_toggle_tearoffs(enable)
int enable;
int enable UNUSED;
{
/* no tearoff menus */
}
@@ -1537,7 +1532,7 @@ gui_mch_destroy_menu(menu)
else
get_left_margin = True;
for (i = 0; i < num_children; ++i)
for (i = 0; i < (int)num_children; ++i)
{
if (children[i] == menu->id)
continue;
@@ -1645,11 +1640,10 @@ gui_mch_destroy_menu(menu)
}
}
/*ARGSUSED*/
static void
gui_athena_menu_timeout(client_data, id)
XtPointer client_data;
XtIntervalId *id;
XtIntervalId *id UNUSED;
{
Widget w = (Widget)client_data;
Widget popup;
@@ -1678,12 +1672,11 @@ gui_athena_menu_timeout(client_data, id)
*
* This is called when XtPopup() is called.
*/
/*ARGSUSED*/
static void
gui_athena_popup_callback(w, client_data, call_data)
Widget w;
XtPointer client_data;
XtPointer call_data;
XtPointer call_data UNUSED;
{
/* Assumption: XtIsSubclass(XtParent(w),simpleMenuWidgetClass) */
vimmenu_T *menu = (vimmenu_T *)client_data;
@@ -1711,7 +1704,6 @@ gui_athena_popup_callback(w, client_data, call_data)
NULL);
}
/* ARGSUSED */
static void
gui_athena_popdown_submenus_action(w, event, args, nargs)
Widget w;
@@ -1756,7 +1748,6 @@ has_submenu(widget)
return False;
}
/* ARGSUSED */
static void
gui_athena_delayed_arm_action(w, event, args, nargs)
Widget w;
@@ -1837,7 +1828,6 @@ submenu_widget(widget)
* (XtIsSubclass(popup,simpleMenuWidgetClass) == True) */
}
/* ARGSUSED */
void
gui_mch_show_popupmenu(menu)
vimmenu_T *menu;
@@ -2046,15 +2036,14 @@ gui_x11_get_wid()
* Put up a file requester.
* Returns the selected name in allocated memory, or NULL for Cancel.
*/
/* ARGSUSED */
char_u *
gui_mch_browse(saving, title, dflt, ext, initdir, filter)
int saving; /* select file to write */
char_u *title; /* not used (title for the window) */
char_u *dflt; /* not used (default name) */
char_u *ext; /* not used (extension added) */
int saving UNUSED; /* select file to write */
char_u *title; /* title for the window */
char_u *dflt; /* default name */
char_u *ext UNUSED; /* extension added */
char_u *initdir; /* initial directory, NULL for current dir */
char_u *filter; /* not used (file name filter) */
char_u *filter UNUSED; /* file name filter */
{
Position x, y;
char_u dirbuf[MAXPATHL];
@@ -2100,13 +2089,12 @@ static void dialog_wm_handler __ARGS((Widget w, XtPointer client_data, XEvent *e
* Callback function for the textfield. When CR is hit this works like
* hitting the "OK" button, ESC like "Cancel".
*/
/* ARGSUSED */
static void
keyhit_callback(w, client_data, event, cont)
Widget w;
XtPointer client_data;
Widget w UNUSED;
XtPointer client_data UNUSED;
XEvent *event;
Boolean *cont;
Boolean *cont UNUSED;
{
char buf[2];
@@ -2119,12 +2107,11 @@ keyhit_callback(w, client_data, event, cont)
}
}
/* ARGSUSED */
static void
butproc(w, client_data, call_data)
Widget w;
Widget w UNUSED;
XtPointer client_data;
XtPointer call_data;
XtPointer call_data UNUSED;
{
dialogStatus = (int)(long)client_data + 1;
}
@@ -2132,27 +2119,25 @@ butproc(w, client_data, call_data)
/*
* Function called when dialog window closed.
*/
/*ARGSUSED*/
static void
dialog_wm_handler(w, client_data, event, dum)
Widget w;
XtPointer client_data;
Widget w UNUSED;
XtPointer client_data UNUSED;
XEvent *event;
Boolean *dum;
Boolean *dum UNUSED;
{
if (event->type == ClientMessage
&& ((XClientMessageEvent *)event)->data.l[0] == dialogatom)
&& (Atom)((XClientMessageEvent *)event)->data.l[0] == dialogatom)
dialogStatus = 0;
}
/* ARGSUSED */
int
gui_mch_dialog(type, title, message, buttons, dfltbutton, textfield)
int type;
int type UNUSED;
char_u *title;
char_u *message;
char_u *buttons;
int dfltbutton;
int dfltbutton UNUSED;
char_u *textfield;
{
char_u *buts;
+8 -12
View File
@@ -15,11 +15,10 @@
/*
* Common code, invoked when the mouse is resting for a moment.
*/
/*ARGSUSED*/
void
general_beval_cb(beval, state)
BalloonEval *beval;
int state;
int state UNUSED;
{
win_T *wp;
int col;
@@ -551,9 +550,8 @@ target_event_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
return FALSE; /* continue emission */
}
/*ARGSUSED*/
static gint
mainwin_event_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
mainwin_event_cb(GtkWidget *widget UNUSED, GdkEvent *event, gpointer data)
{
BalloonEval *beval = (BalloonEval *)data;
@@ -663,9 +661,10 @@ timeout_cb(gpointer data)
return FALSE; /* don't call me again */
}
/*ARGSUSED2*/
static gint
balloon_expose_event_cb(GtkWidget *widget, GdkEventExpose *event, gpointer data)
balloon_expose_event_cb(GtkWidget *widget,
GdkEventExpose *event,
gpointer data UNUSED)
{
gtk_paint_flat_box(widget->style, widget->window,
GTK_STATE_NORMAL, GTK_SHADOW_OUT,
@@ -676,7 +675,6 @@ balloon_expose_event_cb(GtkWidget *widget, GdkEventExpose *event, gpointer data)
}
# ifndef HAVE_GTK2
/*ARGSUSED2*/
static void
balloon_draw_cb(GtkWidget *widget, GdkRectangle *area, gpointer data)
{
@@ -726,13 +724,12 @@ removeEventHandler(beval)
/*
* The X event handler. All it does is call the real event handler.
*/
/*ARGSUSED*/
static void
pointerEventEH(w, client_data, event, unused)
Widget w;
Widget w UNUSED;
XtPointer client_data;
XEvent *event;
Boolean *unused;
Boolean *unused UNUSED;
{
BalloonEval *beval = (BalloonEval *)client_data;
pointerEvent(beval, event);
@@ -877,11 +874,10 @@ pointerEvent(beval, event)
}
}
/*ARGSUSED*/
static void
timerRoutine(dx, id)
XtPointer dx;
XtIntervalId *id;
XtIntervalId *id UNUSED;
{
BalloonEval *beval = (BalloonEval *)dx;
+22 -38
View File
@@ -285,14 +285,14 @@ create_menu_icon(vimmenu_T *menu, GtkIconSize icon_size)
return image;
}
/*ARGSUSED*/
static gint
toolbar_button_focus_in_event(GtkWidget *widget, GdkEventFocus *event, gpointer data)
toolbar_button_focus_in_event(GtkWidget *widget UNUSED,
GdkEventFocus *event UNUSED,
gpointer data UNUSED)
{
/* When we're in a GtkPlug, we don't have window focus events, only widget focus.
* To emulate stand-alone gvim, if a button gets focus (e.g., <Tab> into GtkPlug)
* immediately pass it to mainwin.
*/
/* When we're in a GtkPlug, we don't have window focus events, only widget
* focus. To emulate stand-alone gvim, if a button gets focus (e.g.,
* <Tab> into GtkPlug) immediately pass it to mainwin. */
if (gtk_socket_id != 0)
gtk_widget_grab_focus(gui.drawarea);
@@ -585,9 +585,8 @@ gui_mch_add_menu(vimmenu_T *menu, int idx)
gtk_menu_prepend(GTK_MENU(menu->submenu_id), menu->tearoff_handle);
}
/*ARGSUSED*/
static void
menu_item_activate(GtkWidget *widget, gpointer data)
menu_item_activate(GtkWidget *widget UNUSED, gpointer data)
{
gui_menu_cb((vimmenu_T *)data);
@@ -1202,9 +1201,8 @@ gui_mch_destroy_scrollbar(scrollbar_T *sb)
#endif
#ifndef USE_FILE_CHOOSER
/*ARGSUSED*/
static void
browse_ok_cb(GtkWidget *widget, gpointer cbdata)
browse_ok_cb(GtkWidget *widget UNUSED, gpointer cbdata)
{
gui_T *vw = (gui_T *)cbdata;
@@ -1218,9 +1216,8 @@ browse_ok_cb(GtkWidget *widget, gpointer cbdata)
gtk_main_quit();
}
/*ARGSUSED*/
static void
browse_cancel_cb(GtkWidget *widget, gpointer cbdata)
browse_cancel_cb(GtkWidget *widget UNUSED, gpointer cbdata)
{
gui_T *vw = (gui_T *)cbdata;
@@ -1234,9 +1231,8 @@ browse_cancel_cb(GtkWidget *widget, gpointer cbdata)
gtk_main_quit();
}
/*ARGSUSED*/
static gboolean
browse_destroy_cb(GtkWidget * widget)
browse_destroy_cb(GtkWidget *widget UNUSED)
{
if (gui.browse_fname != NULL)
{
@@ -1262,14 +1258,13 @@ browse_destroy_cb(GtkWidget * widget)
* initdir initial directory, NULL for current dir
* filter not used (file name filter)
*/
/*ARGSUSED*/
char_u *
gui_mch_browse(int saving,
gui_mch_browse(int saving UNUSED,
char_u *title,
char_u *dflt,
char_u *ext,
char_u *ext UNUSED,
char_u *initdir,
char_u *filter)
char_u *filter UNUSED)
{
#ifdef USE_FILE_CHOOSER
GtkWidget *fc;
@@ -1377,7 +1372,6 @@ gui_mch_browse(int saving,
* dflt default name
* initdir initial directory, NULL for current dir
*/
/*ARGSUSED*/
char_u *
gui_mch_browsedir(
char_u *title,
@@ -1460,7 +1454,6 @@ dlg_destroy(GtkWidget *dlg)
}
# ifdef FEAT_GUI_GNOME
/* ARGSUSED */
static int
gui_gnome_dialog( int type,
char_u *title,
@@ -1611,7 +1604,6 @@ typedef struct _CancelData
GtkWidget *dialog;
} CancelData;
/* ARGSUSED */
static void
dlg_button_clicked(GtkWidget * widget, ButtonData *data)
{
@@ -1622,7 +1614,6 @@ dlg_button_clicked(GtkWidget * widget, ButtonData *data)
/*
* This makes the Escape key equivalent to the cancel button.
*/
/*ARGSUSED*/
static int
dlg_key_press_event(GtkWidget *widget, GdkEventKey *event, CancelData *data)
{
@@ -1655,7 +1646,6 @@ dlg_destroy_cb(int *p)
gtk_main_quit();
}
/* ARGSUSED */
int
gui_mch_dialog( int type, /* type of dialog */
char_u *title, /* title of dialog */
@@ -2215,7 +2205,6 @@ typedef struct _DialogInfo
GtkDialog *dialog; /* Widget of the dialog */
} DialogInfo;
/*ARGSUSED2*/
static gboolean
dialog_key_press_event_cb(GtkWidget *widget, GdkEventKey *event, gpointer data)
{
@@ -2398,14 +2387,13 @@ static int popup_mouse_pos;
* Note: The push_in output argument seems to affect scrolling of huge
* menus that don't fit on the screen. Leave it at the default for now.
*/
/*ARGSUSED0*/
static void
popup_menu_position_func(GtkMenu *menu,
popup_menu_position_func(GtkMenu *menu UNUSED,
gint *x, gint *y,
# ifdef HAVE_GTK2
gboolean *push_in,
gboolean *push_in UNUSED,
# endif
gpointer user_data)
gpointer user_data UNUSED)
{
gdk_window_get_origin(gui.drawarea->window, x, y);
@@ -2464,13 +2452,12 @@ typedef struct _SharedFindReplace
GtkWidget *all; /* 'Replace All' action button */
} SharedFindReplace;
static SharedFindReplace find_widgets = { NULL, };
static SharedFindReplace repl_widgets = { NULL, };
static SharedFindReplace find_widgets = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
static SharedFindReplace repl_widgets = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
/* ARGSUSED */
static int
find_key_press_event(
GtkWidget *widget,
GtkWidget *widget UNUSED,
GdkEventKey *event,
SharedFindReplace *frdp)
{
@@ -2962,9 +2949,8 @@ gui_gtk_synch_fonts(void)
/*
* Callback for actions of the find and replace dialogs
*/
/*ARGSUSED*/
static void
find_replace_cb(GtkWidget *widget, gpointer data)
find_replace_cb(GtkWidget *widget UNUSED, gpointer data)
{
int flags;
char_u *find_text;
@@ -3010,9 +2996,8 @@ find_replace_cb(GtkWidget *widget, gpointer data)
}
/* our usual callback function */
/*ARGSUSED*/
static void
entry_activate_cb(GtkWidget *widget, gpointer data)
entry_activate_cb(GtkWidget *widget UNUSED, gpointer data)
{
gtk_widget_grab_focus(GTK_WIDGET(data));
}
@@ -3055,10 +3040,9 @@ entry_changed_cb(GtkWidget * entry, GtkWidget * dialog)
/*
* ":helpfind"
*/
/*ARGSUSED*/
void
ex_helpfind(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
/* This will fail when menus are not loaded. Well, it's only for
* backwards compatibility anyway. */
+15 -18
View File
@@ -227,14 +227,14 @@ gtk_form_get_type(void)
if (!form_type)
{
GtkTypeInfo form_info =
{
"GtkForm",
sizeof(GtkForm),
sizeof(GtkFormClass),
(GtkClassInitFunc) gtk_form_class_init,
(GtkObjectInitFunc) gtk_form_init
};
GtkTypeInfo form_info;
vim_memset(&form_info, 0, sizeof(form_info));
form_info.type_name = "GtkForm";
form_info.object_size = sizeof(GtkForm);
form_info.class_size = sizeof(GtkFormClass);
form_info.class_init_func = (GtkClassInitFunc)gtk_form_class_init;
form_info.object_init_func = (GtkObjectInitFunc)gtk_form_init;
form_type = gtk_type_unique(GTK_TYPE_CONTAINER, &form_info);
}
@@ -611,10 +611,9 @@ gtk_form_remove(GtkContainer *container, GtkWidget *widget)
}
}
/*ARGSUSED1*/
static void
gtk_form_forall(GtkContainer *container,
gboolean include_internals,
gboolean include_internals UNUSED,
GtkCallback callback,
gpointer callback_data)
{
@@ -786,9 +785,8 @@ gtk_form_position_children(GtkForm *form)
* them or discards them, depending on whether we are obscured
* or not.
*/
/*ARGSUSED1*/
static GdkFilterReturn
gtk_form_filter(GdkXEvent *gdk_xevent, GdkEvent *event, gpointer data)
gtk_form_filter(GdkXEvent *gdk_xevent, GdkEvent *event UNUSED, gpointer data)
{
XEvent *xevent;
GtkForm *form;
@@ -821,9 +819,10 @@ gtk_form_filter(GdkXEvent *gdk_xevent, GdkEvent *event, gpointer data)
* there is no corresponding event in GTK, so we have
* to get the events from a filter
*/
/*ARGSUSED1*/
static GdkFilterReturn
gtk_form_main_filter(GdkXEvent *gdk_xevent, GdkEvent *event, gpointer data)
gtk_form_main_filter(GdkXEvent *gdk_xevent,
GdkEvent *event UNUSED,
gpointer data)
{
XEvent *xevent;
GtkForm *form;
@@ -911,9 +910,8 @@ gtk_form_send_configure(GtkForm *form)
#endif
}
/*ARGSUSED0*/
static void
gtk_form_child_map(GtkWidget *widget, gpointer user_data)
gtk_form_child_map(GtkWidget *widget UNUSED, gpointer user_data)
{
GtkFormChild *child;
@@ -923,9 +921,8 @@ gtk_form_child_map(GtkWidget *widget, gpointer user_data)
gdk_window_show(child->window);
}
/*ARGSUSED0*/
static void
gtk_form_child_unmap(GtkWidget *widget, gpointer user_data)
gtk_form_child_unmap(GtkWidget *widget UNUSED, gpointer user_data)
{
GtkFormChild *child;
+170 -133
View File
@@ -107,6 +107,7 @@ enum
TARGET_UTF8_STRING,
TARGET_STRING,
TARGET_COMPOUND_TEXT,
TARGET_HTML,
TARGET_TEXT,
TARGET_TEXT_URI_LIST,
TARGET_TEXT_PLAIN,
@@ -123,6 +124,7 @@ static const GtkTargetEntry selection_targets[] =
{VIMENC_ATOM_NAME, 0, TARGET_VIMENC},
{VIM_ATOM_NAME, 0, TARGET_VIM},
#ifdef FEAT_MBYTE
{"text/html", 0, TARGET_HTML},
{"UTF8_STRING", 0, TARGET_UTF8_STRING},
#endif
{"COMPOUND_TEXT", 0, TARGET_COMPOUND_TEXT},
@@ -140,6 +142,7 @@ static const GtkTargetEntry dnd_targets[] =
{
{"text/uri-list", 0, TARGET_TEXT_URI_LIST},
# ifdef FEAT_MBYTE
{"text/html", 0, TARGET_HTML},
{"UTF8_STRING", 0, TARGET_UTF8_STRING},
# endif
{"STRING", 0, TARGET_STRING},
@@ -178,6 +181,7 @@ static GdkAtom save_yourself_atom = GDK_NONE;
* Atoms used to control/reference X11 selections.
*/
#ifdef FEAT_MBYTE
static GdkAtom html_atom = GDK_NONE;
static GdkAtom utf8_string_atom = GDK_NONE;
#endif
#ifndef HAVE_GTK2
@@ -412,6 +416,7 @@ static const char *role_argument = NULL;
#endif
#if defined(FEAT_GUI_GNOME) && defined(FEAT_SESSION)
static const char *restart_command = NULL;
static char *abs_restart_command = NULL;
#endif
static int found_iconic_arg = FALSE;
@@ -449,8 +454,10 @@ gui_mch_prepare(int *argc, char **argv)
char_u buf[MAXPATHL];
if (mch_FullName((char_u *)argv[0], buf, (int)sizeof(buf), TRUE) == OK)
/* Tiny leak; doesn't matter, and usually we don't even get here */
restart_command = (char *)vim_strsave(buf);
{
abs_restart_command = (char *)vim_strsave(buf);
restart_command = abs_restart_command;
}
}
#endif
@@ -611,6 +618,9 @@ gui_mch_prepare(int *argc, char **argv)
gui_mch_free_all()
{
vim_free(gui_argv);
#if defined(FEAT_GUI_GNOME) && defined(FEAT_SESSION)
vim_free(abs_restart_command);
#endif
}
#endif
@@ -619,9 +629,10 @@ gui_mch_free_all()
* Doesn't seem possible, since check_copy_area() relies on
* this information. --danielk
*/
/*ARGSUSED*/
static gint
visibility_event(GtkWidget *widget, GdkEventVisibility *event, gpointer data)
visibility_event(GtkWidget *widget UNUSED,
GdkEventVisibility *event,
gpointer data UNUSED)
{
gui.visibility = event->state;
/*
@@ -638,9 +649,10 @@ visibility_event(GtkWidget *widget, GdkEventVisibility *event, gpointer data)
/*
* Redraw the corresponding portions of the screen.
*/
/*ARGSUSED*/
static gint
expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data)
expose_event(GtkWidget *widget UNUSED,
GdkEventExpose *event,
gpointer data UNUSED)
{
/* Skip this when the GUI isn't set up yet, will redraw later. */
if (gui.starting)
@@ -668,9 +680,10 @@ expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data)
/*
* Handle changes to the "Comm" property
*/
/*ARGSUSED2*/
static gint
property_event(GtkWidget *widget, GdkEventProperty *event, gpointer data)
property_event(GtkWidget *widget,
GdkEventProperty *event,
gpointer data UNUSED)
{
if (event->type == GDK_PROPERTY_NOTIFY
&& event->state == (int)GDK_PROPERTY_NEW_VALUE
@@ -740,9 +753,8 @@ gui_mch_stop_blink(void)
blink_state = BLINK_NONE;
}
/*ARGSUSED*/
static gint
blink_cb(gpointer data)
blink_cb(gpointer data UNUSED)
{
if (blink_state == BLINK_ON)
{
@@ -781,9 +793,10 @@ gui_mch_start_blink(void)
}
}
/*ARGSUSED*/
static gint
enter_notify_event(GtkWidget *widget, GdkEventCrossing *event, gpointer data)
enter_notify_event(GtkWidget *widget UNUSED,
GdkEventCrossing *event UNUSED,
gpointer data UNUSED)
{
if (blink_state == BLINK_NONE)
gui_mch_start_blink();
@@ -795,9 +808,10 @@ enter_notify_event(GtkWidget *widget, GdkEventCrossing *event, gpointer data)
return FALSE;
}
/*ARGSUSED*/
static gint
leave_notify_event(GtkWidget *widget, GdkEventCrossing *event, gpointer data)
leave_notify_event(GtkWidget *widget UNUSED,
GdkEventCrossing *event UNUSED,
gpointer data UNUSED)
{
if (blink_state != BLINK_NONE)
gui_mch_stop_blink();
@@ -805,9 +819,10 @@ leave_notify_event(GtkWidget *widget, GdkEventCrossing *event, gpointer data)
return FALSE;
}
/*ARGSUSED*/
static gint
focus_in_event(GtkWidget *widget, GdkEventFocus *event, gpointer data)
focus_in_event(GtkWidget *widget,
GdkEventFocus *event UNUSED,
gpointer data UNUSED)
{
gui_focus_change(TRUE);
@@ -826,9 +841,10 @@ focus_in_event(GtkWidget *widget, GdkEventFocus *event, gpointer data)
return TRUE;
}
/*ARGSUSED*/
static gint
focus_out_event(GtkWidget *widget, GdkEventFocus *event, gpointer data)
focus_out_event(GtkWidget *widget UNUSED,
GdkEventFocus *event UNUSED,
gpointer data UNUSED)
{
gui_focus_change(FALSE);
@@ -956,9 +972,10 @@ modifiers_gdk2mouse(guint state)
/*
* Main keyboard handler:
*/
/*ARGSUSED*/
static gint
key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
key_press_event(GtkWidget *widget UNUSED,
GdkEventKey *event,
gpointer data UNUSED)
{
#ifdef HAVE_GTK2
/* 256 bytes is way over the top, but for safety let's reduce it only
@@ -1225,9 +1242,10 @@ key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
}
#if defined(FEAT_XIM) && defined(HAVE_GTK2)
/*ARGSUSED0*/
static gboolean
key_release_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
key_release_event(GtkWidget *widget UNUSED,
GdkEventKey *event,
gpointer data UNUSED)
{
/*
* GTK+ 2 input methods may do fancy stuff on key release events too.
@@ -1243,11 +1261,10 @@ key_release_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
* Selection handlers:
*/
/*ARGSUSED*/
static gint
selection_clear_event(GtkWidget *widget,
selection_clear_event(GtkWidget *widget UNUSED,
GdkEventSelection *event,
gpointer user_data)
gpointer user_data UNUSED)
{
if (event->selection == clip_plus.gtk_sel_atom)
clip_lose_selection(&clip_plus);
@@ -1265,12 +1282,11 @@ selection_clear_event(GtkWidget *widget,
#define RS_FAIL 2 /* selection_received_cb() called and failed */
static int received_selection = RS_NONE;
/*ARGSUSED*/
static void
selection_received_cb(GtkWidget *widget,
selection_received_cb(GtkWidget *widget UNUSED,
GtkSelectionData *data,
guint time_,
gpointer user_data)
guint time_ UNUSED,
gpointer user_data UNUSED)
{
VimClipboard *cbd;
char_u *text;
@@ -1352,6 +1368,24 @@ selection_received_cb(GtkWidget *widget,
else
text = tmpbuf_utf8;
}
else if (len >= 2 && text[0] == 0xff && text[1] == 0xfe)
{
vimconv_T conv;
/* UTF-16, we get this for HTML */
conv.vc_type = CONV_NONE;
convert_setup_ext(&conv, (char_u *)"utf-16le", FALSE, p_enc, TRUE);
if (conv.vc_type != CONV_NONE)
{
text += 2;
len -= 2;
tmpbuf = string_convert(&conv, text, &len);
convert_setup(&conv, NULL, NULL);
}
if (tmpbuf != NULL)
text = tmpbuf;
}
}
#else /* !HAVE_GTK2 */
# ifdef FEAT_MBYTE
@@ -1414,13 +1448,12 @@ selection_received_cb(GtkWidget *widget,
* Prepare our selection data for passing it to the external selection
* client.
*/
/*ARGSUSED*/
static void
selection_get_cb(GtkWidget *widget,
selection_get_cb(GtkWidget *widget UNUSED,
GtkSelectionData *selection_data,
guint info,
guint time_,
gpointer user_data)
guint time_ UNUSED,
gpointer user_data UNUSED)
{
char_u *string;
char_u *tmpbuf;
@@ -1440,6 +1473,7 @@ selection_get_cb(GtkWidget *widget,
if (info != (guint)TARGET_STRING
#ifdef FEAT_MBYTE
&& (!clip_html || info != (guint)TARGET_HTML)
&& info != (guint)TARGET_UTF8_STRING
&& info != (guint)TARGET_VIMENC
#endif
@@ -1475,6 +1509,40 @@ selection_get_cb(GtkWidget *widget,
}
#ifdef FEAT_MBYTE
else if (info == (guint)TARGET_HTML)
{
vimconv_T conv;
/* Since we get utf-16, we probably should set it as well. */
conv.vc_type = CONV_NONE;
convert_setup_ext(&conv, p_enc, TRUE, (char_u *)"utf-16le", FALSE);
if (conv.vc_type != CONV_NONE)
{
tmpbuf = string_convert(&conv, string, &length);
convert_setup(&conv, NULL, NULL);
vim_free(string);
string = tmpbuf;
}
/* Prepend the BOM: "fffe" */
if (string != NULL)
{
tmpbuf = alloc(length + 2);
tmpbuf[0] = 0xff;
tmpbuf[1] = 0xfe;
mch_memmove(tmpbuf + 2, string, (size_t)length);
vim_free(string);
string = tmpbuf;
length += 2;
selection_data->type = selection_data->target;
selection_data->format = 16; /* 16 bits per char */
gtk_selection_data_set(selection_data, html_atom, 16,
string, length);
vim_free(string);
}
return;
}
else if (info == (guint)TARGET_VIMENC)
{
int l = STRLEN(p_enc);
@@ -1678,7 +1746,7 @@ process_motion_notify(int x, int y, GdkModifierType state)
offshoot = dx > dy ? dx : dy;
/* Make a linearly declaying timer delay with a threshold of 5 at a
/* Make a linearly decaying timer delay with a threshold of 5 at a
* distance of 127 pixels from the main window.
*
* One could think endlessly about the most ergonomic variant here.
@@ -1707,9 +1775,8 @@ process_motion_notify(int x, int y, GdkModifierType state)
/*
* Timer used to recognize multiple clicks of the mouse button.
*/
/*ARGSUSED0*/
static gint
motion_repeat_timer_cb(gpointer data)
motion_repeat_timer_cb(gpointer data UNUSED)
{
int x;
int y;
@@ -1749,9 +1816,10 @@ motion_repeat_timer_cb(gpointer data)
return FALSE;
}
/*ARGSUSED2*/
static gint
motion_notify_event(GtkWidget *widget, GdkEventMotion *event, gpointer data)
motion_notify_event(GtkWidget *widget,
GdkEventMotion *event,
gpointer data UNUSED)
{
if (event->is_hint)
{
@@ -1777,9 +1845,10 @@ motion_notify_event(GtkWidget *widget, GdkEventMotion *event, gpointer data)
* by our own timeout mechanism instead of the one provided by GTK+ itself.
* This is due to the way the generic VIM code is recognizing multiple clicks.
*/
/*ARGSUSED2*/
static gint
button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer data)
button_press_event(GtkWidget *widget,
GdkEventButton *event,
gpointer data UNUSED)
{
int button;
int repeated_click = FALSE;
@@ -1855,9 +1924,10 @@ button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer data)
* GTK+ 2 doesn't handle mouse buttons 4, 5, 6 and 7 the same way as GTK+ 1.
* Instead, it abstracts scrolling via the new GdkEventScroll.
*/
/*ARGSUSED2*/
static gboolean
scroll_event(GtkWidget *widget, GdkEventScroll *event, gpointer data)
scroll_event(GtkWidget *widget,
GdkEventScroll *event,
gpointer data UNUSED)
{
int button;
int_u vim_modifiers;
@@ -1896,9 +1966,10 @@ scroll_event(GtkWidget *widget, GdkEventScroll *event, gpointer data)
#endif /* HAVE_GTK2 */
/*ARGSUSED*/
static gint
button_release_event(GtkWidget *widget, GdkEventButton *event, gpointer data)
button_release_event(GtkWidget *widget UNUSED,
GdkEventButton *event,
gpointer data UNUSED)
{
int x, y;
int_u vim_modifiers;
@@ -2100,7 +2171,6 @@ drag_handle_text(GdkDragContext *context,
/*
* DND receiver.
*/
/*ARGSUSED2*/
static void
drag_data_received_cb(GtkWidget *widget,
GdkDragContext *context,
@@ -2109,7 +2179,7 @@ drag_data_received_cb(GtkWidget *widget,
GtkSelectionData *data,
guint info,
guint time_,
gpointer user_data)
gpointer user_data UNUSED)
{
GdkModifierType state;
@@ -2143,7 +2213,6 @@ drag_data_received_cb(GtkWidget *widget,
* be abandoned and pop up a dialog asking the user for confirmation if
* necessary.
*/
/*ARGSUSED0*/
static void
sm_client_check_changed_any(GnomeClient *client,
gint key,
@@ -2251,7 +2320,6 @@ write_session_file(char_u *filename)
* for confirmation if necessary. Save the current editing session and tell
* the session manager how to restart Vim.
*/
/*ARGSUSED1*/
static gboolean
sm_client_save_yourself(GnomeClient *client,
gint phase,
@@ -2339,7 +2407,6 @@ sm_client_save_yourself(GnomeClient *client,
* here since "save_yourself" has been emitted before (unless serious trouble
* is happening).
*/
/*ARGSUSED0*/
static void
sm_client_die(GnomeClient *client, gpointer data)
{
@@ -2379,10 +2446,9 @@ setup_save_yourself(void)
/*
* GTK tells us that XSMP needs attention
*/
/*ARGSUSED*/
static gboolean
local_xsmp_handle_requests(source, condition, data)
GIOChannel *source;
GIOChannel *source UNUSED;
GIOCondition condition;
gpointer data;
{
@@ -2480,16 +2546,18 @@ setup_save_yourself(void)
* WM_SAVE_YOURSELF hack it actually stores the session... And yes,
* it should work with KDE as well.
*/
/*ARGSUSED1*/
static GdkFilterReturn
global_event_filter(GdkXEvent *xev, GdkEvent *event, gpointer data)
global_event_filter(GdkXEvent *xev,
GdkEvent *event UNUSED,
gpointer data UNUSED)
{
XEvent *xevent = (XEvent *)xev;
if (xevent != NULL
&& xevent->type == ClientMessage
&& xevent->xclient.message_type == GET_X_ATOM(wm_protocols_atom)
&& xevent->xclient.data.l[0] == GET_X_ATOM(save_yourself_atom))
&& (long_u)xevent->xclient.data.l[0]
== GET_X_ATOM(save_yourself_atom))
{
out_flush();
ml_sync_all(FALSE, FALSE); /* preserve all swap files */
@@ -2512,7 +2580,6 @@ global_event_filter(GdkXEvent *xev, GdkEvent *event, gpointer data)
/*
* GDK handler for X ClientMessage events.
*/
/*ARGSUSED2*/
static GdkFilterReturn
gdk_wm_protocols_filter(GdkXEvent *xev, GdkEvent *event, gpointer data)
{
@@ -2558,9 +2625,8 @@ gdk_wm_protocols_filter(GdkXEvent *xev, GdkEvent *event, gpointer data)
/*
* Setup the window icon & xcmdsrv comm after the main window has been realized.
*/
/*ARGSUSED*/
static void
mainwin_realize(GtkWidget *widget, gpointer data)
mainwin_realize(GtkWidget *widget UNUSED, gpointer data UNUSED)
{
/* If you get an error message here, you still need to unpack the runtime
* archive! */
@@ -2712,11 +2778,10 @@ create_blank_pointer(void)
}
#ifdef HAVE_GTK_MULTIHEAD
/*ARGSUSED1*/
static void
mainwin_screen_changed_cb(GtkWidget *widget,
GdkScreen *previous_screen,
gpointer data)
GdkScreen *previous_screen UNUSED,
gpointer data UNUSED)
{
if (!gtk_widget_has_screen(widget))
return;
@@ -2757,9 +2822,8 @@ mainwin_screen_changed_cb(GtkWidget *widget,
* Don't try to set any VIM scrollbar sizes anywhere here. I'm relying on the
* fact that the main VIM engine doesn't take them into account anywhere.
*/
/*ARGSUSED1*/
static void
drawarea_realize_cb(GtkWidget *widget, gpointer data)
drawarea_realize_cb(GtkWidget *widget, gpointer data UNUSED)
{
GtkWidget *sbar;
@@ -2789,9 +2853,8 @@ drawarea_realize_cb(GtkWidget *widget, gpointer data)
/*
* Properly clean up on shutdown.
*/
/*ARGSUSED0*/
static void
drawarea_unrealize_cb(GtkWidget *widget, gpointer data)
drawarea_unrealize_cb(GtkWidget *widget UNUSED, gpointer data UNUSED)
{
/* Don't write messages to the GUI anymore */
full_screen = FALSE;
@@ -2827,11 +2890,10 @@ drawarea_unrealize_cb(GtkWidget *widget, gpointer data)
#endif
}
/*ARGSUSED0*/
static void
drawarea_style_set_cb(GtkWidget *widget,
GtkStyle *previous_style,
gpointer data)
drawarea_style_set_cb(GtkWidget *widget UNUSED,
GtkStyle *previous_style UNUSED,
gpointer data UNUSED)
{
gui_mch_new_colors();
}
@@ -2840,9 +2902,10 @@ drawarea_style_set_cb(GtkWidget *widget,
* Callback routine for the "delete_event" signal on the toplevel window.
* Tries to vim gracefully, or refuses to exit with changed buffers.
*/
/*ARGSUSED*/
static gint
delete_event_cb(GtkWidget *widget, GdkEventAny *event, gpointer data)
delete_event_cb(GtkWidget *widget UNUSED,
GdkEventAny *event UNUSED,
gpointer data UNUSED)
{
gui_shell_closed();
return TRUE;
@@ -2964,7 +3027,7 @@ update_window_manager_hints(int force_width, int force_height)
/* At start-up, don't try to set the hints until the initial
* values have been used (those that dictate our initial size)
* Let forced (i.e., correct) values thruogh always.
* Let forced (i.e., correct) values through always.
*/
if (!(force_width && force_height) && init_window_hints_state > 0)
{
@@ -3142,9 +3205,8 @@ static int clicked_page; /* page clicked in tab line */
/*
* Handle selecting an item in the tab line popup menu.
*/
/*ARGSUSED*/
static void
tabline_menu_handler(GtkMenuItem *item, gpointer user_data)
tabline_menu_handler(GtkMenuItem *item UNUSED, gpointer user_data)
{
/* Add the string cmd into input buffer */
send_tabline_menu_event(clicked_page, (int)(long)user_data);
@@ -3244,13 +3306,12 @@ on_tabline_menu(GtkWidget *widget, GdkEvent *event)
/*
* Handle selecting one of the tabs.
*/
/*ARGSUSED*/
static void
on_select_tab(
GtkNotebook *notebook,
GtkNotebookPage *page,
GtkNotebook *notebook UNUSED,
GtkNotebookPage *page UNUSED,
gint idx,
gpointer data)
gpointer data UNUSED)
{
if (!ignore_tabline_evt)
{
@@ -3460,6 +3521,7 @@ gui_mch_init(void)
/* Initialise atoms */
#ifdef FEAT_MBYTE
html_atom = gdk_atom_intern("text/html", FALSE);
utf8_string_atom = gdk_atom_intern("UTF8_STRING", FALSE);
#endif
#ifndef HAVE_GTK2
@@ -3784,7 +3846,7 @@ gui_mch_init(void)
#endif
if (gtk_socket_id != 0)
/* make sure keybord input can go to the drawarea */
/* make sure keyboard input can go to the drawarea */
GTK_WIDGET_SET_FLAGS(gui.drawarea, GTK_CAN_FOCUS);
/*
@@ -3922,10 +3984,10 @@ gui_mch_new_colors(void)
/*
* This signal informs us about the need to rearrange our sub-widgets.
*/
/*ARGSUSED*/
static gint
form_configure_event(GtkWidget *widget, GdkEventConfigure *event,
gpointer data)
form_configure_event(GtkWidget *widget UNUSED,
GdkEventConfigure *event,
gpointer data UNUSED)
{
int usable_height = event->height;
@@ -3948,9 +4010,8 @@ form_configure_event(GtkWidget *widget, GdkEventConfigure *event,
* We can't do much more here than to trying to preserve what had been done,
* since the window is already inevitably going away.
*/
/*ARGSUSED0*/
static void
mainwin_destroy_cb(GtkObject *object, gpointer data)
mainwin_destroy_cb(GtkObject *object UNUSED, gpointer data UNUSED)
{
/* Don't write messages to the GUI anymore */
full_screen = FALSE;
@@ -3980,9 +4041,8 @@ mainwin_destroy_cb(GtkObject *object, gpointer data)
* scrollbar init.), actually do the standard hinst and stop the timer.
* We'll not let the default hints be set while this timer's active.
*/
/*ARGSUSED*/
static gboolean
check_startup_plug_hints(gpointer data)
check_startup_plug_hints(gpointer data UNUSED)
{
if (init_window_hints_state == 1)
{
@@ -4055,7 +4115,7 @@ gui_mch_open(void)
Columns = w;
if (mask & HeightValue)
{
if (p_window > h - 1 || !option_was_set((char_u *)"window"))
if (p_window > (long)h - 1 || !option_was_set((char_u *)"window"))
p_window = h - 1;
Rows = h;
}
@@ -4229,9 +4289,8 @@ gui_mch_open(void)
}
/*ARGSUSED0*/
void
gui_mch_exit(int rc)
gui_mch_exit(int rc UNUSED)
{
if (gui.mainwin != NULL)
gtk_widget_destroy(gui.mainwin);
@@ -4286,7 +4345,6 @@ static int resize_idle_installed = FALSE;
* report the new size through form_configure_event(). That caused the window
* layout to be messed up.
*/
/*ARGSUSED0*/
static gboolean
force_shell_resize_idle(gpointer data)
{
@@ -4314,12 +4372,11 @@ force_shell_resize_idle(gpointer data)
/*
* Set the windows size.
*/
/*ARGSUSED2*/
void
gui_mch_set_shellsize(int width, int height,
int min_width, int min_height,
int base_width, int base_height,
int direction)
int min_width UNUSED, int min_height UNUSED,
int base_width UNUSED, int base_height UNUSED,
int direction UNUSED)
{
#ifndef HAVE_GTK2
/* Hack: When the form already is at the desired size, the window might
@@ -4413,9 +4470,8 @@ gui_mch_get_screen_dimensions(int *screen_w, int *screen_h)
}
#if defined(FEAT_TITLE) || defined(PROTO)
/*ARGSUSED*/
void
gui_mch_settitle(char_u *title, char_u *icon)
gui_mch_settitle(char_u *title, char_u *icon UNUSED)
{
# ifdef HAVE_GTK2
if (title != NULL && output_conv.vc_type != CONV_NONE)
@@ -4493,7 +4549,6 @@ gui_mch_show_toolbar(int showit)
* Get a font structure for highlighting.
* "cbdata" is a pointer to the global gui structure.
*/
/*ARGSUSED*/
static void
font_sel_ok(GtkWidget *wgt, gpointer cbdata)
{
@@ -4509,7 +4564,6 @@ font_sel_ok(GtkWidget *wgt, gpointer cbdata)
gtk_main_quit();
}
/*ARGSUSED*/
static void
font_sel_cancel(GtkWidget *wgt, gpointer cbdata)
{
@@ -4520,7 +4574,6 @@ font_sel_cancel(GtkWidget *wgt, gpointer cbdata)
gtk_main_quit();
}
/*ARGSUSED*/
static void
font_sel_destroy(GtkWidget *wgt, gpointer cbdata)
{
@@ -4620,7 +4673,6 @@ gui_mch_adjust_charheight(void)
/*
* Try to load the requested fontset.
*/
/*ARGSUSED2*/
GuiFontset
gui_mch_get_fontset(char_u *name, int report_error, int fixed_width)
{
@@ -4863,7 +4915,7 @@ get_styled_font_variants(char_u * font_name)
styled_font[1] = &gui.ital_font;
styled_font[2] = &gui.boldital_font;
/* First free whatever was freviously there. */
/* First free whatever was previously there. */
for (i = 0; i < 3; ++i)
if (*styled_font[i])
{
@@ -5012,9 +5064,8 @@ ascii_glyph_table_init(void)
* Initialize Vim to use the font or fontset with the given name.
* Return FAIL if the font could not be loaded, OK otherwise.
*/
/*ARGSUSED1*/
int
gui_mch_init_font(char_u *font_name, int fontset)
gui_mch_init_font(char_u *font_name, int fontset UNUSED)
{
#ifdef HAVE_GTK2
PangoFontDescription *font_desc;
@@ -5326,9 +5377,8 @@ gui_mch_get_font(char_u *name, int report_error)
/*
* Return the name of font "font" in allocated memory.
*/
/*ARGSUSED*/
char_u *
gui_mch_get_fontname(GuiFont font, char_u *name)
gui_mch_get_fontname(GuiFont font, char_u *name UNUSED)
{
# ifdef HAVE_GTK2
if (font != NOFONT)
@@ -5732,7 +5782,7 @@ draw_under(int flags, int row, int col, int cells)
{
int i;
int offset;
const static int val[8] = {1, 0, 0, 0, 1, 2, 2, 2 };
static const int val[8] = {1, 0, 0, 0, 1, 2, 2, 2 };
int y = FILL_Y(row + 1) - 1;
/* Undercurl: draw curl at the bottom of the character cell. */
@@ -6085,12 +6135,15 @@ gui_mch_draw_string(int row, int col, char_u *s, int len, int flags)
# ifdef FEAT_MBYTE
if (enc_utf8)
{
c = utf_ptr2char(p);
int pcc[MAX_MCO];
/* TODO: use the composing characters */
c = utfc_ptr2char_len(p, &pcc, len - (p - s));
if (c >= 0x10000) /* show chars > 0xffff as ? */
c = 0xbf;
buf[textlen].byte1 = c >> 8;
buf[textlen].byte2 = c;
p += utf_ptr2len(p);
p += utfc_ptr2len_len(p, len - (p - s));
width += utf_char2cells(c);
}
else
@@ -6114,8 +6167,8 @@ gui_mch_draw_string(int row, int col, char_u *s, int len, int flags)
if (has_mbyte)
{
width = 0;
for (p = s; p < s + len; p += (*mb_ptr2len)(p))
width += (*mb_ptr2cells)(p);
for (p = s; p < s + len; p += (*mb_ptr2len_len)(p, len - (p - s)))
width += (*mb_ptr2cells_len)(p, len - (p - s));
}
else
# endif
@@ -6402,7 +6455,6 @@ input_timer_cb(gpointer data)
/*
* Callback function, used when data is available on the SNiFF connection.
*/
/* ARGSUSED */
static void
sniff_request_cb(
gpointer data,
@@ -6665,12 +6717,14 @@ clip_mch_request_selection(VimClipboard *cbd)
{
GdkAtom target;
unsigned i;
int nbytes;
char_u *buffer;
time_t start;
for (i = 0; i < N_SELECTION_TARGETS; ++i)
{
#ifdef FEAT_MBYTE
if (!clip_html && selection_targets[i].info == TARGET_HTML)
continue;
#endif
received_selection = RS_NONE;
target = gdk_atom_intern(selection_targets[i].target, FALSE);
@@ -6690,30 +6744,14 @@ clip_mch_request_selection(VimClipboard *cbd)
}
/* Final fallback position - use the X CUT_BUFFER0 store */
nbytes = 0;
buffer = (char_u *)XFetchBuffer(GDK_WINDOW_XDISPLAY(gui.mainwin->window),
&nbytes, 0);
if (nbytes > 0)
{
/* Got something */
clip_yank_selection(MCHAR, buffer, (long)nbytes, cbd);
if (p_verbose > 0)
{
verbose_enter();
smsg((char_u *)_("Used CUT_BUFFER0 instead of empty selection"));
verbose_leave();
}
}
if (buffer != NULL)
XFree(buffer);
yank_cut_buffer0(GDK_WINDOW_XDISPLAY(gui.mainwin->window), cbd);
}
/*
* Disown the selection.
*/
/*ARGSUSED*/
void
clip_mch_lose_selection(VimClipboard *cbd)
clip_mch_lose_selection(VimClipboard *cbd UNUSED)
{
/* WEIRD: when using NULL to actually disown the selection, we lose the
* selection the first time we own it. */
@@ -6741,9 +6779,8 @@ clip_mch_own_selection(VimClipboard *cbd)
* Send the current selection to the clipboard. Do nothing for X because we
* will fill in the selection only when requested by another app.
*/
/*ARGSUSED*/
void
clip_mch_set_selection(VimClipboard *cbd)
clip_mch_set_selection(VimClipboard *cbd UNUSED)
{
}
@@ -6950,7 +6987,7 @@ mch_set_mouse_shape(int shape)
else
id &= ~1; /* they are always even (why?) */
}
else if (shape < sizeof(mshape_ids) / sizeof(int))
else if (shape < (int)(sizeof(mshape_ids) / sizeof(int)))
id = mshape_ids[shape];
else
return;
+50 -71
View File
@@ -117,10 +117,9 @@ static void gui_motif_scroll_colors __ARGS((Widget id));
* Call-back routines.
*/
/* ARGSUSED */
static void
scroll_cb(w, client_data, call_data)
Widget w;
Widget w UNUSED;
XtPointer client_data, call_data;
{
scrollbar_T *sb;
@@ -136,11 +135,11 @@ scroll_cb(w, client_data, call_data)
}
#ifdef FEAT_GUI_TABLINE
/*ARGSUSED*/
static void
tabline_cb(w, client_data, call_data)
Widget w;
XtPointer client_data, call_data;
Widget w UNUSED;
XtPointer client_data UNUSED;
XtPointer call_data;
{
XmNotebookCallbackStruct *nptr;
@@ -149,11 +148,11 @@ tabline_cb(w, client_data, call_data)
send_tabline_event(nptr->page_number);
}
/*ARGSUSED*/
static void
tabline_button_cb(w, client_data, call_data)
Widget w;
XtPointer client_data, call_data;
XtPointer client_data UNUSED;
XtPointer call_data UNUSED;
{
int cmd, tab_idx;
@@ -166,11 +165,10 @@ tabline_button_cb(w, client_data, call_data)
/*
* Tabline single mouse click timeout handler
*/
/*ARGSUSED*/
static void
motif_tabline_timer_cb (timed_out, interval_id)
XtPointer timed_out;
XtIntervalId *interval_id;
XtIntervalId *interval_id UNUSED;
{
*((int *)timed_out) = TRUE;
}
@@ -203,13 +201,12 @@ tabline_scroller_clicked(scroller_name, event)
return FALSE;
}
/*ARGSUSED*/
static void
tabline_menu_cb(w, closure, e, continue_dispatch)
Widget w;
XtPointer closure;
XtPointer closure UNUSED;
XEvent *e;
Boolean *continue_dispatch;
Boolean *continue_dispatch UNUSED;
{
Widget tab_w;
XButtonPressedEvent *event;
@@ -277,11 +274,10 @@ tabline_menu_cb(w, closure, e, continue_dispatch)
XtManageChild(tabLine_menu);
}
/*ARGSUSED*/
static void
tabline_balloon_cb(beval, state)
BalloonEval *beval;
int state;
int state UNUSED;
{
int nr;
tabpage_T *tp;
@@ -642,13 +638,12 @@ gui_x11_destroy_widgets()
#endif
}
/*ARGSUSED*/
void
gui_mch_set_text_area_pos(x, y, w, h)
int x;
int y;
int w;
int h;
int x UNUSED;
int y UNUSED;
int w UNUSED;
int h UNUSED;
{
#ifdef FEAT_TOOLBAR
/* Give keyboard focus to the textArea instead of the toolbar. */
@@ -1261,7 +1256,7 @@ get_toolbar_pixmap(menu, fname)
if (menu->icon_builtin || gui_find_bitmap(menu->name, buf, "xpm") == FAIL)
{
if (menu->iconidx >= 0 && menu->iconidx
< (sizeof(built_in_pixmaps) / sizeof(built_in_pixmaps[0])))
< (int)(sizeof(built_in_pixmaps) / sizeof(built_in_pixmaps[0])))
xpm = built_in_pixmaps[menu->iconidx];
else
xpm = tb_blank_xpm;
@@ -1716,10 +1711,9 @@ gui_mch_destroy_menu(menu)
}
}
/* ARGSUSED */
void
gui_mch_show_popupmenu(menu)
vimmenu_T *menu;
vimmenu_T *menu UNUSED;
{
#ifdef MOTIF_POPUP
XmMenuPosition(menu->submenu_id, gui_x11_get_last_mouse_event());
@@ -2046,9 +2040,8 @@ do_mnemonic(Widget w, unsigned int keycode)
/*
* Callback routine for dialog mnemonic processing.
*/
/*ARGSUSED*/
static void
mnemonic_event(Widget w, XtPointer call_data, XKeyEvent *event)
mnemonic_event(Widget w, XtPointer call_data UNUSED, XKeyEvent *event)
{
do_mnemonic(w, event->keycode);
}
@@ -2287,13 +2280,12 @@ set_predefined_fontlist(parent, name)
* Put up a file requester.
* Returns the selected name in allocated memory, or NULL for Cancel.
*/
/* ARGSUSED */
char_u *
gui_mch_browse(saving, title, dflt, ext, initdir, filter)
int saving; /* select file to write */
int saving UNUSED; /* select file to write */
char_u *title; /* title for the window */
char_u *dflt; /* default name */
char_u *ext; /* not used (extension added) */
char_u *ext UNUSED; /* not used (extension added) */
char_u *initdir; /* initial directory, NULL for current dir */
char_u *filter; /* file name filter */
{
@@ -2413,12 +2405,11 @@ gui_mch_browse(saving, title, dflt, ext, initdir, filter)
/*
* Process callback from Dialog cancel actions.
*/
/* ARGSUSED */
static void
DialogCancelCB(w, client_data, call_data)
Widget w; /* widget id */
XtPointer client_data; /* data from application */
XtPointer call_data; /* data from widget class */
Widget w UNUSED; /* widget id */
XtPointer client_data UNUSED; /* data from application */
XtPointer call_data UNUSED; /* data from widget class */
{
if (browse_fname != NULL)
{
@@ -2431,12 +2422,11 @@ DialogCancelCB(w, client_data, call_data)
/*
* Process callback from Dialog actions.
*/
/* ARGSUSED */
static void
DialogAcceptCB(w, client_data, call_data)
Widget w; /* widget id */
XtPointer client_data; /* data from application */
XtPointer call_data; /* data from widget class */
Widget w UNUSED; /* widget id */
XtPointer client_data UNUSED; /* data from application */
XtPointer call_data; /* data from widget class */
{
XmFileSelectionBoxCallbackStruct *fcb;
@@ -2467,13 +2457,12 @@ static void butproc __ARGS((Widget w, XtPointer client_data, XtPointer call_data
* Callback function for the textfield. When CR is hit this works like
* hitting the "OK" button, ESC like "Cancel".
*/
/* ARGSUSED */
static void
keyhit_callback(w, client_data, event, cont)
Widget w;
XtPointer client_data;
XtPointer client_data UNUSED;
XEvent *event;
Boolean *cont;
Boolean *cont UNUSED;
{
char buf[2];
KeySym key_sym;
@@ -2490,12 +2479,11 @@ keyhit_callback(w, client_data, event, cont)
XmTextFieldClearSelection(w, XtLastTimestampProcessed(gui.dpy));
}
/* ARGSUSED */
static void
butproc(w, client_data, call_data)
Widget w;
Widget w UNUSED;
XtPointer client_data;
XtPointer call_data;
XtPointer call_data UNUSED;
{
dialogStatus = (int)(long)client_data + 1;
}
@@ -2567,10 +2555,9 @@ create_pixmap_label(parent, name, data, args, arg)
}
#endif
/* ARGSUSED */
int
gui_mch_dialog(type, title, message, button_names, dfltbutton, textfield)
int type;
int type UNUSED;
char_u *title;
char_u *message;
char_u *button_names;
@@ -3197,7 +3184,7 @@ gui_mch_compute_toolbar_height()
XmNchildren, &children,
XmNnumChildren, &numChildren, NULL);
borders += tst + tmh;
for (i = 0; i < numChildren; i++)
for (i = 0; i < (int)numChildren; i++)
{
whgt = 0;
XtVaGetValues(children[i], XmNheight, &whgt, NULL);
@@ -3237,13 +3224,12 @@ motif_get_toolbar_colors(bgp, fgp, bsp, tsp, hsp)
* I have to use footer help for backwards compatability. Hopefully both will
* get implemented and the user will have a choice.
*/
/*ARGSUSED*/
static void
toolbarbutton_enter_cb(w, client_data, event, cont)
Widget w;
Widget w UNUSED;
XtPointer client_data;
XEvent *event;
Boolean *cont;
XEvent *event UNUSED;
Boolean *cont UNUSED;
{
vimmenu_T *menu = (vimmenu_T *) client_data;
@@ -3254,13 +3240,12 @@ toolbarbutton_enter_cb(w, client_data, event, cont)
}
}
/*ARGSUSED*/
static void
toolbarbutton_leave_cb(w, client_data, event, cont)
Widget w;
XtPointer client_data;
XEvent *event;
Boolean *cont;
Widget w UNUSED;
XtPointer client_data UNUSED;
XEvent *event UNUSED;
Boolean *cont UNUSED;
{
gui_mch_set_footer((char_u *) "");
}
@@ -3492,10 +3477,9 @@ gui_motif_scroll_colors(id)
/*
* Set the fontlist for Widget "id" to use gui.menu_fontset or gui.menu_font.
*/
/*ARGSUSED*/
void
gui_motif_menu_fontlist(id)
Widget id;
Widget id UNUSED;
{
#ifdef FEAT_MENU
#ifdef FONTSET_ALWAYS
@@ -3566,8 +3550,8 @@ typedef struct _SharedFindReplace
Widget cancel;
} SharedFindReplace;
static SharedFindReplace find_widgets = { NULL };
static SharedFindReplace repl_widgets = { NULL };
static SharedFindReplace find_widgets = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
static SharedFindReplace repl_widgets = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
static void find_replace_destroy_callback __ARGS((Widget w, XtPointer client_data, XtPointer call_data));
static void find_replace_dismiss_callback __ARGS((Widget w, XtPointer client_data, XtPointer call_data));
@@ -3576,12 +3560,11 @@ static void find_replace_callback __ARGS((Widget w, XtPointer client_data, XtPoi
static void find_replace_keypress __ARGS((Widget w, SharedFindReplace * frdp, XKeyEvent * event));
static void find_replace_dialog_create __ARGS((char_u *entry_text, int do_replace));
/*ARGSUSED*/
static void
find_replace_destroy_callback(w, client_data, call_data)
Widget w;
Widget w UNUSED;
XtPointer client_data;
XtPointer call_data;
XtPointer call_data UNUSED;
{
SharedFindReplace *cd = (SharedFindReplace *)client_data;
@@ -3590,12 +3573,11 @@ find_replace_destroy_callback(w, client_data, call_data)
cd->dialog = (Widget)0;
}
/*ARGSUSED*/
static void
find_replace_dismiss_callback(w, client_data, call_data)
Widget w;
Widget w UNUSED;
XtPointer client_data;
XtPointer call_data;
XtPointer call_data UNUSED;
{
SharedFindReplace *cd = (SharedFindReplace *)client_data;
@@ -3603,22 +3585,20 @@ find_replace_dismiss_callback(w, client_data, call_data)
XtUnmanageChild(cd->dialog);
}
/*ARGSUSED*/
static void
entry_activate_callback(w, client_data, call_data)
Widget w;
Widget w UNUSED;
XtPointer client_data;
XtPointer call_data;
XtPointer call_data UNUSED;
{
XmProcessTraversal((Widget)client_data, XmTRAVERSE_CURRENT);
}
/*ARGSUSED*/
static void
find_replace_callback(w, client_data, call_data)
Widget w;
Widget w UNUSED;
XtPointer client_data;
XtPointer call_data;
XtPointer call_data UNUSED;
{
long_u flags = (long_u)client_data;
char *find_text, *repl_text;
@@ -3668,10 +3648,9 @@ find_replace_callback(w, client_data, call_data)
XtFree(repl_text);
}
/*ARGSUSED*/
static void
find_replace_keypress(w, frdp, event)
Widget w;
Widget w UNUSED;
SharedFindReplace *frdp;
XKeyEvent *event;
{
+6 -1
View File
@@ -838,7 +838,12 @@ gui_ph_handle_window_open(
static void
gui_ph_draw_start( void )
{
PhGC_t *gc;
gc = PgGetGC();
PgSetRegion( PtWidgetRid( PtFindDisjoint( gui.vimTextArea ) ) );
PgClearClippingsCx( gc );
PgClearTranslationCx( gc );
PtWidgetOffset( gui.vimTextArea, &gui_ph_raw_offset );
PhTranslatePoint( &gui_ph_raw_offset, PtWidgetPos( gui.vimTextArea, NULL ) );
@@ -2970,7 +2975,7 @@ gui_mch_init_font(char_u *vim_font_name, int fontset)
if( vim_font_name == NULL )
{
/* Default font */
vim_font_name = "PC Term";
vim_font_name = "PC Terminal";
}
if( STRCMP( vim_font_name, "*" ) == 0 )
+54 -69
View File
@@ -570,22 +570,20 @@ static char **gui_argv = NULL;
* Call-back routines.
*/
/* ARGSUSED */
static void
gui_x11_timer_cb(timed_out, interval_id)
XtPointer timed_out;
XtIntervalId *interval_id;
XtIntervalId *interval_id UNUSED;
{
*((int *)timed_out) = TRUE;
}
/* ARGSUSED */
static void
gui_x11_visibility_cb(w, dud, event, dum)
Widget w;
XtPointer dud;
Widget w UNUSED;
XtPointer dud UNUSED;
XEvent *event;
Boolean *dum;
Boolean *dum UNUSED;
{
if (event->type != VisibilityNotify)
return;
@@ -603,13 +601,12 @@ gui_x11_visibility_cb(w, dud, event, dum)
gui_mch_update();
}
/* ARGSUSED */
static void
gui_x11_expose_cb(w, dud, event, dum)
Widget w;
XtPointer dud;
Widget w UNUSED;
XtPointer dud UNUSED;
XEvent *event;
Boolean *dum;
Boolean *dum UNUSED;
{
XExposeEvent *gevent;
int new_x;
@@ -680,13 +677,12 @@ shellRectangle(Widget shell, XRectangle *r)
}
#endif
/* ARGSUSED */
static void
gui_x11_resize_window_cb(w, dud, event, dum)
Widget w;
XtPointer dud;
Widget w UNUSED;
XtPointer dud UNUSED;
XEvent *event;
Boolean *dum;
Boolean *dum UNUSED;
{
static int lastWidth, lastHeight;
@@ -727,35 +723,32 @@ gui_x11_resize_window_cb(w, dud, event, dum)
#endif
}
/* ARGSUSED */
static void
gui_x11_focus_change_cb(w, data, event, dum)
Widget w;
XtPointer data;
Widget w UNUSED;
XtPointer data UNUSED;
XEvent *event;
Boolean *dum;
Boolean *dum UNUSED;
{
gui_focus_change(event->type == FocusIn);
}
/* ARGSUSED */
static void
gui_x11_enter_cb(w, data, event, dum)
Widget w;
XtPointer data;
XEvent *event;
Boolean *dum;
Widget w UNUSED;
XtPointer data UNUSED;
XEvent *event UNUSED;
Boolean *dum UNUSED;
{
gui_focus_change(TRUE);
}
/* ARGSUSED */
static void
gui_x11_leave_cb(w, data, event, dum)
Widget w;
XtPointer data;
XEvent *event;
Boolean *dum;
Widget w UNUSED;
XtPointer data UNUSED;
XEvent *event UNUSED;
Boolean *dum UNUSED;
{
gui_focus_change(FALSE);
}
@@ -766,13 +759,12 @@ gui_x11_leave_cb(w, data, event, dum)
# endif
#endif
/* ARGSUSED */
void
gui_x11_key_hit_cb(w, dud, event, dum)
Widget w;
XtPointer dud;
Widget w UNUSED;
XtPointer dud UNUSED;
XEvent *event;
Boolean *dum;
Boolean *dum UNUSED;
{
XKeyPressedEvent *ev_press;
#ifdef FEAT_XIM
@@ -1078,13 +1070,12 @@ theend:
#endif
}
/* ARGSUSED */
static void
gui_x11_mouse_cb(w, dud, event, dum)
Widget w;
XtPointer dud;
Widget w UNUSED;
XtPointer dud UNUSED;
XEvent *event;
Boolean *dum;
Boolean *dum UNUSED;
{
static XtIntervalId timer = (XtIntervalId)0;
static int timed_out = TRUE;
@@ -1210,11 +1201,11 @@ gui_mch_prepare(argc, argv)
while (arg < *argc)
{
/* Look for argv[arg] in cmdline_options[] table */
for (i = 0; i < XtNumber(cmdline_options); i++)
for (i = 0; i < (int)XtNumber(cmdline_options); i++)
if (strcmp(argv[arg], cmdline_options[i].option) == 0)
break;
if (i < XtNumber(cmdline_options))
if (i < (int)XtNumber(cmdline_options))
{
/* Remember finding "-rv" or "-reverse" */
if (strcmp("-rv", argv[arg]) == 0
@@ -1319,12 +1310,11 @@ static XtInputId _xsmp_xtinputid;
static void local_xsmp_handle_requests __ARGS((XtPointer c, int *s, XtInputId *i));
/*ARGSUSED*/
static void
local_xsmp_handle_requests(c, s, i)
XtPointer c;
int *s;
XtInputId *i;
XtPointer c UNUSED;
int *s UNUSED;
XtInputId *i UNUSED;
{
if (xsmp_handle_requests() == FAIL)
XtRemoveInput(_xsmp_xtinputid);
@@ -1438,7 +1428,7 @@ gui_mch_init()
Columns = w;
if (mask & HeightValue)
{
if (p_window > h - 1 || !option_was_set((char_u *)"window"))
if (p_window > (long)h - 1 || !option_was_set((char_u *)"window"))
p_window = h - 1;
Rows = h;
}
@@ -1753,10 +1743,9 @@ gui_init_menu_font()
}
#endif
/*ARGSUSED*/
void
gui_mch_exit(rc)
int rc;
int rc UNUSED;
{
#if 0
/* Lesstif gives an error message here, and so does Solaris. The man page
@@ -1799,7 +1788,6 @@ gui_mch_set_winpos(x, y)
NULL);
}
/*ARGSUSED*/
void
gui_mch_set_shellsize(width, height, min_width, min_height,
base_width, base_height, direction)
@@ -1809,7 +1797,7 @@ gui_mch_set_shellsize(width, height, min_width, min_height,
int min_height;
int base_width;
int base_height;
int direction;
int direction UNUSED;
{
#ifdef FEAT_XIM
height += xim_get_status_area_height(),
@@ -1847,11 +1835,10 @@ gui_mch_get_screen_dimensions(screen_w, screen_h)
* If "fontset" is TRUE, load the "font_name" as a fontset.
* Return FAIL if the font could not be loaded, OK otherwise.
*/
/*ARGSUSED*/
int
gui_mch_init_font(font_name, do_fontset)
char_u *font_name;
int do_fontset;
int do_fontset UNUSED;
{
XFontStruct *font = NULL;
@@ -2029,10 +2016,9 @@ gui_mch_get_font(name, giveErrorIfMissing)
* Return the name of font "font" in allocated memory.
* Don't know how to get the actual name, thus use the provided name.
*/
/*ARGSUSED*/
char_u *
gui_mch_get_fontname(font, name)
GuiFont font;
GuiFont font UNUSED;
char_u *name;
{
if (name == NULL)
@@ -2521,7 +2507,7 @@ draw_curl(row, col, cells)
{
int i;
int offset;
const static int val[8] = {1, 0, 0, 0, 1, 2, 2, 2 };
static const int val[8] = {1, 0, 0, 0, 1, 2, 2, 2 };
XSetForeground(gui.dpy, gui.text_gc, prev_sp_color);
for (i = FILL_X(col); i < FILL_X(col + cells); ++i)
@@ -2569,8 +2555,10 @@ gui_mch_draw_string(row, col, s, len, flags)
# ifdef FEAT_XFONTSET
if (current_fontset != NULL)
{
if (c >= 0x10000 && sizeof(wchar_t) <= 2)
# ifdef SMALL_WCHAR_T
if (c >= 0x10000)
c = 0xbf; /* show chars > 0xffff as ? */
# endif
((wchar_t *)buf)[wlen] = c;
}
else
@@ -3136,11 +3124,11 @@ gui_mch_draw_menubar()
/* Nothing to do in X */
}
/* ARGSUSED */
void
gui_x11_menu_cb(w, client_data, call_data)
Widget w;
XtPointer client_data, call_data;
Widget w UNUSED;
XtPointer client_data;
XtPointer call_data UNUSED;
{
gui_menu_cb((vimmenu_T *)client_data);
}
@@ -3153,13 +3141,12 @@ gui_x11_menu_cb(w, client_data, call_data)
* Function called when window closed. Works like ":qa".
* Should put up a requester!
*/
/*ARGSUSED*/
static void
gui_x11_wm_protocol_handler(w, client_data, event, dum)
Widget w;
XtPointer client_data;
Widget w UNUSED;
XtPointer client_data UNUSED;
XEvent *event;
Boolean *dum;
Boolean *dum UNUSED;
{
/*
* Only deal with Client messages.
@@ -3172,7 +3159,7 @@ gui_x11_wm_protocol_handler(w, client_data, event, dum)
* exit. That can be cancelled though, thus Vim shouldn't exit here.
* Just sync our swap files.
*/
if (((XClientMessageEvent *)event)->data.l[0] ==
if ((Atom)((XClientMessageEvent *)event)->data.l[0] ==
wm_atoms[SAVE_YOURSELF_IDX])
{
out_flush();
@@ -3185,7 +3172,7 @@ gui_x11_wm_protocol_handler(w, client_data, event, dum)
return;
}
if (((XClientMessageEvent *)event)->data.l[0] !=
if ((Atom)((XClientMessageEvent *)event)->data.l[0] !=
wm_atoms[DELETE_WINDOW_IDX])
return;
@@ -3196,13 +3183,12 @@ gui_x11_wm_protocol_handler(w, client_data, event, dum)
/*
* Function called when property changed. Check for incoming commands
*/
/*ARGSUSED*/
static void
gui_x11_send_event_handler(w, client_data, event, dum)
Widget w;
XtPointer client_data;
Widget w UNUSED;
XtPointer client_data UNUSED;
XEvent *event;
Boolean *dum;
Boolean *dum UNUSED;
{
XPropertyEvent *e = (XPropertyEvent *) event;
@@ -3277,11 +3263,10 @@ gui_mch_start_blink()
}
}
/* ARGSUSED */
static void
gui_x11_blink_cb(timed_out, interval_id)
XtPointer timed_out;
XtIntervalId *interval_id;
XtPointer timed_out UNUSED;
XtIntervalId *interval_id UNUSED;
{
if (blink_state == BLINK_ON)
{
+8 -12
View File
@@ -448,7 +448,7 @@ fill_lists(enum ListSpecifier fix, SharedFontSelData *data)
items[i] = XmStringCreateLocalized(list[ENCODING][i]);
if (i < n_items)
if (i < (int)n_items)
{
/* recycle old button */
XtVaSetValues(children[i],
@@ -481,7 +481,7 @@ fill_lists(enum ListSpecifier fix, SharedFontSelData *data)
/* Destroy all the outstanding menu items.
*/
for (i = count[ENCODING]; i < n_items; ++i)
for (i = count[ENCODING]; i < (int)n_items; ++i)
{
XtUnmanageChild(children[i]);
XtDestroyWidget(children[i]);
@@ -544,9 +544,8 @@ fill_lists(enum ListSpecifier fix, SharedFontSelData *data)
}
}
/*ARGSUSED*/
static void
stoggle_callback(Widget w,
stoggle_callback(Widget w UNUSED,
SharedFontSelData *data,
XmToggleButtonCallbackStruct *call_data)
{
@@ -709,11 +708,10 @@ do_choice(Widget w,
}
}
/*ARGSUSED*/
static void
encoding_callback(Widget w,
SharedFontSelData *data,
XtPointer dummy)
XtPointer dummy UNUSED)
{
XmString str;
XmListCallbackStruct fake_data;
@@ -752,11 +750,10 @@ size_callback(Widget w,
do_choice(w, data, call_data, SIZE);
}
/*ARGSUSED*/
static void
cancel_callback(Widget w,
cancel_callback(Widget w UNUSED,
SharedFontSelData *data,
XmListCallbackStruct *call_data)
XmListCallbackStruct *call_data UNUSED)
{
if (data->sel[ENCODING])
{
@@ -789,11 +786,10 @@ cancel_callback(Widget w,
data->exit = True;
}
/*ARGSUSED*/
static void
ok_callback(Widget w,
ok_callback(Widget w UNUSED,
SharedFontSelData *data,
XmPushButtonCallbackStruct *call_data)
XmPushButtonCallbackStruct *call_data UNUSED)
{
char *pattern;
char **name;
+20 -14
View File
@@ -235,13 +235,12 @@ bump_color(unsigned short value)
return tmp;
}
/*ARGSUSED*/
static int
alloc_color(Display *display,
Colormap colormap,
char *colorname,
XColor *xcolor,
void *closure)
void *closure UNUSED)
{
int status;
@@ -595,9 +594,10 @@ draw_unhighlight(XmEnhancedButtonWidget eb)
XtHeight(eb), eb->primitive.highlight_thickness);
}
/*ARGSUSED*/
static void
draw_pixmap(XmEnhancedButtonWidget eb, XEvent *event, Region region)
draw_pixmap(XmEnhancedButtonWidget eb,
XEvent *event UNUSED,
Region region UNUSED)
{
Pixmap pix;
GC gc = eb->label.normal_GC;
@@ -641,7 +641,7 @@ draw_pixmap(XmEnhancedButtonWidget eb, XEvent *event, Region region)
height = eb->core.height - 2 * y;
if (h < height)
height = h;
if (depth == eb->core.depth)
if (depth == (int)eb->core.depth)
XCopyArea(XtDisplay(eb), pix, XtWindow(eb), gc, 0, 0,
width, height, x, y);
else if (depth == 1)
@@ -731,9 +731,11 @@ draw_label(XmEnhancedButtonWidget eb, XEvent *event, Region region)
eb->label.normal_GC = tmp_gc;
}
/*ARGSUSED*/
static void
Enter(Widget wid, XEvent *event, String *params, Cardinal *num_params)
Enter(Widget wid,
XEvent *event,
String *params UNUSED,
Cardinal *num_params UNUSED)
{
XmEnhancedButtonWidget eb = (XmEnhancedButtonWidget) wid;
XmPushButtonCallbackStruct call_value;
@@ -818,9 +820,11 @@ Enter(Widget wid, XEvent *event, String *params, Cardinal *num_params)
}
}
/*ARGSUSED*/
static void
Leave(Widget wid, XEvent *event, String *params, Cardinal *num_params)
Leave(Widget wid,
XEvent *event,
String *params UNUSED,
Cardinal *num_params UNUSED)
{
XmEnhancedButtonWidget eb = (XmEnhancedButtonWidget)wid;
XmPushButtonCallbackStruct call_value;
@@ -976,9 +980,8 @@ set_size(XmEnhancedButtonWidget newtb)
}
}
/*ARGSUSED*/
static void
Initialize(Widget rq, Widget ebw, ArgList args, Cardinal *n)
Initialize(Widget rq, Widget ebw, ArgList args UNUSED, Cardinal *n UNUSED)
{
XmEnhancedButtonWidget request = (XmEnhancedButtonWidget)rq;
XmEnhancedButtonWidget eb = (XmEnhancedButtonWidget)ebw;
@@ -1056,9 +1059,12 @@ Destroy(Widget w)
free_pixmaps((XmEnhancedButtonWidget)w);
}
/*ARGSUSED*/
static Boolean
SetValues(Widget current, Widget request, Widget new, ArgList args, Cardinal *n)
SetValues(Widget current,
Widget request UNUSED,
Widget new,
ArgList args UNUSED,
Cardinal *n UNUSED)
{
XmEnhancedButtonWidget cur = (XmEnhancedButtonWidget) current;
XmEnhancedButtonWidget eb = (XmEnhancedButtonWidget) new;
@@ -1108,7 +1114,7 @@ SetValues(Widget current, Widget request, Widget new, ArgList args, Cardinal *n)
if ((win_x < 0) || (win_y < 0))
return False;
if ((win_x > r_width) || (win_y > r_height))
if ((win_x > (int)r_width) || (win_y > (int)r_height))
return False;
draw_highlight(eb);
draw_shadows(eb);
+7 -1
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
<assemblyIdentity
processorArchitecture="*"
version="7.2.0.0"
@@ -29,4 +29,10 @@
</requestedPrivileges>
</security>
</trustInfo>
<!-- Vista High DPI aware -->
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>
+7 -11
View File
@@ -442,12 +442,11 @@ prt_get_unit(idx)
/*
* Print the page header.
*/
/*ARGSUSED*/
static void
prt_header(psettings, pagenum, lnum)
prt_settings_T *psettings;
int pagenum;
linenr_T lnum;
linenr_T lnum UNUSED;
{
int width = psettings->chars_per_line;
int page_line;
@@ -1881,7 +1880,7 @@ prt_next_dsc(p_dsc_line)
return FALSE;
/* Find type of DSC comment */
for (comment = 0; comment < NUM_ELEMENTS(prt_dsc_table); comment++)
for (comment = 0; comment < (int)NUM_ELEMENTS(prt_dsc_table); comment++)
if (prt_resfile_strncmp(0, prt_dsc_table[comment].string,
prt_dsc_table[comment].len) == 0)
break;
@@ -2454,12 +2453,11 @@ prt_match_charset(p_charset, p_cmap, pp_mbchar)
}
#endif
/*ARGSUSED*/
int
mch_print_init(psettings, jobname, forceit)
prt_settings_T *psettings;
char_u *jobname;
int forceit;
int forceit UNUSED;
{
int i;
char *paper_name;
@@ -2514,7 +2512,7 @@ mch_print_init(psettings, jobname, forceit)
if (!(props & ENC_8BIT) && ((*p_pmcs != NUL) || !(props & ENC_UNICODE)))
{
p_mbenc_first = NULL;
for (cmap = 0; cmap < NUM_ELEMENTS(prt_ps_mbfonts); cmap++)
for (cmap = 0; cmap < (int)NUM_ELEMENTS(prt_ps_mbfonts); cmap++)
if (prt_match_encoding((char *)p_encoding, &prt_ps_mbfonts[cmap],
&p_mbenc))
{
@@ -2642,7 +2640,7 @@ mch_print_init(psettings, jobname, forceit)
paper_name = "A4";
paper_strlen = 2;
}
for (i = 0; i < PRT_MEDIASIZE_LEN; ++i)
for (i = 0; i < (int)PRT_MEDIASIZE_LEN; ++i)
if (STRLEN(prt_mediasize[i].name) == (unsigned)paper_strlen
&& STRNICMP(prt_mediasize[i].name, paper_name,
paper_strlen) == 0)
@@ -3308,10 +3306,9 @@ mch_print_end_page()
return !prt_file_error;
}
/*ARGSUSED*/
int
mch_print_begin_page(str)
char_u *str;
char_u *str UNUSED;
{
int page_num[2];
@@ -3379,11 +3376,10 @@ mch_print_start_line(margin, page_line)
#endif
}
/*ARGSUSED*/
int
mch_print_text_out(p, len)
char_u *p;
int len;
int len UNUSED;
{
int need_break;
char_u ch;
+87 -75
View File
@@ -46,7 +46,6 @@ static void cs_fill_results __ARGS((char *, int , int *, char ***,
static int cs_find __ARGS((exarg_T *eap));
static int cs_find_common __ARGS((char *opt, char *pat, int, int, int));
static int cs_help __ARGS((exarg_T *eap));
static void cs_init __ARGS((void));
static void clear_csinfo __ARGS((int i));
static int cs_insert_filelist __ARGS((char *, char *, char *,
struct stat *));
@@ -66,7 +65,10 @@ static char * cs_resolve_file __ARGS((int, char *));
static int cs_show __ARGS((exarg_T *eap));
static csinfo_T csinfo[CSCOPE_MAX_CONNECTIONS];
static csinfo_T * csinfo = NULL;
static int csinfo_size = 0; /* number of items allocated in
csinfo[] */
static int eap_arg_len; /* length of eap->arg, set in
cs_lookup_cmd() */
static cscmd_T cs_cmds[] =
@@ -83,7 +85,7 @@ static cscmd_T cs_cmds[] =
N_("Reinit all connections"), "reset", 0 },
{ "show", cs_show,
N_("Show connections"), "show", 0 },
{ NULL }
{ NULL, NULL, NULL, NULL, 0 }
};
static void
@@ -98,6 +100,7 @@ cs_usage_msg(x)
static enum
{
EXP_CSCOPE_SUBCMD, /* expand ":cscope" sub-commands */
EXP_SCSCOPE_SUBCMD, /* expand ":scscope" sub-commands */
EXP_CSCOPE_FIND, /* expand ":cscope find" arguments */
EXP_CSCOPE_KILL /* expand ":cscope kill" arguments */
} expand_what;
@@ -106,18 +109,28 @@ static enum
* Function given to ExpandGeneric() to obtain the cscope command
* expansion.
*/
/*ARGSUSED*/
char_u *
get_cscope_name(xp, idx)
expand_T *xp;
expand_T *xp UNUSED;
int idx;
{
int current_idx;
int i;
switch (expand_what)
{
case EXP_CSCOPE_SUBCMD:
/* Complete with sub-commands of ":cscope":
* add, find, help, kill, reset, show */
return (char_u *)cs_cmds[idx].name;
case EXP_SCSCOPE_SUBCMD:
/* Complete with sub-commands of ":scscope": same sub-commands as
* ":cscope" but skip commands which don't support split windows */
for (i = 0, current_idx = 0; cs_cmds[i].name != NULL; i++)
if (cs_cmds[i].cansplit)
if (current_idx++ == idx)
break;
return (char_u *)cs_cmds[i].name;
case EXP_CSCOPE_FIND:
{
const char *query_type[] =
@@ -133,25 +146,20 @@ get_cscope_name(xp, idx)
}
case EXP_CSCOPE_KILL:
{
int i;
int current_idx = 0;
static char_u connection[2];
static char connection[5];
/* ":cscope kill" accepts connection numbers or partial names of
* the pathname of the cscope database as argument. Only complete
* with connection numbers. -1 can also be used to kill all
* connections. */
for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++)
for (i = 0, current_idx = 0; i < csinfo_size; i++)
{
if (csinfo[i].fname == NULL)
continue;
if (current_idx++ == idx)
{
/* Connection number fits in one character since
* CSCOPE_MAX_CONNECTIONS is < 10 */
connection[0] = i + '0';
connection[1] = NUL;
return connection;
vim_snprintf(connection, sizeof(connection), "%d", i);
return (char_u *)connection;
}
}
return (current_idx == idx && idx > 0) ? (char_u *)"-1" : NULL;
@@ -165,16 +173,18 @@ get_cscope_name(xp, idx)
* Handle command line completion for :cscope command.
*/
void
set_context_in_cscope_cmd(xp, arg)
set_context_in_cscope_cmd(xp, arg, cmdidx)
expand_T *xp;
char_u *arg;
cmdidx_T cmdidx;
{
char_u *p;
/* Default: expand subcommands */
xp->xp_context = EXPAND_CSCOPE;
expand_what = EXP_CSCOPE_SUBCMD;
xp->xp_pattern = arg;
expand_what = (cmdidx == CMD_scscope)
? EXP_SCSCOPE_SUBCMD : EXP_CSCOPE_SUBCMD;
/* (part of) subcommand already typed */
if (*arg != NUL)
@@ -212,7 +222,6 @@ do_cscope_general(eap, make_split)
{
cscmd_T *cmdp;
cs_init();
if ((cmdp = cs_lookup_cmd(eap)) == NULL)
{
cs_help(eap);
@@ -273,8 +282,6 @@ do_cstag(eap)
{
int ret = FALSE;
cs_init();
if (*eap->arg == NUL)
{
(void)EMSG(_("E562: Usage: cstag <ident>"));
@@ -430,7 +437,7 @@ cs_connection(num, dbpath, ppath)
if (num < 0 || num > 4 || (num > 0 && !dbpath))
return FALSE;
for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++)
for (i = 0; i < csinfo_size; i++)
{
if (!csinfo[i].fname)
continue;
@@ -484,10 +491,9 @@ cs_connection(num, dbpath, ppath)
*
* MAXPATHL 256
*/
/* ARGSUSED */
static int
cs_add(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
char *fname, *ppath, *flags = NULL;
@@ -674,7 +680,7 @@ cs_cnt_connections()
short i;
short cnt = 0;
for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++)
for (i = 0; i < csinfo_size; i++)
{
if (csinfo[i].fname != NULL)
cnt++;
@@ -982,7 +988,7 @@ err_closing:
vim_free(ppath);
#if defined(UNIX)
if (execl("/bin/sh", "sh", "-c", cmd, NULL) == -1)
if (execl("/bin/sh", "sh", "-c", cmd, (char *)NULL) == -1)
PERROR(_("cs_create_connection exec failed"));
exit(127);
@@ -1102,7 +1108,8 @@ cs_find_common(opt, pat, forceit, verbose, use_ll)
{
int i;
char *cmd;
int nummatches[CSCOPE_MAX_CONNECTIONS], totmatches;
int *nummatches;
int totmatches;
#ifdef FEAT_QUICKFIX
char cmdletter;
char *qfpos;
@@ -1113,13 +1120,17 @@ cs_find_common(opt, pat, forceit, verbose, use_ll)
if (cmd == NULL)
return FALSE;
nummatches = (int *)alloc(sizeof(int)*csinfo_size);
if (nummatches == NULL)
return FALSE;
/* send query to all open connections, then count the total number
* of matches so we can alloc matchesp all in one swell foop
*/
for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++)
for (i = 0; i < csinfo_size; i++)
nummatches[i] = 0;
totmatches = 0;
for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++)
for (i = 0; i < csinfo_size; i++)
{
if (csinfo[i].fname == NULL || csinfo[i].to_fp == NULL)
continue;
@@ -1144,7 +1155,10 @@ cs_find_common(opt, pat, forceit, verbose, use_ll)
char *buf;
if (!verbose)
{
vim_free(nummatches);
return FALSE;
}
buf = (char *)alloc((unsigned)(strlen(opt) + strlen(pat) + strlen(nf)));
if (buf == NULL)
@@ -1155,6 +1169,7 @@ cs_find_common(opt, pat, forceit, verbose, use_ll)
(void)EMSG(buf);
vim_free(buf);
}
vim_free(nummatches);
return FALSE;
}
@@ -1207,6 +1222,7 @@ cs_find_common(opt, pat, forceit, verbose, use_ll)
(void)EMSG(buf);
vim_free(buf);
}
vim_free(nummatches);
return FALSE;
}
}
@@ -1254,6 +1270,7 @@ cs_find_common(opt, pat, forceit, verbose, use_ll)
}
mch_remove(tmp);
vim_free(tmp);
vim_free(nummatches);
return TRUE;
}
else
@@ -1265,6 +1282,7 @@ cs_find_common(opt, pat, forceit, verbose, use_ll)
/* read output */
cs_fill_results((char *)pat, totmatches, nummatches, &matches,
&contexts, &matched);
vim_free(nummatches);
if (matches == NULL)
return FALSE;
@@ -1280,10 +1298,9 @@ cs_find_common(opt, pat, forceit, verbose, use_ll)
*
* print help
*/
/* ARGSUSED */
static int
cs_help(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
cscmd_T *cmdp = cs_cmds;
@@ -1319,26 +1336,6 @@ cs_help(eap)
} /* cs_help */
/*
* PRIVATE: cs_init
*
* initialize cscope structure if not already
*/
static void
cs_init()
{
short i;
static int init_already = FALSE;
if (init_already)
return;
for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++)
clear_csinfo(i);
init_already = TRUE;
} /* cs_init */
static void
clear_csinfo(i)
int i;
@@ -1387,13 +1384,12 @@ GetWin32Error()
*
* insert a new cscope database filename into the filelist
*/
/*ARGSUSED*/
static int
cs_insert_filelist(fname, ppath, flags, sb)
char *fname;
char *ppath;
char *flags;
struct stat *sb;
struct stat *sb UNUSED;
{
short i, j;
#ifndef UNIX
@@ -1436,7 +1432,7 @@ cs_insert_filelist(fname, ppath, flags, sb)
#endif
i = -1; /* can be set to the index of an empty item in csinfo */
for (j = 0; j < CSCOPE_MAX_CONNECTIONS; j++)
for (j = 0; j < csinfo_size; j++)
{
if (csinfo[j].fname != NULL
#if defined(UNIX)
@@ -1463,9 +1459,25 @@ cs_insert_filelist(fname, ppath, flags, sb)
if (i == -1)
{
if (p_csverbose)
(void)EMSG(_("E569: maximum number of cscope connections reached"));
return -1;
i = csinfo_size;
if (csinfo_size == 0)
{
/* First time allocation: allocate only 1 connection. It should
* be enough for most users. If more is needed, csinfo will be
* reallocated. */
csinfo_size = 1;
csinfo = (csinfo_T *)alloc_clear(sizeof(csinfo_T));
}
else
{
/* Reallocate space for more connections. */
csinfo_size *= 2;
csinfo = vim_realloc(csinfo, sizeof(csinfo_T)*csinfo_size);
}
if (csinfo == NULL)
return -1;
for (j = csinfo_size/2; j < csinfo_size; j++)
clear_csinfo(j);
}
if ((csinfo[i].fname = (char *)alloc((unsigned)strlen(fname)+1)) == NULL)
@@ -1549,10 +1561,9 @@ cs_lookup_cmd(eap)
*
* nuke em
*/
/* ARGSUSED */
static int
cs_kill(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
char *stok;
short i;
@@ -1573,15 +1584,14 @@ cs_kill(eap)
/* It must be part of a name. We will try to find a match
* within all the names in the csinfo data structure
*/
for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++)
for (i = 0; i < csinfo_size; i++)
{
if (csinfo[i].fname != NULL && strstr(csinfo[i].fname, stok))
break;
}
}
if ((i >= CSCOPE_MAX_CONNECTIONS || i < -1 || csinfo[i].fname == NULL)
&& i != -1)
if ((i != -1) && (i >= csinfo_size || i < -1 || csinfo[i].fname == NULL))
{
if (p_csverbose)
(void)EMSG2(_("E261: cscope connection %s not found"), stok);
@@ -1590,7 +1600,7 @@ cs_kill(eap)
{
if (i == -1)
{
for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++)
for (i = 0; i < csinfo_size; i++)
{
if (csinfo[i].fname)
cs_kill_execute(i, csinfo[i].fname);
@@ -1850,7 +1860,7 @@ cs_file_results(f, nummatches_a)
if (buf == NULL)
return;
for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++)
for (i = 0; i < csinfo_size; i++)
{
if (nummatches_a[i] < 1)
continue;
@@ -1922,7 +1932,7 @@ cs_fill_results(tagstr, totmatches, nummatches_a, matches_p, cntxts_p, matched)
if ((cntxts = (char **)alloc(sizeof(char *) * totmatches)) == NULL)
goto parse_out;
for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++)
for (i = 0; i < csinfo_size; i++)
{
if (nummatches_a[i] < 1)
continue;
@@ -2229,7 +2239,6 @@ cs_read_prompt(i)
/*
* Used to catch and ignore SIGALRM below.
*/
/* ARGSUSED */
static RETSIGTYPE
sig_handler SIGDEFARG(sigarg)
{
@@ -2369,19 +2378,21 @@ cs_release_csp(i, freefnpp)
*
* calls cs_kill on all cscope connections then reinits
*/
/* ARGSUSED */
static int
cs_reset(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
char **dblist = NULL, **pplist = NULL, **fllist = NULL;
int i;
char buf[20]; /* for sprintf " (#%d)" */
if (csinfo_size == 0)
return CSCOPE_SUCCESS;
/* malloc our db and ppath list */
dblist = (char **)alloc(CSCOPE_MAX_CONNECTIONS * sizeof(char *));
pplist = (char **)alloc(CSCOPE_MAX_CONNECTIONS * sizeof(char *));
fllist = (char **)alloc(CSCOPE_MAX_CONNECTIONS * sizeof(char *));
dblist = (char **)alloc(csinfo_size * sizeof(char *));
pplist = (char **)alloc(csinfo_size * sizeof(char *));
fllist = (char **)alloc(csinfo_size * sizeof(char *));
if (dblist == NULL || pplist == NULL || fllist == NULL)
{
vim_free(dblist);
@@ -2390,7 +2401,7 @@ cs_reset(eap)
return CSCOPE_FAILURE;
}
for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++)
for (i = 0; i < csinfo_size; i++)
{
dblist[i] = csinfo[i].fname;
pplist[i] = csinfo[i].ppath;
@@ -2400,7 +2411,7 @@ cs_reset(eap)
}
/* rebuild the cscope connection list */
for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++)
for (i = 0; i < csinfo_size; i++)
{
if (dblist[i] != NULL)
{
@@ -2485,10 +2496,9 @@ cs_resolve_file(i, name)
*
* show all cscope connections
*/
/* ARGSUSED */
static int
cs_show(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
short i;
if (cs_cnt_connections() == 0)
@@ -2498,7 +2508,7 @@ cs_show(eap)
MSG_PUTS_ATTR(
_(" # pid database name prepend path\n"),
hl_attr(HLF_T));
for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++)
for (i = 0; i < csinfo_size; i++)
{
if (csinfo[i].fname == NULL)
continue;
@@ -2527,8 +2537,10 @@ cs_end()
{
int i;
for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++)
for (i = 0; i < csinfo_size; i++)
cs_release_csp(i, TRUE);
vim_free(csinfo);
csinfo_size = 0;
}
#endif /* FEAT_CSCOPE */
-1
View File
@@ -25,7 +25,6 @@
#define CSCOPE_SUCCESS 0
#define CSCOPE_FAILURE -1
#define CSCOPE_MAX_CONNECTIONS 8 /* you actually need more? */
#define CSCOPE_DBFILE "cscope.out"
#define CSCOPE_PROMPT ">> "
+904 -451
View File
File diff suppressed because it is too large Load Diff
+28
View File
@@ -11,6 +11,7 @@
/* #ifdef needed for "make depend" */
#ifdef FEAT_MZSCHEME
# include <schvers.h>
# include <scheme.h>
#endif
@@ -46,4 +47,31 @@
# define scheme_byte_string_to_char_string(obj) (obj)
#endif
/* Precise GC macros */
#ifndef MZ_GC_DECL_REG
# define MZ_GC_DECL_REG(size) /* empty */
#endif
#ifndef MZ_GC_VAR_IN_REG
# define MZ_GC_VAR_IN_REG(x, v) /* empty */
#endif
#ifndef MZ_GC_ARRAY_VAR_IN_REG
# define MZ_GC_ARRAY_VAR_IN_REG(x, v, l) /* empty */
#endif
#ifndef MZ_GC_REG
# define MZ_GC_REG() /* empty */
#endif
#ifndef MZ_GC_UNREG
# define MZ_GC_UNREG() /* empty */
#endif
#ifdef MZSCHEME_FORCE_GC
/*
* force garbage collection to check all references are registered
* seg faults will indicate not registered refs
*/
# define MZ_GC_CHECK() scheme_collect_garbage();
#else
# define MZ_GC_CHECK() /* empty */
#endif
#endif /* _IF_MZSCH_H_ */
+3 -2
View File
@@ -720,9 +720,11 @@ ex_perl(eap)
#ifdef HAVE_SANDBOX
if (sandbox)
{
# ifndef MAKE_TEST /* avoid a warning for unreachable code */
if ((safe = perl_get_sv( "VIM::safe", FALSE )) == NULL || !SvTRUE(safe))
EMSG(_("E299: Perl evaluation forbidden in sandbox without the Safe module"));
else
# endif
{
PUSHMARK(SP);
XPUSHs(safe);
@@ -1233,9 +1235,8 @@ Delete(vimbuf, ...)
if (u_savedel(lnum, 1) == OK)
{
ml_delete(lnum, 0);
check_cursor();
deleted_lines_mark(lnum, 1L);
if (aco.save_buf == curbuf)
check_cursor();
}
/* restore curwin/curbuf and a few other things */
+10 -19
View File
@@ -1096,9 +1096,8 @@ static struct PyMethodDef VimMethods[] = {
/* Vim module - Implementation
*/
/*ARGSUSED*/
static PyObject *
VimCommand(PyObject *self, PyObject *args)
VimCommand(PyObject *self UNUSED, PyObject *args)
{
char *cmd;
PyObject *result;
@@ -1242,9 +1241,8 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookupDict)
}
#endif
/*ARGSUSED*/
static PyObject *
VimEval(PyObject *self, PyObject *args)
VimEval(PyObject *self UNUSED, PyObject *args)
{
#ifdef FEAT_EVAL
char *expr;
@@ -1894,9 +1892,8 @@ static PyTypeObject BufListType = {
/* Buffer list object - Implementation
*/
/*ARGSUSED*/
static PyInt
BufListLength(PyObject *self)
BufListLength(PyObject *self UNUSED)
{
buf_T *b = firstbuf;
PyInt n = 0;
@@ -1910,9 +1907,8 @@ BufListLength(PyObject *self)
return n;
}
/*ARGSUSED*/
static PyObject *
BufListItem(PyObject *self, PyInt n)
BufListItem(PyObject *self UNUSED, PyInt n)
{
buf_T *b;
@@ -2210,9 +2206,8 @@ static PyTypeObject WinListType = {
/* Window list object - Implementation
*/
/*ARGSUSED*/
static PyInt
WinListLength(PyObject *self)
WinListLength(PyObject *self UNUSED)
{
win_T *w = firstwin;
PyInt n = 0;
@@ -2226,9 +2221,8 @@ WinListLength(PyObject *self)
return n;
}
/*ARGSUSED*/
static PyObject *
WinListItem(PyObject *self, PyInt n)
WinListItem(PyObject *self UNUSED, PyInt n)
{
win_T *w;
@@ -2274,9 +2268,8 @@ static PyTypeObject CurrentType = {
/* Current items object - Implementation
*/
/*ARGSUSED*/
static PyObject *
CurrentGetattr(PyObject *self, char *name)
CurrentGetattr(PyObject *self UNUSED, char *name)
{
if (strcmp(name, "buffer") == 0)
return (PyObject *)BufferNew(curbuf);
@@ -2295,9 +2288,8 @@ CurrentGetattr(PyObject *self, char *name)
}
}
/*ARGSUSED*/
static int
CurrentSetattr(PyObject *self, char *name, PyObject *value)
CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *value)
{
if (strcmp(name, "line") == 0)
{
@@ -2505,9 +2497,9 @@ SetBufferLine(buf_T *buf, PyInt n, PyObject *line, PyInt *len_change)
PyErr_SetVim(_("cannot delete line"));
else
{
deleted_lines_mark((linenr_T)n, 1L);
if (buf == curwin->w_buffer)
py_fix_cursor((linenr_T)n, (linenr_T)n + 1, (linenr_T)-1);
deleted_lines_mark((linenr_T)n, 1L);
}
curbuf = savebuf;
@@ -2604,10 +2596,9 @@ SetBufferLineList(buf_T *buf, PyInt lo, PyInt hi, PyObject *list, PyInt *len_cha
break;
}
}
deleted_lines_mark((linenr_T)lo, (long)i);
if (buf == curwin->w_buffer)
py_fix_cursor((linenr_T)lo, (linenr_T)hi, (linenr_T)-n);
deleted_lines_mark((linenr_T)lo, (long)i);
}
curbuf = savebuf;
+12 -8
View File
@@ -492,7 +492,7 @@ static void error_print(int state)
}
}
static VALUE vim_message(VALUE self, VALUE str)
static VALUE vim_message(VALUE self UNUSED, VALUE str)
{
char *buff, *p;
@@ -505,20 +505,20 @@ static VALUE vim_message(VALUE self, VALUE str)
return Qnil;
}
static VALUE vim_set_option(VALUE self, VALUE str)
static VALUE vim_set_option(VALUE self UNUSED, VALUE str)
{
do_set((char_u *)STR2CSTR(str), 0);
update_screen(NOT_VALID);
return Qnil;
}
static VALUE vim_command(VALUE self, VALUE str)
static VALUE vim_command(VALUE self UNUSED, VALUE str)
{
do_cmdline_cmd((char_u *)STR2CSTR(str));
return Qnil;
}
static VALUE vim_evaluate(VALUE self, VALUE str)
static VALUE vim_evaluate(VALUE self UNUSED, VALUE str)
{
#ifdef FEAT_EVAL
char_u *value = eval_to_string((char_u *)STR2CSTR(str), NULL, TRUE);
@@ -580,7 +580,7 @@ static VALUE buffer_s_count()
return INT2NUM(n);
}
static VALUE buffer_s_aref(VALUE self, VALUE num)
static VALUE buffer_s_aref(VALUE self UNUSED, VALUE num)
{
buf_T *b;
int n = NUM2INT(num);
@@ -629,7 +629,9 @@ static VALUE get_buffer_line(buf_T *buf, linenr_T n)
return line ? rb_str_new2(line) : Qnil;
}
rb_raise(rb_eIndexError, "index %d out of buffer", n);
#ifndef __GNUC__
return Qnil; /* For stop warning */
#endif
}
static VALUE buffer_aref(VALUE self, VALUE num)
@@ -668,7 +670,9 @@ static VALUE set_buffer_line(buf_T *buf, linenr_T n, VALUE str)
else
{
rb_raise(rb_eIndexError, "index %d out of buffer", n);
#ifndef __GNUC__
return Qnil; /* For stop warning */
#endif
}
return str;
}
@@ -789,7 +793,7 @@ static VALUE line_s_current()
return get_buffer_line(curbuf, curwin->w_cursor.lnum);
}
static VALUE set_current_line(VALUE self, VALUE str)
static VALUE set_current_line(VALUE self UNUSED, VALUE str)
{
return set_buffer_line(curbuf, curwin->w_cursor.lnum, str);
}
@@ -815,7 +819,7 @@ static VALUE window_s_count()
#endif
}
static VALUE window_s_aref(VALUE self, VALUE num)
static VALUE window_s_aref(VALUE self UNUSED, VALUE num)
{
win_T *w;
int n = NUM2INT(num);
@@ -897,7 +901,7 @@ static VALUE window_set_cursor(VALUE self, VALUE pos)
return Qnil;
}
static VALUE f_p(int argc, VALUE *argv, VALUE self)
static VALUE f_p(int argc, VALUE *argv, VALUE self UNUSED)
{
int i;
VALUE str = rb_str_new("", 0);
+44 -41
View File
@@ -161,7 +161,7 @@ typedef int HANDLE;
# endif
/*
* Declare HANDLE for perl.dll and function pointers.
* Declare HANDLE for tcl.dll and function pointers.
*/
static HANDLE hTclLib = NULL;
Tcl_Interp* (*dll_Tcl_CreateInterp)();
@@ -182,7 +182,7 @@ static struct {
* Make all runtime-links of tcl.
*
* 1. Get module handle using LoadLibraryEx.
* 2. Get pointer to perl function by GetProcAddress.
* 2. Get pointer to tcl function by GetProcAddress.
* 3. Repeat 2, until get all functions will be used.
*
* Parameter 'libname' provides name of DLL.
@@ -290,10 +290,9 @@ tcl_end()
*/
#define TCL_EXIT 5
/* ARGSUSED */
static int
exitcmd(dummy, interp, objc, objv)
ClientData dummy;
ClientData dummy UNUSED;
Tcl_Interp *interp;
int objc;
Tcl_Obj *CONST objv[];
@@ -315,10 +314,9 @@ exitcmd(dummy, interp, objc, objv)
return TCL_ERROR;
}
/* ARGSUSED */
static int
catchcmd(dummy, interp, objc, objv)
ClientData dummy;
ClientData dummy UNUSED;
Tcl_Interp *interp;
int objc;
Tcl_Obj *CONST objv[];
@@ -356,10 +354,9 @@ catchcmd(dummy, interp, objc, objv)
/*
* "::vim::beep" - what Vi[m] does best :-)
*/
/* ARGSUSED */
static int
beepcmd(dummy, interp, objc, objv)
ClientData dummy;
ClientData dummy UNUSED;
Tcl_Interp *interp;
int objc;
Tcl_Obj *CONST objv[];
@@ -378,10 +375,9 @@ beepcmd(dummy, interp, objc, objv)
* "::vim::buffer {N}" - create buffer command for buffer N.
* "::vim::buffer new" - create a new buffer (not implemented)
*/
/* ARGSUSED */
static int
buffercmd(dummy, interp, objc, objv)
ClientData dummy;
ClientData dummy UNUSED;
Tcl_Interp *interp;
int objc;
Tcl_Obj *CONST objv[];
@@ -475,10 +471,9 @@ buffercmd(dummy, interp, objc, objv)
/*
* "::vim::window list" - create list of window commands.
*/
/* ARGSUSED */
static int
windowcmd(dummy, interp, objc, objv)
ClientData dummy;
ClientData dummy UNUSED;
Tcl_Interp *interp;
int objc;
Tcl_Obj *CONST objv[];
@@ -1130,10 +1125,9 @@ winselfcmd(ref, interp, objc, objv)
}
/* ARGSUSED */
static int
commandcmd(dummy, interp, objc, objv)
ClientData dummy;
ClientData dummy UNUSED;
Tcl_Interp *interp;
int objc;
Tcl_Obj *CONST objv[];
@@ -1145,10 +1139,9 @@ commandcmd(dummy, interp, objc, objv)
return err;
}
/* ARGSUSED */
static int
optioncmd(dummy, interp, objc, objv)
ClientData dummy;
ClientData dummy UNUSED;
Tcl_Interp *interp;
int objc;
Tcl_Obj *CONST objv[];
@@ -1160,10 +1153,9 @@ optioncmd(dummy, interp, objc, objv)
return err;
}
/* ARGSUSED */
static int
exprcmd(dummy, interp, objc, objv)
ClientData dummy;
ClientData dummy UNUSED;
Tcl_Interp *interp;
int objc;
Tcl_Obj *CONST objv[];
@@ -1584,11 +1576,10 @@ tclsetdelcmd(interp, reflist, vimobj, delcmd)
I/O Channel
********************************************/
/* ARGSUSED */
static int
channel_close(instance, interp)
ClientData instance;
Tcl_Interp *interp;
Tcl_Interp *interp UNUSED;
{
int err = 0;
@@ -1602,12 +1593,11 @@ channel_close(instance, interp)
return err;
}
/* ARGSUSED */
static int
channel_input(instance, buf, bufsiz, errptr)
ClientData instance;
char *buf;
int bufsiz;
ClientData instance UNUSED;
char *buf UNUSED;
int bufsiz UNUSED;
int *errptr;
{
@@ -1659,21 +1649,19 @@ channel_output(instance, buf, bufsiz, errptr)
return result;
}
/* ARGSUSED */
static void
channel_watch(instance, mask)
ClientData instance;
int mask;
ClientData instance UNUSED;
int mask UNUSED;
{
Tcl_SetErrno(EINVAL);
}
/* ARGSUSED */
static int
channel_gethandle(instance, direction, handleptr)
ClientData instance;
int direction;
ClientData *handleptr;
ClientData instance UNUSED;
int direction UNUSED;
ClientData *handleptr UNUSED;
{
Tcl_SetErrno(EINVAL);
return EINVAL;
@@ -1682,16 +1670,31 @@ channel_gethandle(instance, direction, handleptr)
static Tcl_ChannelType channel_type =
{
"vimmessage",
NULL, /* blockmode */
channel_close,
channel_input,
channel_output,
NULL, /* seek */
NULL, /* set option */
NULL, /* get option */
channel_watch,
channel_gethandle
"vimmessage", /* typeName */
NULL, /* version */
channel_close, /* closeProc */
channel_input, /* inputProc */
channel_output, /* outputProc */
NULL, /* seekProc */
NULL, /* setOptionProc */
NULL, /* getOptionProc */
channel_watch, /* watchProc */
channel_gethandle, /* getHandleProc */
NULL, /* close2Proc */
NULL, /* blockModeProc */
#ifdef TCL_CHANNEL_VERSION_2
NULL, /* flushProc */
NULL, /* handlerProc */
#endif
#ifdef TCL_CHANNEL_VERSION_3
NULL, /* wideSeekProc */
#endif
#ifdef TCL_CHANNEL_VERSION_4
NULL, /* threadActionProc */
#endif
#ifdef TCL_CHANNEL_VERSION_5
NULL /* truncateProc */
#endif
};
/**********************************
+10 -11
View File
@@ -683,7 +683,7 @@ serverGetVimNames(dpy)
* Scan all of the names out of the property.
*/
ga_init2(&ga, 1, 100);
for (p = regProp; (p - regProp) < numItems; p++)
for (p = regProp; (long_u)(p - regProp) < numItems; p++)
{
entry = p;
while (*p != 0 && !isspace(*p))
@@ -970,7 +970,7 @@ LookupName(dpy, name, delete, loose)
*/
returnValue = (int_u)None;
entry = NULL; /* Not needed, but eliminates compiler warning. */
for (p = regProp; (p - regProp) < numItems; )
for (p = regProp; (long_u)(p - regProp) < numItems; )
{
entry = p;
while (*p != 0 && !isspace(*p))
@@ -987,7 +987,7 @@ LookupName(dpy, name, delete, loose)
if (loose != NULL && returnValue == (int_u)None && !IsSerialName(name))
{
for (p = regProp; (p - regProp) < numItems; )
for (p = regProp; (long_u)(p - regProp) < numItems; )
{
entry = p;
while (*p != 0 && !isspace(*p))
@@ -1057,7 +1057,7 @@ DeleteAnyLingerer(dpy, win)
return;
/* Scan the property for the window id. */
for (p = regProp; (p - regProp) < numItems; )
for (p = regProp; (long_u)(p - regProp) < numItems; )
{
if (*p != 0)
{
@@ -1197,7 +1197,7 @@ serverEventProc(dpy, eventPtr)
* one time; each iteration through the outer loop handles a
* single command or result.
*/
for (p = propInfo; (p - propInfo) < numItems; )
for (p = propInfo; (long_u)(p - propInfo) < numItems; )
{
/*
* Ignore leading NULs; each command or result starts with a
@@ -1231,7 +1231,7 @@ serverEventProc(dpy, eventPtr)
serial = (char_u *)"";
script = NULL;
enc = NULL;
while (p - propInfo < numItems && *p == '-')
while ((long_u)(p - propInfo) < numItems && *p == '-')
{
switch (p[1])
{
@@ -1334,7 +1334,7 @@ serverEventProc(dpy, eventPtr)
res = (char_u *)"";
code = 0;
enc = NULL;
while ((p-propInfo) < numItems && *p == '-')
while ((long_u)(p - propInfo) < numItems && *p == '-')
{
switch (p[1])
{
@@ -1402,7 +1402,7 @@ serverEventProc(dpy, eventPtr)
gotWindow = 0;
str = (char_u *)"";
enc = NULL;
while ((p-propInfo) < numItems && *p == '-')
while ((long_u)(p - propInfo) < numItems && *p == '-')
{
switch (p[1])
{
@@ -1490,11 +1490,10 @@ AppendPropCarefully(dpy, window, property, value, length)
/*
* Another X Error handler, just used to check for errors.
*/
/* ARGSUSED */
static int
x_error_check(dpy, error_event)
Display *dpy;
XErrorEvent *error_event;
Display *dpy UNUSED;
XErrorEvent *error_event UNUSED;
{
got_x_error = TRUE;
return 0;
+1 -1
View File
@@ -284,7 +284,7 @@
# define mb_cptr2len(p) (enc_utf8 ? utf_ptr2len(p) : (*mb_ptr2len)(p))
# define MB_COPY_CHAR(f, t) if (has_mbyte) mb_copy_char(&f, &t); else *t++ = *f++
# define MB_CHARLEN(p) (has_mbyte ? mb_charlen(p) : STRLEN(p))
# define MB_CHARLEN(p) (has_mbyte ? mb_charlen(p) : (int)STRLEN(p))
# define PTR2CHAR(p) (has_mbyte ? mb_ptr2char(p) : (int)*(p))
#else
# define mb_ptr_adv(p) ++p
+9 -6
View File
@@ -998,8 +998,14 @@ main
/*
* Call the main command loop. This never returns.
* For embedded MzScheme the main_loop will be called by Scheme
* for proper stack tracking
*/
#ifndef FEAT_MZSCHEME
main_loop(FALSE, FALSE);
#else
mzscheme_main();
#endif
#if FEAT_GUI_MACVIM
objc_msgSend(autoreleasePool, sel_getUid("release"));
@@ -1590,10 +1596,9 @@ parse_command_name(parmp)
*
* Also find the --server... arguments and --socketid and --windowid
*/
/*ARGSUSED*/
static void
early_arg_scan(parmp)
mparm_T *parmp;
mparm_T *parmp UNUSED;
{
#if defined(FEAT_XCLIPBOARD) || defined(FEAT_CLIENTSERVER) \
|| !defined(FEAT_NETBEANS_INTG)
@@ -2465,10 +2470,9 @@ read_stdin()
* Create the requested number of windows and edit buffers in them.
* Also does recovery if "recoverymode" set.
*/
/*ARGSUSED*/
static void
create_windows(parmp)
mparm_T *parmp;
mparm_T *parmp UNUSED;
{
#ifdef FEAT_WINDOWS
int dorewind;
@@ -3944,10 +3948,9 @@ eval_client_expr_to_string(expr)
* return an allocated string. Otherwise return "data".
* "*tofree" is set to the result when it needs to be freed later.
*/
/*ARGSUSED*/
char_u *
serverConvert(client_enc, data, tofree)
char_u *client_enc;
char_u *client_enc UNUSED;
char_u *data;
char_u **tofree;
{
+7 -6
View File
@@ -884,10 +884,9 @@ ex_delmarks(eap)
/*
* print the jumplist
*/
/*ARGSUSED*/
void
ex_jumps(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
int i;
char_u *name;
@@ -933,10 +932,9 @@ ex_jumps(eap)
/*
* print the changelist
*/
/*ARGSUSED*/
void
ex_changes(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
int i;
char_u *name;
@@ -1023,6 +1021,9 @@ mark_adjust(line1, line2, amount, amount_after)
int fnum = curbuf->b_fnum;
linenr_T *lp;
win_T *win;
#ifdef FEAT_WINDOWS
tabpage_T *tab;
#endif
if (line2 < line1 && amount_after == 0L) /* nothing to do */
return;
@@ -1064,7 +1065,7 @@ mark_adjust(line1, line2, amount, amount_after)
/* quickfix marks */
qf_mark_adjust(NULL, line1, line2, amount, amount_after);
/* location lists */
FOR_ALL_WINDOWS(win)
FOR_ALL_TAB_WINDOWS(tab, win)
qf_mark_adjust(win, line1, line2, amount, amount_after);
#endif
@@ -1086,7 +1087,7 @@ mark_adjust(line1, line2, amount, amount_after)
/*
* Adjust items in all windows related to the current buffer.
*/
FOR_ALL_WINDOWS(win)
FOR_ALL_TAB_WINDOWS(tab, win)
{
#ifdef FEAT_JUMPLIST
if (!cmdmod.lockmarks)
+176 -64
View File
@@ -127,7 +127,10 @@ static int enc_canon_search __ARGS((char_u *name));
static int dbcs_char2len __ARGS((int c));
static int dbcs_char2bytes __ARGS((int c, char_u *buf));
static int dbcs_ptr2len __ARGS((char_u *p));
static int dbcs_ptr2len_len __ARGS((char_u *p, int size));
static int utf_ptr2cells_len __ARGS((char_u *p, int size));
static int dbcs_char2cells __ARGS((int c));
static int dbcs_ptr2cells_len __ARGS((char_u *p, int size));
static int dbcs_ptr2char __ARGS((char_u *p));
/* Lookup table to quickly get the length in bytes of a UTF-8 character from
@@ -606,9 +609,11 @@ codepage_invalid:
if (enc_utf8)
{
mb_ptr2len = utfc_ptr2len;
mb_ptr2len_len = utfc_ptr2len_len;
mb_char2len = utf_char2len;
mb_char2bytes = utf_char2bytes;
mb_ptr2cells = utf_ptr2cells;
mb_ptr2cells_len = utf_ptr2cells_len;
mb_char2cells = utf_char2cells;
mb_off2cells = utf_off2cells;
mb_ptr2char = utf_ptr2char;
@@ -617,9 +622,11 @@ codepage_invalid:
else if (enc_dbcs != 0)
{
mb_ptr2len = dbcs_ptr2len;
mb_ptr2len_len = dbcs_ptr2len_len;
mb_char2len = dbcs_char2len;
mb_char2bytes = dbcs_char2bytes;
mb_ptr2cells = dbcs_ptr2cells;
mb_ptr2cells_len = dbcs_ptr2cells_len;
mb_char2cells = dbcs_char2cells;
mb_off2cells = dbcs_off2cells;
mb_ptr2char = dbcs_ptr2char;
@@ -628,9 +635,11 @@ codepage_invalid:
else
{
mb_ptr2len = latin_ptr2len;
mb_ptr2len_len = latin_ptr2len_len;
mb_char2len = latin_char2len;
mb_char2bytes = latin_char2bytes;
mb_ptr2cells = latin_ptr2cells;
mb_ptr2cells_len = latin_ptr2cells_len;
mb_char2cells = latin_char2cells;
mb_off2cells = latin_off2cells;
mb_ptr2char = latin_ptr2char;
@@ -1015,10 +1024,9 @@ dbcs_class(lead, trail)
* Return length in bytes of character "c".
* Returns 1 for a single-byte character.
*/
/* ARGSUSED */
int
latin_char2len(c)
int c;
int c UNUSED;
{
return 1;
}
@@ -1070,7 +1078,6 @@ dbcs_char2bytes(c, buf)
* Get byte length of character at "*p" but stop at a NUL.
* For UTF-8 this includes following composing characters.
* Returns 0 when *p is NUL.
*
*/
int
latin_ptr2len(p)
@@ -1092,6 +1099,40 @@ dbcs_ptr2len(p)
return len;
}
/*
* mb_ptr2len_len() function pointer.
* Like mb_ptr2len(), but limit to read "size" bytes.
* Returns 0 for an empty string.
* Returns 1 for an illegal char or an incomplete byte sequence.
*/
int
latin_ptr2len_len(p, size)
char_u *p;
int size;
{
if (size < 1 || *p == NUL)
return 0;
return 1;
}
static int
dbcs_ptr2len_len(p, size)
char_u *p;
int size;
{
int len;
if (size < 1 || *p == NUL)
return 0;
if (size == 1)
return 1;
/* Check that second byte is not missing. */
len = MB_BYTE2LEN(*p);
if (len == 2 && p[1] == NUL)
len = 1;
return len;
}
struct interval
{
unsigned short first;
@@ -1248,10 +1289,9 @@ utf_char2cells(c)
* Return the number of display cells character at "*p" occupies.
* This doesn't take care of unprintable characters, use ptr2cells() for that.
*/
/*ARGSUSED*/
int
latin_ptr2cells(p)
char_u *p;
char_u *p UNUSED;
{
return 1;
}
@@ -1288,15 +1328,63 @@ dbcs_ptr2cells(p)
return MB_BYTE2LEN(*p);
}
/*
* mb_ptr2cells_len() function pointer.
* Like mb_ptr2cells(), but limit string length to "size".
* For an empty string or truncated character returns 1.
*/
int
latin_ptr2cells_len(p, size)
char_u *p UNUSED;
int size UNUSED;
{
return 1;
}
static int
utf_ptr2cells_len(p, size)
char_u *p;
int size;
{
int c;
/* Need to convert to a wide character. */
if (size > 0 && *p >= 0x80)
{
if (utf_ptr2len_len(p, size) < utf8len_tab[*p])
return 1;
c = utf_ptr2char(p);
/* An illegal byte is displayed as <xx>. */
if (utf_ptr2len(p) == 1 || c == NUL)
return 4;
/* If the char is ASCII it must be an overlong sequence. */
if (c < 0x80)
return char2cells(c);
return utf_char2cells(c);
}
return 1;
}
static int
dbcs_ptr2cells_len(p, size)
char_u *p;
int size;
{
/* Number of cells is equal to number of bytes, except for euc-jp when
* the first byte is 0x8e. */
if (size <= 1 || (enc_dbcs == DBCS_JPNU && *p == 0x8e))
return 1;
return MB_BYTE2LEN(*p);
}
/*
* mb_char2cells() function pointer.
* Return the number of display cells character "c" occupies.
* Only takes care of multi-byte chars, not "^C" and such.
*/
/*ARGSUSED*/
int
latin_char2cells(c)
int c;
int c UNUSED;
{
return 1;
}
@@ -1318,11 +1406,10 @@ dbcs_char2cells(c)
* Return number of display cells for char at ScreenLines[off].
* We make sure that the offset used is less than "max_off".
*/
/*ARGSUSED*/
int
latin_off2cells(off, max_off)
unsigned off;
unsigned max_off;
unsigned off UNUSED;
unsigned max_off UNUSED;
{
return 1;
}
@@ -1720,6 +1807,7 @@ utfc_ptr2len(p)
/*
* Return the number of bytes the UTF-8 encoding of the character at "p[size]"
* takes. This includes following composing characters.
* Returns 0 for an empty string.
* Returns 1 for an illegal char or an incomplete byte sequence.
*/
int
@@ -1732,7 +1820,7 @@ utfc_ptr2len_len(p, size)
int prevlen;
#endif
if (*p == NUL)
if (size < 1 || *p == NUL)
return 0;
if (p[0] < 0x80 && (size == 1 || p[1] < 0x80)) /* be quick for ASCII */
return 1;
@@ -2419,11 +2507,10 @@ show_utf8()
* Return offset from "p" to the first byte of the character it points into.
* Returns 0 when already at the first byte of a character.
*/
/*ARGSUSED*/
int
latin_head_off(base, p)
char_u *base;
char_u *p;
char_u *base UNUSED;
char_u *p UNUSED;
{
return 0;
}
@@ -3131,7 +3218,7 @@ enc_locale()
else
s = p + 1;
}
for (i = 0; s[i] != NUL && i < sizeof(buf) - 1; ++i)
for (i = 0; s[i] != NUL && i < (int)sizeof(buf) - 1; ++i)
{
if (s[i] == '_' || s[i] == '-')
buf[i] = '-';
@@ -3178,7 +3265,7 @@ encname2codepage(name)
# if defined(USE_ICONV) || defined(PROTO)
static char_u *iconv_string __ARGS((vimconv_T *vcp, char_u *str, int slen, int *unconvlenp));
static char_u *iconv_string __ARGS((vimconv_T *vcp, char_u *str, int slen, int *unconvlenp, int *resultlenp));
/*
* Call iconv_open() with a check if iconv() works properly (there are broken
@@ -3239,13 +3326,15 @@ my_iconv_open(to, from)
* If "unconvlenp" is not NULL handle the string ending in an incomplete
* sequence and set "*unconvlenp" to the length of it.
* Returns the converted string in allocated memory. NULL for an error.
* If resultlenp is not NULL, sets it to the result length in bytes.
*/
static char_u *
iconv_string(vcp, str, slen, unconvlenp)
iconv_string(vcp, str, slen, unconvlenp, resultlenp)
vimconv_T *vcp;
char_u *str;
int slen;
int *unconvlenp;
int *resultlenp;
{
const char *from;
size_t fromlen;
@@ -3331,6 +3420,9 @@ iconv_string(vcp, str, slen, unconvlenp)
/* Not enough room or skipping illegal sequence. */
done = to - (char *)result;
}
if (resultlenp != NULL)
*resultlenp = (int)(to - (char *)result);
return result;
}
@@ -3582,9 +3674,10 @@ im_show_info(void)
* Callback invoked when the user finished preediting.
* Put the final string into the input buffer.
*/
/*ARGSUSED0*/
static void
im_commit_cb(GtkIMContext *context, const gchar *str, gpointer data)
im_commit_cb(GtkIMContext *context UNUSED,
const gchar *str,
gpointer data UNUSED)
{
int slen = (int)STRLEN(str);
int add_to_input = TRUE;
@@ -3670,9 +3763,8 @@ im_commit_cb(GtkIMContext *context, const gchar *str, gpointer data)
/*
* Callback invoked after start to the preedit.
*/
/*ARGSUSED*/
static void
im_preedit_start_cb(GtkIMContext *context, gpointer data)
im_preedit_start_cb(GtkIMContext *context UNUSED, gpointer data UNUSED)
{
#ifdef XIM_DEBUG
xim_log("im_preedit_start_cb()\n");
@@ -3687,9 +3779,8 @@ im_preedit_start_cb(GtkIMContext *context, gpointer data)
/*
* Callback invoked after end to the preedit.
*/
/*ARGSUSED*/
static void
im_preedit_end_cb(GtkIMContext *context, gpointer data)
im_preedit_end_cb(GtkIMContext *context UNUSED, gpointer data UNUSED)
{
#ifdef XIM_DEBUG
xim_log("im_preedit_end_cb()\n");
@@ -3748,9 +3839,8 @@ im_preedit_end_cb(GtkIMContext *context, gpointer data)
* remaining input from within the "retrieve_surrounding" signal handler, this
* might not be necessary. Gotta ask on vim-dev for opinions.
*/
/*ARGSUSED1*/
static void
im_preedit_changed_cb(GtkIMContext *context, gpointer data)
im_preedit_changed_cb(GtkIMContext *context, gpointer data UNUSED)
{
char *preedit_string = NULL;
int cursor_index = 0;
@@ -4616,11 +4706,10 @@ xim_set_focus(focus)
}
}
/*ARGSUSED*/
void
im_set_position(row, col)
int row;
int col;
int row UNUSED;
int col UNUSED;
{
xim_set_preedit();
}
@@ -4927,12 +5016,11 @@ static int xim_real_init __ARGS((Window x11_window, Display *x11_display));
static void xim_instantiate_cb __ARGS((Display *display, XPointer client_data, XPointer call_data));
static void xim_destroy_cb __ARGS((XIM im, XPointer client_data, XPointer call_data));
/*ARGSUSED*/
static void
xim_instantiate_cb(display, client_data, call_data)
Display *display;
XPointer client_data;
XPointer call_data;
XPointer client_data UNUSED;
XPointer call_data UNUSED;
{
Window x11_window;
Display *x11_display;
@@ -4952,12 +5040,11 @@ xim_instantiate_cb(display, client_data, call_data)
xim_instantiate_cb, NULL);
}
/*ARGSUSED*/
static void
xim_destroy_cb(im, client_data, call_data)
XIM im;
XPointer client_data;
XPointer call_data;
XIM im UNUSED;
XPointer client_data UNUSED;
XPointer call_data UNUSED;
{
Window x11_window;
Display *x11_display;
@@ -5276,9 +5363,10 @@ xim_decide_input_style()
}
}
/*ARGSUSED*/
static void
preedit_start_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
preedit_start_cbproc(XIC thexic UNUSED,
XPointer client_data UNUSED,
XPointer call_data UNUSED)
{
#ifdef XIM_DEBUG
xim_log("xim_decide_input_style()\n");
@@ -5310,9 +5398,10 @@ xim_back_delete(int n)
static GSList *key_press_event_queue = NULL;
static gboolean processing_queued_event = FALSE;
/*ARGSUSED*/
static void
preedit_draw_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
preedit_draw_cbproc(XIC thexic UNUSED,
XPointer client_data UNUSED,
XPointer call_data)
{
XIMPreeditDrawCallbackStruct *draw_data;
XIMText *text;
@@ -5451,18 +5540,20 @@ im_get_feedback_attr(int col)
return -1;
}
/*ARGSUSED*/
static void
preedit_caret_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
preedit_caret_cbproc(XIC thexic UNUSED,
XPointer client_data UNUSED,
XPointer call_data UNUSED)
{
#ifdef XIM_DEBUG
xim_log("preedit_caret_cbproc()\n");
#endif
}
/*ARGSUSED*/
static void
preedit_done_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
preedit_done_cbproc(XIC thexic UNUSED,
XPointer client_data UNUSED,
XPointer call_data UNUSED)
{
#ifdef XIM_DEBUG
xim_log("preedit_done_cbproc()\n");
@@ -5501,9 +5592,8 @@ xim_reset(void)
}
}
/*ARGSUSED*/
int
xim_queue_key_press_event(GdkEventKey *event, int down)
xim_queue_key_press_event(GdkEventKey *event, int down UNUSED)
{
#ifdef XIM_DEBUG
xim_log("xim_queue_key_press_event()\n");
@@ -5519,9 +5609,8 @@ xim_queue_key_press_event(GdkEventKey *event, int down)
return TRUE;
}
/*ARGSUSED*/
static void
preedit_callback_setup(GdkIC *ic)
preedit_callback_setup(GdkIC *ic UNUSED)
{
XIC xxic;
XVaNestedList preedit_attr;
@@ -5546,9 +5635,8 @@ preedit_callback_setup(GdkIC *ic)
XFree(preedit_attr);
}
/*ARGSUSED*/
static void
reset_state_setup(GdkIC *ic)
reset_state_setup(GdkIC *ic UNUSED)
{
#ifdef USE_X11R6_XIM
/* don't change the input context when we call reset */
@@ -5753,9 +5841,26 @@ convert_setup(vcp, from, to)
vimconv_T *vcp;
char_u *from;
char_u *to;
{
return convert_setup_ext(vcp, from, TRUE, to, TRUE);
}
/*
* As convert_setup(), but only when from_unicode_is_utf8 is TRUE will all
* "from" unicode charsets be considered utf-8. Same for "to".
*/
int
convert_setup_ext(vcp, from, from_unicode_is_utf8, to, to_unicode_is_utf8)
vimconv_T *vcp;
char_u *from;
int from_unicode_is_utf8;
char_u *to;
int to_unicode_is_utf8;
{
int from_prop;
int to_prop;
int from_is_utf8;
int to_is_utf8;
/* Reset to no conversion. */
# ifdef USE_ICONV
@@ -5773,37 +5878,46 @@ convert_setup(vcp, from, to)
from_prop = enc_canon_props(from);
to_prop = enc_canon_props(to);
if ((from_prop & ENC_LATIN1) && (to_prop & ENC_UNICODE))
if (from_unicode_is_utf8)
from_is_utf8 = from_prop & ENC_UNICODE;
else
from_is_utf8 = from_prop == ENC_UNICODE;
if (to_unicode_is_utf8)
to_is_utf8 = to_prop & ENC_UNICODE;
else
to_is_utf8 = to_prop == ENC_UNICODE;
if ((from_prop & ENC_LATIN1) && to_is_utf8)
{
/* Internal latin1 -> utf-8 conversion. */
vcp->vc_type = CONV_TO_UTF8;
vcp->vc_factor = 2; /* up to twice as long */
}
else if ((from_prop & ENC_LATIN9) && (to_prop & ENC_UNICODE))
else if ((from_prop & ENC_LATIN9) && to_is_utf8)
{
/* Internal latin9 -> utf-8 conversion. */
vcp->vc_type = CONV_9_TO_UTF8;
vcp->vc_factor = 3; /* up to three as long (euro sign) */
}
else if ((from_prop & ENC_UNICODE) && (to_prop & ENC_LATIN1))
else if (from_is_utf8 && (to_prop & ENC_LATIN1))
{
/* Internal utf-8 -> latin1 conversion. */
vcp->vc_type = CONV_TO_LATIN1;
}
else if ((from_prop & ENC_UNICODE) && (to_prop & ENC_LATIN9))
else if (from_is_utf8 && (to_prop & ENC_LATIN9))
{
/* Internal utf-8 -> latin9 conversion. */
vcp->vc_type = CONV_TO_LATIN9;
}
#ifdef WIN3264
/* Win32-specific codepage <-> codepage conversion without iconv. */
else if (((from_prop & ENC_UNICODE) || encname2codepage(from) > 0)
&& ((to_prop & ENC_UNICODE) || encname2codepage(to) > 0))
else if ((from_is_utf8 || encname2codepage(from) > 0)
&& (to_is_utf8 || encname2codepage(to) > 0))
{
vcp->vc_type = CONV_CODEPAGE;
vcp->vc_factor = 2; /* up to twice as long */
vcp->vc_cpfrom = (from_prop & ENC_UNICODE) ? 0 : encname2codepage(from);
vcp->vc_cpto = (to_prop & ENC_UNICODE) ? 0 : encname2codepage(to);
vcp->vc_cpfrom = from_is_utf8 ? 0 : encname2codepage(from);
vcp->vc_cpto = to_is_utf8 ? 0 : encname2codepage(to);
}
#endif
#ifdef MACOS_X
@@ -5811,7 +5925,7 @@ convert_setup(vcp, from, to)
{
vcp->vc_type = CONV_MAC_LATIN1;
}
else if ((from_prop & ENC_MACROMAN) && (to_prop & ENC_UNICODE))
else if ((from_prop & ENC_MACROMAN) && to_is_utf8)
{
vcp->vc_type = CONV_MAC_UTF8;
vcp->vc_factor = 2; /* up to twice as long */
@@ -5820,7 +5934,7 @@ convert_setup(vcp, from, to)
{
vcp->vc_type = CONV_LATIN1_MAC;
}
else if ((from_prop & ENC_UNICODE) && (to_prop & ENC_MACROMAN))
else if (from_is_utf8 && (to_prop & ENC_MACROMAN))
{
vcp->vc_type = CONV_UTF8_MAC;
}
@@ -5830,8 +5944,8 @@ convert_setup(vcp, from, to)
{
/* Use iconv() for conversion. */
vcp->vc_fd = (iconv_t)my_iconv_open(
(to_prop & ENC_UNICODE) ? (char_u *)"utf-8" : to,
(from_prop & ENC_UNICODE) ? (char_u *)"utf-8" : from);
to_is_utf8 ? (char_u *)"utf-8" : to,
from_is_utf8 ? (char_u *)"utf-8" : from);
if (vcp->vc_fd != (iconv_t)-1)
{
vcp->vc_type = CONV_ICONV;
@@ -6087,9 +6201,7 @@ string_convert_ext(vcp, ptr, lenp, unconvlenp)
# ifdef USE_ICONV
case CONV_ICONV: /* conversion with output_conv.vc_fd */
retval = iconv_string(vcp, ptr, len, unconvlenp);
if (retval != NULL && lenp != NULL)
*lenp = (int)STRLEN(retval);
retval = iconv_string(vcp, ptr, len, unconvlenp, lenp);
break;
# endif
# ifdef WIN3264
+14 -6
View File
@@ -1554,10 +1554,15 @@ recover_names(fname, list, nr)
for (i = 0; i < num_files; ++i)
if (fullpathcmp(p, files[i], TRUE) & FPC_SAME)
{
/* Remove the name from files[i]. Move further entries
* down. When the array becomes empty free it here, since
* FreeWild() won't be called below. */
vim_free(files[i]);
--num_files;
for ( ; i < num_files; ++i)
files[i] = files[i + 1];
if (--num_files == 0)
vim_free(files);
else
for ( ; i < num_files; ++i)
files[i] = files[i + 1];
}
}
if (nr > 0)
@@ -3522,7 +3527,7 @@ resolve_symlink(fname, buf)
if (errno == EINVAL || errno == ENOENT)
{
/* Found non-symlink or not existing file, stop here.
* When at the first level use the unmodifed name, skip the
* When at the first level use the unmodified name, skip the
* call to vim_FullName(). */
if (depth == 1)
return FAIL;
@@ -3766,8 +3771,10 @@ do_swapexists(buf, fname)
set_vim_var_string(VV_SWAPCHOICE, NULL, -1);
/* Trigger SwapExists autocommands with <afile> set to the file being
* edited. */
* edited. Disallow changing directory here. */
++allbuf_lock;
apply_autocmds(EVENT_SWAPEXISTS, buf->b_fname, NULL, FALSE, NULL);
--allbuf_lock;
set_vim_var_string(VV_SWAPNAME, NULL, -1);
@@ -3793,6 +3800,7 @@ do_swapexists(buf, fname)
*
* Note: If BASENAMELEN is not correct, you will get error messages for
* not being able to open the swapfile
* Note: May trigger SwapExists autocmd, pointers may change!
*/
static char_u *
findswapname(buf, dirp, old_fname)
@@ -4560,7 +4568,7 @@ ml_updatechunk(buf, line, len, updtype)
buf->b_ml.ml_chunksize + curix,
(buf->b_ml.ml_usedchunks - curix) *
sizeof(chunksize_T));
/* Compute length of first half of lines in the splitted chunk */
/* Compute length of first half of lines in the split chunk */
size = 0;
linecnt = 0;
while (curline < buf->b_ml.ml_line_count
+6 -10
View File
@@ -231,7 +231,7 @@ ex_menu(eap)
if (skipdigits(menu_path + 7) == p)
{
menuarg.iconidx = atoi((char *)menu_path + 7);
if (menuarg.iconidx >= TOOLBAR_NAME_COUNT)
if (menuarg.iconidx >= (int)TOOLBAR_NAME_COUNT)
menuarg.iconidx = -1;
else
menuarg.icon_builtin = TRUE;
@@ -239,7 +239,7 @@ ex_menu(eap)
}
else
{
for (i = 0; i < TOOLBAR_NAME_COUNT; ++i)
for (i = 0; i < (int)TOOLBAR_NAME_COUNT; ++i)
if (STRNCMP(toolbar_names[i], menu_path, p - menu_path)
== 0)
{
@@ -1345,10 +1345,9 @@ set_context_in_menu_cmd(xp, cmd, arg, forceit)
* Function given to ExpandGeneric() to obtain the list of (sub)menus (not
* entries).
*/
/*ARGSUSED*/
char_u *
get_menu_name(xp, idx)
expand_T *xp;
expand_T *xp UNUSED;
int idx;
{
static vimmenu_T *menu = NULL;
@@ -1382,10 +1381,9 @@ get_menu_name(xp, idx)
* Function given to ExpandGeneric() to obtain the list of menus and menu
* entries.
*/
/*ARGSUSED*/
char_u *
get_menu_names(xp, idx)
expand_T *xp;
expand_T *xp UNUSED;
int idx;
{
static vimmenu_T *menu = NULL;
@@ -1743,10 +1741,9 @@ menu_is_hidden(name)
/*
* Return TRUE if the menu is the tearoff menu.
*/
/*ARGSUSED*/
static int
menu_is_tearoff(name)
char_u *name;
char_u *name UNUSED;
{
#ifdef FEAT_GUI
return (STRCMP(name, TEAR_STRING) == 0);
@@ -2365,10 +2362,9 @@ static garray_T menutrans_ga = {0, 0, 0, 0, NULL};
* This function is also defined without the +multi_lang feature, in which
* case the commands are ignored.
*/
/*ARGSUSED*/
void
ex_menutranslate(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
#ifdef FEAT_MULTI_LANG
char_u *arg = eap->arg;
+33 -21
View File
@@ -107,7 +107,7 @@ msg(s)
}
#if defined(FEAT_EVAL) || defined(FEAT_X11) || defined(USE_XSMP) \
|| defined(PROTO)
|| defined(FEAT_GUI_GTK) || defined(PROTO)
/*
* Like msg() but keep it silent when 'verbosefile' is set.
*/
@@ -818,10 +818,9 @@ delete_first_msg()
/*
* ":messages" command.
*/
/*ARGSUSED*/
void
ex_messages(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
struct msg_hist *p;
char_u *s;
@@ -3023,11 +3022,7 @@ redir_write(str, maxlen)
if (*p_vfile != NUL)
verbose_write(s, maxlen);
if (redir_fd != NULL
#ifdef FEAT_EVAL
|| redir_reg || redir_vname
#endif
)
if (redirecting())
{
/* If the string doesn't start with CR or NL, go to msg_col */
if (*s != '\n' && *s != '\r')
@@ -3074,6 +3069,16 @@ redir_write(str, maxlen)
}
}
int
redirecting()
{
return redir_fd != NULL
#ifdef FEAT_EVAL
|| redir_reg || redir_vname
#endif
;
}
/*
* Before giving verbose message.
* Must always be called paired with verbose_leave()!
@@ -3284,15 +3289,15 @@ msg_advance(col)
* A '&' in a button name becomes a shortcut, so each '&' should be before a
* different letter.
*/
/* ARGSUSED */
int
do_dialog(type, title, message, buttons, dfltbutton, textfield)
int type;
char_u *title;
int type UNUSED;
char_u *title UNUSED;
char_u *message;
char_u *buttons;
int dfltbutton;
char_u *textfield; /* IObuff for inputdialog(), NULL otherwise */
char_u *textfield UNUSED; /* IObuff for inputdialog(), NULL
otherwise */
{
int oldState;
int retval = 0;
@@ -4015,7 +4020,7 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
if (*p != '%')
{
char *q = strchr(p + 1, '%');
size_t n = (q == NULL) ? STRLEN(p) : (q - p);
size_t n = (q == NULL) ? STRLEN(p) : (size_t)(q - p);
/* Copy up to the next '%' or NUL without any changes. */
if (str_l < str_m)
@@ -4262,7 +4267,8 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
precision <= (size_t)0x7fffffffL ? precision
: (size_t)0x7fffffffL);
#endif
str_arg_l = (q == NULL) ? precision : q - str_arg;
str_arg_l = (q == NULL) ? precision
: (size_t)(q - str_arg);
}
break;
@@ -4362,7 +4368,8 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
get_a_arg(arg_idx);
#else
# if defined(FEAT_EVAL)
tvs != NULL ? tv_nr(tvs, &arg_idx) :
tvs != NULL ? (unsigned)
tv_nr(tvs, &arg_idx) :
# endif
va_arg(ap, unsigned int);
#endif
@@ -4375,7 +4382,8 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
get_a_arg(arg_idx);
#else
# if defined(FEAT_EVAL)
tvs != NULL ? tv_nr(tvs, &arg_idx) :
tvs != NULL ? (unsigned long)
tv_nr(tvs, &arg_idx) :
# endif
va_arg(ap, unsigned long int);
#endif
@@ -4698,7 +4706,8 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
size_t avail = str_m - str_l;
vim_memset(str + str_l, zero_padding ? '0' : ' ',
(size_t)pn > avail ? avail : pn);
(size_t)pn > avail ? avail
: (size_t)pn);
}
str_l += pn;
}
@@ -4725,7 +4734,8 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
size_t avail = str_m - str_l;
mch_memmove(str + str_l, str_arg,
(size_t)zn > avail ? avail : zn);
(size_t)zn > avail ? avail
: (size_t)zn);
}
str_l += zn;
}
@@ -4740,7 +4750,8 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
size_t avail = str_m-str_l;
vim_memset(str + str_l, '0',
(size_t)zn > avail ? avail : zn);
(size_t)zn > avail ? avail
: (size_t)zn);
}
str_l += zn;
}
@@ -4759,7 +4770,7 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
mch_memmove(str + str_l,
str_arg + zero_padding_insertion_ind,
(size_t)sn > avail ? avail : sn);
(size_t)sn > avail ? avail : (size_t)sn);
}
str_l += sn;
}
@@ -4779,7 +4790,8 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
size_t avail = str_m - str_l;
vim_memset(str + str_l, ' ',
(size_t)pn > avail ? avail : pn);
(size_t)pn > avail ? avail
: (size_t)pn);
}
str_l += pn;
}
+42 -21
View File
@@ -2188,12 +2188,11 @@ del_chars(count, fixpos)
*
* return FAIL for failure, OK otherwise
*/
/*ARGSUSED*/
int
del_bytes(count, fixpos_arg, use_delcombine)
long count;
int fixpos_arg;
int use_delcombine; /* 'delcombine' option applies */
int use_delcombine UNUSED; /* 'delcombine' option applies */
{
char_u *oldp, *newp;
colnr_T oldlen;
@@ -2346,12 +2345,13 @@ del_lines(nlines, undo)
int undo; /* if TRUE, prepare for undo */
{
long n;
linenr_T first = curwin->w_cursor.lnum;
if (nlines <= 0)
return;
/* save the deleted lines for undo */
if (undo && u_savedel(curwin->w_cursor.lnum, nlines) == FAIL)
if (undo && u_savedel(first, nlines) == FAIL)
return;
for (n = 0; n < nlines; )
@@ -2359,18 +2359,21 @@ del_lines(nlines, undo)
if (curbuf->b_ml.ml_flags & ML_EMPTY) /* nothing to delete */
break;
ml_delete(curwin->w_cursor.lnum, TRUE);
ml_delete(first, TRUE);
++n;
/* If we delete the last line in the file, stop */
if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count)
if (first > curbuf->b_ml.ml_line_count)
break;
}
/* adjust marks, mark the buffer as changed and prepare for displaying */
deleted_lines_mark(curwin->w_cursor.lnum, n);
/* Correct the cursor position before calling deleted_lines_mark(), it may
* trigger a callback to display the cursor. */
curwin->w_cursor.col = 0;
check_cursor_lnum();
/* adjust marks, mark the buffer as changed and prepare for displaying */
deleted_lines_mark(first, n);
}
int
@@ -2622,6 +2625,8 @@ deleted_lines(lnum, count)
/*
* Like deleted_lines(), but adjust marks first.
* Make sure the cursor is on a valid line before calling, a GUI callback may
* be triggered to display the cursor.
*/
void
deleted_lines_mark(lnum, count)
@@ -2717,6 +2722,9 @@ changed_common(lnum, col, lnume, xtra)
long xtra;
{
win_T *wp;
#ifdef FEAT_WINDOWS
tabpage_T *tp;
#endif
int i;
#ifdef FEAT_JUMPLIST
int cols;
@@ -2769,7 +2777,7 @@ changed_common(lnum, col, lnume, xtra)
curbuf->b_changelistlen = JUMPLISTSIZE - 1;
mch_memmove(curbuf->b_changelist, curbuf->b_changelist + 1,
sizeof(pos_T) * (JUMPLISTSIZE - 1));
FOR_ALL_WINDOWS(wp)
FOR_ALL_TAB_WINDOWS(tp, wp)
{
/* Correct position in changelist for other windows on
* this buffer. */
@@ -2777,7 +2785,7 @@ changed_common(lnum, col, lnume, xtra)
--wp->w_changelistidx;
}
}
FOR_ALL_WINDOWS(wp)
FOR_ALL_TAB_WINDOWS(tp, wp)
{
/* For other windows, if the position in the changelist is
* at the end it stays at the end. */
@@ -2796,7 +2804,7 @@ changed_common(lnum, col, lnume, xtra)
#endif
}
FOR_ALL_WINDOWS(wp)
FOR_ALL_TAB_WINDOWS(tp, wp)
{
if (wp->w_buffer == curbuf)
{
@@ -4145,10 +4153,9 @@ vim_setenv(name, val)
/*
* Function given to ExpandGeneric() to obtain an environment variable name.
*/
/*ARGSUSED*/
char_u *
get_env_name(xp, idx)
expand_T *xp;
expand_T *xp UNUSED;
int idx;
{
# if defined(AMIGA) || defined(__MRC__) || defined(__SC__)
@@ -4740,9 +4747,9 @@ find_start_comment(ind_maxcomment) /* XXX */
* If it is then restrict the search to below this line and try again.
*/
line = ml_get(pos->lnum);
for (p = line; *p && (unsigned)(p - line) < pos->col; ++p)
for (p = line; *p && (colnr_T)(p - line) < pos->col; ++p)
p = skip_string(p);
if ((unsigned)(p - line) <= pos->col)
if ((colnr_T)(p - line) <= pos->col)
break;
cur_maxcomment = curwin->w_cursor.lnum - pos->lnum - 1;
if (cur_maxcomment <= 0)
@@ -6273,7 +6280,7 @@ get_c_indent()
* check for that.
*/
if ((State & INSERT)
&& curwin->w_cursor.col < STRLEN(linecopy)
&& curwin->w_cursor.col < (colnr_T)STRLEN(linecopy)
&& linecopy[curwin->w_cursor.col] == ')')
linecopy[curwin->w_cursor.col] = NUL;
@@ -8526,11 +8533,25 @@ match_suffix(fname)
for (setsuf = p_su; *setsuf; )
{
setsuflen = copy_option_part(&setsuf, suf_buf, MAXSUFLEN, ".,");
if (fnamelen >= setsuflen
&& fnamencmp(suf_buf, fname + fnamelen - setsuflen,
(size_t)setsuflen) == 0)
break;
setsuflen = 0;
if (setsuflen == 0)
{
char_u *tail = gettail(fname);
/* empty entry: match name without a '.' */
if (vim_strchr(tail, '.') == NULL)
{
setsuflen = 1;
break;
}
}
else
{
if (fnamelen >= setsuflen
&& fnamencmp(suf_buf, fname + fnamelen - setsuflen,
(size_t)setsuflen) == 0)
break;
setsuflen = 0;
}
}
return (setsuflen != 0);
}
@@ -9192,7 +9213,7 @@ gen_expand_wildcards(num_pat, pat, num_file, file, flags)
else if (vim_strpbrk(p, (char_u *)"$~") != NULL)
{
vim_free(p);
ga_clear(&ga);
ga_clear_strings(&ga);
i = mch_expand_wildcards(num_pat, pat, num_file, file,
flags);
recursive = FALSE;

Some files were not shown because too many files have changed in this diff Show More