mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-02 11:19:22 +02:00
Compare commits
231 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ddd5a2bd4b | |||
| 5bc897df9d | |||
| 2f3a9d7740 | |||
| 3aaef67b85 | |||
| 9f957bcd6c | |||
| 9a01753529 | |||
| ac4412ace2 | |||
| b712dd06eb | |||
| 8cad670f16 | |||
| fe79caddfa | |||
| 33c4dd0eef | |||
| d5365574cc | |||
| 615d7dd609 | |||
| e411119903 | |||
| 1ab1bec908 | |||
| 770796042e | |||
| f5a8f4f083 | |||
| c36f69c013 | |||
| b05db8d377 | |||
| b262a38339 | |||
| 3b2784e277 | |||
| 04a6eb68d0 | |||
| 25d39a282a | |||
| fdd9622c00 | |||
| be45005f25 | |||
| 281f280eb1 | |||
| 9c1037f556 | |||
| 2b77fe974e | |||
| fc05fb5e3e | |||
| b7b4e364c4 | |||
| ed55437203 | |||
| b07059a739 | |||
| 00a63422ca | |||
| a3bc1d1a86 | |||
| 629eb02403 | |||
| a81d84df1f | |||
| 19314f214b | |||
| baeec8addc | |||
| 49c9e43d59 | |||
| 0b5eab9c89 | |||
| 49a5d8fbab | |||
| 5f972f11ac | |||
| 554448b77f | |||
| c8d08d3d53 | |||
| 9539d1240e | |||
| f6785cd6c8 | |||
| 2688634afb | |||
| 2a1aff523b | |||
| d2d8135617 | |||
| e33ea64952 | |||
| 6a36ea9a4f | |||
| 98d113300f | |||
| 814f3a5ed0 | |||
| 99805e6988 | |||
| fd2804b9df | |||
| 6f553b7ad5 | |||
| 67df700615 | |||
| ad7da68f84 | |||
| a396b2f7bf | |||
| bb28facdad | |||
| 25133f7d03 | |||
| 6907a6b43e | |||
| 6a87e8cc02 | |||
| d04263aee2 | |||
| 64d84c49fa | |||
| 823ab3d45a | |||
| 2a5bbeead5 | |||
| 935ea1a658 | |||
| bf68c50168 | |||
| 84c844a956 | |||
| 889b7064e3 | |||
| 7a5e3f51cb | |||
| f03063e1cf | |||
| 32c1d587d8 | |||
| 497535c098 | |||
| 8624d40d53 | |||
| dc8a6b7bec | |||
| c5d549a4e0 | |||
| 3eb0ca1305 | |||
| 6ab612e357 | |||
| 16caec3a2b | |||
| 3506261522 | |||
| 6cc607a2f4 | |||
| 4894e8fb74 | |||
| a2e0526744 | |||
| d69e140c24 | |||
| 7cae9e965c | |||
| 2d7c78f24c | |||
| a8da347a13 | |||
| 2e45751630 | |||
| 8cd984a56b | |||
| 650cb7ac61 | |||
| ae400c2dbb | |||
| 507a68ef81 | |||
| 271ef88821 | |||
| 9a248b819d | |||
| 6aeca470b5 | |||
| 936863de98 | |||
| d96b64262d | |||
| 200d3e5957 | |||
| 4ca28fccbd | |||
| 9c08729d42 | |||
| 8e0d50c1ed | |||
| 865619bc65 | |||
| 3b1a4d48f0 | |||
| 6c124f1604 | |||
| 44c21d0863 | |||
| ad1b34005d | |||
| 107a1cf7cc | |||
| cbe2f307b1 | |||
| 5213b783d7 | |||
| c6babee370 | |||
| b4b97fe905 | |||
| cd37d01770 | |||
| d8b193e98b | |||
| 629579e8a0 | |||
| 9d6d075726 | |||
| 7d6909d353 | |||
| b75c36581f | |||
| ae253a2dad | |||
| 21cced3fc6 | |||
| 29745cf124 | |||
| 699de3c049 | |||
| 5560396666 | |||
| 8570b5df1f | |||
| 7391be3977 | |||
| 7068f9086c | |||
| af2e8b9e3b | |||
| 7d87f83e26 | |||
| eb6512ab82 | |||
| c2d5277fc9 | |||
| e9d2694dce | |||
| 36154dd8c0 | |||
| 0d778b28a4 | |||
| fa7096a6ee | |||
| cc2b9e2245 | |||
| 2cd4c80953 | |||
| 8303ab1b1a | |||
| 3ef707c468 | |||
| b3ec0ad87a | |||
| 4486bb71fb | |||
| 176ab5d393 | |||
| aff8366139 | |||
| d05fb395d1 | |||
| e764e25045 | |||
| bd178a9659 | |||
| 5a5cd60221 | |||
| 7c3e218035 | |||
| 760e36dc8b | |||
| 941e7a992d | |||
| 7108d56061 | |||
| d5a9cdd9c8 | |||
| 60ed6e1213 | |||
| d628c3711d | |||
| 3344f11140 | |||
| f047b3aa3e | |||
| 31ad5d0472 | |||
| edbdca29e1 | |||
| 5433ca7d4c | |||
| 816ac0a441 | |||
| 90e4752df4 | |||
| 0978ebc1c6 | |||
| f486bb41d6 | |||
| 44227b9a93 | |||
| ad02696d27 | |||
| 87658a916a | |||
| 66299b9ed5 | |||
| fc072b7b61 | |||
| fef8272db2 | |||
| b04c78a6a0 | |||
| 99b7765c18 | |||
| c8e331a5f5 | |||
| 03f0a92f69 | |||
| ca96b60e9a | |||
| ea811731f0 | |||
| 11b068fc25 | |||
| 097577c351 | |||
| 250b62c9a8 | |||
| 54fea5fe67 | |||
| e63aad92b1 | |||
| 8ac99eed90 | |||
| 25b4e351c9 | |||
| 20da24a60c | |||
| 0873fb8f49 | |||
| 839717064f | |||
| cee529f197 | |||
| a3935654b8 | |||
| ff7ca495c1 | |||
| 335f08054d | |||
| fa0d5e0ba9 | |||
| 1f4d8dd8e1 | |||
| b465ee5bbe | |||
| 919b11d301 | |||
| f5cfc6a148 | |||
| 915fba8a25 | |||
| 6b64a62626 | |||
| 0ee0fbc2d4 | |||
| 8db81befc3 | |||
| 47b763090e | |||
| 99b962f986 | |||
| e6b7f4ff3b | |||
| 11f7764bd6 | |||
| 3f2fbccc21 | |||
| 84602997b6 | |||
| 19a1e1db6b | |||
| 0949ad4f8b | |||
| 8f5131b2d7 | |||
| 682e144672 | |||
| a05172e1db | |||
| 9b0f42ed24 | |||
| 7b900cf55a | |||
| 82c9ce9eeb | |||
| 104a7e6484 | |||
| 1e2844207d | |||
| b39439f386 | |||
| 185e34337d | |||
| e711158eed | |||
| f43ffacda1 | |||
| 160f5fa78f | |||
| 7ebc297d1d | |||
| 3a9b07d2d2 | |||
| 86d424677a | |||
| 1666886eaa | |||
| 7f3a4e21e7 | |||
| 49b3032c6d | |||
| 153c893e9e | |||
| e07aeca8c3 | |||
| 788aadad0a | |||
| 396732e9af | |||
| 1c74207cd6 | |||
| eb9ece5bf1 |
@@ -14,8 +14,14 @@ src/MacVim/icons/build
|
||||
src/MacVim/icons/makeicns/*.o
|
||||
src/MacVim/icons/makeicns/makeicns
|
||||
src/MacVim/PSMTabBarControl/PSMTabBarControl.xcodeproj/*.mode1
|
||||
src/MacVim/PSMTabBarControl/PSMTabBarControl.xcodeproj/*.mode1v3
|
||||
src/MacVim/PSMTabBarControl/PSMTabBarControl.xcodeproj/*.pbxuser
|
||||
src/MacVim/PSMTabBarControl/build
|
||||
src/MacVim/edit-in-odb/Edit in ODBEditor.xcodeproj/*.mode1
|
||||
src/MacVim/edit-in-odb/Edit in ODBEditor.xcodeproj/*.mode1v3
|
||||
src/MacVim/edit-in-odb/Edit in ODBEditor.xcodeproj/*.pbxuser
|
||||
src/MacVim/edit-in-odb/build
|
||||
src/MacVim/PSMTabBarControl/build
|
||||
src/MacVim/build
|
||||
src/TAGS
|
||||
src/Vim
|
||||
|
||||
@@ -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
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()*
|
||||
|
||||
+53
-17
@@ -1,4 +1,4 @@
|
||||
*gui_mac.txt* For Vim version 7.2. Last change: 2009 Mar 15
|
||||
*gui_mac.txt* For Vim version 7.2. Last change: 2009 Sep 23
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bjorn Winckler
|
||||
@@ -17,8 +17,9 @@ The MacVim Graphical User Interface *macvim* *gui-macvim*
|
||||
8. System services |macvim-services|
|
||||
9. mvim:// URL handler |macvim-url-handler|
|
||||
10. Keyboard shortcuts |macvim-shortcuts|
|
||||
11. Known bugs/missing features |macvim-todo|
|
||||
12. Hints |macvim-hints|
|
||||
11. International |macvim-international|
|
||||
12. Known bugs/missing features |macvim-todo|
|
||||
13. Hints |macvim-hints|
|
||||
|
||||
Other relevant documentation:
|
||||
|gui.txt| For generic items of the GUI.
|
||||
@@ -350,7 +351,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|.
|
||||
|
||||
==============================================================================
|
||||
@@ -511,8 +512,8 @@ some experimentation might be required in order to figure out which key to
|
||||
press.
|
||||
|
||||
The second way of controlling dialogs with the keyboard is to enable "Full
|
||||
keyboard access" in the "Keyboard & Mouse" pane of the System Preferences (you
|
||||
can also toggle this on or off by pressing Ctrl-F7). Once keyboard access is
|
||||
keyboard access" in the "Keyboard" pane of the System Preferences (you can
|
||||
also toggle this on or off by pressing Ctrl-F7). Once keyboard access is
|
||||
enabled it is possible to move between buttons with Tab and pressing Space to
|
||||
select the current button. The current button is indicated with a blue
|
||||
outline.
|
||||
@@ -573,12 +574,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" System Preferences.
|
||||
|
||||
*Cmd-Left* *<D-Left>*
|
||||
Cmd-Left Move cursor to the beginning of the line
|
||||
@@ -622,7 +626,28 @@ See |macvim-shift-movement| if you want Shift to select text when used in
|
||||
conjunction with the above Cmd/Alt movement shortcuts.
|
||||
|
||||
==============================================================================
|
||||
11. Known bugs/missing features *macvim-todo*
|
||||
11. International *macvim-international*
|
||||
|
||||
When editing non-English text it may be convenient to keep separate keyboard
|
||||
layouts for normal and insert mode. This is supported via the 'imd' option on
|
||||
Mac OS X 10.5 or later (on 10.4 the 'imd' option support is not as useful as
|
||||
it only switches between Roman and non-Roman input sources and it has been
|
||||
known not to work very reliably).
|
||||
|
||||
For example: When 'noimd' is enabled (i.e. IM is enabled) the input source is
|
||||
saved when toggling between normal and insert mode, so you can use a US layout
|
||||
in normal mode then switch to insert mode and choose a Swedish layout. When
|
||||
you go back to normal mode the US layout will be selected and when you enter
|
||||
insert mode the Swedish layout is selected. This also works when searching
|
||||
for text etc. see 'imc', 'imi', 'ims'.
|
||||
|
||||
Note that the layout used in normal mode is the layout used when 'noimd' is
|
||||
set (i.e when IM is enabled). If you find that MacVim switches to the
|
||||
wrong layout when going back to normal mode, then select the layout you want
|
||||
to use in normal mode and type ":set imd" followed by ":set noimd".
|
||||
|
||||
==============================================================================
|
||||
12. Known bugs/missing features *macvim-todo*
|
||||
|
||||
This list is by no means exhaustive, it only enumerates some of the more
|
||||
prominent bugs/missing features.
|
||||
@@ -645,7 +670,7 @@ might be simple to implement, but unless somebody asks for a particular
|
||||
feature then there is little incentive to add it.
|
||||
|
||||
==============================================================================
|
||||
12. Hints *macvim-hints*
|
||||
13. Hints *macvim-hints*
|
||||
|
||||
In this section some general (not necessarily MacVim specific) hints are
|
||||
given.
|
||||
@@ -689,11 +714,11 @@ This is a known problem, see |macvim-todo|.
|
||||
Scenario: ~
|
||||
You dislike the default font (DejaVu Sans Mono).
|
||||
Solution: ~
|
||||
The standard fixed width font on other Mac OS X applications is Monaco. If
|
||||
you prefer this font then add the following line to your "~/.gvimrc" (note
|
||||
that Monaco does not come in italic and bold variants): >
|
||||
set guifont=Monaco:h10
|
||||
The suffix ":h10" specifies the point size of the font should be "10" (see
|
||||
The standard fixed width font on Mac OS X is Menlo (it used to be Monaco prior
|
||||
to OS X 10.6). If you prefer this font then add the following line to your
|
||||
"~/.gvimrc": >
|
||||
set guifont=Menlo:h11
|
||||
The suffix ":h11" specifies the point size of the font should be "11" (see
|
||||
'guifont' for more information on how to set the font).
|
||||
|
||||
Scenario: ~
|
||||
@@ -742,13 +767,24 @@ bring up an editor, you would set that option to something like: >
|
||||
Scenario: ~
|
||||
You would like to remap Caps Lock to Esc.
|
||||
Solution: ~
|
||||
The free app "PCKeyboardHack" can be used to remap Caps Lock. It is available
|
||||
as a free download from:
|
||||
The app "PCKeyboardHack" can be used to remap Caps Lock. It is available as a
|
||||
free download from:
|
||||
http://www.pqrs.org/tekezo/macosx/keyremap4macbook/extra.html
|
||||
On some Apple keyboards the Caps Lock key doesn't immediately register and
|
||||
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).
|
||||
the "Keyboard" System Preference and remap Caps Lock to Ctrl first (click the
|
||||
"Modifier Keys..." button). This trick may also be necessary if the Caps Lock
|
||||
light turns on/off despite having remapped to Esc.
|
||||
|
||||
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
|
||||
|
||||
@@ -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*
|
||||
@@ -486,7 +481,8 @@ bit of code) was adapted from the cscope interface in nvi. Please report
|
||||
any problems, suggestions, patches, et al., you have for the usage of
|
||||
cscope within Vim to him.
|
||||
*cscope-win32*
|
||||
For a cscope version for Win32 see: http://iamphet.nm.ru/cscope/index.html
|
||||
For a cscope version for Win32 see:
|
||||
http://code.google.com/p/cscope-win32/
|
||||
|
||||
Win32 support was added by Sergey Khorev <sergey.khorev@gmail.com>. Contact
|
||||
him if you have Win32-specific issues.
|
||||
|
||||
+39
-58
@@ -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|.
|
||||
|
||||
@@ -224,6 +224,10 @@ expression is evaluated to obtain the {rhs} that is used. Example: >
|
||||
The result of the InsertDot() function will be inserted. It could check the
|
||||
text before the cursor and start omni completion when some condition is met.
|
||||
|
||||
For abbreviations |v:char| is set to the character that was typed to trigger
|
||||
the abbreviation. You can use this to decide how to expand the {lhs}. You
|
||||
can't change v:char and you should not insert it.
|
||||
|
||||
Be very careful about side effects! The expression is evaluated while
|
||||
obtaining characters, you may very well make the command dysfunctional.
|
||||
For this reason the following is blocked:
|
||||
|
||||
+12
-3
@@ -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
|
||||
@@ -3873,11 +3881,12 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
global
|
||||
{not in Vi}
|
||||
{only available when compiled with the |+xim|
|
||||
|+multi_byte_ime| or |global-ime| feature}
|
||||
|+multi_byte_ime| or |global-ime| feature, always
|
||||
available in MacVim}
|
||||
When set the Input Method is never used. This is useful to disable
|
||||
the IM when it doesn't work properly.
|
||||
Currently this option is on by default for SGI/IRIX and MacVim. This
|
||||
may change in later releases.
|
||||
Currently this option is on by default for SGI/IRIX. This may change
|
||||
in later releases.
|
||||
|
||||
*'iminsert'* *'imi'*
|
||||
'iminsert' 'imi' number (default 0, 2 when an input method is supported)
|
||||
|
||||
@@ -208,7 +208,7 @@ When using gvim, the --remote-wait only works properly this way: >
|
||||
MacVim uses distributed objects for interprocess communication. A server
|
||||
listens to a named port for new connections, and clients connect to this port
|
||||
to send messages. Server listings are made possible by the frontend (MacVim)
|
||||
keeping a list of all currently running servers. Thus, server are not aware
|
||||
keeping a list of all currently running servers. Thus, servers are not aware
|
||||
of each other directly; only MacVim knows which servers are running.
|
||||
|
||||
A client is any object which implements the MMVimClientProtocol (see
|
||||
|
||||
@@ -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
|
||||
|
||||
+134
-15
@@ -17,8 +17,7 @@ if !exists("did_install_default_menus")
|
||||
let did_install_default_menus = 1
|
||||
|
||||
|
||||
" Localized menus currently not supported in MacVim
|
||||
if !has("gui_macvim") && (exists("v:lang") || &langmenu != "")
|
||||
if (exists("v:lang") || &langmenu != "")
|
||||
" Try to find a menu translation file for the current language.
|
||||
if &langmenu != ""
|
||||
if &langmenu =~ "none"
|
||||
@@ -68,7 +67,27 @@ if !has("gui_macvim") && (exists("v:lang") || &langmenu != "")
|
||||
endif
|
||||
|
||||
|
||||
" MacVim Window menu (should be next to Help so give it a high priority)
|
||||
if has("gui_macvim")
|
||||
an <silent> 9998.300 Window.Minimize <Nop>
|
||||
an <silent> 9998.301 Window.Minimize\ All <Nop>
|
||||
an <silent> 9998.310 Window.Zoom <Nop>
|
||||
an <silent> 9998.311 Window.Zoom\ All <Nop>
|
||||
an <silent> 9998.320 Window.Toggle\ Full\ Screen\ Mode :set invfullscreen<CR>
|
||||
an 9998.330 Window.-SEP1- <Nop>
|
||||
" TODO! Grey out if no tabs are visible.
|
||||
an <silent> 9998.340 Window.Select\ Next\ Tab :tabnext<CR>
|
||||
an <silent> 9998.350 Window.Select\ Previous\ Tab :tabprevious<CR>
|
||||
an 9998.360 Window.-SEP2- <Nop>
|
||||
an <silent> 9998.370 Window.Bring\ All\ To\ Front <Nop>
|
||||
endif
|
||||
|
||||
" Help menu
|
||||
if has("gui_macvim")
|
||||
an 9999.1 &Help.MacVim\ Help :h gui_mac<CR>
|
||||
an <silent> 9999.2 Help.MacVim\ Website <Nop>
|
||||
an 9999.3 &Help.-sep0- <Nop>
|
||||
endif
|
||||
an 9999.10 &Help.&Overview<Tab><F1> :help<CR>
|
||||
an 9999.20 &Help.&User\ Manual :help usr_toc<CR>
|
||||
an 9999.30 &Help.&How-to\ links :help how-to<CR>
|
||||
@@ -97,16 +116,32 @@ fun! s:Helpfind()
|
||||
endfun
|
||||
|
||||
" File menu
|
||||
an 10.310 &File.&Open\.\.\.<Tab>:e :browse confirm e<CR>
|
||||
if has("gui_macvim")
|
||||
an <silent> 10.290 &File.New\ Window <Nop>
|
||||
an 10.295 &File.New\ Tab :tabnew<CR>
|
||||
an <silent> 10.310 &File.Open\.\.\. <Nop>
|
||||
an <silent> 10.325 &File.Open\ Recent <Nop>
|
||||
an 10.328 &File.-SEP0- <Nop>
|
||||
an <silent> 10.330 &File.Close\ Window<Tab>:qa :conf qa<CR>
|
||||
an <silent> 10.332 &File.Close :conf q<CR>
|
||||
an <silent> 10.341 &File.Save\ All :browse conf wa<CR>
|
||||
an 10.350 &File.Save\ As\.\.\.<Tab>:sav :browse confirm saveas<CR>
|
||||
else
|
||||
endif
|
||||
if !has("gui_macvim")
|
||||
an 10.310 &File.&Open\.\.\.<Tab>:e :browse confirm e<CR>
|
||||
endif
|
||||
an 10.320 &File.Sp&lit-Open\.\.\.<Tab>:sp :browse sp<CR>
|
||||
an 10.320 &File.Open\ Tab\.\.\.<Tab>:tabnew :browse tabnew<CR>
|
||||
an 10.325 &File.&New<Tab>:enew :confirm enew<CR>
|
||||
an <silent> 10.330 &File.&Close<Tab>:close
|
||||
if !has("gui_macvim")
|
||||
an 10.325 &File.&New<Tab>:enew :confirm enew<CR>
|
||||
an <silent> 10.330 &File.&Close<Tab>:close
|
||||
\ :if winheight(2) < 0 <Bar>
|
||||
\ confirm enew <Bar>
|
||||
\ else <Bar>
|
||||
\ confirm close <Bar>
|
||||
\ endif<CR>
|
||||
endif
|
||||
an 10.335 &File.-SEP1- <Nop>
|
||||
an <silent> 10.340 &File.&Save<Tab>:w :if expand("%") == ""<Bar>browse confirm w<Bar>else<Bar>confirm w<Bar>endif<CR>
|
||||
an 10.350 &File.Save\ &As\.\.\.<Tab>:sav :browse confirm saveas<CR>
|
||||
@@ -128,9 +163,11 @@ elseif has("unix")
|
||||
vunmenu &File.&Print
|
||||
vnoremenu &File.&Print :w !lpr<CR>
|
||||
endif
|
||||
an 10.600 &File.-SEP4- <Nop>
|
||||
an 10.610 &File.Sa&ve-Exit<Tab>:wqa :confirm wqa<CR>
|
||||
an 10.620 &File.E&xit<Tab>:qa :confirm qa<CR>
|
||||
if !has("gui_macvim")
|
||||
an 10.600 &File.-SEP4- <Nop>
|
||||
an 10.610 &File.Sa&ve-Exit<Tab>:wqa :confirm wqa<CR>
|
||||
an 10.620 &File.E&xit<Tab>:qa :confirm qa<CR>
|
||||
endif
|
||||
|
||||
func! <SID>SelectAll()
|
||||
exe "norm gg" . (&slm == "" ? "VG" : "gH\<C-O>G")
|
||||
@@ -167,13 +204,20 @@ inoremenu <script> <silent> 20.400 &Edit.&Select\ All<Tab>ggVG <C-O>:call <SID>S
|
||||
cnoremenu <script> <silent> 20.400 &Edit.&Select\ All<Tab>ggVG <C-U>call <SID>SelectAll()<CR>
|
||||
|
||||
an 20.405 &Edit.-SEP2- <Nop>
|
||||
if has("win32") || has("win16") || has("gui_gtk") || has("gui_kde") || has("gui_motif")
|
||||
if has("win32") || has("win16") || has("gui_gtk") || has("gui_kde") || has("gui_motif")
|
||||
an 20.410 &Edit.&Find\.\.\. :promptfind<CR>
|
||||
vunmenu &Edit.&Find\.\.\.
|
||||
vnoremenu <silent> &Edit.&Find\.\.\. y:promptfind <C-R>=<SID>FixFText()<CR><CR>
|
||||
an 20.420 &Edit.Find\ and\ Rep&lace\.\.\. :promptrepl<CR>
|
||||
vunmenu &Edit.Find\ and\ Rep&lace\.\.\.
|
||||
vnoremenu <silent> &Edit.Find\ and\ Rep&lace\.\.\. y:promptrepl <C-R>=<SID>FixFText()<CR><CR>
|
||||
elseif has("gui_macvim")
|
||||
an <silent> 20.410.10 &Edit.Find.Find\.\.\. :promptfind<CR>
|
||||
vunmenu &Edit.Find.Find\.\.\.
|
||||
vnoremenu <silent> &Edit.Find.Find\.\.\. y:promptfind <C-R>=<SID>FixFText()<CR><CR>
|
||||
an 20.410.20 &Edit.Find.Find\ Next <Nop>
|
||||
an 20.410.30 &Edit.Find.Find\ Previous <Nop>
|
||||
vmenu 20.410.35 &Edit.Find.Use\ Selection\ for\ Find y:let @/=@"<CR>:<BS>
|
||||
else
|
||||
an 20.410 &Edit.&Find<Tab>/ /
|
||||
an 20.420 &Edit.Find\ and\ Rep&lace<Tab>:%s :%s/
|
||||
@@ -386,6 +430,13 @@ if has("keymap")
|
||||
endif
|
||||
if has("win32") || has("win16") || has("gui_motif") || has("gui_gtk") || has("gui_kde") || has("gui_photon") || has("gui_mac")
|
||||
an 20.470 &Edit.Select\ Fo&nt\.\.\. :set guifont=*<CR>
|
||||
elseif has("gui_macvim")
|
||||
an 20.470 &Edit.-SEP4- <Nop>
|
||||
an 20.475.10 &Edit.Font.Show\ Fonts <Nop>
|
||||
an 20.475.20 &Edit.Font.-SEP5- <Nop>
|
||||
an 20.475.30 &Edit.Font.Bigger <Nop>
|
||||
an 20.475.40 &Edit.Font.Smaller <Nop>
|
||||
an 20.480 &Edit.Special\ Characters\.\.\. <Nop>
|
||||
endif
|
||||
|
||||
" Programming menu
|
||||
@@ -803,6 +854,7 @@ endif
|
||||
endif " !exists("no_buffers_menu")
|
||||
|
||||
" Window menu
|
||||
if !has("gui_macvim")
|
||||
an 70.300 &Window.&New<Tab>^Wn <C-W>n
|
||||
an 70.310 &Window.S&plit<Tab>^Ws <C-W>s
|
||||
an 70.320 &Window.Sp&lit\ To\ #<Tab>^W^^ <C-W><C-^>
|
||||
@@ -835,6 +887,7 @@ an 70.380 &Window.&Max\ Height<Tab>^W_ <C-W>_
|
||||
an 70.390 &Window.M&in\ Height<Tab>^W1_ <C-W>1_
|
||||
an 70.400 &Window.Max\ &Width<Tab>^W\| <C-W>\|
|
||||
an 70.410 &Window.Min\ Widt&h<Tab>^W1\| <C-W>1\|
|
||||
endif " !has("gui_macvim")
|
||||
|
||||
" The popup menu
|
||||
an 1.10 PopUp.&Undo u
|
||||
@@ -980,7 +1033,7 @@ if has("toolbar")
|
||||
exe 'vnoremenu <script> ToolBar.Paste ' . paste#paste_cmd['v']
|
||||
exe 'inoremenu <script> ToolBar.Paste ' . paste#paste_cmd['i']
|
||||
|
||||
if !has("gui_athena")
|
||||
if !has("gui_athena") && !has("gui_macvim")
|
||||
an 1.95 ToolBar.-sep3- <Nop>
|
||||
an 1.100 ToolBar.Replace :promptrepl<CR>
|
||||
vunmenu ToolBar.Replace
|
||||
@@ -989,19 +1042,27 @@ if has("toolbar")
|
||||
an 1.120 ToolBar.FindPrev N
|
||||
endif
|
||||
|
||||
an 1.215 ToolBar.-sep5- <Nop>
|
||||
if !has("gui_macvim")
|
||||
an 1.215 ToolBar.-sep5- <Nop>
|
||||
endif
|
||||
an <silent> 1.220 ToolBar.LoadSesn :call <SID>LoadVimSesn()<CR>
|
||||
an <silent> 1.230 ToolBar.SaveSesn :call <SID>SaveVimSesn()<CR>
|
||||
an 1.240 ToolBar.RunScript :browse so<CR>
|
||||
|
||||
an 1.245 ToolBar.-sep6- <Nop>
|
||||
if !has("gui_macvim")
|
||||
an 1.245 ToolBar.-sep6- <Nop>
|
||||
endif
|
||||
an 1.250 ToolBar.Make :make<CR>
|
||||
an 1.270 ToolBar.RunCtags :exe "!" . g:ctags_command<CR>
|
||||
an 1.280 ToolBar.TagJump g<C-]>
|
||||
if !has("gui_macvim")
|
||||
an 1.270 ToolBar.RunCtags :exe "!" . g:ctags_command<CR>
|
||||
an 1.280 ToolBar.TagJump g<C-]>
|
||||
endif
|
||||
|
||||
an 1.295 ToolBar.-sep7- <Nop>
|
||||
an 1.300 ToolBar.Help :help<CR>
|
||||
an <silent> 1.310 ToolBar.FindHelp :call <SID>Helpfind()<CR>
|
||||
if !has("gui_macvim")
|
||||
an <silent> 1.310 ToolBar.FindHelp :call <SID>Helpfind()<CR>
|
||||
endif
|
||||
|
||||
" Only set the tooltips here if not done in a language menu file
|
||||
if exists("*Do_toolbar_tmenu")
|
||||
@@ -1104,4 +1165,62 @@ endif " !exists("did_install_syntax_menu")
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
|
||||
if has("gui_macvim")
|
||||
"
|
||||
" Set up menu key equivalents (these should always have the 'D' modifier
|
||||
" set), action bindings, and alternate items.
|
||||
"
|
||||
" Note: menu items which should execute an action are bound to <Nop>; the
|
||||
" action message is specified here via the :macmenu command.
|
||||
"
|
||||
macm File.New\ Window key=<D-n> action=newWindow:
|
||||
macm File.New\ Tab key=<D-t>
|
||||
macm File.Open\.\.\. key=<D-o> action=fileOpen:
|
||||
macm File.Open\ Tab\.\.\.<Tab>:tabnew key=<D-T>
|
||||
macm File.Open\ Recent action=recentFilesDummy:
|
||||
macm File.Close\ Window<Tab>:qa key=<D-W>
|
||||
macm File.Close key=<D-w> action=performClose:
|
||||
macm File.Save<Tab>:w key=<D-s>
|
||||
macm File.Save\ All key=<D-M-s> alt=YES
|
||||
macm File.Save\ As\.\.\.<Tab>:sav key=<D-S>
|
||||
macm File.Print key=<D-p>
|
||||
|
||||
macm Edit.Undo<Tab>u key=<D-z> action=undo:
|
||||
macm Edit.Redo<Tab>^R key=<D-Z> action=redo:
|
||||
macm Edit.Cut<Tab>"+x key=<D-x> action=cut:
|
||||
macm Edit.Copy<Tab>"+y key=<D-c> action=copy:
|
||||
macm Edit.Paste<Tab>"+gP key=<D-v> action=paste:
|
||||
macm Edit.Select\ All<Tab>ggVG key=<D-a> action=selectAll:
|
||||
macm Edit.Find.Find\.\.\. key=<D-f>
|
||||
macm Edit.Find.Find\ Next key=<D-g> action=findNext:
|
||||
macm Edit.Find.Find\ Previous key=<D-G> action=findPrevious:
|
||||
macm Edit.Find.Use\ Selection\ for\ Find key=<D-e>
|
||||
macm Edit.Font.Show\ Fonts action=orderFrontFontPanel:
|
||||
macm Edit.Font.Bigger key=<D-=> action=fontSizeUp:
|
||||
macm Edit.Font.Smaller key=<D--> action=fontSizeDown:
|
||||
macm Edit.Special\ Characters\.\.\. key=<D-M-t> action=orderFrontCharacterPalette:
|
||||
|
||||
macm Tools.Spelling.To\ Next\ error<Tab>]s key=<D-;>
|
||||
macm Tools.Spelling.Suggest\ Corrections<Tab>z= key=<D-:>
|
||||
macm Tools.Make<Tab>:make key=<D-b>
|
||||
macm Tools.List\ Errors<Tab>:cl key=<D-l>
|
||||
macm Tools.Next\ Error<Tab>:cn key=<D-C-Right>
|
||||
macm Tools.Previous\ Error<Tab>:cp key=<D-C-Left>
|
||||
macm Tools.Older\ List<Tab>:cold key=<D-C-Up>
|
||||
macm Tools.Newer\ List<Tab>:cnew key=<D-C-Down>
|
||||
|
||||
macm Window.Minimize key=<D-m> action=performMiniaturize:
|
||||
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.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-?>
|
||||
macm Help.MacVim\ Website action=openWebsite:
|
||||
endif
|
||||
|
||||
" vim: set sw=2 :
|
||||
|
||||
@@ -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
|
||||
@@ -635,7 +635,9 @@ STDMETHODIMP CShellExt::QueryContextMenu(HMENU hMenu,
|
||||
}
|
||||
// Now concatenate
|
||||
strncpy(temp, _("Edit with existing Vim - "), BUFSIZE - 1);
|
||||
strncat(temp, title, BUFSIZE - 1);
|
||||
temp[BUFSIZE - 1] = '\0';
|
||||
strncat(temp, title, BUFSIZE - 1 - strlen(temp));
|
||||
temp[BUFSIZE - 1] = '\0';
|
||||
InsertMenu(hMenu,
|
||||
indexMenu++,
|
||||
MF_STRING|MF_BYPOSITION,
|
||||
|
||||
@@ -54,8 +54,7 @@
|
||||
NSEnumerator* myIterator = [commands objectEnumerator];
|
||||
NSDictionary* currCommand;
|
||||
|
||||
while (currCommand = [myIterator nextObject])
|
||||
{
|
||||
while ((currCommand = [myIterator nextObject])) {
|
||||
/* do something useful with currCommand */
|
||||
FILE *ioPipe = NULL;
|
||||
char junk[256];
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
// Released into public domain on 4/10/08.
|
||||
//
|
||||
// Version: 1.8
|
||||
#ifdef MM_ENABLE_PLUGINS
|
||||
|
||||
#import "CTGradient.h"
|
||||
|
||||
@@ -1266,3 +1267,5 @@ void resolveHSV(float *color1, float *color2) //H value may be undefined (i.e. g
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif // MM_ENABLE_PLUGINS
|
||||
|
||||
@@ -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.\
|
||||
|
||||
@@ -42,7 +42,12 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
|
||||
@interface DBPrefsWindowController : NSWindowController {
|
||||
@interface DBPrefsWindowController : NSWindowController
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1060)
|
||||
// 10.6 has turned delegate messages into formal protocols
|
||||
<NSAnimationDelegate, NSToolbarDelegate>
|
||||
#endif
|
||||
{
|
||||
NSMutableArray *toolbarIdentifiers;
|
||||
NSMutableDictionary *toolbarViews;
|
||||
NSMutableDictionary *toolbarItems;
|
||||
|
||||
Generated
Generated
+1363
-7
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,532 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<!-- These keys are needed to prevent Cocoa from inserting them as
|
||||
normal text (missing from StandardKeyBinding.dict below).
|
||||
-->
|
||||
<key>$</key>
|
||||
<string>deleteBackward:</string>
|
||||
<key>$
|
||||
</key>
|
||||
<string>insertNewline:</string>
|
||||
<key>^~
|
||||
</key>
|
||||
<string>insertNewline:</string>
|
||||
<key>$</key>
|
||||
<string>insertNewline:</string>
|
||||
<key>^~</key>
|
||||
<string>insertNewline:</string>
|
||||
<key>^</key>
|
||||
<string>cancelOperation:</string>
|
||||
<key>$</key>
|
||||
<string>cancelOperation:</string>
|
||||
<key>^~</key>
|
||||
<string>cancelOperation:</string>
|
||||
<key>^~ </key>
|
||||
<string>insertTab:</string>
|
||||
<key>~</key>
|
||||
<string>insertBackTab:</string>
|
||||
<key>^~</key>
|
||||
<string>insertBackTab:</string>
|
||||
<key>^ </key>
|
||||
<string>keySpace:</string>
|
||||
<key>~ </key>
|
||||
<string>keySpace:</string>
|
||||
<key>$ </key>
|
||||
<string>keySpace:</string>
|
||||
<key>^~ </key>
|
||||
<string>keySpace:</string>
|
||||
|
||||
<!-- The following keys involving Command (@) are here to make sure
|
||||
interpretKeyEvents: does not block Command+Alt+.. and
|
||||
Command+Ctrl+.. key events. -->
|
||||
<key>@~</key>
|
||||
<string>noop:</string>
|
||||
<key>@^</key>
|
||||
<string>noop:</string>
|
||||
<key>@^~</key>
|
||||
<string>noop:</string>
|
||||
|
||||
|
||||
<!-- These keys are used to convert certain keys so that we don't have
|
||||
to do it manually.
|
||||
-->
|
||||
<!-- Turn Ctrl-2 into Ctrl-@ -->
|
||||
<key>^2</key>
|
||||
<string>keyCtrlAt:</string>
|
||||
<!-- Turn Ctrl-6 into Ctrl-^ -->
|
||||
<key>^6</key>
|
||||
<string>keyCtrlHat:</string>
|
||||
|
||||
|
||||
<!-- These are copied from AppKit.framework/StandardKeyBinding.dict
|
||||
-->
|
||||
<key></key>
|
||||
<string>insertNewline:</string>
|
||||
<key></key>
|
||||
<string>deleteBackward:</string>
|
||||
<key> </key>
|
||||
<string>insertTab:</string>
|
||||
<key>
|
||||
</key>
|
||||
<string>insertNewline:</string>
|
||||
<key>
|
||||
</key>
|
||||
<string>insertNewline:</string>
|
||||
<key></key>
|
||||
<string>insertBacktab:</string>
|
||||
<key></key>
|
||||
<string>cancelOperation:</string>
|
||||
<key>$</key>
|
||||
<string>moveUpAndModifySelection:</string>
|
||||
<key>$</key>
|
||||
<string>moveDownAndModifySelection:</string>
|
||||
<key>$</key>
|
||||
<string>moveLeftAndModifySelection:</string>
|
||||
<key>$</key>
|
||||
<string>moveRightAndModifySelection:</string>
|
||||
<key>$</key>
|
||||
<string>moveToBeginningOfDocumentAndModifySelection:</string>
|
||||
<key>$</key>
|
||||
<string>moveToEndOfDocumentAndModifySelection:</string>
|
||||
<key>$</key>
|
||||
<string>pageUpAndModifySelection:</string>
|
||||
<key>$</key>
|
||||
<string>pageDownAndModifySelection:</string>
|
||||
<key>@</key>
|
||||
<string>noop:</string>
|
||||
<key>@ </key>
|
||||
<string>cycleToNextInputScript:</string>
|
||||
<key>@.</key>
|
||||
<string>cancelOperation:</string>
|
||||
<key>@^ </key>
|
||||
<string>togglePlatformInputSystem:</string>
|
||||
<key>@~ </key>
|
||||
<string>cycleToNextInputKeyboardLayout:</string>
|
||||
<key>^</key>
|
||||
<string>noop:</string>
|
||||
<key>^</key>
|
||||
<string>insertLineBreak:</string>
|
||||
<key>^ </key>
|
||||
<string>selectNextKeyView:</string>
|
||||
<key>^
|
||||
</key>
|
||||
<string>insertLineBreak:</string>
|
||||
<key>^
|
||||
</key>
|
||||
<string>insertLineBreak:</string>
|
||||
<key>^</key>
|
||||
<string>selectPreviousKeyView:</string>
|
||||
<key>^"</key>
|
||||
<string>insertDoubleQuoteIgnoringSubstitution:</string>
|
||||
<key>^'</key>
|
||||
<string>insertSingleQuoteIgnoringSubstitution:</string>
|
||||
<key>^A</key>
|
||||
<string>moveToBeginningOfParagraphAndModifySelection:</string>
|
||||
<key>^B</key>
|
||||
<string>moveBackwardAndModifySelection:</string>
|
||||
<key>^E</key>
|
||||
<string>moveToEndOfParagraphAndModifySelection:</string>
|
||||
<key>^F</key>
|
||||
<string>moveForwardAndModifySelection:</string>
|
||||
<key>^N</key>
|
||||
<string>moveDownAndModifySelection:</string>
|
||||
<key>^P</key>
|
||||
<string>moveUpAndModifySelection:</string>
|
||||
<key>^V</key>
|
||||
<string>pageDownAndModifySelection:</string>
|
||||
<key>^a</key>
|
||||
<string>moveToBeginningOfParagraph:</string>
|
||||
<key>^b</key>
|
||||
<string>moveBackward:</string>
|
||||
<key>^d</key>
|
||||
<string>deleteForward:</string>
|
||||
<key>^e</key>
|
||||
<string>moveToEndOfParagraph:</string>
|
||||
<key>^f</key>
|
||||
<string>moveForward:</string>
|
||||
<key>^h</key>
|
||||
<string>deleteBackward:</string>
|
||||
<key>^k</key>
|
||||
<string>deleteToEndOfParagraph:</string>
|
||||
<key>^l</key>
|
||||
<string>centerSelectionInVisibleArea:</string>
|
||||
<key>^n</key>
|
||||
<string>moveDown:</string>
|
||||
<!-- <key>^o</key>
|
||||
<array>
|
||||
<string>insertNewlineIgnoringFieldEditor:</string>
|
||||
<string>moveBackward:</string>
|
||||
</array> -->
|
||||
<key>^p</key>
|
||||
<string>moveUp:</string>
|
||||
<key>^t</key>
|
||||
<string>transpose:</string>
|
||||
<key>^v</key>
|
||||
<string>pageDown:</string>
|
||||
<key>^y</key>
|
||||
<string>yank:</string>
|
||||
<key>^~</key>
|
||||
<string>deleteWordBackward:</string>
|
||||
<key>^</key>
|
||||
<string>deleteBackwardByDecomposingPreviousCharacter:</string>
|
||||
<key>~</key>
|
||||
<string>insertNewlineIgnoringFieldEditor:</string>
|
||||
<key>~</key>
|
||||
<string>deleteWordBackward:</string>
|
||||
<key>~ </key>
|
||||
<string>insertTabIgnoringFieldEditor:</string>
|
||||
<key>~
|
||||
</key>
|
||||
<string>insertNewlineIgnoringFieldEditor:</string>
|
||||
<key>~
|
||||
</key>
|
||||
<string>insertNewlineIgnoringFieldEditor:</string>
|
||||
<key>~</key>
|
||||
<string>complete:</string>
|
||||
<key>~^B</key>
|
||||
<string>moveWordBackwardAndModifySelection:</string>
|
||||
<key>~^F</key>
|
||||
<string>moveWordForwardAndModifySelection:</string>
|
||||
<key>~^b</key>
|
||||
<string>moveWordBackward:</string>
|
||||
<key>~^f</key>
|
||||
<string>moveWordForward:</string>
|
||||
<key>~</key>
|
||||
<string>deleteWordBackward:</string>
|
||||
<key></key>
|
||||
<string>deleteBackward:</string>
|
||||
<key></key>
|
||||
<string>moveUp:</string>
|
||||
<key></key>
|
||||
<string>moveDown:</string>
|
||||
<key></key>
|
||||
<string>moveLeft:</string>
|
||||
<key></key>
|
||||
<string>moveRight:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>complete:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>deleteForward:</string>
|
||||
<key></key>
|
||||
<string>scrollToBeginningOfDocument:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>scrollToEndOfDocument:</string>
|
||||
<key></key>
|
||||
<string>scrollPageUp:</string>
|
||||
<key></key>
|
||||
<string>scrollPageDown:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key>@</key>
|
||||
<string>moveToBeginningOfDocument:</string>
|
||||
<key>@</key>
|
||||
<string>moveToEndOfDocument:</string>
|
||||
<key>@</key>
|
||||
<string>moveToBeginningOfLine:</string>
|
||||
<key>@</key>
|
||||
<string>moveToEndOfLine:</string>
|
||||
<key>@$</key>
|
||||
<string>moveToBeginningOfDocumentAndModifySelection:</string>
|
||||
<key>@$</key>
|
||||
<string>moveToEndOfDocumentAndModifySelection:</string>
|
||||
<key>@$</key>
|
||||
<string>moveToBeginningOfLineAndModifySelection:</string>
|
||||
<key>@$</key>
|
||||
<string>moveToEndOfLineAndModifySelection:</string>
|
||||
<key>@^</key>
|
||||
<string>changeBaseWritingDirectionToRTL:</string>
|
||||
<key>@^</key>
|
||||
<string>changeBaseWritingDirectionToLTR:</string>
|
||||
<key>@</key>
|
||||
<string>deleteToBeginningOfLine:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key></key>
|
||||
<string>noop:</string>
|
||||
<key>^</key>
|
||||
<string>scrollPageUp:</string>
|
||||
<key>^</key>
|
||||
<string>scrollPageDown:</string>
|
||||
<key>^</key>
|
||||
<string>moveToBeginningOfLine:</string>
|
||||
<key>^</key>
|
||||
<string>moveToEndOfLine:</string>
|
||||
<key>^$</key>
|
||||
<string>moveToBeginningOfLineAndModifySelection:</string>
|
||||
<key>^$</key>
|
||||
<string>moveToEndOfLineAndModifySelection:</string>
|
||||
<!-- <key>~</key>
|
||||
<array>
|
||||
<string>moveBackward:</string>
|
||||
<string>moveToBeginningOfParagraph:</string>
|
||||
</array>
|
||||
<key>~</key>
|
||||
<array>
|
||||
<string>moveForward:</string>
|
||||
<string>moveToEndOfParagraph:</string>
|
||||
</array> -->
|
||||
<key>~</key>
|
||||
<string>moveWordLeft:</string>
|
||||
<key>~</key>
|
||||
<string>moveWordRight:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~$</key>
|
||||
<string>moveParagraphBackwardAndModifySelection:</string>
|
||||
<key>~$</key>
|
||||
<string>moveParagraphForwardAndModifySelection:</string>
|
||||
<key>~$</key>
|
||||
<string>moveWordLeftAndModifySelection:</string>
|
||||
<key>~$</key>
|
||||
<string>moveWordRightAndModifySelection:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>deleteWordForward:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>pageUp:</string>
|
||||
<key>~</key>
|
||||
<string>pageDown:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
<string>noop:</string>
|
||||
<key>~</key>
|
||||
+256
-128
@@ -61,27 +61,39 @@ static NSTimeInterval MMReplyTimeout = 5;
|
||||
|
||||
static NSString *MMWebsiteString = @"http://code.google.com/p/macvim/";
|
||||
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4)
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
|
||||
// Latency (in s) between FS event occuring and being reported to MacVim.
|
||||
// Should be small so that MacVim is notified of changes to the ~/.vim
|
||||
// directory more or less immediately.
|
||||
static CFTimeInterval MMEventStreamLatency = 0.1;
|
||||
#endif
|
||||
|
||||
static float MMCascadeHorizontalOffset = 21;
|
||||
static float MMCascadeVerticalOffset = 23;
|
||||
|
||||
#pragma options align=mac68k
|
||||
|
||||
#pragma pack(push,1)
|
||||
// The alignment and sizes of these fields are based on trial-and-error. It
|
||||
// may be necessary to adjust them to fit if Xcode ever changes this struct.
|
||||
typedef struct
|
||||
{
|
||||
short unused1; // 0 (not used)
|
||||
short lineNum; // line to select (< 0 to specify range)
|
||||
long startRange; // start of selection range (if line < 0)
|
||||
long endRange; // end of selection range (if line < 0)
|
||||
long unused2; // 0 (not used)
|
||||
long theDate; // modification date/time
|
||||
} MMSelectionRange;
|
||||
#pragma options align=reset
|
||||
int16_t unused1; // 0 (not used)
|
||||
int16_t lineNum; // line to select (< 0 to specify range)
|
||||
int32_t startRange; // start of selection range (if line < 0)
|
||||
int32_t endRange; // end of selection range (if line < 0)
|
||||
int32_t unused2; // 0 (not used)
|
||||
int32_t theDate; // modification date/time
|
||||
} MMXcodeSelectionRange;
|
||||
#pragma pack(pop)
|
||||
|
||||
|
||||
// This is a private AppKit API gleaned from class-dump.
|
||||
@interface NSKeyBindingManager : NSObject
|
||||
+ (id)sharedKeyBindingManager;
|
||||
- (id)dictionary;
|
||||
- (void)setDictionary:(id)arg1;
|
||||
@end
|
||||
|
||||
|
||||
@interface MMAppController (MMServices)
|
||||
- (void)openSelection:(NSPasteboard *)pboard userData:(NSString *)userData
|
||||
@@ -136,7 +148,7 @@ typedef struct
|
||||
|
||||
|
||||
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4)
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
|
||||
static void
|
||||
fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
void *clientCallBackInfo,
|
||||
@@ -153,6 +165,22 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
static BOOL initDone = NO;
|
||||
if (initDone) return;
|
||||
initDone = YES;
|
||||
|
||||
ASLInit();
|
||||
|
||||
// HACK! The following user default must be reset, else Ctrl-q (or
|
||||
// whichever key is specified by the default) will be blocked by the input
|
||||
// manager (interpretKeyEvents: swallows that key). (We can't use
|
||||
// NSUserDefaults since it only allows us to write to the registration
|
||||
// domain and this preference has "higher precedence" than that so such a
|
||||
// change would have no effect.)
|
||||
CFPreferencesSetAppValue(CFSTR("NSQuotedKeystrokeBinding"),
|
||||
CFSTR(""),
|
||||
kCFPreferencesCurrentApplication);
|
||||
|
||||
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSNumber numberWithBool:NO], MMNoWindowKey,
|
||||
[NSNumber numberWithInt:64], MMTabMinWidthKey,
|
||||
@@ -186,6 +214,9 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
[NSNumber numberWithInt:0], MMPreloadCacheSizeKey,
|
||||
[NSNumber numberWithInt:0], MMLastWindowClosedBehaviorKey,
|
||||
[NSNumber numberWithBool:YES], MMLoadDefaultFontKey,
|
||||
#ifdef INCLUDE_OLD_IM_CODE
|
||||
[NSNumber numberWithBool:YES], MMUseInlineImKey,
|
||||
#endif // INCLUDE_OLD_IM_CODE
|
||||
nil];
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] registerDefaults:dict];
|
||||
@@ -237,10 +268,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 +278,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
//NSLog(@"MMAppController dealloc");
|
||||
ASLogDebug(@"");
|
||||
|
||||
[connection release]; connection = nil;
|
||||
[inputQueues release]; inputQueues = nil;
|
||||
@@ -321,6 +350,40 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
andSelector:@selector(handleGetURLEvent:replyEvent:)
|
||||
forEventClass:kInternetEventClass
|
||||
andEventID:kAEGetURL];
|
||||
|
||||
// Disable the default Cocoa "Key Bindings" since they interfere with the
|
||||
// way Vim handles keyboard input. Cocoa reads bindings from
|
||||
// /System/Library/Frameworks/AppKit.framework/Resources/
|
||||
// StandardKeyBinding.dict
|
||||
// and
|
||||
// ~/Library/KeyBindings/DefaultKeyBinding.dict
|
||||
// To avoid having the user accidentally break keyboard handling (by
|
||||
// modifying the latter in some unexpected way) in MacVim we load our own
|
||||
// key binding dictionary from Resource/KeyBinding.plist. We can't disable
|
||||
// the bindings completely since it would break keyboard handling in
|
||||
// dialogs so the our custom dictionary contains all the entries from the
|
||||
// former location.
|
||||
//
|
||||
// It is possible to disable key bindings completely by not calling
|
||||
// interpretKeyEvents: in keyDown: but this also disables key bindings used
|
||||
// by certain input methods. E.g. Ctrl-Shift-; would no longer work in
|
||||
// the Kotoeri input manager.
|
||||
//
|
||||
// To solve this problem we access a private API and set the key binding
|
||||
// dictionary to our own custom dictionary here. At this time Cocoa will
|
||||
// have already read the above mentioned dictionaries so it (hopefully)
|
||||
// won't try to change the key binding dictionary again after this point.
|
||||
NSKeyBindingManager *mgr = [NSKeyBindingManager sharedKeyBindingManager];
|
||||
NSBundle *mainBundle = [NSBundle mainBundle];
|
||||
NSString *path = [mainBundle pathForResource:@"KeyBinding"
|
||||
ofType:@"plist"];
|
||||
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path];
|
||||
if (mgr && dict) {
|
||||
[mgr setDictionary:dict];
|
||||
} else {
|
||||
ASLogNotice(@"Failed to override the Cocoa key bindings. Keyboard "
|
||||
"input may behave strangely as a result (path=%@).", path);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)notification
|
||||
@@ -334,6 +397,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
[self scheduleVimControllerPreloadAfterDelay:2];
|
||||
[self startWatchingVimDir];
|
||||
}
|
||||
|
||||
ASLogInfo(@"MacVim finished launching");
|
||||
}
|
||||
|
||||
- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender
|
||||
@@ -378,12 +443,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 +585,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 +606,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 +619,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
|
||||
- (void)applicationWillTerminate:(NSNotification *)notification
|
||||
{
|
||||
ASLogInfo(@"Terminating MacVim...");
|
||||
|
||||
[self stopWatchingVimDir];
|
||||
|
||||
#ifdef MM_ENABLE_PLUGINS
|
||||
@@ -585,7 +655,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 +670,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,13 +695,19 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
|
||||
- (void)removeVimController:(id)controller
|
||||
{
|
||||
int idx = [vimControllers indexOfObject:controller];
|
||||
if (NSNotFound == idx)
|
||||
ASLogDebug(@"Remove Vim controller pid=%d id=%d (processingFlag=%d)",
|
||||
[controller pid], [controller vimControllerId], processingFlag);
|
||||
|
||||
NSUInteger idx = [vimControllers indexOfObject:controller];
|
||||
if (NSNotFound == idx) {
|
||||
ASLogDebug(@"Controller not found, probably due to duplicate removal");
|
||||
return;
|
||||
}
|
||||
|
||||
[controller cleanup];
|
||||
|
||||
[controller retain];
|
||||
[vimControllers removeObjectAtIndex:idx];
|
||||
[controller cleanup];
|
||||
[controller release];
|
||||
|
||||
if (![vimControllers count]) {
|
||||
// The last editor window just closed so restore the main menu back to
|
||||
@@ -674,33 +751,34 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
}
|
||||
|
||||
if (!NSEqualPoints(topLeft, NSZeroPoint)) {
|
||||
NSPoint oldTopLeft = topLeft;
|
||||
if (topWin)
|
||||
topLeft = [win cascadeTopLeftFromPoint:topLeft];
|
||||
if (topWin) {
|
||||
// Do manual cascading instead of using
|
||||
// -[MMWindow cascadeTopLeftFromPoint:] since it is rather
|
||||
// unpredictable.
|
||||
topLeft.x += MMCascadeHorizontalOffset;
|
||||
topLeft.y -= MMCascadeVerticalOffset;
|
||||
}
|
||||
|
||||
NSScreen *screen = [win screen];
|
||||
if (screen) {
|
||||
// Constrain the window so that it is entirely visible on the
|
||||
// screen. If it sticks out on the right, move it all the way
|
||||
// left. If it sticks out on the bottom, move it all the way up.
|
||||
// (Assumption: the cascading offsets are positive.)
|
||||
NSRect screenFrame = [screen frame];
|
||||
NSSize winSize = [win frame].size;
|
||||
NSRect winFrame =
|
||||
{ { topLeft.x, topLeft.y - winSize.height }, winSize };
|
||||
|
||||
if (NSMaxX(winFrame) > NSMaxX(screenFrame))
|
||||
topLeft.x = NSMinX(screenFrame);
|
||||
if (NSMinY(winFrame) < NSMinY(screenFrame))
|
||||
topLeft.y = NSMaxY(screenFrame);
|
||||
} else {
|
||||
ASLogNotice(@"Window not on screen, don't constrain position");
|
||||
}
|
||||
|
||||
[win setFrameTopLeftPoint:topLeft];
|
||||
|
||||
if ([win screen]) {
|
||||
NSPoint screenOrigin = [[win screen] frame].origin;
|
||||
if ([win frame].origin.y < screenOrigin.y) {
|
||||
// Try to avoid shifting the new window downwards if it means
|
||||
// that the bottom of the window will be off the screen. E.g.
|
||||
// if the user has set windows to open maximized in the
|
||||
// vertical direction then the new window will cascade
|
||||
// horizontally only.
|
||||
topLeft.y = oldTopLeft.y;
|
||||
[win setFrameTopLeftPoint:topLeft];
|
||||
}
|
||||
|
||||
if ([win frame].origin.y < screenOrigin.y) {
|
||||
// Move the window to the top of the screen if the bottom of
|
||||
// the window is still obscured.
|
||||
topLeft.y = NSMaxY([[win screen] frame]);
|
||||
[win setFrameTopLeftPoint:topLeft];
|
||||
}
|
||||
} else {
|
||||
NSLog(@"[%s] WINDOW NOT ON SCREEN, don't constrain position", _cmd);
|
||||
}
|
||||
}
|
||||
|
||||
if (1 == [vimControllers count]) {
|
||||
@@ -819,6 +897,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
NSMutableDictionary *arguments = (args ? [[args mutableCopy] autorelease]
|
||||
: [NSMutableDictionary dictionary]);
|
||||
|
||||
filenames = normalizeFilenames(filenames);
|
||||
|
||||
//
|
||||
// a) Filter out any already open files
|
||||
//
|
||||
@@ -969,6 +1049,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 +1070,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
|
||||
- (IBAction)fileOpen:(id)sender
|
||||
{
|
||||
ASLogDebug(@"Show file open panel");
|
||||
|
||||
NSString *dir = nil;
|
||||
BOOL trackPwd = [[NSUserDefaults standardUserDefaults]
|
||||
boolForKey:MMDialogsTrackPwdKey];
|
||||
@@ -1007,6 +1091,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
|
||||
- (IBAction)selectNextWindow:(id)sender
|
||||
{
|
||||
ASLogDebug(@"Select next window");
|
||||
|
||||
unsigned i, count = [vimControllers count];
|
||||
if (!count) return;
|
||||
|
||||
@@ -1027,6 +1113,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
|
||||
- (IBAction)selectPreviousWindow:(id)sender
|
||||
{
|
||||
ASLogDebug(@"Select previous window");
|
||||
|
||||
unsigned i, count = [vimControllers count];
|
||||
if (!count) return;
|
||||
|
||||
@@ -1050,17 +1138,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 +1159,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 +1173,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 +1181,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
|
||||
- (IBAction)quickstartButtonClicked:(id)sender
|
||||
{
|
||||
ASLogDebug(@"Toggle Quickstart option");
|
||||
if ([self maxPreloadCacheSize] > 0) {
|
||||
[self scheduleVimControllerPreloadAfterDelay:1.0];
|
||||
[self startWatchingVimDir];
|
||||
@@ -1114,7 +1209,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)];
|
||||
|
||||
@@ -1125,31 +1220,36 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
// (What if input arrives before the vim controller is added to the list of
|
||||
// controllers? This should not be a problem since the input isn't
|
||||
// processed immediately (see processInput:forIdentifier:).)
|
||||
// Also, since the app may be multithreaded (e.g. as a result of showing
|
||||
// the open panel) we have to ensure this call happens on the main thread,
|
||||
// else there is a race condition that may lead to a crash.
|
||||
MMVimController *vc = [[MMVimController alloc] initWithBackend:proxy
|
||||
pid:pid];
|
||||
[self performSelector:@selector(addVimController:)
|
||||
withObject:vc
|
||||
afterDelay:0];
|
||||
[self performSelectorOnMainThread:@selector(addVimController:)
|
||||
withObject:vc
|
||||
waitUntilDone:NO
|
||||
modes:[NSArray arrayWithObject:
|
||||
NSDefaultRunLoopMode]];
|
||||
|
||||
[vc release];
|
||||
|
||||
return [vc identifier];
|
||||
return [vc vimControllerId];
|
||||
}
|
||||
|
||||
- (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];
|
||||
@@ -1163,11 +1263,15 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
// NOTE: We must use "event tracking mode" as well as "default mode",
|
||||
// otherwise the input queue will not be processed e.g. during live
|
||||
// resizing.
|
||||
[self performSelector:@selector(processInputQueues:)
|
||||
withObject:nil
|
||||
afterDelay:0
|
||||
inModes:[NSArray arrayWithObjects:NSDefaultRunLoopMode,
|
||||
NSEventTrackingRunLoopMode, nil]];
|
||||
// Also, since the app may be multithreaded (e.g. as a result of showing
|
||||
// the open panel) we have to ensure this call happens on the main thread,
|
||||
// else there is a race condition that may lead to a crash.
|
||||
[self performSelectorOnMainThread:@selector(processInputQueues:)
|
||||
withObject:nil
|
||||
waitUntilDone:NO
|
||||
modes:[NSArray arrayWithObjects:
|
||||
NSDefaultRunLoopMode,
|
||||
NSEventTrackingRunLoopMode, nil]];
|
||||
}
|
||||
|
||||
- (NSArray *)serverList
|
||||
@@ -1195,11 +1299,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 +1327,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 +1337,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,20 +1359,22 @@ 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;
|
||||
}
|
||||
|
||||
NSString *path = [pboard stringForType:NSStringPboardType];
|
||||
path = [path stringByExpandingTildeInPath];
|
||||
|
||||
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 +1425,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 +1464,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;
|
||||
@@ -1455,7 +1563,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
if (openFiles != nil)
|
||||
*openFiles = dict;
|
||||
|
||||
return files;
|
||||
return [files autorelease];
|
||||
}
|
||||
|
||||
#if MM_HANDLE_XCODE_MOD_EVENT
|
||||
@@ -1465,8 +1573,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;
|
||||
@@ -1512,7 +1620,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
NSArray *queries = [[url query] componentsSeparatedByString:@"&"];
|
||||
NSEnumerator *enumerator = [queries objectEnumerator];
|
||||
NSString *param;
|
||||
while( param = [enumerator nextObject] ) {
|
||||
while ((param = [enumerator nextObject])) {
|
||||
NSArray *arr = [param componentsSeparatedByString:@"="];
|
||||
if ([arr count] == 2) {
|
||||
[dict setValue:[[arr lastObject]
|
||||
@@ -1577,10 +1685,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;
|
||||
}
|
||||
@@ -1635,19 +1741,30 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
[desc paramDescriptorForKeyword:keyAEPosition];
|
||||
if (xcodedesc) {
|
||||
NSRange range;
|
||||
MMSelectionRange *sr = (MMSelectionRange*)[[xcodedesc data] bytes];
|
||||
NSData *data = [xcodedesc data];
|
||||
NSUInteger length = [data length];
|
||||
|
||||
if (sr->lineNum < 0) {
|
||||
// Should select a range of lines.
|
||||
range.location = sr->startRange + 1;
|
||||
range.length = sr->endRange - sr->startRange + 1;
|
||||
if (length == sizeof(MMXcodeSelectionRange)) {
|
||||
MMXcodeSelectionRange *sr = (MMXcodeSelectionRange*)[data bytes];
|
||||
ASLogDebug(@"Xcode selection range (%d,%d,%d,%d,%d,%d)",
|
||||
sr->unused1, sr->lineNum, sr->startRange, sr->endRange,
|
||||
sr->unused2, sr->theDate);
|
||||
|
||||
if (sr->lineNum < 0) {
|
||||
// Should select a range of lines.
|
||||
range.location = sr->startRange + 1;
|
||||
range.length = sr->endRange - sr->startRange + 1;
|
||||
} else {
|
||||
// Should only move cursor to a line.
|
||||
range.location = sr->lineNum + 1;
|
||||
range.length = 0;
|
||||
}
|
||||
|
||||
[dict setObject:NSStringFromRange(range) forKey:@"selectionRange"];
|
||||
} else {
|
||||
// Should only move cursor to a line.
|
||||
range.location = sr->lineNum + 1;
|
||||
range.length = 0;
|
||||
ASLogErr(@"Xcode selection range size mismatch! got=%d expected=%d",
|
||||
length, sizeof(MMXcodeSelectionRange));
|
||||
}
|
||||
|
||||
[dict setObject:NSStringFromRange(range) forKey:@"selectionRange"];
|
||||
}
|
||||
|
||||
// 3. Extract Spotlight search text (if any)
|
||||
@@ -1824,6 +1941,13 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// HACK: fileAttributesAtPath was deprecated in 10.5
|
||||
#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5)
|
||||
#define MM_fileAttributes(fm,p) [fm attributesOfItemAtPath:p error:NULL]
|
||||
#else
|
||||
#define MM_fileAttributes(fm,p) [fm fileAttributesAtPath:p traverseLink:YES]
|
||||
#endif
|
||||
- (NSDate *)rcFilesModificationDate
|
||||
{
|
||||
// Check modification dates for ~/.vimrc and ~/.gvimrc and return the
|
||||
@@ -1835,20 +1959,20 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
|
||||
NSString *path = [@"~/.vimrc" stringByExpandingTildeInPath];
|
||||
NSDictionary *attr = [fm fileAttributesAtPath:path traverseLink:YES];
|
||||
NSDictionary *attr = MM_fileAttributes(fm, path);
|
||||
if (!attr) {
|
||||
path = [@"~/_vimrc" stringByExpandingTildeInPath];
|
||||
attr = [fm fileAttributesAtPath:path traverseLink:YES];
|
||||
attr = MM_fileAttributes(fm, path);
|
||||
}
|
||||
NSDate *modDate = [attr objectForKey:NSFileModificationDate];
|
||||
if (modDate)
|
||||
date = modDate;
|
||||
|
||||
path = [@"~/.gvimrc" stringByExpandingTildeInPath];
|
||||
attr = [fm fileAttributesAtPath:path traverseLink:YES];
|
||||
attr = MM_fileAttributes(fm, path);
|
||||
if (!attr) {
|
||||
path = [@"~/_gvimrc" stringByExpandingTildeInPath];
|
||||
attr = [fm fileAttributesAtPath:path traverseLink:YES];
|
||||
attr = MM_fileAttributes(fm, path);
|
||||
}
|
||||
modDate = [attr objectForKey:NSFileModificationDate];
|
||||
if (modDate)
|
||||
@@ -1856,6 +1980,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
|
||||
return date;
|
||||
}
|
||||
#undef MM_fileAttributes
|
||||
|
||||
- (BOOL)openVimControllerWithArguments:(NSDictionary *)arguments
|
||||
{
|
||||
@@ -1895,13 +2020,13 @@ 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 (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
|
||||
if (fsEventStream)
|
||||
return;
|
||||
if (NULL == FSEventStreamStart)
|
||||
@@ -1919,14 +2044,13 @@ 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 (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
|
||||
if (NULL == FSEventStreamStop)
|
||||
return; // FSEvent functions are weakly linked
|
||||
|
||||
@@ -1935,7 +2059,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
FSEventStreamInvalidate(fsEventStream);
|
||||
FSEventStreamRelease(fsEventStream);
|
||||
fsEventStream = NULL;
|
||||
//NSLog(@"Stopped FS event stream");
|
||||
ASLogDebug(@"Stopped FS event stream");
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1943,7 +2067,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 +2080,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];
|
||||
@@ -1968,7 +2095,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
FSRef fsRef;
|
||||
CFURLGetFSRef((CFURLRef)fontsURL, &fsRef);
|
||||
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4)
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
|
||||
// This is the font activation API for OS X 10.5. Only compile
|
||||
// this code if we're building on OS X 10.5 or later.
|
||||
if (NULL != ATSFontActivateFromFileReference) { // Weakly linked
|
||||
@@ -1978,7 +2105,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
&fontContainerRef);
|
||||
}
|
||||
#endif
|
||||
#if (MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4)
|
||||
#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
|
||||
// The following font activation API was deprecated in OS X 10.5.
|
||||
// Don't compile this code unless we're targeting OS X 10.4.
|
||||
FSSpec fsSpec;
|
||||
@@ -1993,9 +2120,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 +2145,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 +2155,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 +2219,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 +2238,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 +2253,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;
|
||||
}
|
||||
@@ -2155,7 +2279,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
int i = 0, count = [vimControllers count];
|
||||
for (i = 0; i < count; ++i) {
|
||||
MMVimController *vc = [vimControllers objectAtIndex:i];
|
||||
if (ukey == [vc identifier]) {
|
||||
if (ukey == [vc vimControllerId]) {
|
||||
[vc processInputQueue:[queues objectForKey:key]]; // !exceptions
|
||||
break;
|
||||
}
|
||||
@@ -2166,15 +2290,15 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
count = [cachedVimControllers count];
|
||||
for (i = 0; i < count; ++i) {
|
||||
MMVimController *vc = [cachedVimControllers objectAtIndex:i];
|
||||
if (ukey == [vc identifier]) {
|
||||
if (ukey == [vc vimControllerId]) {
|
||||
[vc processInputQueue:[queues objectForKey:key]]; // !exceptions
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
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];
|
||||
@@ -2182,17 +2306,21 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
// If new input arrived while we were processing it would have been
|
||||
// blocked so we have to schedule it to be processed again.
|
||||
if (processingFlag < 0)
|
||||
[self performSelector:@selector(processInputQueues:)
|
||||
withObject:nil
|
||||
afterDelay:0
|
||||
inModes:[NSArray arrayWithObjects:NSDefaultRunLoopMode,
|
||||
NSEventTrackingRunLoopMode, nil]];
|
||||
[self performSelectorOnMainThread:@selector(processInputQueues:)
|
||||
withObject:nil
|
||||
waitUntilDone:NO
|
||||
modes:[NSArray arrayWithObjects:
|
||||
NSDefaultRunLoopMode,
|
||||
NSEventTrackingRunLoopMode, nil]];
|
||||
|
||||
processingFlag = 0;
|
||||
}
|
||||
|
||||
- (void)addVimController:(MMVimController *)vc
|
||||
{
|
||||
ASLogDebug(@"Add Vim controller pid=%d id=%d",
|
||||
[vc pid], [vc vimControllerId]);
|
||||
|
||||
int pid = [vc pid];
|
||||
NSNumber *pidKey = [NSNumber numberWithInt:pid];
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#import "MMApplication.h"
|
||||
|
||||
// Ctrl-Tab is broken on pre 10.5, so we add a hack to make it work.
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
|
||||
# import "MMTextView.h"
|
||||
# define MM_CTRL_TAB_HACK 1
|
||||
#endif
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
* See README.txt for an overview of the Vim source code.
|
||||
*/
|
||||
|
||||
#if ENABLE_ATSUI
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "MMTextView.h"
|
||||
|
||||
@@ -68,6 +70,8 @@ enum { MMMaxCellsPerChar = 2 };
|
||||
- (void)setPreEditRow:(int)row column:(int)col;
|
||||
- (void)setMouseShape:(int)shape;
|
||||
- (void)setAntialias:(BOOL)state;
|
||||
- (void)setImControl:(BOOL)enable;
|
||||
- (void)activateIm:(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
|
||||
@@ -95,3 +99,5 @@ enum { MMMaxCellsPerChar = 2 };
|
||||
- (NSSize)constrainRows:(int *)rows columns:(int *)cols toSize:(NSSize)size;
|
||||
|
||||
@end
|
||||
|
||||
#endif // ENABLE_ATSUI
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
* resized.
|
||||
*/
|
||||
|
||||
#if ENABLE_ATSUI
|
||||
|
||||
#import "MMAppController.h"
|
||||
#import "MMAtsuiTextView.h"
|
||||
#import "MMTextViewHelper.h"
|
||||
@@ -139,7 +141,7 @@ defaultLineHeightForFont(NSFont *font)
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
LOG_DEALLOC
|
||||
ASLogDebug(@"");
|
||||
|
||||
[self disposeAtsuStyles];
|
||||
[font release]; font = nil;
|
||||
@@ -324,6 +326,16 @@ defaultLineHeightForFont(NSFont *font)
|
||||
antialias = state;
|
||||
}
|
||||
|
||||
- (void)setImControl:(BOOL)enable
|
||||
{
|
||||
[helper setImControl:enable];
|
||||
}
|
||||
|
||||
- (void)activateIm:(BOOL)enable
|
||||
{
|
||||
[helper activateIm:enable];
|
||||
}
|
||||
|
||||
- (void)keyDown:(NSEvent *)event
|
||||
{
|
||||
[helper keyDown:event];
|
||||
@@ -508,7 +520,8 @@ defaultLineHeightForFont(NSFont *font)
|
||||
NSPoint pt = { insetSize.width, insetSize.height };
|
||||
[contentImage compositeToPoint:pt operation:NSCompositeCopy];
|
||||
|
||||
if ([self hasMarkedText]) {
|
||||
#ifdef INCLUDE_OLD_IM_CODE
|
||||
if ([self hasMarkedText] && ![helper useInlineIm]) {
|
||||
int len = [[helper markedText] length];
|
||||
int rows = 0;
|
||||
int cols = maxColumns - [helper preEditColumn];
|
||||
@@ -564,6 +577,7 @@ defaultLineHeightForFont(NSFont *font)
|
||||
shape:MMInsertionPointVertical
|
||||
fraction:25];
|
||||
}
|
||||
#endif // INCLUDE_OLD_IM_CODE
|
||||
}
|
||||
|
||||
- (BOOL) wantsDefaultClipping
|
||||
@@ -583,7 +597,7 @@ defaultLineHeightForFont(NSFont *font)
|
||||
[self resizeContentImage];
|
||||
|
||||
#if MM_DEBUG_DRAWING
|
||||
NSLog(@"====> BEGIN %s", _cmd);
|
||||
ASLogDebug(@"====> BEGIN %s", _cmd);
|
||||
#endif
|
||||
[self beginDrawing];
|
||||
|
||||
@@ -594,7 +608,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 +619,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 +634,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 +656,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 +681,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 +694,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 +707,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 +718,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 +732,7 @@ defaultLineHeightForFont(NSFont *font)
|
||||
[self display];
|
||||
|
||||
#if MM_DEBUG_DRAWING
|
||||
NSLog(@"<==== END %s", _cmd);
|
||||
ASLogDebug(@"<==== END %s", _cmd);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -775,24 +789,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];
|
||||
}
|
||||
|
||||
|
||||
@@ -894,7 +891,7 @@ defaultLineHeightForFont(NSFont *font)
|
||||
|
||||
// The return type of this message changed with OS X 10.5 so we need this
|
||||
// kludge in order to avoid compiler warnings on OS X 10.4.
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4)
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
|
||||
- (NSInteger)conversationIdentifier
|
||||
{
|
||||
return (NSInteger)self;
|
||||
@@ -1044,7 +1041,6 @@ defaultLineHeightForFont(NSFont *font)
|
||||
|
||||
- (void)resizeContentImage
|
||||
{
|
||||
//NSLog(@"resizeContentImage");
|
||||
[contentImage release];
|
||||
contentImage = [[NSImage alloc] initWithSize:[self textAreaSize]];
|
||||
[contentImage setFlipped:YES];
|
||||
@@ -1102,8 +1098,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,
|
||||
@@ -1116,6 +1110,11 @@ defaultLineHeightForFont(NSFont *font)
|
||||
rect.size.width = rect.size.width * 2;
|
||||
CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort];
|
||||
|
||||
// Clip drawing to avoid text bleeding into adjacent display cells when
|
||||
// antialiasing is enabled.
|
||||
CGContextSaveGState(context);
|
||||
CGContextClipToRect(context, *(CGRect*)&rect);
|
||||
|
||||
ATSUAttributeTag tags[] = { kATSUCGContextTag };
|
||||
ByteCount sizes[] = { sizeof(CGContextRef) };
|
||||
ATSUAttributeValuePtr values[] = { &context };
|
||||
@@ -1165,6 +1164,8 @@ defaultLineHeightForFont(NSFont *font)
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
CGContextRestoreGState(context);
|
||||
}
|
||||
|
||||
- (void)scrollRect:(NSRect)rect lineCount:(int)count
|
||||
@@ -1231,8 +1232,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;
|
||||
@@ -1271,3 +1270,5 @@ defaultLineHeightForFont(NSFont *font)
|
||||
}
|
||||
|
||||
@end // MMAtsuiTextView (Drawing)
|
||||
|
||||
#endif // ENABLE_ATSUI
|
||||
|
||||
+16
-6
@@ -21,6 +21,7 @@
|
||||
NSMutableArray *inputQueue;
|
||||
NSMutableData *drawData;
|
||||
NSConnection *connection;
|
||||
NSConnection *vimServerConnection;
|
||||
id appProxy;
|
||||
unsigned identifier;
|
||||
NSDictionary *colorDict;
|
||||
@@ -49,6 +50,9 @@
|
||||
BOOL flushDisabled;
|
||||
unsigned numWholeLineChanges;
|
||||
unsigned offsetForDrawDataPrune;
|
||||
BOOL imState;
|
||||
CFSocketRef netbeansSocket;
|
||||
CFRunLoopSourceRef netbeansRunLoopSource;
|
||||
}
|
||||
|
||||
+ (MMBackend *)sharedInstance;
|
||||
@@ -91,12 +95,12 @@
|
||||
- (char *)browseForFileWithAttributes:(NSDictionary *)attr;
|
||||
- (int)showDialogWithAttributes:(NSDictionary *)attr textField:(char *)txtfield;
|
||||
- (void)showToolbar:(int)enable flags:(int)flags;
|
||||
- (void)createScrollbarWithIdentifier:(long)ident type:(int)type;
|
||||
- (void)destroyScrollbarWithIdentifier:(long)ident;
|
||||
- (void)showScrollbarWithIdentifier:(long)ident state:(int)visible;
|
||||
- (void)setScrollbarPosition:(int)pos length:(int)len identifier:(long)ident;
|
||||
- (void)createScrollbarWithIdentifier:(int32_t)ident type:(int)type;
|
||||
- (void)destroyScrollbarWithIdentifier:(int32_t)ident;
|
||||
- (void)showScrollbarWithIdentifier:(int32_t)ident state:(int)visible;
|
||||
- (void)setScrollbarPosition:(int)pos length:(int)len identifier:(int32_t)ident;
|
||||
- (void)setScrollbarThumbValue:(long)val size:(long)size max:(long)max
|
||||
identifier:(long)ident;
|
||||
identifier:(int32_t)ident;
|
||||
- (void)setFont:(GuiFont)font wide:(BOOL)wide;
|
||||
- (void)executeActionWithName:(NSString *)name;
|
||||
- (void)setMouseShape:(int)shape;
|
||||
@@ -108,7 +112,7 @@
|
||||
- (void)setPreEditRow:(int)row column:(int)col;
|
||||
|
||||
- (int)lookupColorWithKey:(NSString *)key;
|
||||
- (BOOL)hasSpecialKeyWithValue:(NSString *)value;
|
||||
- (BOOL)hasSpecialKeyWithValue:(char_u *)value;
|
||||
|
||||
- (void)enterFullscreen:(int)fuoptions background:(int)bg;
|
||||
- (void)leaveFullscreen;
|
||||
@@ -131,6 +135,12 @@
|
||||
- (void)setWaitForAck:(BOOL)yn;
|
||||
- (void)waitForConnectionAcknowledgement;
|
||||
|
||||
- (BOOL)imState;
|
||||
- (void)setImState:(BOOL)activated;
|
||||
|
||||
- (void)messageFromNetbeans;
|
||||
- (void)setNetbeansSocket:(int)socket;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
+479
-288
File diff suppressed because it is too large
Load Diff
@@ -30,7 +30,7 @@
|
||||
#import "MMWindowController.h"
|
||||
#import "Miscellaneous.h"
|
||||
#import <Carbon/Carbon.h>
|
||||
#import <PSMTabBarControl.h>
|
||||
#import <PSMTabBarControl/PSMTabBarControl.h>
|
||||
|
||||
// These have to be the same as in option.h
|
||||
#define FUOPT_MAXVERT 0x001
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,6 +115,8 @@ NSString *kOdbEditorIdentifierWriteRoom = @"com.hogbaysoftware.WriteRoom";
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
ASLogDebug(@"");
|
||||
|
||||
[supportedOdbEditors release]; supportedOdbEditors = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
@@ -225,7 +227,7 @@ NSString *kOdbEditorIdentifierWriteRoom = @"com.hogbaysoftware.WriteRoom";
|
||||
// user changes settings in terminal, the changes are reflected in the
|
||||
// dialog)
|
||||
|
||||
NSString *versionString;
|
||||
NSString *versionString = @"";
|
||||
|
||||
// Check if ODB path exists before calling isFilePackageAtPath: otherwise
|
||||
// an error is output to stderr on Tiger.
|
||||
@@ -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];
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* See README.txt for an overview of the Vim source code.
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "MacVim.h"
|
||||
|
||||
|
||||
#define MM_USE_ROW_CACHE 1
|
||||
@@ -48,10 +48,8 @@ typedef struct {
|
||||
}
|
||||
|
||||
- (NSString *)string;
|
||||
- (NSDictionary *)attributesAtIndex:(unsigned)index
|
||||
- (NSDictionary *)attributesAtIndex:(NSUInteger)index
|
||||
effectiveRange:(NSRangePointer)aRange;
|
||||
- (id)attribute:(NSString *)attrib atIndex:(unsigned)index
|
||||
effectiveRange:(NSRangePointer)range;
|
||||
- (void)replaceCharactersInRange:(NSRange)aRange
|
||||
withString:(NSString *)aString;
|
||||
- (void)setAttributes:(NSDictionary *)attributes range:(NSRange)aRange;
|
||||
@@ -89,7 +87,7 @@ typedef struct {
|
||||
- (NSSize)cellSize;
|
||||
- (NSRect)rectForRowsInRange:(NSRange)range;
|
||||
- (NSRect)rectForColumnsInRange:(NSRange)range;
|
||||
- (unsigned)characterIndexForRow:(int)row column:(int)col;
|
||||
- (NSUInteger)characterIndexForRow:(int)row column:(int)col;
|
||||
- (BOOL)resizeToFitSize:(NSSize)size;
|
||||
- (NSSize)fitToSize:(NSSize)size;
|
||||
- (NSSize)fitToSize:(NSSize)size rows:(int *)rows columns:(int *)columns;
|
||||
|
||||
+52
-62
@@ -84,7 +84,7 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
LOG_DEALLOC
|
||||
ASLogDebug(@"");
|
||||
|
||||
#if MM_USE_ROW_CACHE
|
||||
if (rowCache) {
|
||||
@@ -112,38 +112,23 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
|
||||
return [attribString string];
|
||||
}
|
||||
|
||||
- (NSDictionary *)attributesAtIndex:(unsigned)index
|
||||
- (NSDictionary *)attributesAtIndex:(NSUInteger)index
|
||||
effectiveRange:(NSRangePointer)range
|
||||
{
|
||||
if (index >= [attribString length]) {
|
||||
if (range)
|
||||
*range = NSMakeRange(NSNotFound, 0);
|
||||
|
||||
return [NSDictionary dictionary];
|
||||
}
|
||||
|
||||
return [attribString attributesAtIndex:index effectiveRange:range];
|
||||
}
|
||||
|
||||
- (id)attribute:(NSString *)attrib atIndex:(unsigned)index
|
||||
effectiveRange:(NSRangePointer)range
|
||||
{
|
||||
return [attribString attribute:attrib atIndex:index effectiveRange:range];
|
||||
}
|
||||
|
||||
- (void)replaceCharactersInRange:(NSRange)range
|
||||
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 +170,6 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
|
||||
|
||||
[attribString setAttributes:newAttr range:range];
|
||||
} else {
|
||||
//NSLog(@"NOT fixing font attribute!");
|
||||
[attribString setAttributes:attributes range:range];
|
||||
}
|
||||
#endif
|
||||
@@ -220,7 +204,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 +237,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 +259,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;
|
||||
}
|
||||
@@ -332,7 +313,7 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
|
||||
[attribString replaceCharactersInRange:range withString:string];
|
||||
[attribString setAttributes:attributes range:r];
|
||||
|
||||
unsigned changeInLength = [string length] - range.length;
|
||||
NSInteger changeInLength = [string length] - range.length;
|
||||
if (acells != cells || acol != col) {
|
||||
if (acells == cells + 1) {
|
||||
// NOTE: A normal width character replaced a double width
|
||||
@@ -344,13 +325,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 +339,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
|
||||
}
|
||||
}
|
||||
@@ -371,6 +350,11 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
|
||||
|
||||
[self fixInvalidCharactersInRange:r];
|
||||
|
||||
#if 0
|
||||
ASLogDebug(@"length=%d row=%d col=%d cells=%d replaceRange=%@ change=%d",
|
||||
[string length], row, col, cells,
|
||||
NSStringFromRange(r), changeInLength);
|
||||
#endif
|
||||
[self edited:(NSTextStorageEditedCharacters|NSTextStorageEditedAttributes)
|
||||
range:range changeInLength:changeInLength];
|
||||
|
||||
@@ -387,7 +371,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 +390,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 +398,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 +436,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 +468,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 +488,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 +531,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 +558,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 +578,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 +604,6 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
|
||||
|
||||
- (void)clearAll
|
||||
{
|
||||
//NSLog(@"%s", _cmd);
|
||||
[self lazyResize:YES];
|
||||
}
|
||||
|
||||
@@ -683,7 +662,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;
|
||||
}
|
||||
|
||||
@@ -790,7 +769,7 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
|
||||
|
||||
- (NSRect)rectForRowsInRange:(NSRange)range
|
||||
{
|
||||
NSRect rect = { 0, 0, 0, 0 };
|
||||
NSRect rect = { {0, 0}, {0, 0} };
|
||||
unsigned start = range.location > maxRows ? maxRows : range.location;
|
||||
unsigned length = range.length;
|
||||
|
||||
@@ -805,7 +784,7 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
|
||||
|
||||
- (NSRect)rectForColumnsInRange:(NSRange)range
|
||||
{
|
||||
NSRect rect = { 0, 0, 0, 0 };
|
||||
NSRect rect = { {0, 0}, {0, 0} };
|
||||
unsigned start = range.location > maxColumns ? maxColumns : range.location;
|
||||
unsigned length = range.length;
|
||||
|
||||
@@ -818,7 +797,7 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
|
||||
return rect;
|
||||
}
|
||||
|
||||
- (unsigned)characterIndexForRow:(int)row column:(int)col
|
||||
- (NSUInteger)characterIndexForRow:(int)row column:(int)col
|
||||
{
|
||||
int cells = 1;
|
||||
NSRange range = [self charRangeForRow:row column:&col cells:&cells];
|
||||
@@ -1009,15 +988,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 +1009,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 +1050,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 +1066,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 +1095,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 +1117,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 +1134,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 +1153,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;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
- (void)performBatchDrawWithData:(NSData *)data;
|
||||
- (void)setMouseShape:(int)shape;
|
||||
- (void)setAntialias:(BOOL)antialias;
|
||||
- (void)setImControl:(BOOL)enable;
|
||||
- (void)activateIm:(BOOL)enable;
|
||||
|
||||
//
|
||||
// MMTextStorage methods
|
||||
|
||||
+43
-47
@@ -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,16 @@
|
||||
antialias = state;
|
||||
}
|
||||
|
||||
- (void)setImControl:(BOOL)enable
|
||||
{
|
||||
[helper setImControl:enable];
|
||||
}
|
||||
|
||||
- (void)activateIm:(BOOL)enable
|
||||
{
|
||||
[helper activateIm:enable];
|
||||
}
|
||||
|
||||
- (NSFont *)font
|
||||
{
|
||||
return [(MMTextStorage*)[self textStorage] font];
|
||||
@@ -444,9 +456,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;
|
||||
}
|
||||
|
||||
@@ -513,7 +522,8 @@
|
||||
numInvertRects = 0;
|
||||
}
|
||||
|
||||
if ([self hasMarkedText]) {
|
||||
#ifdef INCLUDE_OLD_IM_CODE
|
||||
if ([self hasMarkedText] && ![helper useInlineIm]) {
|
||||
shouldDrawInsertionPoint = YES;
|
||||
MMTextStorage *ts = (MMTextStorage*)[self textStorage];
|
||||
NSSize inset = [self textContainerInset];
|
||||
@@ -571,6 +581,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // INCLUDE_OLD_IM_CODE
|
||||
|
||||
if (shouldDrawInsertionPoint) {
|
||||
MMTextStorage *ts = (MMTextStorage*)[self textStorage];
|
||||
@@ -580,8 +591,9 @@
|
||||
ipRect.origin.x += [self textContainerOrigin].x;
|
||||
ipRect.origin.y += [self textContainerOrigin].y;
|
||||
|
||||
#ifdef INCLUDE_OLD_IM_CODE
|
||||
// Draw insertion point inside marked text.
|
||||
if ([self hasMarkedText]) {
|
||||
if ([self hasMarkedText] && ![helper useInlineIm]) {
|
||||
NSFont *theFont = [[self markedTextAttributes]
|
||||
valueForKey:NSFontAttributeName];
|
||||
if (theFont == [ts font])
|
||||
@@ -593,6 +605,7 @@
|
||||
([helper imRange].location +
|
||||
[helper imRange].length);
|
||||
}
|
||||
#endif // INCLUDE_OLD_IM_CODE
|
||||
|
||||
if (MMInsertionPointHorizontal == insertionPointShape) {
|
||||
int frac = ([ts cellSize].height * insertionPointFraction + 99)/100;
|
||||
@@ -617,10 +630,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 +817,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
|
||||
@@ -878,6 +866,14 @@
|
||||
[[self windowController] vimMenuItemAction:sender];
|
||||
}
|
||||
|
||||
- (IBAction)cancelOperation:(id)sender
|
||||
{
|
||||
// NSTextView overrides this method to send complete:, whereas NSResponder
|
||||
// sends cancel: by default. So override it yet again to revert to the
|
||||
// default behavior (we resond to cancel: in MMTextViewHelper).
|
||||
[self doCommandBySelector:@selector(cancel:)];
|
||||
}
|
||||
|
||||
- (BOOL)validateMenuItem:(NSMenuItem *)item
|
||||
{
|
||||
if ([item action] == @selector(cut:)
|
||||
@@ -941,7 +937,7 @@
|
||||
numColumns:ncols];
|
||||
[self setNeedsDisplayInRect:invertRects[n]];
|
||||
} else {
|
||||
n = numInvertRects = 0;
|
||||
numInvertRects = 0;
|
||||
}
|
||||
} else {
|
||||
// The result should look normal; all we need to do is to mark
|
||||
|
||||
@@ -10,6 +10,11 @@
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4)
|
||||
// Need Carbon for TIS...() functions
|
||||
#import <Carbon/Carbon.h>
|
||||
#endif
|
||||
|
||||
|
||||
enum {
|
||||
// These values are chosen so that the min text view size is not too small
|
||||
@@ -31,6 +36,8 @@ enum {
|
||||
int mouseShape;
|
||||
NSTrackingRectTag trackingRectTag;
|
||||
NSColor *insertionPointColor;
|
||||
BOOL interpretKeyEventsSwallowedKey;
|
||||
NSEvent *currentEvent;
|
||||
|
||||
// Input Manager
|
||||
NSRange imRange;
|
||||
@@ -39,6 +46,12 @@ enum {
|
||||
NSMutableAttributedString *markedText;
|
||||
int preEditRow;
|
||||
int preEditColumn;
|
||||
BOOL imControl;
|
||||
BOOL imState;
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4)
|
||||
TISInputSourceRef lastImSource;
|
||||
TISInputSourceRef asciiImSource;
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)setTextView:(id)view;
|
||||
@@ -63,6 +76,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 +93,8 @@ enum {
|
||||
- (NSRange)imRange;
|
||||
- (void)setMarkedRange:(NSRange)range;
|
||||
- (NSRect)firstRectForCharacterRange:(NSRange)range;
|
||||
- (void)setImControl:(BOOL)enable;
|
||||
- (void)activateIm:(BOOL)enable;
|
||||
- (BOOL)useInlineIm;
|
||||
|
||||
@end
|
||||
|
||||
+471
-266
@@ -23,9 +23,6 @@
|
||||
#import "Miscellaneous.h"
|
||||
|
||||
|
||||
static char MMKeypadEnter[2] = { 'K', 'A' };
|
||||
static NSString *MMKeypadEnterString = @"KA";
|
||||
|
||||
// The max/min drag timer interval in seconds
|
||||
static NSTimeInterval MMDragTimerMaxInterval = 0.3;
|
||||
static NSTimeInterval MMDragTimerMinInterval = 0.01;
|
||||
@@ -37,25 +34,60 @@ static float MMDragAreaSize = 73.0f;
|
||||
@interface MMTextViewHelper (Private)
|
||||
- (MMWindowController *)windowController;
|
||||
- (MMVimController *)vimController;
|
||||
- (void)dispatchKeyEvent:(NSEvent *)event;
|
||||
- (void)sendKeyDown:(const char *)chars length:(int)len modifiers:(int)flags
|
||||
isARepeat:(BOOL)isARepeat;
|
||||
- (void)doKeyDown:(NSString *)key;
|
||||
- (void)doInsertText:(NSString *)text;
|
||||
- (void)checkImState;
|
||||
- (void)hideMouseCursor;
|
||||
- (void)startDragTimerWithInterval:(NSTimeInterval)t;
|
||||
- (void)dragTimerFired:(NSTimer *)timer;
|
||||
- (void)setCursor;
|
||||
- (NSRect)trackingRect;
|
||||
- (BOOL)inputManagerHandleMouseEvent:(NSEvent *)event;
|
||||
- (void)sendMarkedText:(NSString *)text position:(unsigned)pos;
|
||||
@end
|
||||
|
||||
|
||||
|
||||
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
|
||||
static BOOL
|
||||
KeyboardInputSourcesEqual(TISInputSourceRef a, TISInputSourceRef b)
|
||||
{
|
||||
// Define two sources to be equal iff both are non-NULL and they have
|
||||
// identical source ID strings.
|
||||
|
||||
if (!(a && b))
|
||||
return NO;
|
||||
|
||||
NSString *as = TISGetInputSourceProperty(a, kTISPropertyInputSourceID);
|
||||
NSString *bs = TISGetInputSourceProperty(b, kTISPropertyInputSourceID);
|
||||
|
||||
return [as isEqualToString:bs];
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@implementation MMTextViewHelper
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
ASLogDebug(@"");
|
||||
|
||||
[insertionPointColor release]; insertionPointColor = nil;
|
||||
[markedText release]; markedText = nil;
|
||||
[markedTextAttributes release]; markedTextAttributes = nil;
|
||||
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
|
||||
if (asciiImSource) {
|
||||
CFRelease(asciiImSource);
|
||||
asciiImSource = NULL;
|
||||
}
|
||||
if (lastImSource) {
|
||||
CFRelease(lastImSource);
|
||||
lastImSource = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@@ -80,245 +112,214 @@ static float MMDragAreaSize = 73.0f;
|
||||
|
||||
- (void)keyDown:(NSEvent *)event
|
||||
{
|
||||
//NSLog(@"%s %@", _cmd, 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
|
||||
// Alt+Function key presses (Alt+Up and Alt+Down are bound to two
|
||||
// commands). This hack may break input management, but unless we can
|
||||
// figure out a way to disable key bindings there seems little else to do.
|
||||
//
|
||||
// TODO: Figure out a way to disable Cocoa key bindings entirely, without
|
||||
// affecting input management.
|
||||
ASLogDebug(@"%@", event);
|
||||
|
||||
// When the Input Method is activated, some special key inputs
|
||||
// should be treated as key inputs for Input Method.
|
||||
if ([textView hasMarkedText]) {
|
||||
[textView interpretKeyEvents:[NSArray arrayWithObject:event]];
|
||||
// NOTE: Check IM state _before_ key has been interpreted or we'll pick up
|
||||
// the old IM state when it has been switched via a keyboard shortcut that
|
||||
// MacVim cannot handle.
|
||||
if (imControl)
|
||||
[self checkImState];
|
||||
|
||||
// NOTE: Keyboard handling is complicated by the fact that we must call
|
||||
// interpretKeyEvents: otherwise key equivalents set up by input methods do
|
||||
// not work (e.g. Ctrl-Shift-; would not work under Kotoeri).
|
||||
|
||||
// NOTE: insertText: and doCommandBySelector: may need to extract data from
|
||||
// the key down event so keep a local reference to the event. This is
|
||||
// released and set to nil at the end of this method. Don't make any early
|
||||
// returns from this method without releasing and resetting this reference!
|
||||
currentEvent = [event retain];
|
||||
|
||||
if ([self hasMarkedText]) {
|
||||
// HACK! Need to redisplay manually otherwise the marked text may not
|
||||
// be correctly displayed (e.g. it is still visible after pressing Esc
|
||||
// even though the text has been unmarked).
|
||||
[textView setNeedsDisplay:YES];
|
||||
return;
|
||||
}
|
||||
|
||||
int flags = [event modifierFlags];
|
||||
if ((flags & NSControlKeyMask) ||
|
||||
((flags & NSAlternateKeyMask) && (flags & NSFunctionKeyMask))) {
|
||||
BOOL unmodIsPrintable = YES;
|
||||
NSString *unmod = [event charactersIgnoringModifiers];
|
||||
if (unmod && [unmod length] > 0 && [unmod characterAtIndex:0] < 0x20)
|
||||
unmodIsPrintable = NO;
|
||||
[self hideMouseCursor];
|
||||
|
||||
NSString *chars = [event characters];
|
||||
if ([chars length] == 1 && [chars characterAtIndex:0] < 0x20
|
||||
&& unmodIsPrintable) {
|
||||
// HACK! Send unprintable characters (such as C-@, C-[, C-\, C-],
|
||||
// C-^, C-_) as normal text to be added to the Vim input buffer.
|
||||
// This must be done in order for the backend to be able to
|
||||
// separate e.g. Ctrl-i and Ctrl-tab.
|
||||
[self insertText:chars];
|
||||
} else {
|
||||
[self dispatchKeyEvent:event];
|
||||
}
|
||||
} else if ((flags & NSAlternateKeyMask) &&
|
||||
[[[[self vimController] vimState] objectForKey:@"p_mmta"]
|
||||
boolValue]) {
|
||||
// If the 'macmeta' option is set, then send Alt+key presses directly
|
||||
// to Vim without interpreting the key press.
|
||||
NSString *unmod = [event charactersIgnoringModifiers];
|
||||
int len = [unmod lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
|
||||
const char *bytes = [unmod UTF8String];
|
||||
unsigned flags = [event modifierFlags];
|
||||
id mmta = [[[self vimController] vimState] objectForKey:@"p_mmta"];
|
||||
NSString *string = [event characters];
|
||||
NSString *unmod = [event charactersIgnoringModifiers];
|
||||
|
||||
[self sendKeyDown:bytes length:len modifiers:flags
|
||||
isARepeat:[event isARepeat]];
|
||||
// Alt key presses should not be interpreted if the 'macmeta' option is
|
||||
// set. We still have to call interpretKeyEvents: for keys
|
||||
// like Enter, Esc, etc. to work as usual so only skip interpretation for
|
||||
// ASCII chars in the range after space (0x20) and before backspace (0x7f).
|
||||
// Note that this implies that 'mmta' (if enabled) breaks input methods
|
||||
// when the Alt key is held.
|
||||
if ((flags & NSAlternateKeyMask) && [mmta boolValue] && [unmod length] == 1
|
||||
&& [unmod characterAtIndex:0] > 0x20
|
||||
&& [unmod characterAtIndex:0] < 0x7f) {
|
||||
ASLogDebug(@"MACMETA key, don't interpret it");
|
||||
string = unmod;
|
||||
} else if (imState && (flags & NSControlKeyMask)
|
||||
&& !(flags & (NSAlternateKeyMask|NSCommandKeyMask))
|
||||
&& [unmod length] == 1
|
||||
&& ([unmod characterAtIndex:0] == '6' ||
|
||||
[unmod characterAtIndex:0] == '^')) {
|
||||
// HACK! interpretKeyEvents: does not call doCommandBySelector:
|
||||
// with Ctrl-6 or Ctrl-^ when IM is active.
|
||||
[self doKeyDown:@"\x1e"];
|
||||
string = nil;
|
||||
} else {
|
||||
// HACK! interpretKeyEvents: may call insertText: or
|
||||
// doCommandBySelector:, or it may swallow the key (most likely the
|
||||
// current input method used it). In the first two cases we have to
|
||||
// manually set the below flag to NO if the key wasn't handled.
|
||||
interpretKeyEventsSwallowedKey = YES;
|
||||
[textView interpretKeyEvents:[NSArray arrayWithObject:event]];
|
||||
if (interpretKeyEventsSwallowedKey)
|
||||
string = nil;
|
||||
else if (flags & NSCommandKeyMask) {
|
||||
// HACK! When Command is held we have to more or less guess whether
|
||||
// we should use characters or charactersIgnoringModifiers. The
|
||||
// following heuristic seems to work but it may have to change.
|
||||
// Note that the Shift and Alt flags may also need to be cleared
|
||||
// (see doKeyDown:keyCode:modifiers: in MMBackend).
|
||||
if ((flags & NSShiftKeyMask && !(flags & NSAlternateKeyMask))
|
||||
|| flags & NSControlKeyMask)
|
||||
string = unmod;
|
||||
}
|
||||
}
|
||||
|
||||
if (string)
|
||||
[self doKeyDown:string];
|
||||
|
||||
[currentEvent release];
|
||||
currentEvent = nil;
|
||||
}
|
||||
|
||||
- (void)insertText:(id)string
|
||||
{
|
||||
//NSLog(@"%s %@", _cmd, 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,
|
||||
// so 'string' need not be a printable character! In this case it still
|
||||
// works to pass 'string' on to Vim as a printable character (since
|
||||
// modifiers are already included and should not be added to the input
|
||||
// buffer using CSI, K_MODIFIER).
|
||||
if ([self hasMarkedText]) {
|
||||
[self sendMarkedText:nil position:0];
|
||||
|
||||
if ([textView hasMarkedText]) {
|
||||
[textView unmarkText];
|
||||
// NOTE: If this call is left out then the marked text isn't properly
|
||||
// erased when Return is used to accept the text.
|
||||
// The input manager only ever sets new marked text, it never actually
|
||||
// calls to have it unmarked. It seems that whenever insertText: is
|
||||
// called the input manager expects the marked text to be unmarked
|
||||
// automatically, hence the explicit unmarkText: call here.
|
||||
[self unmarkText];
|
||||
}
|
||||
|
||||
NSEvent *event = [NSApp currentEvent];
|
||||
|
||||
// HACK! In order to be able to bind to <S-Space>, <S-M-Tab>, etc. we have
|
||||
// to watch for them here.
|
||||
if ([event type] == NSKeyDown
|
||||
&& [[event charactersIgnoringModifiers] length] > 0
|
||||
&& [event modifierFlags]
|
||||
& (NSShiftKeyMask|NSControlKeyMask|NSAlternateKeyMask)) {
|
||||
unichar c = [[event charactersIgnoringModifiers] characterAtIndex:0];
|
||||
|
||||
// <S-M-Tab> translates to 0x19
|
||||
if (' ' == c || 0x19 == c) {
|
||||
[self dispatchKeyEvent:event];
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
[self hideMouseCursor];
|
||||
|
||||
// NOTE: 'string' is either an NSString or an NSAttributedString. Since we
|
||||
// do not support attributes, simply pass the corresponding NSString in the
|
||||
// latter case.
|
||||
if ([string isKindOfClass:[NSAttributedString class]])
|
||||
string = [string string];
|
||||
|
||||
//NSLog(@"send InsertTextMsgID: %@", string);
|
||||
//int len = [string length];
|
||||
//ASLogDebug(@"len=%d char[0]=%#x char[1]=%#x string='%@'", [string length],
|
||||
// [string characterAtIndex:0],
|
||||
// len > 1 ? [string characterAtIndex:1] : 0, string);
|
||||
|
||||
NSMutableData *data = [NSMutableData data];
|
||||
int len = [string lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
|
||||
int flags = [event modifierFlags] & 0xffff0000U;
|
||||
if ([event type] == NSKeyDown && [event isARepeat])
|
||||
flags |= 1;
|
||||
|
||||
[data appendBytes:&flags length:sizeof(int)];
|
||||
[data appendBytes:&len length:sizeof(int)];
|
||||
[data appendBytes:[string UTF8String] length:len];
|
||||
|
||||
[[self vimController] sendMessage:InsertTextMsgID data:data];
|
||||
[self doInsertText:string];
|
||||
}
|
||||
|
||||
- (void)doCommandBySelector:(SEL)selector
|
||||
- (void)doCommandBySelector:(SEL)sel
|
||||
{
|
||||
//NSLog(@"%s %@", _cmd, 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
|
||||
// match, etc.).
|
||||
ASLogDebug(@"%@", NSStringFromSelector(sel));
|
||||
|
||||
// Translate Ctrl-2 -> Ctrl-@ (see also Resources/KeyBinding.plist)
|
||||
if (@selector(keyCtrlAt:) == sel)
|
||||
[self doKeyDown:@"\x00"];
|
||||
// Translate Ctrl-6 -> Ctrl-^ (see also Resources/KeyBinding.plist)
|
||||
else if (@selector(keyCtrlHat:) == sel)
|
||||
[self doKeyDown:@"\x1e"];
|
||||
//
|
||||
// We usually end up here if the user pressed Ctrl+key (but not
|
||||
// Ctrl+Option+key).
|
||||
|
||||
NSEvent *event = [NSApp currentEvent];
|
||||
|
||||
if (selector == @selector(cancelOperation:)
|
||||
|| selector == @selector(insertNewline:)) {
|
||||
// HACK! If there was marked text which got abandoned as a result of
|
||||
// hitting escape or enter, then 'insertText:' is called with the
|
||||
// abandoned text but '[event characters]' includes the abandoned text
|
||||
// as well. Since 'dispatchKeyEvent:' looks at '[event characters]' we
|
||||
// must intercept these keys here or the abandonded text gets inserted
|
||||
// twice.
|
||||
NSString *key = [event charactersIgnoringModifiers];
|
||||
const char *chars = [key UTF8String];
|
||||
int len = [key lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
|
||||
|
||||
if (0x3 == chars[0]) {
|
||||
// HACK! AppKit turns enter (not return) into Ctrl-C, so we need to
|
||||
// handle it separately (else Ctrl-C doesn't work).
|
||||
len = sizeof(MMKeypadEnter)/sizeof(MMKeypadEnter[0]);
|
||||
chars = MMKeypadEnter;
|
||||
}
|
||||
|
||||
[self sendKeyDown:chars length:len modifiers:[event modifierFlags]
|
||||
isARepeat:[event isARepeat]];
|
||||
} else {
|
||||
[self dispatchKeyEvent:event];
|
||||
}
|
||||
// Check for selectors from AppKit.framework/StandardKeyBinding.dict and
|
||||
// send the corresponding key directly on to the backend. The reason for
|
||||
// not just letting all of these fall through is that -[NSEvent characters]
|
||||
// sometimes includes marked text as well as the actual key, but the marked
|
||||
// text is also passed to insertText:. For example, pressing Ctrl-i Return
|
||||
// on a US keyboard would call insertText:@"^" but the key event for the
|
||||
// Return press will contain "^\x0d" -- if we fell through the result would
|
||||
// be that "^^\x0d" got sent to the backend (i.e. one extra "^" would
|
||||
// appear).
|
||||
// For this reason we also have to make sure that there are key bindings to
|
||||
// all combinations of modifier with certain keys (these are set up in
|
||||
// KeyBinding.plist in the Resources folder).
|
||||
else if (@selector(insertTab:) == sel ||
|
||||
@selector(selectNextKeyView:) == sel ||
|
||||
@selector(insertTabIgnoringFieldEditor:) == sel)
|
||||
[self doKeyDown:@"\x09"];
|
||||
else if (@selector(insertNewline:) == sel ||
|
||||
@selector(insertLineBreak:) == sel ||
|
||||
@selector(insertNewlineIgnoringFieldEditor:) == sel)
|
||||
[self doKeyDown:@"\x0d"];
|
||||
else if (@selector(cancelOperation:) == sel ||
|
||||
@selector(complete:) == sel)
|
||||
[self doKeyDown:@"\x1b"];
|
||||
else if (@selector(insertBackTab:) == sel ||
|
||||
@selector(selectPreviousKeyView:) == sel)
|
||||
[self doKeyDown:@"\x19"];
|
||||
else if (@selector(deleteBackward:) == sel ||
|
||||
@selector(deleteWordBackward:) == sel ||
|
||||
@selector(deleteBackwardByDecomposingPreviousCharacter:) == sel ||
|
||||
@selector(deleteToBeginningOfLine:) == sel)
|
||||
[self doKeyDown:@"\x08"];
|
||||
else if (@selector(keySpace:) == sel)
|
||||
[self doKeyDown:@" "];
|
||||
else if (@selector(cancel:) == sel)
|
||||
kill([[self vimController] pid], SIGINT);
|
||||
else interpretKeyEventsSwallowedKey = NO;
|
||||
}
|
||||
|
||||
- (BOOL)performKeyEquivalent:(NSEvent *)event
|
||||
{
|
||||
//NSLog(@"%s %@", _cmd, event);
|
||||
// Called for Cmd+key keystrokes, function keys, arrow keys, page
|
||||
// up/down, home, end.
|
||||
//
|
||||
// NOTE: This message cannot be ignored since Cmd+letter keys never are
|
||||
// passed to keyDown:. It seems as if the main menu consumes Cmd-key
|
||||
// strokes, unless the key is a function key.
|
||||
|
||||
// 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
|
||||
// event will still reach Vim though (via keyDown:). The exceptions to
|
||||
// this rule are: PageUp/PageDown (keycode 116/121).
|
||||
int flags = [event modifierFlags] & 0xffff0000U;
|
||||
if ([event type] != NSKeyDown || flags & NSFunctionKeyMask
|
||||
&& !(116 == [event keyCode] || 121 == [event keyCode]))
|
||||
ASLogDebug(@"");
|
||||
if ([event type] != NSKeyDown)
|
||||
return NO;
|
||||
|
||||
// HACK! KeyCode 50 represent the key which switches between windows
|
||||
// NOTE: Key equivalent handling was fixed in Leopard. That is, an
|
||||
// unhandled key equivalent is passed to keyDown: -- contrast this with
|
||||
// pre-Leopard where unhandled key equivalents would simply disappear
|
||||
// (hence the ugly hack below for Tiger).
|
||||
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_4)
|
||||
return NO;
|
||||
|
||||
// HACK! KeyCode 50 represent the key which switches between windows
|
||||
// within an application (like Cmd+Tab is used to switch between
|
||||
// applications). Return NO here, else the window switching does not work.
|
||||
if ([event keyCode] == 50)
|
||||
return NO;
|
||||
|
||||
// HACK! Let the main menu try to handle any key down event, before
|
||||
// HACK! The -[NSRespoder cancelOperation:] indicates that Cmd-. is handled
|
||||
// in a special way by the key window. Indeed, if we pass this event on to
|
||||
// keyDown: it will result in doCommandBySelector: being called with
|
||||
// cancelOperation: as selector, otherwise it is called with cancel: as the
|
||||
// selector (and we respond to cancel: there).
|
||||
int flags = [event modifierFlags] & NSDeviceIndependentModifierFlagsMask;
|
||||
NSString *unmod = [event charactersIgnoringModifiers];
|
||||
if (flags == NSCommandKeyMask && [unmod isEqual:@"."])
|
||||
return NO;
|
||||
|
||||
// HACK! Let the main menu try to handle any key down event, before
|
||||
// passing it on to vim, otherwise key equivalents for menus will
|
||||
// effectively be disabled.
|
||||
if ([[NSApp mainMenu] performKeyEquivalent:event])
|
||||
return YES;
|
||||
|
||||
// HACK! On Leopard Ctrl-key events end up here instead of keyDown:.
|
||||
if (flags & NSControlKeyMask) {
|
||||
[self keyDown:event];
|
||||
return YES;
|
||||
}
|
||||
|
||||
// HACK! Don't handle Cmd-? or the "Help" menu does not work on Leopard.
|
||||
NSString *unmodchars = [event charactersIgnoringModifiers];
|
||||
if ([unmodchars isEqual:@"?"])
|
||||
return NO;
|
||||
|
||||
// Cmd-. is hard-wired to send SIGINT unlike Ctrl-C which is just another
|
||||
// key press which Vim has to interpret. This means that Cmd-. always
|
||||
// works to interrupt a Vim process whereas Ctrl-C can suffer from problems
|
||||
// such as dropped DO messages (or if Vim is stuck in a loop without
|
||||
// checking for keyboard input).
|
||||
if ((flags & NSDeviceIndependentModifierFlagsMask) == NSCommandKeyMask &&
|
||||
[unmodchars isEqual:@"."]) {
|
||||
kill([[self vimController] pid], SIGINT);
|
||||
return YES;
|
||||
}
|
||||
|
||||
//NSLog(@"%s%@", _cmd, event);
|
||||
|
||||
NSString *chars = [event characters];
|
||||
int len = [unmodchars lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
|
||||
NSMutableData *data = [NSMutableData data];
|
||||
|
||||
if (len <= 0)
|
||||
return NO;
|
||||
|
||||
// If 'chars' and 'unmodchars' differs when shift flag is present, then we
|
||||
// can clear the shift flag as it is already included in 'unmodchars'.
|
||||
// Failing to clear the shift flag means <D-Bar> turns into <S-D-Bar> (on
|
||||
// an English keyboard).
|
||||
if (flags & NSShiftKeyMask && ![chars isEqual:unmodchars])
|
||||
flags &= ~NSShiftKeyMask;
|
||||
|
||||
if (0x3 == [unmodchars characterAtIndex:0]) {
|
||||
// HACK! AppKit turns enter (not return) into Ctrl-C, so we need to
|
||||
// handle it separately (else Cmd-enter turns into Ctrl-C).
|
||||
unmodchars = MMKeypadEnterString;
|
||||
len = [unmodchars lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
|
||||
}
|
||||
|
||||
if ([event isARepeat])
|
||||
flags |= 1;
|
||||
|
||||
[data appendBytes:&flags length:sizeof(int)];
|
||||
[data appendBytes:&len length:sizeof(int)];
|
||||
[data appendBytes:[unmodchars UTF8String] length:len];
|
||||
|
||||
[[self vimController] sendMessage:CmdKeyMsgID data:data];
|
||||
|
||||
// HACK! Pass the event on or it may disappear (Tiger does not pass Cmd-key
|
||||
// events to keyDown:).
|
||||
[self keyDown:event];
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)scrollWheel:(NSEvent *)event
|
||||
{
|
||||
if ([self hasMarkedText]) {
|
||||
// We must clear the marked text since the cursor may move if the
|
||||
// marked text moves outside the view as a result of scrolling.
|
||||
[self sendMarkedText:nil position:0];
|
||||
[self unmarkText];
|
||||
[[NSInputManager currentInputManager] markedTextAbandoned:self];
|
||||
}
|
||||
|
||||
if ([event deltaY] == 0)
|
||||
return;
|
||||
|
||||
@@ -340,6 +341,9 @@ static float MMDragAreaSize = 73.0f;
|
||||
|
||||
- (void)mouseDown:(NSEvent *)event
|
||||
{
|
||||
if ([self inputManagerHandleMouseEvent:event])
|
||||
return;
|
||||
|
||||
int row, col;
|
||||
NSPoint pt = [textView convertPoint:[event locationInWindow] fromView:nil];
|
||||
if (![textView convertPoint:pt toRow:&row column:&col])
|
||||
@@ -372,6 +376,9 @@ static float MMDragAreaSize = 73.0f;
|
||||
|
||||
- (void)mouseUp:(NSEvent *)event
|
||||
{
|
||||
if ([self inputManagerHandleMouseEvent:event])
|
||||
return;
|
||||
|
||||
int row, col;
|
||||
NSPoint pt = [textView convertPoint:[event locationInWindow] fromView:nil];
|
||||
if (![textView convertPoint:pt toRow:&row column:&col])
|
||||
@@ -391,6 +398,9 @@ static float MMDragAreaSize = 73.0f;
|
||||
|
||||
- (void)mouseDragged:(NSEvent *)event
|
||||
{
|
||||
if ([self inputManagerHandleMouseEvent:event])
|
||||
return;
|
||||
|
||||
int flags = [event modifierFlags];
|
||||
int row, col;
|
||||
NSPoint pt = [textView convertPoint:[event locationInWindow] fromView:nil];
|
||||
@@ -421,6 +431,9 @@ static float MMDragAreaSize = 73.0f;
|
||||
|
||||
- (void)mouseMoved:(NSEvent *)event
|
||||
{
|
||||
if ([self inputManagerHandleMouseEvent:event])
|
||||
return;
|
||||
|
||||
// HACK! NSTextView has a nasty habit of resetting the cursor to the
|
||||
// default I-beam cursor at random moments. The only reliable way we know
|
||||
// of to work around this is to set the cursor each time the mouse moves.
|
||||
@@ -444,15 +457,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 +472,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 +487,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 +497,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 +512,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 +572,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;
|
||||
@@ -591,6 +626,7 @@ static float MMDragAreaSize = 73.0f;
|
||||
|
||||
- (void)setMarkedTextAttributes:(NSDictionary *)attr
|
||||
{
|
||||
ASLogDebug(@"%@", attr);
|
||||
if (attr != markedTextAttributes) {
|
||||
[markedTextAttributes release];
|
||||
markedTextAttributes = [attr retain];
|
||||
@@ -599,8 +635,23 @@ static float MMDragAreaSize = 73.0f;
|
||||
|
||||
- (void)setMarkedText:(id)text selectedRange:(NSRange)range
|
||||
{
|
||||
ASLogDebug(@"text='%@' range=%@", text, NSStringFromRange(range));
|
||||
[self unmarkText];
|
||||
|
||||
if ([self useInlineIm]) {
|
||||
if ([text isKindOfClass:[NSAttributedString class]])
|
||||
text = [text string];
|
||||
|
||||
if ([text length] > 0) {
|
||||
markedRange = NSMakeRange(0, [text length]);
|
||||
imRange = range;
|
||||
}
|
||||
|
||||
[self sendMarkedText:text position:range.location];
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef INCLUDE_OLD_IM_CODE
|
||||
if (!(text && [text length] > 0))
|
||||
return;
|
||||
|
||||
@@ -640,10 +691,12 @@ static float MMDragAreaSize = 73.0f;
|
||||
}
|
||||
|
||||
[textView setNeedsDisplay:YES];
|
||||
#endif // INCLUDE_OLD_IM_CODE
|
||||
}
|
||||
|
||||
- (void)unmarkText
|
||||
{
|
||||
ASLogDebug(@"");
|
||||
imRange = NSMakeRange(0, 0);
|
||||
markedRange = NSMakeRange(NSNotFound, 0);
|
||||
[markedText release];
|
||||
@@ -723,6 +776,82 @@ 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. On >=10.5 and later we do not forward changes to the input
|
||||
// method, instead we let Vim be in complete control.
|
||||
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
|
||||
// The TIS symbols are weakly linked.
|
||||
if (NULL != TISCopyCurrentKeyboardInputSource) {
|
||||
// We get here when compiled on >=10.5 and running on >=10.5.
|
||||
|
||||
if (asciiImSource) {
|
||||
CFRelease(asciiImSource);
|
||||
asciiImSource = NULL;
|
||||
}
|
||||
if (lastImSource) {
|
||||
CFRelease(lastImSource);
|
||||
lastImSource = NULL;
|
||||
}
|
||||
if (enable) {
|
||||
// Save current locale input source for use when IM is active and
|
||||
// get an ASCII source for use when IM is deactivated (by Vim).
|
||||
asciiImSource = TISCopyCurrentASCIICapableKeyboardInputSource();
|
||||
NSString *locale = [[NSLocale currentLocale] localeIdentifier];
|
||||
lastImSource = TISCopyInputSourceForLanguage((CFStringRef)locale);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
imControl = enable;
|
||||
ASLogInfo(@"IM control %sabled", enable ? "en" : "dis");
|
||||
}
|
||||
|
||||
- (void)activateIm:(BOOL)enable
|
||||
{
|
||||
ASLogInfo(@"Activate IM=%d", enable);
|
||||
imState = enable;
|
||||
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
|
||||
// The TIS symbols are weakly linked.
|
||||
if (NULL != TISCopyCurrentKeyboardInputSource) {
|
||||
// We get here when compiled on >=10.5 and running on >=10.5.
|
||||
|
||||
// Enable IM: switch back to input source used when IM was last on
|
||||
// Disable IM: switch back to ASCII input source (set in setImControl:)
|
||||
TISInputSourceRef ref = enable ? lastImSource : asciiImSource;
|
||||
if (ref) {
|
||||
ASLogDebug(@"Change input source: %@",
|
||||
TISGetInputSourceProperty(ref, kTISPropertyInputSourceID));
|
||||
TISSelectInputSource(ref);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// We get here when compiled on >=10.5 but running on 10.4 -- fall through
|
||||
// and use old IM code...
|
||||
#endif
|
||||
#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
|
||||
// NOTE: The IM code is delegated to the frontend since calling it in
|
||||
// the backend caused weird bugs (second dock icon appearing etc.).
|
||||
KeyScript(enable ? smKeySysScript : smKeyRoman);
|
||||
#endif
|
||||
}
|
||||
|
||||
- (BOOL)useInlineIm
|
||||
{
|
||||
#ifdef INCLUDE_OLD_IM_CODE
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
return [ud boolForKey:MMUseInlineImKey];
|
||||
#else
|
||||
return YES;
|
||||
#endif // INCLUDE_OLD_IM_CODE
|
||||
}
|
||||
|
||||
@end // MMTextViewHelper
|
||||
|
||||
|
||||
@@ -743,72 +872,115 @@ static float MMDragAreaSize = 73.0f;
|
||||
return [[self windowController] vimController];
|
||||
}
|
||||
|
||||
- (void)dispatchKeyEvent:(NSEvent *)event
|
||||
- (void)doKeyDown:(NSString *)key
|
||||
{
|
||||
// Only handle the command if it came from a keyDown event
|
||||
if ([event type] != NSKeyDown)
|
||||
if (!currentEvent) {
|
||||
ASLogDebug(@"No current event; ignore key");
|
||||
return;
|
||||
|
||||
NSString *chars = [event characters];
|
||||
NSString *unmodchars = [event charactersIgnoringModifiers];
|
||||
unichar c = [chars characterAtIndex:0];
|
||||
unichar imc = [unmodchars length] > 0 ? [unmodchars characterAtIndex:0] : 0;
|
||||
int len = 0;
|
||||
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);
|
||||
|
||||
if (' ' == imc && 0xa0 != c) {
|
||||
// HACK! The AppKit turns <C-Space> into <C-@> which is not standard
|
||||
// Vim behaviour, so bypass this problem. (0xa0 is <M-Space>, which
|
||||
// should be passed on as is.)
|
||||
len = [unmodchars lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
|
||||
bytes = [unmodchars UTF8String];
|
||||
} else if (imc == c && '2' == c) {
|
||||
// HACK! Translate Ctrl+2 to <C-@>.
|
||||
static char ctrl_at = 0;
|
||||
len = 1; bytes = &ctrl_at;
|
||||
} else if (imc == c && '6' == c) {
|
||||
// HACK! Translate Ctrl+6 to <C-^>.
|
||||
static char ctrl_hat = 0x1e;
|
||||
len = 1; bytes = &ctrl_hat;
|
||||
} else if (c == 0x19 && imc == 0x19) {
|
||||
// HACK! AppKit turns back tab into Ctrl-Y, so we need to handle it
|
||||
// separately (else Ctrl-Y doesn't work).
|
||||
static char tab = 0x9;
|
||||
len = 1; bytes = &tab; mods |= NSShiftKeyMask;
|
||||
} else {
|
||||
len = [chars lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
|
||||
bytes = [chars UTF8String];
|
||||
}
|
||||
|
||||
[self sendKeyDown:bytes length:len modifiers:mods
|
||||
isARepeat:[event isARepeat]];
|
||||
const char *chars = [key UTF8String];
|
||||
unsigned length = [key lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
|
||||
unsigned keyCode = [currentEvent keyCode];
|
||||
unsigned flags = [currentEvent modifierFlags];
|
||||
|
||||
// The low 16 bits are not used for modifier flags by NSEvent. Use
|
||||
// these bits for custom flags.
|
||||
flags &= NSDeviceIndependentModifierFlagsMask;
|
||||
if ([currentEvent isARepeat])
|
||||
flags |= 1;
|
||||
|
||||
NSMutableData *data = [NSMutableData data];
|
||||
[data appendBytes:&flags length:sizeof(unsigned)];
|
||||
[data appendBytes:&keyCode length:sizeof(unsigned)];
|
||||
[data appendBytes:&length length:sizeof(unsigned)];
|
||||
if (length > 0)
|
||||
[data appendBytes:chars length:length];
|
||||
|
||||
[[self vimController] sendMessage:KeyDownMsgID data:data];
|
||||
}
|
||||
|
||||
- (void)sendKeyDown:(const char *)chars length:(int)len modifiers:(int)flags
|
||||
isARepeat:(BOOL)isARepeat
|
||||
- (void)doInsertText:(NSString *)text
|
||||
{
|
||||
if (chars && len > 0) {
|
||||
NSMutableData *data = [NSMutableData data];
|
||||
unsigned length = [text lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
|
||||
if (0 == length)
|
||||
return;
|
||||
|
||||
// The low 16 bits are not used for modifier flags by NSEvent. Use
|
||||
// these bits for custom flags.
|
||||
flags &= 0xffff0000;
|
||||
if (isARepeat)
|
||||
const char *chars = [text UTF8String];
|
||||
unsigned keyCode = 0;
|
||||
unsigned flags = 0;
|
||||
|
||||
// HACK! insertText: can be called from outside a keyDown: event in which
|
||||
// case currentEvent is nil. This happens e.g. when the "Special
|
||||
// Characters" palette is used to insert text. In this situation we assume
|
||||
// that the key is not a repeat (if there was a palette that did auto
|
||||
// repeat of input we might have to rethink this).
|
||||
if (currentEvent) {
|
||||
// HACK! Keys on the numeric key pad are treated as special keys by Vim
|
||||
// so we need to pass on key code and modifier flags in this situation.
|
||||
unsigned mods = [currentEvent modifierFlags];
|
||||
if (mods & NSNumericPadKeyMask) {
|
||||
flags = mods & NSDeviceIndependentModifierFlagsMask;
|
||||
keyCode = [currentEvent keyCode];
|
||||
}
|
||||
|
||||
if ([currentEvent isARepeat])
|
||||
flags |= 1;
|
||||
|
||||
[data appendBytes:&flags length:sizeof(int)];
|
||||
[data appendBytes:&len length:sizeof(int)];
|
||||
[data appendBytes:chars length:len];
|
||||
|
||||
[self hideMouseCursor];
|
||||
|
||||
//NSLog(@"%s len=%d chars=0x%x", _cmd, len, chars[0]);
|
||||
[[self vimController] sendMessage:KeyDownMsgID data:data];
|
||||
}
|
||||
|
||||
NSMutableData *data = [NSMutableData data];
|
||||
[data appendBytes:&flags length:sizeof(unsigned)];
|
||||
[data appendBytes:&keyCode length:sizeof(unsigned)];
|
||||
[data appendBytes:&length length:sizeof(unsigned)];
|
||||
[data appendBytes:chars length:length];
|
||||
|
||||
[[self vimController] sendMessage:KeyDownMsgID data:data];
|
||||
}
|
||||
|
||||
- (void)checkImState
|
||||
{
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
|
||||
if (NULL != TISCopyCurrentKeyboardInputSource) {
|
||||
// We get here when compiled on >=10.5 and running on >=10.5.
|
||||
TISInputSourceRef cur = TISCopyCurrentKeyboardInputSource();
|
||||
BOOL state = !KeyboardInputSourcesEqual(asciiImSource, cur);
|
||||
BOOL isChanged = !KeyboardInputSourcesEqual(lastImSource, cur);
|
||||
if (state && isChanged) {
|
||||
// Remember current input source so we can switch back to it
|
||||
// when IM is once more enabled.
|
||||
ASLogDebug(@"Remember last input source: %@",
|
||||
TISGetInputSourceProperty(cur, kTISPropertyInputSourceID));
|
||||
if (lastImSource) CFRelease(lastImSource);
|
||||
lastImSource = cur;
|
||||
} else {
|
||||
CFRelease(cur);
|
||||
}
|
||||
if (imState != state) {
|
||||
imState = state;
|
||||
int msgid = state ? ActivatedImMsgID : DeactivatedImMsgID;
|
||||
[[self vimController] sendMessage:msgid data:nil];
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
|
||||
// Compiled for <=10.4, running on 10.4
|
||||
|
||||
// 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];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)hideMouseCursor
|
||||
@@ -887,7 +1059,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];
|
||||
}
|
||||
}
|
||||
@@ -928,4 +1100,37 @@ static float MMDragAreaSize = 73.0f;
|
||||
return rect;
|
||||
}
|
||||
|
||||
- (BOOL)inputManagerHandleMouseEvent:(NSEvent *)event
|
||||
{
|
||||
// NOTE: The input manager usually handles events like mouse clicks (e.g.
|
||||
// the Kotoeri manager "commits" the text on left clicks).
|
||||
|
||||
if (event) {
|
||||
NSInputManager *imgr = [NSInputManager currentInputManager];
|
||||
if ([imgr wantsToHandleMouseEvents])
|
||||
return [imgr handleMouseEvent:event];
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)sendMarkedText:(NSString *)text position:(unsigned)pos
|
||||
{
|
||||
if (![self useInlineIm])
|
||||
return;
|
||||
|
||||
NSMutableData *data = [NSMutableData data];
|
||||
unsigned len = text == nil ? 0
|
||||
: [text lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
|
||||
|
||||
[data appendBytes:&pos length:sizeof(unsigned)];
|
||||
[data appendBytes:&len length:sizeof(unsigned)];
|
||||
if (len > 0) {
|
||||
[data appendBytes:[text UTF8String] length:len];
|
||||
[data appendBytes:"\x00" length:1];
|
||||
}
|
||||
|
||||
[[self vimController] sendMessage:SetMarkedTextMsgID data:data];
|
||||
}
|
||||
|
||||
@end // MMTextViewHelper (Private)
|
||||
|
||||
+13
-10
@@ -26,7 +26,7 @@
|
||||
- (void)willSetLineFragmentRect:(NSRectPointer)lineRect
|
||||
forGlyphRange:(NSRange)glyphRange
|
||||
usedRect:(NSRectPointer)usedRect
|
||||
baselineOffset:(float *)baselineOffset
|
||||
baselineOffset:(CGFloat *)baselineOffset
|
||||
{
|
||||
MMTextStorage *ts = (MMTextStorage*)[[self layoutManager] textStorage];
|
||||
float h = [ts cellSize].height;
|
||||
@@ -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
|
||||
|
||||
//
|
||||
@@ -102,9 +103,9 @@
|
||||
// height and that EOL glyphs are hidden.
|
||||
//
|
||||
- (void)layoutGlyphsInLayoutManager:(NSLayoutManager *)lm
|
||||
startingAtGlyphIndex:(unsigned)startGlyphIdx
|
||||
maxNumberOfLineFragments:(unsigned)maxNumLines
|
||||
nextGlyphIndex:(unsigned *)nextGlyph
|
||||
startingAtGlyphIndex:(NSUInteger)startGlyphIdx
|
||||
maxNumberOfLineFragments:(NSUInteger)maxNumLines
|
||||
nextGlyphIndex:(NSUInteger *)nextGlyph
|
||||
{
|
||||
// TODO: Check that it really is an MMTextStorage?
|
||||
MMTextStorage *ts = (MMTextStorage*)[lm textStorage];
|
||||
@@ -159,8 +160,8 @@
|
||||
|
||||
NSRange lineRange = { lineIdx, 0 };
|
||||
NSRange glyphRange = { startGlyphIdx, 0 };
|
||||
NSRect lineRect = { 0, line*cellSize.height,
|
||||
[ts actualColumns]*cellSize.width, cellSize.height };
|
||||
NSRect lineRect = { {0, line*cellSize.height},
|
||||
{[ts actualColumns]*cellSize.width, cellSize.height} };
|
||||
int endLine = line + maxNumLines;
|
||||
if (endLine > actualRows)
|
||||
endLine = actualRows;
|
||||
@@ -188,3 +189,5 @@
|
||||
|
||||
@end // MMTypesetter2
|
||||
|
||||
#endif // MM_USE_ROW_CACHE
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
* See README.txt for an overview of the Vim source code.
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "MacVim.h"
|
||||
|
||||
#ifdef MM_ENABLE_PLUGINS
|
||||
@@ -20,7 +19,12 @@
|
||||
|
||||
|
||||
|
||||
@interface MMVimController : NSObject {
|
||||
@interface MMVimController : NSObject
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
|
||||
// 10.6 has turned delegate messages into formal protocols
|
||||
<NSToolbarDelegate, NSOpenSavePanelDelegate>
|
||||
#endif
|
||||
{
|
||||
unsigned identifier;
|
||||
BOOL isInitialized;
|
||||
MMWindowController *windowController;
|
||||
@@ -40,7 +44,7 @@
|
||||
}
|
||||
|
||||
- (id)initWithBackend:(id)backend pid:(int)processIdentifier;
|
||||
- (unsigned)identifier;
|
||||
- (unsigned)vimControllerId;
|
||||
- (id)backendProxy;
|
||||
- (int)pid;
|
||||
- (void)setServerName:(NSString *)name;
|
||||
|
||||
+104
-58
@@ -27,7 +27,6 @@
|
||||
*/
|
||||
|
||||
#import "MMAppController.h"
|
||||
#import "MMAtsuiTextView.h"
|
||||
#import "MMFindReplaceController.h"
|
||||
#import "MMTextView.h"
|
||||
#import "MMVimController.h"
|
||||
@@ -162,7 +161,7 @@ static BOOL isUnsafeMessage(int msgid);
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
LOG_DEALLOC
|
||||
ASLogDebug(@"");
|
||||
|
||||
isInitialized = NO;
|
||||
|
||||
@@ -185,7 +184,7 @@ static BOOL isUnsafeMessage(int msgid);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (unsigned)identifier
|
||||
- (unsigned)vimControllerId
|
||||
{
|
||||
return identifier;
|
||||
}
|
||||
@@ -252,6 +251,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 +276,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 +288,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 +305,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 +321,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 +339,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 +361,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 +378,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 +392,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 +409,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 +427,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 +468,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 +478,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 +506,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 +536,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 +557,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 +570,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) {
|
||||
@@ -638,24 +656,24 @@ static BOOL isUnsafeMessage(int msgid);
|
||||
[windowController showToolbar:enable size:size mode:mode];
|
||||
} else if (CreateScrollbarMsgID == msgid) {
|
||||
const void *bytes = [data bytes];
|
||||
long ident = *((long*)bytes); bytes += sizeof(long);
|
||||
int32_t ident = *((int32_t*)bytes); bytes += sizeof(int32_t);
|
||||
int type = *((int*)bytes); bytes += sizeof(int);
|
||||
|
||||
[windowController createScrollbarWithIdentifier:ident type:type];
|
||||
} else if (DestroyScrollbarMsgID == msgid) {
|
||||
const void *bytes = [data bytes];
|
||||
long ident = *((long*)bytes); bytes += sizeof(long);
|
||||
int32_t ident = *((int32_t*)bytes); bytes += sizeof(int32_t);
|
||||
|
||||
[windowController destroyScrollbarWithIdentifier:ident];
|
||||
} else if (ShowScrollbarMsgID == msgid) {
|
||||
const void *bytes = [data bytes];
|
||||
long ident = *((long*)bytes); bytes += sizeof(long);
|
||||
int32_t ident = *((int32_t*)bytes); bytes += sizeof(int32_t);
|
||||
int visible = *((int*)bytes); bytes += sizeof(int);
|
||||
|
||||
[windowController showScrollbarWithIdentifier:ident state:visible];
|
||||
} else if (SetScrollbarPositionMsgID == msgid) {
|
||||
const void *bytes = [data bytes];
|
||||
long ident = *((long*)bytes); bytes += sizeof(long);
|
||||
int32_t ident = *((int32_t*)bytes); bytes += sizeof(int32_t);
|
||||
int pos = *((int*)bytes); bytes += sizeof(int);
|
||||
int len = *((int*)bytes); bytes += sizeof(int);
|
||||
|
||||
@@ -663,7 +681,7 @@ static BOOL isUnsafeMessage(int msgid);
|
||||
identifier:ident];
|
||||
} else if (SetScrollbarThumbMsgID == msgid) {
|
||||
const void *bytes = [data bytes];
|
||||
long ident = *((long*)bytes); bytes += sizeof(long);
|
||||
int32_t ident = *((int32_t*)bytes); bytes += sizeof(int32_t);
|
||||
float val = *((float*)bytes); bytes += sizeof(float);
|
||||
float prop = *((float*)bytes); bytes += sizeof(float);
|
||||
|
||||
@@ -739,7 +757,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 +805,14 @@ static BOOL isUnsafeMessage(int msgid);
|
||||
showWithText:[dict objectForKey:@"text"]
|
||||
flags:[[dict objectForKey:@"flags"] intValue]];
|
||||
}
|
||||
} else if (ActivateKeyScriptID == msgid) {
|
||||
KeyScript(smKeySysScript);
|
||||
} else if (DeactivateKeyScriptID == msgid) {
|
||||
KeyScript(smKeyRoman);
|
||||
} else if (ActivateKeyScriptMsgID == msgid) {
|
||||
[[[windowController vimView] textView] activateIm:YES];
|
||||
} else if (DeactivateKeyScriptMsgID == msgid) {
|
||||
[[[windowController vimView] textView] activateIm:NO];
|
||||
} 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 +824,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 +832,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 +858,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 +879,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -947,7 +986,7 @@ static BOOL isUnsafeMessage(int msgid);
|
||||
if (!toolbar) {
|
||||
// NOTE! Each toolbar must have a unique identifier, else each
|
||||
// window will have the same toolbar.
|
||||
NSString *ident = [NSString stringWithFormat:@"%d", (int)self];
|
||||
NSString *ident = [NSString stringWithFormat:@"%d", identifier];
|
||||
toolbar = [[NSToolbar alloc] initWithIdentifier:ident];
|
||||
|
||||
[toolbar setShowsBaselineSeparator:NO];
|
||||
@@ -1014,8 +1053,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;
|
||||
}
|
||||
|
||||
@@ -1067,7 +1106,7 @@ static BOOL isUnsafeMessage(int msgid);
|
||||
// Only remove toolbar items, never actually remove the toolbar
|
||||
// itself or strange things may happen.
|
||||
if ([desc count] == 2) {
|
||||
int idx = [toolbar indexOfItemWithItemIdentifier:title];
|
||||
NSUInteger idx = [toolbar indexOfItemWithItemIdentifier:title];
|
||||
if (idx != NSNotFound)
|
||||
[toolbar removeItemAtIndex:idx];
|
||||
}
|
||||
@@ -1077,8 +1116,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 +1140,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 +1179,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 +1269,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
|
||||
@@ -1246,10 +1284,15 @@ static BOOL isUnsafeMessage(int msgid);
|
||||
// free objects that Cocoa is currently using (e.g. view objects). The
|
||||
// following call ensures that the vim controller is not released until the
|
||||
// run loop is back in the 'default' mode.
|
||||
// Also, since the app may be multithreaded (e.g. as a result of showing
|
||||
// the open panel) we have to ensure this call happens on the main thread,
|
||||
// else there is a race condition that may lead to a crash.
|
||||
[[MMAppController sharedInstance]
|
||||
performSelector:@selector(removeVimController:)
|
||||
withObject:self
|
||||
afterDelay:0];
|
||||
performSelectorOnMainThread:@selector(removeVimController:)
|
||||
withObject:self
|
||||
waitUntilDone:NO
|
||||
modes:[NSArray arrayWithObject:
|
||||
NSDefaultRunLoopMode]];
|
||||
}
|
||||
|
||||
// NSSavePanel delegate
|
||||
@@ -1389,8 +1432,11 @@ static BOOL isUnsafeMessage(int msgid);
|
||||
|
||||
|
||||
@implementation MMAlert
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
ASLogDebug(@"");
|
||||
|
||||
[textField release]; textField = nil;
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@@ -43,12 +43,12 @@
|
||||
- (void)selectTabWithIndex:(int)idx;
|
||||
- (NSTabViewItem *)addNewTabViewItem;
|
||||
|
||||
- (void)createScrollbarWithIdentifier:(long)ident type:(int)type;
|
||||
- (BOOL)destroyScrollbarWithIdentifier:(long)ident;
|
||||
- (BOOL)showScrollbarWithIdentifier:(long)ident state:(BOOL)visible;
|
||||
- (void)createScrollbarWithIdentifier:(int32_t)ident type:(int)type;
|
||||
- (BOOL)destroyScrollbarWithIdentifier:(int32_t)ident;
|
||||
- (BOOL)showScrollbarWithIdentifier:(int32_t)ident state:(BOOL)visible;
|
||||
- (void)setScrollbarThumbValue:(float)val proportion:(float)prop
|
||||
identifier:(long)ident;
|
||||
- (void)setScrollbarPosition:(int)pos length:(int)len identifier:(long)ident;
|
||||
identifier:(int32_t)ident;
|
||||
- (void)setScrollbarPosition:(int)pos length:(int)len identifier:(int32_t)ident;
|
||||
|
||||
- (void)setDefaultColorsBackground:(NSColor *)back foreground:(NSColor *)fore;
|
||||
|
||||
|
||||
+42
-47
@@ -24,7 +24,7 @@
|
||||
#import "MMVimView.h"
|
||||
#import "MMWindowController.h"
|
||||
#import "Miscellaneous.h"
|
||||
#import <PSMTabBarControl.h>
|
||||
#import <PSMTabBarControl/PSMTabBarControl.h>
|
||||
|
||||
|
||||
|
||||
@@ -38,12 +38,12 @@ enum {
|
||||
|
||||
// TODO: Move!
|
||||
@interface MMScroller : NSScroller {
|
||||
long identifier;
|
||||
int32_t identifier;
|
||||
int type;
|
||||
NSRange range;
|
||||
}
|
||||
- (id)initWithIdentifier:(long)ident type:(int)type;
|
||||
- (long)identifier;
|
||||
- (id)initWithIdentifier:(int32_t)ident type:(int)type;
|
||||
- (int32_t)scrollerId;
|
||||
- (int)type;
|
||||
- (NSRange)range;
|
||||
- (void)setRange:(NSRange)newRange;
|
||||
@@ -55,8 +55,8 @@ enum {
|
||||
- (BOOL)leftScrollbarVisible;
|
||||
- (BOOL)rightScrollbarVisible;
|
||||
- (void)placeScrollbars;
|
||||
- (int)representedIndexOfTabViewItem:(NSTabViewItem *)tvi;
|
||||
- (MMScroller *)scrollbarForIdentifier:(long)ident index:(unsigned *)idx;
|
||||
- (NSUInteger)representedIndexOfTabViewItem:(NSTabViewItem *)tvi;
|
||||
- (MMScroller *)scrollbarForIdentifier:(int32_t)ident index:(unsigned *)idx;
|
||||
- (NSSize)vimViewSizeForTextViewSize:(NSSize)textViewSize;
|
||||
- (NSRect)textViewRectForVimViewSize:(NSSize)contentSize;
|
||||
- (NSTabView *)tabView;
|
||||
@@ -89,13 +89,16 @@ enum {
|
||||
[self setAutoresizesSubviews:YES];
|
||||
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
#if ENABLE_ATSUI
|
||||
if ([ud boolForKey:MMAtsuiRendererKey]) {
|
||||
// Use ATSUI for text rendering.
|
||||
//
|
||||
// HACK! 'textView' has type MMTextView, but MMAtsuiTextView is not
|
||||
// derived from MMTextView.
|
||||
textView = [[MMAtsuiTextView alloc] initWithFrame:frame];
|
||||
} else {
|
||||
} else
|
||||
#endif // ENABLE_ATSUI
|
||||
{
|
||||
// Use Cocoa text system for text rendering.
|
||||
textView = [[MMTextView alloc] initWithFrame:frame];
|
||||
}
|
||||
@@ -152,7 +155,7 @@ enum {
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
LOG_DEALLOC
|
||||
ASLogDebug(@"");
|
||||
|
||||
[tabBarControl release]; tabBarControl = nil;
|
||||
[tabView release]; tabView = nil;
|
||||
@@ -311,7 +314,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 +329,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 +338,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;
|
||||
}
|
||||
|
||||
@@ -374,10 +374,8 @@ enum {
|
||||
return tvi;
|
||||
}
|
||||
|
||||
- (void)createScrollbarWithIdentifier:(long)ident type:(int)type
|
||||
- (void)createScrollbarWithIdentifier:(int32_t)ident type:(int)type
|
||||
{
|
||||
//NSLog(@"Create scroller %d of type %d", ident, type);
|
||||
|
||||
MMScroller *scroller = [[MMScroller alloc] initWithIdentifier:ident
|
||||
type:type];
|
||||
[scroller setTarget:self];
|
||||
@@ -388,10 +386,8 @@ enum {
|
||||
[scroller release];
|
||||
}
|
||||
|
||||
- (BOOL)destroyScrollbarWithIdentifier:(long)ident
|
||||
- (BOOL)destroyScrollbarWithIdentifier:(int32_t)ident
|
||||
{
|
||||
//NSLog(@"Destroy scroller %d", ident);
|
||||
|
||||
unsigned idx = 0;
|
||||
MMScroller *scroller = [self scrollbarForIdentifier:ident index:&idx];
|
||||
if (!scroller) return NO;
|
||||
@@ -404,14 +400,12 @@ enum {
|
||||
return ![scroller isHidden];
|
||||
}
|
||||
|
||||
- (BOOL)showScrollbarWithIdentifier:(long)ident state:(BOOL)visible
|
||||
- (BOOL)showScrollbarWithIdentifier:(int32_t)ident state:(BOOL)visible
|
||||
{
|
||||
MMScroller *scroller = [self scrollbarForIdentifier:ident index:NULL];
|
||||
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
|
||||
@@ -420,12 +414,15 @@ enum {
|
||||
}
|
||||
|
||||
- (void)setScrollbarThumbValue:(float)val proportion:(float)prop
|
||||
identifier:(long)ident
|
||||
identifier:(int32_t)ident
|
||||
{
|
||||
MMScroller *scroller = [self scrollbarForIdentifier:ident index:NULL];
|
||||
//NSLog(@"Set thumb value %.2f proportion %.2f for scroller %d",
|
||||
// val, prop, ident);
|
||||
#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5)
|
||||
[scroller setDoubleValue:val];
|
||||
[scroller setKnobProportion:prop];
|
||||
#else
|
||||
[scroller setFloatValue:val knobProportion:prop];
|
||||
#endif
|
||||
[scroller setEnabled:prop != 1.f];
|
||||
}
|
||||
|
||||
@@ -433,24 +430,22 @@ enum {
|
||||
- (void)scroll:(id)sender
|
||||
{
|
||||
NSMutableData *data = [NSMutableData data];
|
||||
long ident = [(MMScroller*)sender identifier];
|
||||
int32_t ident = [(MMScroller*)sender scrollerId];
|
||||
int hitPart = [sender hitPart];
|
||||
float value = [sender floatValue];
|
||||
|
||||
[data appendBytes:&ident length:sizeof(long)];
|
||||
[data appendBytes:&ident length:sizeof(int32_t)];
|
||||
[data appendBytes:&hitPart length:sizeof(int)];
|
||||
[data appendBytes:&value length:sizeof(float)];
|
||||
|
||||
[vimController sendMessage:ScrollbarEventMsgID data:data];
|
||||
}
|
||||
|
||||
- (void)setScrollbarPosition:(int)pos length:(int)len identifier:(long)ident
|
||||
- (void)setScrollbarPosition:(int)pos length:(int)len identifier:(int32_t)ident
|
||||
{
|
||||
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.
|
||||
|
||||
@@ -483,9 +478,10 @@ enum {
|
||||
// flag is set when Vim initiated the selection.
|
||||
if (!vimTaskSelectedTab) {
|
||||
// Propagate the selection message to Vim.
|
||||
int idx = [self representedIndexOfTabViewItem:tabViewItem];
|
||||
NSUInteger idx = [self representedIndexOfTabViewItem:tabViewItem];
|
||||
if (NSNotFound != idx) {
|
||||
NSData *data = [NSData dataWithBytes:&idx length:sizeof(int)];
|
||||
int i = (int)idx; // HACK! Never more than MAXINT tabs?!
|
||||
NSData *data = [NSData dataWithBytes:&i length:sizeof(int)];
|
||||
[vimController sendMessage:SelectTabMsgID data:data];
|
||||
}
|
||||
}
|
||||
@@ -501,9 +497,9 @@ enum {
|
||||
// HACK! This method is only called when the user clicks the close button
|
||||
// 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)];
|
||||
NSUInteger idx = [self representedIndexOfTabViewItem:tabViewItem];
|
||||
int i = (int)idx; // HACK! Never more than MAXINT tabs?!
|
||||
NSData *data = [NSData dataWithBytes:&i length:sizeof(int)];
|
||||
[vimController sendMessage:CloseTabMsgID data:data];
|
||||
|
||||
return NO;
|
||||
@@ -520,7 +516,7 @@ enum {
|
||||
|
||||
- (NSDragOperation)tabBarControl:(PSMTabBarControl *)theTabBarControl
|
||||
draggingEntered:(id <NSDraggingInfo>)sender
|
||||
forTabAtIndex:(unsigned)tabIndex
|
||||
forTabAtIndex:(NSUInteger)tabIndex
|
||||
{
|
||||
NSPasteboard *pb = [sender draggingPasteboard];
|
||||
return [[pb types] containsObject:NSFilenamesPboardType]
|
||||
@@ -530,7 +526,7 @@ enum {
|
||||
|
||||
- (BOOL)tabBarControl:(PSMTabBarControl *)theTabBarControl
|
||||
performDragOperation:(id <NSDraggingInfo>)sender
|
||||
forTabAtIndex:(unsigned)tabIndex
|
||||
forTabAtIndex:(NSUInteger)tabIndex
|
||||
{
|
||||
NSPasteboard *pb = [sender draggingPasteboard];
|
||||
if ([[pb types] containsObject:NSFilenamesPboardType]) {
|
||||
@@ -743,7 +739,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];
|
||||
@@ -755,18 +750,18 @@ enum {
|
||||
}
|
||||
}
|
||||
|
||||
- (int)representedIndexOfTabViewItem:(NSTabViewItem *)tvi
|
||||
- (NSUInteger)representedIndexOfTabViewItem:(NSTabViewItem *)tvi
|
||||
{
|
||||
NSArray *tabViewItems = [[self tabBarControl] representedTabViewItems];
|
||||
return [tabViewItems indexOfObject:tvi];
|
||||
}
|
||||
|
||||
- (MMScroller *)scrollbarForIdentifier:(long)ident index:(unsigned *)idx
|
||||
- (MMScroller *)scrollbarForIdentifier:(int32_t)ident index:(unsigned *)idx
|
||||
{
|
||||
unsigned i, count = [scrollbars count];
|
||||
for (i = 0; i < count; ++i) {
|
||||
MMScroller *scroller = [scrollbars objectAtIndex:i];
|
||||
if ([scroller identifier] == ident) {
|
||||
if ([scroller scrollerId] == ident) {
|
||||
if (idx) *idx = i;
|
||||
return scroller;
|
||||
}
|
||||
@@ -794,7 +789,7 @@ enum {
|
||||
|
||||
- (NSRect)textViewRectForVimViewSize:(NSSize)contentSize
|
||||
{
|
||||
NSRect rect = { 0, 0, contentSize.width, contentSize.height };
|
||||
NSRect rect = { {0, 0}, {contentSize.width, contentSize.height} };
|
||||
|
||||
if (![[self tabBarControl] isHidden])
|
||||
rect.size.height -= [[self tabBarControl] frame].size.height;
|
||||
@@ -856,9 +851,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];
|
||||
|
||||
@@ -878,7 +873,7 @@ enum {
|
||||
|
||||
@implementation MMScroller
|
||||
|
||||
- (id)initWithIdentifier:(long)ident type:(int)theType
|
||||
- (id)initWithIdentifier:(int32_t)ident type:(int)theType
|
||||
{
|
||||
// HACK! NSScroller creates a horizontal scroller if it is init'ed with a
|
||||
// frame whose with exceeds its height; so create a bogus rect and pass it
|
||||
@@ -899,7 +894,7 @@ enum {
|
||||
return self;
|
||||
}
|
||||
|
||||
- (long)identifier
|
||||
- (int32_t)scrollerId
|
||||
{
|
||||
return identifier;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* See README.txt for an overview of the Vim source code.
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "MacVim.h"
|
||||
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
}
|
||||
|
||||
- (id)initWithContentRect:(NSRect)rect
|
||||
styleMask:(unsigned int)style
|
||||
styleMask:(NSUInteger)style
|
||||
backing:(NSBackingStoreType)bufferingType
|
||||
defer:(BOOL)flag;
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
@implementation MMWindow
|
||||
|
||||
- (id)initWithContentRect:(NSRect)rect
|
||||
styleMask:(unsigned int)style
|
||||
styleMask:(NSUInteger)style
|
||||
backing:(NSBackingStoreType)bufferingType
|
||||
defer:(BOOL)flag
|
||||
{
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
[self setReleasedWhenClosed:NO];
|
||||
|
||||
NSRect tabSepRect = { 0, rect.size.height - 1, rect.size.width, 1 };
|
||||
NSRect tabSepRect = { {0, rect.size.height - 1}, {rect.size.width, 1} };
|
||||
tablineSeparator = [[NSBox alloc] initWithFrame:tabSepRect];
|
||||
|
||||
[tablineSeparator setBoxType:NSBoxSeparator];
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* See README.txt for an overview of the Vim source code.
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "MacVim.h"
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,12 @@
|
||||
@class MMVimController;
|
||||
@class MMVimView;
|
||||
|
||||
@interface MMWindowController : NSWindowController {
|
||||
@interface MMWindowController : NSWindowController
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6)
|
||||
// 10.6 has turned delegate messages into formal protocols
|
||||
<NSWindowDelegate>
|
||||
#endif
|
||||
{
|
||||
MMVimController *vimController;
|
||||
MMVimView *vimView;
|
||||
BOOL setupDone;
|
||||
@@ -46,12 +51,12 @@
|
||||
- (void)setTitle:(NSString *)title;
|
||||
- (void)setDocumentFilename:(NSString *)filename;
|
||||
- (void)setToolbar:(NSToolbar *)toolbar;
|
||||
- (void)createScrollbarWithIdentifier:(long)ident type:(int)type;
|
||||
- (BOOL)destroyScrollbarWithIdentifier:(long)ident;
|
||||
- (BOOL)showScrollbarWithIdentifier:(long)ident state:(BOOL)visible;
|
||||
- (void)setScrollbarPosition:(int)pos length:(int)len identifier:(long)ident;
|
||||
- (void)createScrollbarWithIdentifier:(int32_t)ident type:(int)type;
|
||||
- (BOOL)destroyScrollbarWithIdentifier:(int32_t)ident;
|
||||
- (BOOL)showScrollbarWithIdentifier:(int32_t)ident state:(BOOL)visible;
|
||||
- (void)setScrollbarPosition:(int)pos length:(int)len identifier:(int32_t)ident;
|
||||
- (void)setScrollbarThumbValue:(float)val proportion:(float)prop
|
||||
identifier:(long)ident;
|
||||
identifier:(int32_t)ident;
|
||||
- (void)setDefaultColorsBackground:(NSColor *)back foreground:(NSColor *)fore;
|
||||
- (void)setFont:(NSFont *)font;
|
||||
- (void)setWideFont:(NSFont *)font;
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
#import "MMWindow.h"
|
||||
#import "MMWindowController.h"
|
||||
#import "Miscellaneous.h"
|
||||
#import <PSMTabBarControl.h>
|
||||
#import <PSMTabBarControl/PSMTabBarControl.h>
|
||||
|
||||
|
||||
|
||||
@@ -99,18 +99,6 @@
|
||||
@interface NSWindow (NSLeopardOnly)
|
||||
// Note: These functions are Leopard-only, use -[NSObject respondsToSelector:]
|
||||
// before calling them to make sure everything works on Tiger too.
|
||||
|
||||
#ifndef CGFLOAT_DEFINED
|
||||
// On Leopard, CGFloat is float on 32bit and double on 64bit. On Tiger,
|
||||
// we can't use this anyways, so it's just here to keep the compiler happy.
|
||||
// However, when we're compiling for Tiger and running on Leopard, we
|
||||
// might need the correct typedef, so this piece is copied from ATSTypes.h
|
||||
# ifdef __LP64__
|
||||
typedef double CGFloat;
|
||||
# else
|
||||
typedef float CGFloat;
|
||||
# endif
|
||||
#endif
|
||||
- (void)setAutorecalculatesContentBorderThickness:(BOOL)b forEdge:(NSRectEdge)e;
|
||||
- (void)setContentBorderThickness:(CGFloat)b forEdge:(NSRectEdge)e;
|
||||
@end
|
||||
@@ -122,9 +110,6 @@
|
||||
|
||||
- (id)initWithVimController:(MMVimController *)controller
|
||||
{
|
||||
#ifndef NSAppKitVersionNumber10_4 // needed for non-10.5 sdk
|
||||
# define NSAppKitVersionNumber10_4 824
|
||||
#endif
|
||||
unsigned styleMask = NSTitledWindowMask | NSClosableWindowMask
|
||||
| NSMiniaturizableWindowMask | NSResizableWindowMask
|
||||
| NSUnifiedTitleAndToolbarWindowMask;
|
||||
@@ -201,7 +186,7 @@
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
LOG_DEALLOC
|
||||
ASLogDebug(@"");
|
||||
|
||||
[decoratedWindow release]; decoratedWindow = nil;
|
||||
[windowAutosaveKey release]; windowAutosaveKey = nil;
|
||||
@@ -241,7 +226,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 +287,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
|
||||
@@ -326,6 +311,18 @@
|
||||
shouldResizeVimView = YES;
|
||||
keepOnScreen = !reply;
|
||||
}
|
||||
|
||||
if (windowAutosaveKey) {
|
||||
// Autosave rows and columns (only done for window which also autosaves
|
||||
// window position).
|
||||
id tv = [vimView textView];
|
||||
int rows = [tv maxRows];
|
||||
int cols = [tv maxColumns];
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
[ud setInteger:rows forKey:MMAutosaveRowsKey];
|
||||
[ud setInteger:cols forKey:MMAutosaveColumnsKey];
|
||||
[ud synchronize];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setTitle:(NSString *)title
|
||||
@@ -362,12 +359,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)createScrollbarWithIdentifier:(long)ident type:(int)type
|
||||
- (void)createScrollbarWithIdentifier:(int32_t)ident type:(int)type
|
||||
{
|
||||
[vimView createScrollbarWithIdentifier:ident type:type];
|
||||
}
|
||||
|
||||
- (BOOL)destroyScrollbarWithIdentifier:(long)ident
|
||||
- (BOOL)destroyScrollbarWithIdentifier:(int32_t)ident
|
||||
{
|
||||
BOOL scrollbarHidden = [vimView destroyScrollbarWithIdentifier:ident];
|
||||
shouldResizeVimView = shouldResizeVimView || scrollbarHidden;
|
||||
@@ -375,7 +372,7 @@
|
||||
return scrollbarHidden;
|
||||
}
|
||||
|
||||
- (BOOL)showScrollbarWithIdentifier:(long)ident state:(BOOL)visible
|
||||
- (BOOL)showScrollbarWithIdentifier:(int32_t)ident state:(BOOL)visible
|
||||
{
|
||||
BOOL scrollbarToggled = [vimView showScrollbarWithIdentifier:ident
|
||||
state:visible];
|
||||
@@ -384,13 +381,13 @@
|
||||
return scrollbarToggled;
|
||||
}
|
||||
|
||||
- (void)setScrollbarPosition:(int)pos length:(int)len identifier:(long)ident
|
||||
- (void)setScrollbarPosition:(int)pos length:(int)len identifier:(int32_t)ident
|
||||
{
|
||||
[vimView setScrollbarPosition:pos length:len identifier:ident];
|
||||
}
|
||||
|
||||
- (void)setScrollbarThumbValue:(float)val proportion:(float)prop
|
||||
identifier:(long)ident
|
||||
identifier:(int32_t)ident
|
||||
{
|
||||
[vimView setScrollbarThumbValue:val proportion:prop identifier:ident];
|
||||
}
|
||||
@@ -551,8 +548,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 +995,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+104
-7
@@ -9,14 +9,27 @@
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <asl.h>
|
||||
|
||||
|
||||
//
|
||||
// Enable support for MacVim plugins (not to be confused with Vim plugins!).
|
||||
// Uncomment to enable support for MacVim plugins (not to be confused with Vim
|
||||
// plugins!).
|
||||
//
|
||||
#define MM_ENABLE_PLUGINS
|
||||
//#define MM_ENABLE_PLUGINS
|
||||
|
||||
|
||||
// Taken from /usr/include/AvailabilityMacros.h
|
||||
#ifndef MAC_OS_X_VERSION_10_4
|
||||
# define MAC_OS_X_VERSION_10_4 1040
|
||||
#endif
|
||||
#ifndef MAC_OS_X_VERSION_10_5
|
||||
# define MAC_OS_X_VERSION_10_5 1050
|
||||
#endif
|
||||
#ifndef MAC_OS_X_VERSION_10_6
|
||||
# define MAC_OS_X_VERSION_10_6 1060
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// This is the protocol MMBackend implements.
|
||||
@@ -102,9 +115,7 @@ extern char *MessageStrings[];
|
||||
|
||||
enum {
|
||||
OpenWindowMsgID = 1, // NOTE: FIRST IN ENUM MUST BE 1
|
||||
InsertTextMsgID,
|
||||
KeyDownMsgID,
|
||||
CmdKeyMsgID,
|
||||
BatchDrawMsgID,
|
||||
SelectTabMsgID,
|
||||
CloseTabMsgID,
|
||||
@@ -169,10 +180,16 @@ enum {
|
||||
SetFullscreenColorMsgID,
|
||||
ShowFindReplaceDialogMsgID,
|
||||
FindReplaceMsgID,
|
||||
ActivateKeyScriptID,
|
||||
DeactivateKeyScriptID,
|
||||
ActivateKeyScriptMsgID,
|
||||
DeactivateKeyScriptMsgID,
|
||||
EnableImControlMsgID,
|
||||
DisableImControlMsgID,
|
||||
ActivatedImMsgID,
|
||||
DeactivatedImMsgID,
|
||||
BrowseForFileMsgID,
|
||||
ShowDialogMsgID,
|
||||
NetBeansMsgID,
|
||||
SetMarkedTextMsgID,
|
||||
LastMsgID // NOTE: MUST BE LAST MESSAGE IN ENUM!
|
||||
};
|
||||
|
||||
@@ -219,10 +236,21 @@ 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;
|
||||
|
||||
extern NSString *MMAutosaveRowsKey;
|
||||
extern NSString *MMAutosaveColumnsKey;
|
||||
|
||||
|
||||
// Vim pasteboard type (holds motion type + string)
|
||||
extern NSString *VimPBoardType;
|
||||
|
||||
@@ -269,7 +297,7 @@ extern NSString *VimPBoardType;
|
||||
|
||||
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4
|
||||
#ifndef NSINTEGER_DEFINED
|
||||
// NSInteger was introduced in 10.5
|
||||
# if __LP64__ || NS_BUILD_32_LIKE_64
|
||||
typedef long NSInteger;
|
||||
@@ -278,4 +306,73 @@ typedef unsigned long NSUInteger;
|
||||
typedef int NSInteger;
|
||||
typedef unsigned int NSUInteger;
|
||||
# endif
|
||||
# define NSINTEGER_DEFINED 1
|
||||
#endif
|
||||
|
||||
#ifndef NSAppKitVersionNumber10_4 // Needed for pre-10.5 SDK
|
||||
# define NSAppKitVersionNumber10_4 824
|
||||
#endif
|
||||
|
||||
#ifndef CGFLOAT_DEFINED
|
||||
// On Leopard, CGFloat is float on 32bit and double on 64bit. On Tiger,
|
||||
// we can't use this anyways, so it's just here to keep the compiler happy.
|
||||
// However, when we're compiling for Tiger and running on Leopard, we
|
||||
// might need the correct typedef, so this piece is copied from ATSTypes.h
|
||||
# ifdef __LP64__
|
||||
typedef double CGFloat;
|
||||
# else
|
||||
typedef float CGFloat;
|
||||
# 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__)
|
||||
#define ASLogTmp(fmt, ...) ASLog(ASL_LEVEL_NOTICE, fmt, ##__VA_ARGS__)
|
||||
|
||||
+62
-5
@@ -13,13 +13,12 @@
|
||||
|
||||
#import "MacVim.h"
|
||||
|
||||
|
||||
char *MessageStrings[] =
|
||||
{
|
||||
"INVALID MESSAGE ID",
|
||||
"OpenWindowMsgID",
|
||||
"InsertTextMsgID",
|
||||
"KeyDownMsgID",
|
||||
"CmdKeyMsgID",
|
||||
"BatchDrawMsgID",
|
||||
"SelectTabMsgID",
|
||||
"CloseTabMsgID",
|
||||
@@ -84,23 +83,37 @@ char *MessageStrings[] =
|
||||
"SetFullscreenColorMsgID",
|
||||
"ShowFindReplaceDialogMsgID",
|
||||
"FindReplaceMsgID",
|
||||
"ActivateKeyScriptID",
|
||||
"DeactivateKeyScriptID",
|
||||
"ActivateKeyScriptMsgID",
|
||||
"DeactivateKeyScriptMsgID",
|
||||
"EnableImControlMsgID",
|
||||
"DisableImControlMsgID",
|
||||
"ActivatedImMsgID",
|
||||
"DeactivatedImMsgID",
|
||||
"BrowseForFileMsgID",
|
||||
"ShowDialogMsgID",
|
||||
"NetBeansMsgID",
|
||||
"SetMarkedTextMsgID",
|
||||
"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";
|
||||
|
||||
NSString *MMAutosaveRowsKey = @"MMAutosaveRows";
|
||||
NSString *MMAutosaveColumnsKey = @"MMAutosaveColumns";
|
||||
|
||||
// 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 +124,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 +134,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 +265,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
|
||||
}
|
||||
|
||||
@@ -23,21 +23,22 @@
|
||||
1D1474B00C5678370038FA2B /* MMTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D1474AE0C5678370038FA2B /* MMTextView.m */; };
|
||||
1D1474B60C56796D0038FA2B /* MMVimController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D1474B40C56796D0038FA2B /* MMVimController.m */; };
|
||||
1D1474BC0C567A910038FA2B /* MMWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D1474BA0C567A910038FA2B /* MMWindowController.m */; };
|
||||
1D22121E104B04530086DFF1 /* Sparkle.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 1D8B5A88104AFF2A002E59D5 /* Sparkle.framework */; };
|
||||
1D22374B0E45DF4800E6FFFF /* Advanced.png in Resources */ = {isa = PBXBuildFile; fileRef = 1D22374A0E45DF4800E6FFFF /* Advanced.png */; };
|
||||
1D384A0E100D671700D3C22F /* KeyBinding.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1D384A0D100D671700D3C22F /* KeyBinding.plist */; };
|
||||
1D3D19110CA690FF0004A0A5 /* DejaVuSansMono-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 1D3D190D0CA690FF0004A0A5 /* DejaVuSansMono-Bold.ttf */; };
|
||||
1D3D19120CA690FF0004A0A5 /* DejaVuSansMono-BoldOblique.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 1D3D190E0CA690FF0004A0A5 /* DejaVuSansMono-BoldOblique.ttf */; };
|
||||
1D3D19130CA690FF0004A0A5 /* DejaVuSansMono-Oblique.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 1D3D190F0CA690FF0004A0A5 /* DejaVuSansMono-Oblique.ttf */; };
|
||||
1D3D19140CA690FF0004A0A5 /* DejaVuSansMono.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 1D3D19100CA690FF0004A0A5 /* DejaVuSansMono.ttf */; };
|
||||
1D493D580C5247BF00AB718C /* Vim in Copy Executables */ = {isa = PBXBuildFile; fileRef = 1D493D570C5247BF00AB718C /* Vim */; };
|
||||
1D493DBA0C52534300AB718C /* PSMTabBarControl.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 1D493DB90C52533B00AB718C /* PSMTabBarControl.framework */; };
|
||||
1D6008830E96886D003763F0 /* FindAndReplace.nib in Resources */ = {isa = PBXBuildFile; fileRef = 1D6008820E96886D003763F0 /* FindAndReplace.nib */; };
|
||||
1D60088B0E96A0B2003763F0 /* MMFindReplaceController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D60088A0E96A0B2003763F0 /* MMFindReplaceController.m */; };
|
||||
1D7F74580E4CE1AE003225C6 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D7F74570E4CE1AE003225C6 /* Sparkle.framework */; };
|
||||
1D7F745B0E4CE1CD003225C6 /* Sparkle.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 1D7F74570E4CE1AE003225C6 /* Sparkle.framework */; };
|
||||
1D80591F0E1185EA001699D1 /* Miscellaneous.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D80591D0E1185EA001699D1 /* Miscellaneous.m */; };
|
||||
1D80FBD40CBBD3B700102A1C /* MMFullscreenWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D80FBD00CBBD3B700102A1C /* MMFullscreenWindow.m */; };
|
||||
1D80FBD60CBBD3B700102A1C /* MMVimView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D80FBD20CBBD3B700102A1C /* MMVimView.m */; };
|
||||
1D80FBE40CBBD6F200102A1C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D80FBE30CBBD6F200102A1C /* Carbon.framework */; };
|
||||
1D8B5A53104AF9FF002E59D5 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D8B5A52104AF9FF002E59D5 /* Carbon.framework */; };
|
||||
1D8B5A89104AFF2A002E59D5 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D8B5A88104AFF2A002E59D5 /* Sparkle.framework */; };
|
||||
1D8BEA74104992290069B072 /* FindAndReplace.nib in Resources */ = {isa = PBXBuildFile; fileRef = 1D8BEA73104992290069B072 /* FindAndReplace.nib */; };
|
||||
1D9918490D299F9900A96335 /* MMAtsuiTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D9918470D299F9900A96335 /* MMAtsuiTextView.m */; };
|
||||
1D9C60520EF79C0C0034AD44 /* MacVim.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D9C602E0EF79C0C0034AD44 /* MacVim.icns */; };
|
||||
1DCD00BF0E50B2B700460166 /* Attention.png in Resources */ = {isa = PBXBuildFile; fileRef = 1DCD00AA0E50B2B700460166 /* Attention.png */; };
|
||||
@@ -65,7 +66,6 @@
|
||||
1DD0C20C0C60FFB4008CD84A /* gvimrc in Copy Vim Runtime Files */ = {isa = PBXBuildFile; fileRef = 1DD0C20A0C60FF9A008CD84A /* gvimrc */; };
|
||||
1DD3D51E0D82D4C9006E4320 /* ibeam.png in Resources */ = {isa = PBXBuildFile; fileRef = 1DD3D51D0D82D4C9006E4320 /* ibeam.png */; };
|
||||
1DD66ECE0C803D3600EBDAB3 /* MMApplication.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DD66ECC0C803D3600EBDAB3 /* MMApplication.m */; };
|
||||
1DD704310BA9F9C2008679E9 /* SpecialKeys.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1DD704300BA9F9C2008679E9 /* SpecialKeys.plist */; };
|
||||
1DD9F5E50C85D60500E8D5A5 /* SystemColors.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1DD9F5E40C85D60500E8D5A5 /* SystemColors.plist */; };
|
||||
1DE3F8E70D50F80500052B9E /* Preferences.nib in Resources */ = {isa = PBXBuildFile; fileRef = 1DE3F8E50D50F80500052B9E /* Preferences.nib */; };
|
||||
1DE3F8EB0D50F84600052B9E /* MMPreferenceController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DE3F8E90D50F84600052B9E /* MMPreferenceController.m */; };
|
||||
@@ -148,7 +148,7 @@
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
1D7F745B0E4CE1CD003225C6 /* Sparkle.framework in Copy Frameworks */,
|
||||
1D22121E104B04530086DFF1 /* Sparkle.framework in Copy Frameworks */,
|
||||
1D493DBA0C52534300AB718C /* PSMTabBarControl.framework in Copy Frameworks */,
|
||||
);
|
||||
name = "Copy Frameworks";
|
||||
@@ -199,23 +199,24 @@
|
||||
1D1474B90C567A910038FA2B /* MMWindowController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MMWindowController.h; sourceTree = "<group>"; };
|
||||
1D1474BA0C567A910038FA2B /* MMWindowController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MMWindowController.m; sourceTree = "<group>"; };
|
||||
1D22374A0E45DF4800E6FFFF /* Advanced.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Advanced.png; sourceTree = "<group>"; };
|
||||
1D384A0D100D671700D3C22F /* KeyBinding.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = KeyBinding.plist; sourceTree = "<group>"; };
|
||||
1D3D190D0CA690FF0004A0A5 /* DejaVuSansMono-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "DejaVuSansMono-Bold.ttf"; path = "dejavu-ttf/DejaVuSansMono-Bold.ttf"; sourceTree = "<group>"; };
|
||||
1D3D190E0CA690FF0004A0A5 /* DejaVuSansMono-BoldOblique.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "DejaVuSansMono-BoldOblique.ttf"; path = "dejavu-ttf/DejaVuSansMono-BoldOblique.ttf"; sourceTree = "<group>"; };
|
||||
1D3D190F0CA690FF0004A0A5 /* DejaVuSansMono-Oblique.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "DejaVuSansMono-Oblique.ttf"; path = "dejavu-ttf/DejaVuSansMono-Oblique.ttf"; sourceTree = "<group>"; };
|
||||
1D3D19100CA690FF0004A0A5 /* DejaVuSansMono.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = DejaVuSansMono.ttf; path = "dejavu-ttf/DejaVuSansMono.ttf"; sourceTree = "<group>"; };
|
||||
1D493D570C5247BF00AB718C /* Vim */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; name = Vim; path = ../Vim; sourceTree = SOURCE_ROOT; };
|
||||
1D493DB30C52533B00AB718C /* PSMTabBarControl.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = PSMTabBarControl.xcodeproj; path = PSMTabBarControl/PSMTabBarControl.xcodeproj; sourceTree = "<group>"; };
|
||||
1D6008820E96886D003763F0 /* FindAndReplace.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; path = FindAndReplace.nib; sourceTree = "<group>"; };
|
||||
1D6008820E96886D003763F0 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/FindAndReplace.nib; sourceTree = "<group>"; };
|
||||
1D6008890E96A0B2003763F0 /* MMFindReplaceController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMFindReplaceController.h; sourceTree = "<group>"; };
|
||||
1D60088A0E96A0B2003763F0 /* MMFindReplaceController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMFindReplaceController.m; sourceTree = "<group>"; };
|
||||
1D7F74570E4CE1AE003225C6 /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Sparkle.framework; sourceTree = "<group>"; };
|
||||
1D80591D0E1185EA001699D1 /* Miscellaneous.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Miscellaneous.m; sourceTree = "<group>"; };
|
||||
1D8059220E118663001699D1 /* Miscellaneous.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Miscellaneous.h; sourceTree = "<group>"; };
|
||||
1D80FBCF0CBBD3B700102A1C /* MMFullscreenWindow.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MMFullscreenWindow.h; sourceTree = "<group>"; };
|
||||
1D80FBD00CBBD3B700102A1C /* MMFullscreenWindow.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MMFullscreenWindow.m; sourceTree = "<group>"; };
|
||||
1D80FBD10CBBD3B700102A1C /* MMVimView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MMVimView.h; sourceTree = "<group>"; };
|
||||
1D80FBD20CBBD3B700102A1C /* MMVimView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MMVimView.m; sourceTree = "<group>"; };
|
||||
1D80FBE30CBBD6F200102A1C /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
|
||||
1D8B5A52104AF9FF002E59D5 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
|
||||
1D8B5A88104AFF2A002E59D5 /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Sparkle.framework; sourceTree = "<group>"; };
|
||||
1D9918460D299F9900A96335 /* MMAtsuiTextView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MMAtsuiTextView.h; sourceTree = "<group>"; };
|
||||
1D9918470D299F9900A96335 /* MMAtsuiTextView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MMAtsuiTextView.m; sourceTree = "<group>"; };
|
||||
1D9C602E0EF79C0C0034AD44 /* MacVim.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = MacVim.icns; path = icons/MacVim.icns; sourceTree = "<group>"; };
|
||||
@@ -245,7 +246,6 @@
|
||||
1DD3D51D0D82D4C9006E4320 /* ibeam.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ibeam.png; sourceTree = "<group>"; };
|
||||
1DD66ECB0C803D3600EBDAB3 /* MMApplication.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MMApplication.h; sourceTree = "<group>"; };
|
||||
1DD66ECC0C803D3600EBDAB3 /* MMApplication.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MMApplication.m; sourceTree = "<group>"; };
|
||||
1DD704300BA9F9C2008679E9 /* SpecialKeys.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = SpecialKeys.plist; sourceTree = "<group>"; };
|
||||
1DD9F5E40C85D60500E8D5A5 /* SystemColors.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = SystemColors.plist; sourceTree = "<group>"; };
|
||||
1DE3F8E60D50F80500052B9E /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/Preferences.nib; sourceTree = "<group>"; };
|
||||
1DE3F8E80D50F84600052B9E /* MMPreferenceController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MMPreferenceController.h; sourceTree = "<group>"; };
|
||||
@@ -286,9 +286,9 @@
|
||||
files = (
|
||||
1DFE25A50C527BC4003000F7 /* PSMTabBarControl.framework in Frameworks */,
|
||||
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
|
||||
1D80FBE40CBBD6F200102A1C /* Carbon.framework in Frameworks */,
|
||||
0395A9C30D75D04D00881434 /* Security.framework in Frameworks */,
|
||||
1D7F74580E4CE1AE003225C6 /* Sparkle.framework in Frameworks */,
|
||||
1D8B5A53104AF9FF002E59D5 /* Carbon.framework in Frameworks */,
|
||||
1D8B5A89104AFF2A002E59D5 /* Sparkle.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -374,7 +374,6 @@
|
||||
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1D80FBE30CBBD6F200102A1C /* Carbon.framework */,
|
||||
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
|
||||
);
|
||||
name = "Linked Frameworks";
|
||||
@@ -478,8 +477,9 @@
|
||||
29B97317FDCFA39411CA2CEA /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1D384A0D100D671700D3C22F /* KeyBinding.plist */,
|
||||
1D9C602E0EF79C0C0034AD44 /* MacVim.icns */,
|
||||
1D6008820E96886D003763F0 /* FindAndReplace.nib */,
|
||||
1D8BEA73104992290069B072 /* FindAndReplace.nib */,
|
||||
0395A8A90D72D88B00881434 /* General.png */,
|
||||
0395A9590D74D47B00881434 /* Integration.png */,
|
||||
1D22374A0E45DF4800E6FFFF /* Advanced.png */,
|
||||
@@ -490,7 +490,6 @@
|
||||
1DD9F5E40C85D60500E8D5A5 /* SystemColors.plist */,
|
||||
1DE8CC610C5E2AAD003F56E3 /* Actions.plist */,
|
||||
1DD04DEB0C529C5E006CDC2B /* Credits.rtf */,
|
||||
1DD704300BA9F9C2008679E9 /* SpecialKeys.plist */,
|
||||
1D0E051B0BA5F83800B6049E /* Colors.plist */,
|
||||
8D1107310486CEB800E47090 /* Info.plist */,
|
||||
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
|
||||
@@ -503,7 +502,8 @@
|
||||
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1D7F74570E4CE1AE003225C6 /* Sparkle.framework */,
|
||||
1D8B5A88104AFF2A002E59D5 /* Sparkle.framework */,
|
||||
1D8B5A52104AF9FF002E59D5 /* Carbon.framework */,
|
||||
0395AA980D76E86200881434 /* Edit in ODBEditor */,
|
||||
0395A9C20D75D04D00881434 /* Security.framework */,
|
||||
1D493DB30C52533B00AB718C /* PSMTabBarControl.xcodeproj */,
|
||||
@@ -549,6 +549,13 @@
|
||||
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "MacVim" */;
|
||||
compatibilityVersion = "Xcode 2.4";
|
||||
hasScannedForEncodings = 1;
|
||||
knownRegions = (
|
||||
English,
|
||||
Japanese,
|
||||
French,
|
||||
German,
|
||||
Swedish,
|
||||
);
|
||||
mainGroup = 29B97314FDCFA39411CA2CEA /* MacVim */;
|
||||
projectDirPath = "";
|
||||
projectReferences = (
|
||||
@@ -593,7 +600,6 @@
|
||||
8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */,
|
||||
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
|
||||
1D0E051C0BA5F83800B6049E /* Colors.plist in Resources */,
|
||||
1DD704310BA9F9C2008679E9 /* SpecialKeys.plist in Resources */,
|
||||
1DD04DEC0C529C5E006CDC2B /* Credits.rtf in Resources */,
|
||||
1DE8CC620C5E2AAD003F56E3 /* Actions.plist in Resources */,
|
||||
1DD9F5E50C85D60500E8D5A5 /* SystemColors.plist in Resources */,
|
||||
@@ -628,8 +634,9 @@
|
||||
1DCD00D10E50B2B700460166 /* SaveSesn.png in Resources */,
|
||||
1DCD00D20E50B2B700460166 /* TagJump.png in Resources */,
|
||||
1DCD00D30E50B2B700460166 /* Undo.png in Resources */,
|
||||
1D6008830E96886D003763F0 /* FindAndReplace.nib in Resources */,
|
||||
1D8BEA74104992290069B072 /* FindAndReplace.nib in Resources */,
|
||||
1D9C60520EF79C0C0034AD44 /* MacVim.icns in Resources */,
|
||||
1D384A0E100D671700D3C22F /* KeyBinding.plist in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -710,6 +717,14 @@
|
||||
name = InfoPlist.strings;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1D8BEA73104992290069B072 /* FindAndReplace.nib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
1D6008820E96886D003763F0 /* English */,
|
||||
);
|
||||
name = FindAndReplace.nib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1DE3F8E50D50F80500052B9E /* Preferences.nib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
@@ -729,63 +744,14 @@
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
1D13D1610D560D9D0084F3AB /* Universal */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = (
|
||||
ppc,
|
||||
i386,
|
||||
);
|
||||
COPY_PHASE_STRIP = YES;
|
||||
CURRENT_PROJECT_VERSION = 45;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_2)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_3)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_2)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
|
||||
);
|
||||
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)\"";
|
||||
GCC_DYNAMIC_NO_PIC = YES;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_OPTIMIZATION_LEVEL = s;
|
||||
HEADER_SEARCH_PATHS = PSMTabBarControl/source/;
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
INSTALL_PATH = "$(HOME)/Applications";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.4;
|
||||
PRODUCT_NAME = MacVim;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
WRAPPER_EXTENSION = app;
|
||||
ZERO_LINK = NO;
|
||||
};
|
||||
name = Universal;
|
||||
};
|
||||
1D13D1620D560D9D0084F3AB /* Universal */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
PREBINDING = NO;
|
||||
};
|
||||
name = Universal;
|
||||
};
|
||||
C01FCF4B08A954540054247B /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(NATIVE_ARCH)";
|
||||
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 45;
|
||||
CURRENT_PROJECT_VERSION = 50;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_2)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_3)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_2)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
|
||||
);
|
||||
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)\"";
|
||||
@@ -794,12 +760,15 @@
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
HEADER_SEARCH_PATHS = PSMTabBarControl/source/;
|
||||
GCC_WARN_PEDANTIC = NO;
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
INSTALL_PATH = "$(HOME)/Applications";
|
||||
MACOSX_DEPLOYMENT_TARGET = "";
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PRODUCT_NAME = MacVim;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
WARNING_CFLAGS = "-Wall";
|
||||
WRAPPER_EXTENSION = app;
|
||||
ZERO_LINK = NO;
|
||||
};
|
||||
@@ -808,16 +777,11 @@
|
||||
C01FCF4C08A954540054247B /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(NATIVE_ARCH)";
|
||||
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
|
||||
COPY_PHASE_STRIP = YES;
|
||||
CURRENT_PROJECT_VERSION = 45;
|
||||
CURRENT_PROJECT_VERSION = 50;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_2)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_3)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_2)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
|
||||
);
|
||||
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)\"";
|
||||
@@ -826,10 +790,11 @@
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_OPTIMIZATION_LEVEL = s;
|
||||
HEADER_SEARCH_PATHS = PSMTabBarControl/source/;
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
INSTALL_PATH = "$(HOME)/Applications";
|
||||
MACOSX_DEPLOYMENT_TARGET = "";
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PRODUCT_NAME = MacVim;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
WRAPPER_EXTENSION = app;
|
||||
@@ -840,8 +805,10 @@
|
||||
C01FCF4F08A954540054247B /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PREBINDING = NO;
|
||||
};
|
||||
name = Debug;
|
||||
@@ -849,8 +816,10 @@
|
||||
C01FCF5008A954540054247B /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PREBINDING = NO;
|
||||
};
|
||||
name = Release;
|
||||
@@ -863,7 +832,6 @@
|
||||
buildConfigurations = (
|
||||
C01FCF4B08A954540054247B /* Debug */,
|
||||
C01FCF4C08A954540054247B /* Release */,
|
||||
1D13D1610D560D9D0084F3AB /* Universal */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
@@ -873,7 +841,6 @@
|
||||
buildConfigurations = (
|
||||
C01FCF4F08A954540054247B /* Debug */,
|
||||
C01FCF5008A954540054247B /* Release */,
|
||||
1D13D1620D560D9D0084F3AB /* Universal */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
|
||||
@@ -12,14 +12,14 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "MacVim.h"
|
||||
|
||||
#define MM_LOG_DEALLOCATIONS 0
|
||||
|
||||
// TODO: Remove this when the inline IM code has been tested
|
||||
#define INCLUDE_OLD_IM_CODE
|
||||
|
||||
#if MM_LOG_DEALLOCATIONS
|
||||
# define LOG_DEALLOC NSLog(@"%s %@", _cmd, [self className]);
|
||||
#else
|
||||
# define LOG_DEALLOC
|
||||
#endif
|
||||
// Disable ATSUI when compiling on 10.6. This is because ATSUI is deprecated
|
||||
// on 10.6 and hence spews out masses of warning messages when building. Also,
|
||||
// the ATSUI code currently does not work on 10.6.
|
||||
#define MM_ENABLE_ATSUI (MAC_OS_X_VERSION_MIN_REQUIRED<MAC_OS_X_VERSION_10_6)
|
||||
|
||||
|
||||
// NSUserDefaults keys
|
||||
@@ -55,6 +55,9 @@ extern NSString *MMVerticalSplitKey;
|
||||
extern NSString *MMPreloadCacheSizeKey;
|
||||
extern NSString *MMLastWindowClosedBehaviorKey;
|
||||
extern NSString *MMLoadDefaultFontKey;
|
||||
#ifdef INCLUDE_OLD_IM_CODE
|
||||
extern NSString *MMUseInlineImKey;
|
||||
#endif // INCLUDE_OLD_IM_CODE
|
||||
|
||||
|
||||
// Enum for MMUntitledWindowKey
|
||||
@@ -113,8 +116,8 @@ enum {
|
||||
|
||||
|
||||
@interface NSToolbar (MMExtras)
|
||||
- (int)indexOfItemWithItemIdentifier:(NSString *)identifier;
|
||||
- (NSToolbarItem *)itemAtIndex:(int)idx;
|
||||
- (NSUInteger)indexOfItemWithItemIdentifier:(NSString *)identifier;
|
||||
- (NSToolbarItem *)itemAtIndex:(NSUInteger)idx;
|
||||
- (NSToolbarItem *)itemWithItemIdentifier:(NSString *)identifier;
|
||||
@end
|
||||
|
||||
@@ -125,7 +128,8 @@ enum {
|
||||
|
||||
|
||||
@interface NSNumber (MMExtras)
|
||||
- (int)tag;
|
||||
// HACK to allow font size to be changed via menu (bound to Cmd+/Cmd-)
|
||||
- (NSInteger)tag;
|
||||
@end
|
||||
|
||||
|
||||
@@ -135,3 +139,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);
|
||||
|
||||
@@ -46,6 +46,9 @@ NSString *MMVerticalSplitKey = @"MMVerticalSplit";
|
||||
NSString *MMPreloadCacheSizeKey = @"MMPreloadCacheSize";
|
||||
NSString *MMLastWindowClosedBehaviorKey = @"MMLastWindowClosedBehavior";
|
||||
NSString *MMLoadDefaultFontKey = @"MMLoadDefaultFont";
|
||||
#ifdef INCLUDE_OLD_IM_CODE
|
||||
NSString *MMUseInlineImKey = @"MMUseInlineIm";
|
||||
#endif // INCLUDE_OLD_IM_CODE
|
||||
|
||||
|
||||
|
||||
@@ -200,10 +203,10 @@ NSString *MMLoadDefaultFontKey = @"MMLoadDefaultFont";
|
||||
|
||||
@implementation NSToolbar (MMExtras)
|
||||
|
||||
- (int)indexOfItemWithItemIdentifier:(NSString *)identifier
|
||||
- (NSUInteger)indexOfItemWithItemIdentifier:(NSString *)identifier
|
||||
{
|
||||
NSArray *items = [self items];
|
||||
int i, count = [items count];
|
||||
NSUInteger i, count = [items count];
|
||||
for (i = 0; i < count; ++i) {
|
||||
id item = [items objectAtIndex:i];
|
||||
if ([[item itemIdentifier] isEqual:identifier])
|
||||
@@ -213,7 +216,7 @@ NSString *MMLoadDefaultFontKey = @"MMLoadDefaultFont";
|
||||
return NSNotFound;
|
||||
}
|
||||
|
||||
- (NSToolbarItem *)itemAtIndex:(int)idx
|
||||
- (NSToolbarItem *)itemAtIndex:(NSUInteger)idx
|
||||
{
|
||||
NSArray *items = [self items];
|
||||
if (idx < 0 || idx >= [items count])
|
||||
@@ -224,7 +227,7 @@ NSString *MMLoadDefaultFontKey = @"MMLoadDefaultFont";
|
||||
|
||||
- (NSToolbarItem *)itemWithItemIdentifier:(NSString *)identifier
|
||||
{
|
||||
int idx = [self indexOfItemWithItemIdentifier:identifier];
|
||||
NSUInteger idx = [self indexOfItemWithItemIdentifier:identifier];
|
||||
return idx != NSNotFound ? [self itemAtIndex:idx] : nil;
|
||||
}
|
||||
|
||||
@@ -240,7 +243,7 @@ NSString *MMLoadDefaultFontKey = @"MMLoadDefaultFont";
|
||||
NSArray *existingItems = [self tabViewItems];
|
||||
NSEnumerator *e = [existingItems objectEnumerator];
|
||||
NSTabViewItem *item;
|
||||
while (item = [e nextObject]){
|
||||
while ((item = [e nextObject])) {
|
||||
[self removeTabViewItem:item];
|
||||
}
|
||||
}
|
||||
@@ -252,7 +255,8 @@ NSString *MMLoadDefaultFontKey = @"MMLoadDefaultFont";
|
||||
|
||||
@implementation NSNumber (MMExtras)
|
||||
|
||||
- (int)tag
|
||||
// HACK to allow font size to be changed via menu (bound to Cmd+/Cmd-)
|
||||
- (NSInteger)tag
|
||||
{
|
||||
return [self intValue];
|
||||
}
|
||||
@@ -290,3 +294,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;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -93,7 +93,7 @@
|
||||
13F8B88A07B434F6008AE28D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
|
||||
32DBCF980370C29C00C91783 /* PSMTabBarControl_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PSMTabBarControl_Prefix.pch; path = source/PSMTabBarControl_Prefix.pch; sourceTree = "<group>"; };
|
||||
53DF68FD067E5B5A0090B5B0 /* PSMTabBarControl.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PSMTabBarControl.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
53DF68FE067E5B5A0090B5B0 /* PSMTabBarControlFramework-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "PSMTabBarControlFramework-Info.plist"; sourceTree = "<group>"; };
|
||||
53DF68FE067E5B5A0090B5B0 /* PSMTabBarControlFramework-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "PSMTabBarControlFramework-Info.plist"; sourceTree = "<group>"; };
|
||||
54D33B2806778E3300C9C163 /* PSMTabBarControl.ibclassdescription */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PSMTabBarControl.ibclassdescription; sourceTree = "<group>"; };
|
||||
8D1AC9730486D14A00FE50C9 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
|
||||
8D1AC97B0486D23100FE50C9 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
@@ -123,7 +123,7 @@
|
||||
A251BE930959A23A0058BC7F /* TabClose_Front_Rollover.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = TabClose_Front_Rollover.tif; path = images/TabClose_Front_Rollover.tif; sourceTree = "<group>"; };
|
||||
A251BE940959A23A0058BC7F /* TabClose_Front.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = TabClose_Front.tif; path = images/TabClose_Front.tif; sourceTree = "<group>"; };
|
||||
A251BE9B0959A2530058BC7F /* ReadMe.rtfd */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; path = ReadMe.rtfd; sourceTree = "<group>"; };
|
||||
A251BEA20959BB5B0058BC7F /* TabBarControlDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "TabBarControlDemo-Info.plist"; sourceTree = "<group>"; };
|
||||
A251BEA20959BB5B0058BC7F /* TabBarControlDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "TabBarControlDemo-Info.plist"; sourceTree = "<group>"; };
|
||||
A251BEC30959BC0E0058BC7F /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MainMenu.nib; sourceTree = "<group>"; };
|
||||
A268E7F809A9822900E082AA /* AquaTabNew.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = AquaTabNew.png; path = images/AquaTabNew.png; sourceTree = "<group>"; };
|
||||
A268E7F909A9822900E082AA /* AquaTabNewPressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = AquaTabNewPressed.png; path = images/AquaTabNewPressed.png; sourceTree = "<group>"; };
|
||||
@@ -533,63 +533,10 @@
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
1D13D16D0D560DDA0084F3AB /* Universal */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = (
|
||||
ppc,
|
||||
i386,
|
||||
);
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
FRAMEWORK_VERSION = A;
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h";
|
||||
INFOPLIST_FILE = "PSMTabBarControlFramework-Info.plist";
|
||||
INSTALL_PATH = "@executable_path/../Frameworks";
|
||||
OTHER_LDFLAGS = (
|
||||
"-seg1addr",
|
||||
0xc0000000,
|
||||
);
|
||||
PRODUCT_NAME = PSMTabBarControl;
|
||||
SYMROOT = ../build;
|
||||
};
|
||||
name = Universal;
|
||||
};
|
||||
1D13D16E0D560DDA0084F3AB /* Universal */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = (
|
||||
ppc,
|
||||
i386,
|
||||
);
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
PRODUCT_NAME = All;
|
||||
WARNING_CFLAGS = (
|
||||
"-Wmost",
|
||||
"-Wno-four-char-constants",
|
||||
"-Wno-unknown-pragmas",
|
||||
);
|
||||
};
|
||||
name = Universal;
|
||||
};
|
||||
1D13D16F0D560DDA0084F3AB /* Universal */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
PREBINDING = NO;
|
||||
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
|
||||
};
|
||||
name = Universal;
|
||||
};
|
||||
C056398008A954F8003078D8 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(NATIVE_ARCH)";
|
||||
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
@@ -602,10 +549,8 @@
|
||||
GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h";
|
||||
INFOPLIST_FILE = "PSMTabBarControlFramework-Info.plist";
|
||||
INSTALL_PATH = "@executable_path/../Frameworks";
|
||||
OTHER_LDFLAGS = (
|
||||
"-seg1addr",
|
||||
0xc0000000,
|
||||
);
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
OTHER_LDFLAGS = "";
|
||||
PRODUCT_NAME = PSMTabBarControl;
|
||||
SYMROOT = ../build;
|
||||
ZERO_LINK = NO;
|
||||
@@ -615,7 +560,7 @@
|
||||
C056398108A954F8003078D8 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(NATIVE_ARCH)";
|
||||
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
FRAMEWORK_VERSION = A;
|
||||
@@ -625,10 +570,8 @@
|
||||
GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h";
|
||||
INFOPLIST_FILE = "PSMTabBarControlFramework-Info.plist";
|
||||
INSTALL_PATH = "@executable_path/../Frameworks";
|
||||
OTHER_LDFLAGS = (
|
||||
"-seg1addr",
|
||||
0xc0000000,
|
||||
);
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
OTHER_LDFLAGS = "";
|
||||
PRODUCT_NAME = PSMTabBarControl;
|
||||
SYMROOT = ../build;
|
||||
};
|
||||
@@ -673,20 +616,24 @@
|
||||
C056398C08A954F8003078D8 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PREBINDING = NO;
|
||||
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
|
||||
SYMROOT = ../build;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
C056398D08A954F8003078D8 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PREBINDING = NO;
|
||||
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
|
||||
SYMROOT = ../build;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@@ -698,7 +645,6 @@
|
||||
buildConfigurations = (
|
||||
C056398008A954F8003078D8 /* Debug */,
|
||||
C056398108A954F8003078D8 /* Release */,
|
||||
1D13D16D0D560DDA0084F3AB /* Universal */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
@@ -708,7 +654,6 @@
|
||||
buildConfigurations = (
|
||||
C056398808A954F8003078D8 /* Debug */,
|
||||
C056398908A954F8003078D8 /* Release */,
|
||||
1D13D16E0D560DDA0084F3AB /* Universal */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
@@ -718,7 +663,6 @@
|
||||
buildConfigurations = (
|
||||
C056398C08A954F8003078D8 /* Debug */,
|
||||
C056398D08A954F8003078D8 /* Release */,
|
||||
1D13D16F0D560DDA0084F3AB /* Universal */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,178 +0,0 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
0259C573FE90428111CA0C5A /* Project object */ = {
|
||||
activeBuildConfigurationName = Debug;
|
||||
activeTarget = 53DF68FC067E5B5A0090B5B0 /* PSMTabBarControlFramework */;
|
||||
codeSenseManager = 1D82C6110AC093AF00AAD418 /* Code sense */;
|
||||
perUserDictionary = {
|
||||
PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = {
|
||||
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
|
||||
PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
|
||||
PBXFileTableDataSourceColumnWidthsKey = (
|
||||
20,
|
||||
243,
|
||||
20,
|
||||
48,
|
||||
43,
|
||||
43,
|
||||
20,
|
||||
);
|
||||
PBXFileTableDataSourceColumnsKey = (
|
||||
PBXFileDataSource_FiletypeID,
|
||||
PBXFileDataSource_Filename_ColumnID,
|
||||
PBXFileDataSource_Built_ColumnID,
|
||||
PBXFileDataSource_ObjectSize_ColumnID,
|
||||
PBXFileDataSource_Errors_ColumnID,
|
||||
PBXFileDataSource_Warnings_ColumnID,
|
||||
PBXFileDataSource_Target_ColumnID,
|
||||
);
|
||||
};
|
||||
PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = {
|
||||
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
|
||||
PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
|
||||
PBXFileTableDataSourceColumnWidthsKey = (
|
||||
20,
|
||||
200,
|
||||
63,
|
||||
20,
|
||||
48,
|
||||
43,
|
||||
43,
|
||||
);
|
||||
PBXFileTableDataSourceColumnsKey = (
|
||||
PBXFileDataSource_FiletypeID,
|
||||
PBXFileDataSource_Filename_ColumnID,
|
||||
PBXTargetDataSource_PrimaryAttribute,
|
||||
PBXFileDataSource_Built_ColumnID,
|
||||
PBXFileDataSource_ObjectSize_ColumnID,
|
||||
PBXFileDataSource_Errors_ColumnID,
|
||||
PBXFileDataSource_Warnings_ColumnID,
|
||||
);
|
||||
};
|
||||
PBXPerProjectTemplateStateSaveDate = 223743414;
|
||||
PBXWorkspaceStateSaveDate = 223743414;
|
||||
};
|
||||
sourceControlManager = 1D82C6100AC093AF00AAD418 /* Source Control */;
|
||||
userBuildSettings = {
|
||||
};
|
||||
};
|
||||
0259C576FE90428111CA0C5A /* PSMTabBarControl.m */ = {
|
||||
uiCtxt = {
|
||||
sepNavIntBoundsRect = "{{0, 0}, {4143, 22432}}";
|
||||
sepNavSelRange = "{48941, 0}";
|
||||
sepNavVisRect = "{{0, 1451}, {459, 186}}";
|
||||
sepNavWindowFrame = "{{15, -1}, {750, 742}}";
|
||||
};
|
||||
};
|
||||
0259C57AFE90428111CA0C5A /* PSMTabBarControl.h */ = {
|
||||
uiCtxt = {
|
||||
sepNavIntBoundsRect = "{{0, 0}, {1077, 2000}}";
|
||||
sepNavSelRange = "{3919, 0}";
|
||||
sepNavVisRect = "{{0, 1387}, {711, 613}}";
|
||||
sepNavWindowFrame = "{{15, -1}, {750, 742}}";
|
||||
};
|
||||
};
|
||||
1D82C6100AC093AF00AAD418 /* Source Control */ = {
|
||||
isa = PBXSourceControlManager;
|
||||
fallbackIsa = XCSourceControlManager;
|
||||
isSCMEnabled = 0;
|
||||
scmConfiguration = {
|
||||
};
|
||||
scmType = "";
|
||||
};
|
||||
1D82C6110AC093AF00AAD418 /* Code sense */ = {
|
||||
isa = PBXCodeSenseManager;
|
||||
indexTemplatePath = "";
|
||||
};
|
||||
53DF68FC067E5B5A0090B5B0 /* PSMTabBarControlFramework */ = {
|
||||
activeExec = 0;
|
||||
};
|
||||
53DF6901067E5B8E0090B5B0 /* All */ = {
|
||||
activeExec = 0;
|
||||
};
|
||||
A2082A8E09EAEB33009AC8BE /* PSMTabDragAssistant.m */ = {
|
||||
uiCtxt = {
|
||||
sepNavIntBoundsRect = "{{0, 0}, {1420, 7040}}";
|
||||
sepNavSelRange = "{14900, 0}";
|
||||
sepNavVisRect = "{{0, 3817}, {978, 600}}";
|
||||
sepNavWindowFrame = "{{6, 17}, {1017, 729}}";
|
||||
};
|
||||
};
|
||||
A246FB040A2BD6F9005BDF7B /* PSMTabBarControlDoc.html */ = {
|
||||
uiCtxt = {
|
||||
sepNavWindowFrame = "{{15, 3}, {750, 742}}";
|
||||
};
|
||||
};
|
||||
A251BE830959A1B90058BC7F /* PSMTabBarCell.h */ = {
|
||||
uiCtxt = {
|
||||
sepNavIntBoundsRect = "{{0, 0}, {804, 1648}}";
|
||||
sepNavSelRange = "{0, 0}";
|
||||
sepNavVisRect = "{{0, 744}, {619, 599}}";
|
||||
sepNavWindowFrame = "{{15, 13}, {658, 728}}";
|
||||
};
|
||||
};
|
||||
A251BE840959A1B90058BC7F /* PSMTabBarCell.m */ = {
|
||||
uiCtxt = {
|
||||
sepNavIntBoundsRect = "{{0, 0}, {972, 6368}}";
|
||||
sepNavSelRange = "{0, 0}";
|
||||
sepNavVisRect = "{{0, 5769}, {619, 599}}";
|
||||
sepNavWindowFrame = "{{15, 13}, {658, 728}}";
|
||||
};
|
||||
};
|
||||
A251BE8A0959A1EA0058BC7F /* AppController.m */ = {
|
||||
uiCtxt = {
|
||||
sepNavIntBoundsRect = "{{0, 0}, {711, 613}}";
|
||||
sepNavSelRange = "{0, 0}";
|
||||
sepNavVisRect = "{{0, 0}, {711, 613}}";
|
||||
sepNavWindowFrame = "{{15, -1}, {750, 742}}";
|
||||
};
|
||||
};
|
||||
A251BE8B0959A1EA0058BC7F /* FakeModel.h */ = {
|
||||
uiCtxt = {
|
||||
sepNavIntBoundsRect = "{{0, 0}, {711, 613}}";
|
||||
sepNavSelRange = "{0, 0}";
|
||||
sepNavVisRect = "{{0, 0}, {711, 613}}";
|
||||
sepNavWindowFrame = "{{15, -1}, {750, 742}}";
|
||||
};
|
||||
};
|
||||
A251BE8C0959A1EA0058BC7F /* FakeModel.m */ = {
|
||||
uiCtxt = {
|
||||
sepNavIntBoundsRect = "{{0, 0}, {711, 1248}}";
|
||||
sepNavSelRange = "{0, 0}";
|
||||
sepNavVisRect = "{{0, 117}, {711, 613}}";
|
||||
sepNavWindowFrame = "{{15, -1}, {750, 742}}";
|
||||
};
|
||||
};
|
||||
A251BE9B0959A2530058BC7F /* ReadMe.rtfd */ = {
|
||||
uiCtxt = {
|
||||
sepNavIntBoundsRect = "{{0, 0}, {711, 3047}}";
|
||||
sepNavSelRange = "{0, 0}";
|
||||
sepNavVisRect = "{{0, 2419}, {711, 628}}";
|
||||
sepNavWindowFrame = "{{15, -1}, {750, 742}}";
|
||||
};
|
||||
};
|
||||
A2A711BD09E5BF0500D0089B /* WindowController.h */ = {
|
||||
uiCtxt = {
|
||||
sepNavIntBoundsRect = "{{0, 0}, {958, 944}}";
|
||||
sepNavSelRange = "{0, 0}";
|
||||
sepNavVisRect = "{{0, 197}, {711, 613}}";
|
||||
sepNavWindowFrame = "{{15, -1}, {750, 742}}";
|
||||
};
|
||||
};
|
||||
A2A711BE09E5BF0500D0089B /* WindowController.m */ = {
|
||||
uiCtxt = {
|
||||
sepNavIntBoundsRect = "{{0, 0}, {1399, 4496}}";
|
||||
sepNavSelRange = "{2008, 125}";
|
||||
sepNavVisRect = "{{0, 824}, {784, 608}}";
|
||||
sepNavWindowFrame = "{{15, 4}, {823, 737}}";
|
||||
};
|
||||
};
|
||||
A2D32EFF09A63D7A00EC8662 /* PSMMetalTabStyle.m */ = {
|
||||
uiCtxt = {
|
||||
sepNavIntBoundsRect = "{{0, 0}, {1728, 8400}}";
|
||||
sepNavSelRange = "{683, 5}";
|
||||
sepNavVisRect = "{{0, 0}, {781, 608}}";
|
||||
sepNavWindowFrame = "{{15, 4}, {820, 737}}";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -8,22 +8,31 @@
|
||||
|
||||
#import "NSBezierPath_AMShading.h"
|
||||
|
||||
// CGFloat was introduced in OS X 10.5
|
||||
#ifndef CGFLOAT_DEFINED
|
||||
typedef float CGFloat;
|
||||
# define CGFLOAT_MIN FLT_MIN
|
||||
# define CGFLOAT_MAX FLT_MAX
|
||||
# define CGFLOAT_IS_DOUBLE 0
|
||||
# define CGFLOAT_DEFINED 1
|
||||
#endif
|
||||
|
||||
|
||||
@implementation NSBezierPath (AMShading)
|
||||
|
||||
static void linearShadedColor(void *info, const float *in, float *out)
|
||||
static void linearShadedColor(void *info, const CGFloat *in, CGFloat *out)
|
||||
{
|
||||
float *colors = info;
|
||||
CGFloat *colors = info;
|
||||
*out++ = colors[0] + *in * colors[8];
|
||||
*out++ = colors[1] + *in * colors[9];
|
||||
*out++ = colors[2] + *in * colors[10];
|
||||
*out++ = colors[3] + *in * colors[11];
|
||||
}
|
||||
|
||||
static void bilinearShadedColor(void *info, const float *in, float *out)
|
||||
static void bilinearShadedColor(void *info, const CGFloat *in, CGFloat *out)
|
||||
{
|
||||
float *colors = info;
|
||||
float factor = (*in)*2.0;
|
||||
CGFloat *colors = info;
|
||||
CGFloat factor = (*in)*2.0;
|
||||
if (*in > 0.5) {
|
||||
factor = 2-factor;
|
||||
}
|
||||
@@ -41,7 +50,7 @@ static void bilinearShadedColor(void *info, const float *in, float *out)
|
||||
CGPoint startPoint = {0, 0};
|
||||
CGPoint endPoint = {0, 0};
|
||||
CGFunctionRef function;
|
||||
float colors[12]; // pointer to color values
|
||||
CGFloat colors[12]; // pointer to color values
|
||||
|
||||
// get my context
|
||||
CGContextRef currentContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
|
||||
@@ -70,8 +79,8 @@ static void bilinearShadedColor(void *info, const float *in, float *out)
|
||||
colorspace = CGColorSpaceCreateDeviceRGB();
|
||||
|
||||
size_t components = 1 + CGColorSpaceGetNumberOfComponents(colorspace);
|
||||
static const float domain[2] = {0.0, 1.0};
|
||||
static const float range[10] = {0, 1, 0, 1, 0, 1, 0, 1, 0, 1};
|
||||
static const CGFloat domain[2] = {0.0, 1.0};
|
||||
static const CGFloat range[10] = {0, 1, 0, 1, 0, 1, 0, 1, 0, 1};
|
||||
static const CGFunctionCallbacks callbacks = {0, &shadedColor, NULL};
|
||||
|
||||
// Create a CGFunctionRef that describes a function taking 1 input and kChannelsPerColor outputs.
|
||||
@@ -113,7 +122,7 @@ static void bilinearShadedColor(void *info, const float *in, float *out)
|
||||
CGPoint startPoint = {0, 0};
|
||||
CGPoint endPoint = {0, 0};
|
||||
CGFunctionRef function;
|
||||
float colors[12]; // pointer to color values
|
||||
CGFloat colors[12]; // pointer to color values
|
||||
|
||||
// get my context
|
||||
CGContextRef currentContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
|
||||
@@ -141,8 +150,8 @@ static void bilinearShadedColor(void *info, const float *in, float *out)
|
||||
// draw gradient
|
||||
colorspace = CGColorSpaceCreateDeviceRGB();
|
||||
size_t components = 1 + CGColorSpaceGetNumberOfComponents(colorspace);
|
||||
static const float domain[2] = {0.0, 1.0};
|
||||
static const float range[10] = {0, 1, 0, 1, 0, 1, 0, 1, 0, 1};
|
||||
static const CGFloat domain[2] = {0.0, 1.0};
|
||||
static const CGFloat range[10] = {0, 1, 0, 1, 0, 1, 0, 1, 0, 1};
|
||||
//static const CGFunctionCallbacks callbacks = {0, &bilinearShadedColor, NULL};
|
||||
|
||||
// Create a CGFunctionRef that describes a function taking 1 input and kChannelsPerColor outputs.
|
||||
|
||||
@@ -12,6 +12,18 @@
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#ifndef NSINTEGER_DEFINED
|
||||
// NSInteger was introduced in 10.5
|
||||
# if __LP64__ || NS_BUILD_32_LIKE_64
|
||||
typedef long NSInteger;
|
||||
typedef unsigned long NSUInteger;
|
||||
# else
|
||||
typedef int NSInteger;
|
||||
typedef unsigned int NSUInteger;
|
||||
# endif
|
||||
# define NSINTEGER_DEFINED 1
|
||||
#endif
|
||||
|
||||
#define kPSMTabBarControlHeight 22
|
||||
// internal cell border
|
||||
#define MARGIN_X 6
|
||||
@@ -39,7 +51,12 @@ enum {
|
||||
PSMTab_PositionSingleMask = 1 << 7
|
||||
};
|
||||
|
||||
@interface PSMTabBarControl : NSControl {
|
||||
@interface PSMTabBarControl : NSControl
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1060)
|
||||
// 10.6 has turned delegate messages into formal protocols
|
||||
<NSTabViewDelegate>
|
||||
#endif
|
||||
{
|
||||
|
||||
// control basics
|
||||
NSMutableArray *_cells; // the cells that draw the tabs
|
||||
@@ -127,10 +144,10 @@ enum {
|
||||
- (void)tabView:(NSTabView *)aTabView didCloseTabViewItem:(NSTabViewItem *)tabViewItem;
|
||||
- (void)tabView:(NSTabView *)aTabView didDragTabViewItem:(NSTabViewItem *)tabViewItem toIndex:(int)idx;
|
||||
|
||||
- (NSDragOperation)tabBarControl:(PSMTabBarControl *)theTabBarControl draggingEntered:(id <NSDraggingInfo>)sender forTabAtIndex:(unsigned)tabIndex;
|
||||
- (NSDragOperation)tabBarControl:(PSMTabBarControl *)theTabBarControl draggingUpdated:(id <NSDraggingInfo>)sender forTabAtIndex:(unsigned)tabIndex;
|
||||
- (void)tabBarControl:(PSMTabBarControl *)theTabBarControl draggingExited:(id <NSDraggingInfo>)sender forTabAtIndex:(unsigned)tabIndex;
|
||||
- (BOOL)tabBarControl:(PSMTabBarControl *)theTabBarControl prepareForDragOperation:(id <NSDraggingInfo>)sender forTabAtIndex:(unsigned)tabIndex;
|
||||
- (BOOL)tabBarControl:(PSMTabBarControl *)theTabBarControl performDragOperation:(id <NSDraggingInfo>)sender forTabAtIndex:(unsigned)tabIndex;
|
||||
- (void)tabBarControl:(PSMTabBarControl *)theTabBarControl concludeDragOperation:(id <NSDraggingInfo>)sender forTabAtIndex:(unsigned)tabIndex;
|
||||
- (NSDragOperation)tabBarControl:(PSMTabBarControl *)theTabBarControl draggingEntered:(id <NSDraggingInfo>)sender forTabAtIndex:(NSUInteger)tabIndex;
|
||||
- (NSDragOperation)tabBarControl:(PSMTabBarControl *)theTabBarControl draggingUpdated:(id <NSDraggingInfo>)sender forTabAtIndex:(NSUInteger)tabIndex;
|
||||
- (void)tabBarControl:(PSMTabBarControl *)theTabBarControl draggingExited:(id <NSDraggingInfo>)sender forTabAtIndex:(NSUInteger)tabIndex;
|
||||
- (BOOL)tabBarControl:(PSMTabBarControl *)theTabBarControl prepareForDragOperation:(id <NSDraggingInfo>)sender forTabAtIndex:(NSUInteger)tabIndex;
|
||||
- (BOOL)tabBarControl:(PSMTabBarControl *)theTabBarControl performDragOperation:(id <NSDraggingInfo>)sender forTabAtIndex:(NSUInteger)tabIndex;
|
||||
- (void)tabBarControl:(PSMTabBarControl *)theTabBarControl concludeDragOperation:(id <NSDraggingInfo>)sender forTabAtIndex:(NSUInteger)tabIndex;
|
||||
@end
|
||||
|
||||
@@ -57,8 +57,8 @@
|
||||
|
||||
// convenience
|
||||
- (id)cellForPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame;
|
||||
- (unsigned)indexOfCellAtPoint:(NSPoint)point;
|
||||
- (unsigned)indexOfCellAtPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame;
|
||||
- (NSUInteger)indexOfCellAtPoint:(NSPoint)point;
|
||||
- (NSUInteger)indexOfCellAtPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame;
|
||||
- (PSMTabBarCell *)lastVisibleTab;
|
||||
- (int)numberOfVisibleTabs;
|
||||
|
||||
@@ -412,7 +412,7 @@
|
||||
[bindingOptions setObject:NSNegateBooleanTransformerName forKey:@"NSValueTransformerName"];
|
||||
[[cell indicator] bind:@"animate" toObject:[item identifier] withKeyPath:@"selection.isProcessing" options:nil];
|
||||
[[cell indicator] bind:@"hidden" toObject:[item identifier] withKeyPath:@"selection.isProcessing" options:bindingOptions];
|
||||
[[item identifier] addObserver:self forKeyPath:@"selection.isProcessing" options:nil context:nil];
|
||||
[[item identifier] addObserver:self forKeyPath:@"selection.isProcessing" options:0 context:nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -425,7 +425,7 @@
|
||||
NSMutableDictionary *bindingOptions = [NSMutableDictionary dictionary];
|
||||
[bindingOptions setObject:NSIsNotNilTransformerName forKey:@"NSValueTransformerName"];
|
||||
[cell bind:@"hasIcon" toObject:[item identifier] withKeyPath:@"selection.icon" options:bindingOptions];
|
||||
[[item identifier] addObserver:self forKeyPath:@"selection.icon" options:nil context:nil];
|
||||
[[item identifier] addObserver:self forKeyPath:@"selection.icon" options:0 context:nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -436,7 +436,7 @@
|
||||
if([[item identifier] respondsToSelector:@selector(content)]){
|
||||
if([[[[cell representedObject] identifier] content] respondsToSelector:@selector(objectCount)]){
|
||||
[cell bind:@"count" toObject:[item identifier] withKeyPath:@"selection.objectCount" options:nil];
|
||||
[[item identifier] addObserver:self forKeyPath:@"selection.objectCount" options:nil context:nil];
|
||||
[[item identifier] addObserver:self forKeyPath:@"selection.objectCount" options:0 context:nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -993,7 +993,7 @@
|
||||
}
|
||||
|
||||
// NSDraggingSource
|
||||
- (unsigned int)draggingSourceOperationMaskForLocal:(BOOL)isLocal
|
||||
- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal
|
||||
{
|
||||
return (isLocal ? NSDragOperationMove : NSDragOperationNone);
|
||||
}
|
||||
@@ -1083,7 +1083,7 @@
|
||||
#if 1
|
||||
// HACK! Notify the delegate that a tab was dragged to a new position.
|
||||
if (delegate && [delegate respondsToSelector:@selector(tabView:didDragTabViewItem:toIndex:)]) {
|
||||
int idx = [[self representedTabViewItems] indexOfObject:tvi];
|
||||
NSUInteger idx = [[self representedTabViewItems] indexOfObject:tvi];
|
||||
if (NSNotFound != idx) {
|
||||
[delegate tabView:[self tabView] didDragTabViewItem:tvi toIndex:idx];
|
||||
}
|
||||
@@ -1252,7 +1252,9 @@
|
||||
{
|
||||
if([self delegate]){
|
||||
if([[self delegate] respondsToSelector:@selector(tabView:shouldSelectTabViewItem:)]){
|
||||
return (int)[[self delegate] performSelector:@selector(tabView:shouldSelectTabViewItem:) withObject:aTabView withObject:tabViewItem];
|
||||
// This is an ugly hack. tabView:shouldSelectTabViewItem: returns
|
||||
// a BOOL and performSelector: assumes that it returns an id.
|
||||
return nil != [[self delegate] performSelector:@selector(tabView:shouldSelectTabViewItem:) withObject:aTabView withObject:tabViewItem];
|
||||
} else {
|
||||
return YES;
|
||||
}
|
||||
@@ -1414,19 +1416,19 @@
|
||||
|
||||
- (id)cellForPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame
|
||||
{
|
||||
unsigned i = [self indexOfCellAtPoint:point cellFrame:outFrame];
|
||||
NSUInteger i = [self indexOfCellAtPoint:point cellFrame:outFrame];
|
||||
if (i == NSNotFound)
|
||||
return nil;
|
||||
PSMTabBarCell *cell = [_cells objectAtIndex:i];
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (unsigned)indexOfCellAtPoint:(NSPoint)point
|
||||
- (NSUInteger)indexOfCellAtPoint:(NSPoint)point
|
||||
{
|
||||
return [self indexOfCellAtPoint:point cellFrame:NULL];
|
||||
}
|
||||
|
||||
- (unsigned)indexOfCellAtPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame
|
||||
- (NSUInteger)indexOfCellAtPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame
|
||||
{
|
||||
NSRect aRect = [self genericCellRect];
|
||||
|
||||
@@ -1434,7 +1436,7 @@
|
||||
return NSNotFound;
|
||||
}
|
||||
|
||||
int i, cnt = [_cells count];
|
||||
NSUInteger i, cnt = [_cells count];
|
||||
for(i = 0; i < cnt; i++){
|
||||
PSMTabBarCell *cell = [_cells objectAtIndex:i];
|
||||
float width = [cell width];
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ static int MMPlugInArchMinorVersion = 0;
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
//NSLog(@"%@ %s", [self className], _cmd);
|
||||
ASLogDebug(@"");
|
||||
|
||||
[plugInViews release]; plugInViews = nil;
|
||||
[instances release]; instances = nil;
|
||||
@@ -113,8 +113,10 @@ static int MMPlugInArchMinorVersion = 0;
|
||||
NSString *errstr = nil;
|
||||
id res = [vimController evaluateVimExpressionCocoa:vimExpression
|
||||
errorString:&errstr];
|
||||
if (!res)
|
||||
[NSException raise:@"VimEvaluationException" format:errstr];
|
||||
if (!res) {
|
||||
// Setting format to %@ instead of just passing errstr avoids warning.
|
||||
[NSException raise:@"VimEvaluationException" format:@"%@", errstr];
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -126,8 +128,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]
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
// Copyright 2004-2006 Rainer Brockerhoff.
|
||||
// Some Rights Reserved under the Creative Commons Attribution License, version 2.5, and/or the MIT License.
|
||||
//
|
||||
#ifdef MM_ENABLE_PLUGINS
|
||||
|
||||
#import "RBSplitView.h"
|
||||
#import "RBSplitViewPrivateDefines.h"
|
||||
@@ -925,3 +926,4 @@ static animationData* currentAnimation = NULL;
|
||||
|
||||
@end
|
||||
|
||||
#endif // MM_ENABLE_PLUGINS
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
// Copyright 2004-2006 Rainer Brockerhoff.
|
||||
// Some Rights Reserved under the Creative Commons Attribution License, version 2.5, and/or the MIT License.
|
||||
//
|
||||
#ifdef MM_ENABLE_PLUGINS
|
||||
|
||||
#import "RBSplitView.h"
|
||||
#import "RBSplitViewPrivateDefines.h"
|
||||
@@ -1732,3 +1733,4 @@ static inline float fMAX(float a,float b) {
|
||||
|
||||
@end
|
||||
|
||||
#endif // MM_ENABLE_PLUGINS
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
MacVim is a port of the text editor Vim to Mac OS X. More information can be
|
||||
found on the [project webpage][gcode]. The file `src/MacVim/README` gives an
|
||||
overview of the MacVim source code.
|
||||
|
||||
|
||||
### Branches ###
|
||||
|
||||
`master`
|
||||
: MacVim and core Vim sources
|
||||
`vim`
|
||||
: Core Vim sources pulled from the SVN repository with the latest runtime
|
||||
: files from the Vim FTP included
|
||||
`stable`
|
||||
: Used to build the Stable binary distribution
|
||||
`feat/core-text`
|
||||
: Core Text renderer (fast with improved Unicode rendering, but has some
|
||||
: display issues)
|
||||
|
||||
_Note:_ Branches starting with `feat/` are experimental and will be rebased
|
||||
against master occasionally (other branches will not be rebased).
|
||||
|
||||
|
||||
[gcode]: http://code.google.com/p/macvim/
|
||||
@@ -1,62 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>KA</key>
|
||||
<string>KA</string>
|
||||
<key></key>
|
||||
<string>kb</string>
|
||||
<key></key>
|
||||
<string>ku</string>
|
||||
<key></key>
|
||||
<string>kd</string>
|
||||
<key></key>
|
||||
<string>kl</string>
|
||||
<key></key>
|
||||
<string>kr</string>
|
||||
<key></key>
|
||||
<string>k1</string>
|
||||
<key></key>
|
||||
<string>k2</string>
|
||||
<key></key>
|
||||
<string>k3</string>
|
||||
<key></key>
|
||||
<string>k4</string>
|
||||
<key></key>
|
||||
<string>k5</string>
|
||||
<key></key>
|
||||
<string>k6</string>
|
||||
<key></key>
|
||||
<string>k7</string>
|
||||
<key></key>
|
||||
<string>k8</string>
|
||||
<key></key>
|
||||
<string>k9</string>
|
||||
<key></key>
|
||||
<string>k;</string>
|
||||
<key></key>
|
||||
<string>F1</string>
|
||||
<key></key>
|
||||
<string>F2</string>
|
||||
<key></key>
|
||||
<string>F3</string>
|
||||
<key></key>
|
||||
<string>F4</string>
|
||||
<key></key>
|
||||
<string>F5</string>
|
||||
<key></key>
|
||||
<string>F6</string>
|
||||
<key></key>
|
||||
<string>kD</string>
|
||||
<key></key>
|
||||
<string>kh</string>
|
||||
<key></key>
|
||||
<string>@7</string>
|
||||
<key></key>
|
||||
<string>kP</string>
|
||||
<key></key>
|
||||
<string>kN</string>
|
||||
<key></key>
|
||||
<string>%1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -28,7 +28,7 @@
|
||||
17966369093A122C00138851 /* WebView: Edit in ODBEditor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = "WebView: Edit in ODBEditor.mm"; path = "src/WebView: Edit in ODBEditor.mm"; sourceTree = "<group>"; };
|
||||
32DBCF630370AF2F00C91783 /* Edit in ODBEditor_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Edit in ODBEditor_Prefix.pch"; sourceTree = "<group>"; };
|
||||
8D5B49B6048680CD000E48DA /* Edit in ODBEditor.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Edit in ODBEditor.bundle"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
@@ -196,42 +196,6 @@
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
1DD3D5530D82D8D7006E4320 /* Universal */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = (
|
||||
ppc,
|
||||
i386,
|
||||
);
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "Edit in ODBEditor_Prefix.pch";
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
INSTALL_PATH = "";
|
||||
OTHER_LDFLAGS = (
|
||||
"-undefined",
|
||||
dynamic_lookup,
|
||||
);
|
||||
PRODUCT_NAME = "Edit in ODBEditor";
|
||||
SYMROOT = ../build;
|
||||
WRAPPER_EXTENSION = bundle;
|
||||
};
|
||||
name = Universal;
|
||||
};
|
||||
1DD3D5540D82D8D7006E4320 /* Universal */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
GCC_ENABLE_CPP_EXCEPTIONS = NO;
|
||||
GCC_ENABLE_CPP_RTTI = NO;
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
PREBINDING = NO;
|
||||
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
|
||||
};
|
||||
name = Universal;
|
||||
};
|
||||
1DEB913B08733D840010E9CD /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
@@ -282,7 +246,6 @@
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
PREBINDING = NO;
|
||||
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -295,7 +258,6 @@
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
PREBINDING = NO;
|
||||
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@@ -307,7 +269,6 @@
|
||||
buildConfigurations = (
|
||||
1DEB913B08733D840010E9CD /* Debug */,
|
||||
1DEB913C08733D840010E9CD /* Release */,
|
||||
1DD3D5530D82D8D7006E4320 /* Universal */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
@@ -317,7 +278,6 @@
|
||||
buildConfigurations = (
|
||||
1DEB913F08733D840010E9CD /* Debug */,
|
||||
1DEB914008733D840010E9CD /* Release */,
|
||||
1DD3D5540D82D8D7006E4320 /* Universal */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
|
||||
@@ -220,7 +220,11 @@ struct PBX_SelectionRange
|
||||
}
|
||||
else
|
||||
{
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4)
|
||||
[[NSFileManager defaultManager] removeItemAtPath:fileName error:NULL];
|
||||
#else
|
||||
[[NSFileManager defaultManager] removeFileAtPath:fileName handler:nil];
|
||||
#endif
|
||||
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
|
||||
}
|
||||
|
||||
@@ -256,7 +260,7 @@ struct PBX_SelectionRange
|
||||
{
|
||||
[editMenu addItem:[NSMenuItem separatorItem]];
|
||||
NSString* ellips = [NSString stringWithUTF8String:"\xe2\x80\xa6"]; // utf-8 for the '...' character (literal utf8 is not allowed in source code)
|
||||
id <NSMenuItem> menuItem = [editMenu addItemWithTitle:[NSString stringWithFormat:@"Edit in %@%@", ODBEditorName, ellips] action:@selector(editInODBEditor:) keyEquivalent:@"E"];
|
||||
NSMenuItem *menuItem = [editMenu addItemWithTitle:[NSString stringWithFormat:@"Edit in %@%@", ODBEditorName, ellips] action:@selector(editInODBEditor:) keyEquivalent:@"E"];
|
||||
[menuItem setKeyEquivalentModifierMask:NSControlKeyMask | NSCommandKeyMask];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,7 +313,11 @@ static DOMHTMLTextAreaElement* find_active_text_area (WebView* view)
|
||||
|
||||
if(selection)
|
||||
{
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4)
|
||||
str = convert_dom_to_text([[[self mainFrame] DOMDocument] createTreeWalker:selection whatToShow:DOM_SHOW_ALL filter:nil expandEntityReferences:YES]);
|
||||
#else
|
||||
str = convert_dom_to_text([[[self mainFrame] DOMDocument] createTreeWalker:selection :DOM_SHOW_ALL :nil :YES]);
|
||||
#endif
|
||||
while([str hasSuffix:@"\n\n"])
|
||||
str = [str substringToIndex:[str length]-1];
|
||||
|
||||
|
||||
+147
-80
@@ -38,32 +38,52 @@ vimmenu_T *menu_for_descriptor(NSArray *desc);
|
||||
|
||||
// -- Initialization --------------------------------------------------------
|
||||
|
||||
void
|
||||
macvim_early_init()
|
||||
{
|
||||
NSBundle *bundle = [NSBundle mainBundle];
|
||||
if (bundle) {
|
||||
// Set environment variables $VIM and $VIMRUNTIME
|
||||
NSString *path = [[bundle resourcePath]
|
||||
stringByAppendingPathComponent:@"vim"];
|
||||
vim_setenv((char_u*)"VIM", (char_u*)[path UTF8String]);
|
||||
|
||||
path = [path stringByAppendingPathComponent:@"runtime"];
|
||||
vim_setenv((char_u*)"VIMRUNTIME", (char_u*)[path UTF8String]);
|
||||
}
|
||||
|
||||
#if 0 // NOTE: setlocale(LC_ALL, "") seems to work after a restart so this is
|
||||
// not necessary. The locale used depends on what "Region" is set
|
||||
// inside the "Formats" tab of the "International" System Preferences
|
||||
// pane.
|
||||
// Try to ensure that the locale is set to match that used by NSBundle to
|
||||
// load localized resources. If there is a mismatch e.g. between the
|
||||
// MacVim menu and other menus, then this code needs to change (nb. the
|
||||
// MacVim menu is set up inside a nib file so the locale used for it is
|
||||
// chosen by NSBundle and the other menus are set up by Vim so their locale
|
||||
// matches whatever we set here).
|
||||
NSLocale *loc = [NSLocale currentLocale];
|
||||
if (loc) {
|
||||
NSString *s = [NSString stringWithFormat:@"%@_%@.UTF-8",
|
||||
[loc objectForKey:NSLocaleLanguageCode],
|
||||
[loc objectForKey:NSLocaleCountryCode]];
|
||||
setlocale(LC_ALL, [s UTF8String]);
|
||||
fprintf(stderr, "locale=%s\n", [s UTF8String]);
|
||||
fflush(stderr);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 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
|
||||
// values!
|
||||
//
|
||||
// TODO:
|
||||
// - ensure this is called first to avoid above problem
|
||||
// - encoding
|
||||
|
||||
NSString *path = [[[NSBundle mainBundle] resourcePath]
|
||||
stringByAppendingPathComponent:@"vim"];
|
||||
vim_setenv((char_u*)"VIM", (char_u*)[path UTF8String]);
|
||||
|
||||
path = [path stringByAppendingPathComponent:@"runtime"];
|
||||
vim_setenv((char_u*)"VIMRUNTIME", (char_u*)[path UTF8String]);
|
||||
|
||||
int i;
|
||||
for (i = 0; i < *argc; ++i) {
|
||||
if (strncmp(argv[i], "--mmwaitforack", 14) == 0) {
|
||||
@@ -74,6 +94,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 +117,29 @@ gui_mch_prepare(int *argc, char **argv)
|
||||
int
|
||||
gui_mch_init_check(void)
|
||||
{
|
||||
//NSLog(@"gui_mch_init_check()");
|
||||
ASLInit();
|
||||
ASLogDebug(@"");
|
||||
|
||||
// Restore autosaved rows & columns
|
||||
CFNumberRef rowsRef, colsRef;
|
||||
rowsRef = CFPreferencesCopyAppValue((CFStringRef)MMAutosaveRowsKey,
|
||||
kCFPreferencesCurrentApplication);
|
||||
colsRef = CFPreferencesCopyAppValue((CFStringRef)MMAutosaveColumnsKey,
|
||||
kCFPreferencesCurrentApplication);
|
||||
if (rowsRef && colsRef) {
|
||||
int rows, cols;
|
||||
if (CFNumberGetValue(rowsRef, kCFNumberIntType, &rows)
|
||||
&& CFNumberGetValue(colsRef, kCFNumberIntType, &cols)) {
|
||||
if (rows > 4 && rows < 1000 && cols > 29 && cols < 4000) {
|
||||
Rows = rows;
|
||||
Columns = cols;
|
||||
} else {
|
||||
ASLogWarn(@"Autosaved window dimensions invalid: %dx%d",
|
||||
cols, rows);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -96,7 +151,7 @@ gui_mch_init_check(void)
|
||||
int
|
||||
gui_mch_init(void)
|
||||
{
|
||||
//NSLog(@"gui_mch_init()");
|
||||
ASLogDebug(@"");
|
||||
|
||||
if (![[MMBackend sharedInstance] checkin]) {
|
||||
// TODO: Kill the process if there is no terminal to fall back on,
|
||||
@@ -138,7 +193,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 +508,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
|
||||
@@ -770,9 +824,10 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx)
|
||||
&& lookup_menu_iconfile(menu->name, fname))
|
||||
icon = fname;
|
||||
|
||||
// Last resort, use display name (usually signals a builtin icon)
|
||||
// Still no icon found, try using a builtin icon. (If this also fails,
|
||||
// then a warning icon will be displayed).
|
||||
if (!icon)
|
||||
icon = menu->dname;
|
||||
icon = lookup_toolbar_item(menu->iconidx);
|
||||
}
|
||||
|
||||
[[MMBackend sharedInstance] queueMessage:AddMenuItemMsgID properties:
|
||||
@@ -921,7 +976,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 +995,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 +1028,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.
|
||||
@@ -1069,6 +1123,14 @@ gui_macvim_font_with_name(char_u *name)
|
||||
|
||||
// -- Scrollbars ------------------------------------------------------------
|
||||
|
||||
// NOTE: Even though scrollbar identifiers are 'long' we tacitly assume that
|
||||
// they only use 32 bits (in particular when compiling for 64 bit). This is
|
||||
// justified since identifiers are generated from a 32 bit counter in
|
||||
// gui_create_scrollbar(). However if that code changes we may be in trouble
|
||||
// (if ever that many scrollbars are allocated...). The reason behind this is
|
||||
// that we pass scrollbar identifers over process boundaries so the width of
|
||||
// the variable needs to be fixed (and why fix at 64 bit when only 32 are
|
||||
// really used?).
|
||||
|
||||
void
|
||||
gui_mch_create_scrollbar(
|
||||
@@ -1076,7 +1138,7 @@ gui_mch_create_scrollbar(
|
||||
int orient) /* SBAR_VERT or SBAR_HORIZ */
|
||||
{
|
||||
[[MMBackend sharedInstance]
|
||||
createScrollbarWithIdentifier:sb->ident type:sb->type];
|
||||
createScrollbarWithIdentifier:(int32_t)sb->ident type:sb->type];
|
||||
}
|
||||
|
||||
|
||||
@@ -1084,7 +1146,7 @@ gui_mch_create_scrollbar(
|
||||
gui_mch_destroy_scrollbar(scrollbar_T *sb)
|
||||
{
|
||||
[[MMBackend sharedInstance]
|
||||
destroyScrollbarWithIdentifier:sb->ident];
|
||||
destroyScrollbarWithIdentifier:(int32_t)sb->ident];
|
||||
}
|
||||
|
||||
|
||||
@@ -1094,7 +1156,7 @@ gui_mch_enable_scrollbar(
|
||||
int flag)
|
||||
{
|
||||
[[MMBackend sharedInstance]
|
||||
showScrollbarWithIdentifier:sb->ident state:flag];
|
||||
showScrollbarWithIdentifier:(int32_t)sb->ident state:flag];
|
||||
}
|
||||
|
||||
|
||||
@@ -1114,7 +1176,7 @@ gui_mch_set_scrollbar_pos(
|
||||
}
|
||||
|
||||
[[MMBackend sharedInstance]
|
||||
setScrollbarPosition:pos length:len identifier:sb->ident];
|
||||
setScrollbarPosition:pos length:len identifier:(int32_t)sb->ident];
|
||||
}
|
||||
|
||||
|
||||
@@ -1126,7 +1188,10 @@ gui_mch_set_scrollbar_thumb(
|
||||
long max)
|
||||
{
|
||||
[[MMBackend sharedInstance]
|
||||
setScrollbarThumbValue:val size:size max:max identifier:sb->ident];
|
||||
setScrollbarThumbValue:val
|
||||
size:size
|
||||
max:max
|
||||
identifier:(int32_t)sb->ident];
|
||||
}
|
||||
|
||||
|
||||
@@ -1226,14 +1291,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 +1323,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 +1348,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 +1476,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 +1506,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 +1621,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;
|
||||
}
|
||||
@@ -1577,21 +1644,7 @@ gui_mch_get_winpos(int *x, int *y)
|
||||
int
|
||||
gui_mch_haskey(char_u *name)
|
||||
{
|
||||
BOOL ok = NO;
|
||||
|
||||
#ifdef FEAT_MBYTE
|
||||
name = CONVERT_TO_UTF8(name);
|
||||
#endif
|
||||
|
||||
NSString *value = [NSString stringWithUTF8String:(char*)name];
|
||||
if (value)
|
||||
ok = [[MMBackend sharedInstance] hasSpecialKeyWithValue:value];
|
||||
|
||||
#ifdef FEAT_MBYTE
|
||||
CONVERT_TO_UTF8_FREE(name);
|
||||
#endif
|
||||
|
||||
return ok;
|
||||
return [[MMBackend sharedInstance] hasSpecialKeyWithValue:name];
|
||||
}
|
||||
|
||||
|
||||
@@ -1627,10 +1680,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 +1710,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);
|
||||
@@ -1974,7 +2026,7 @@ serverSendReply(char_u *serverid, char_u *reply)
|
||||
* All communication between MacVim and the server goes via Apple Events.
|
||||
*/
|
||||
|
||||
static OSErr
|
||||
static int16_t
|
||||
odb_event(buf_T *buf, const AEEventID action)
|
||||
{
|
||||
if (!(buf->b_odb_server_id && buf->b_ffname))
|
||||
@@ -1983,7 +2035,7 @@ odb_event(buf_T *buf, const AEEventID action)
|
||||
NSAppleEventDescriptor *targetDesc = [NSAppleEventDescriptor
|
||||
descriptorWithDescriptorType:typeApplSignature
|
||||
bytes:&buf->b_odb_server_id
|
||||
length:sizeof(OSType)];
|
||||
length:sizeof(uint32_t)];
|
||||
|
||||
// TODO: Convert b_ffname to UTF-8?
|
||||
NSString *path = [NSString stringWithUTF8String:(char*)buf->b_ffname];
|
||||
@@ -2008,10 +2060,10 @@ odb_event(buf_T *buf, const AEEventID action)
|
||||
kAEDefaultTimeout);
|
||||
}
|
||||
|
||||
OSErr
|
||||
int16_t
|
||||
odb_buffer_close(buf_T *buf)
|
||||
{
|
||||
OSErr err = noErr;
|
||||
int16_t err = noErr;
|
||||
if (buf) {
|
||||
err = odb_event(buf, kAEClosedFile);
|
||||
|
||||
@@ -2031,7 +2083,7 @@ odb_buffer_close(buf_T *buf)
|
||||
return err;
|
||||
}
|
||||
|
||||
OSErr
|
||||
int16_t
|
||||
odb_post_buffer_write(buf_T *buf)
|
||||
{
|
||||
return buf ? odb_event(buf, kAEModifiedFile) : noErr;
|
||||
@@ -2178,3 +2230,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
|
||||
|
||||
+1
-164
@@ -1,7 +1,7 @@
|
||||
" System gvimrc file for MacVim
|
||||
"
|
||||
" Maintainer: Bjorn Winckler <bjorn.winckler@gmail.com>
|
||||
" Last Change: Sun Mar 15 2009
|
||||
" Last Change: Sun Aug 29 2009
|
||||
"
|
||||
" This is a work in progress. If you feel so inclined, please help me improve
|
||||
" this file.
|
||||
@@ -30,115 +30,11 @@ endif
|
||||
" name and the buffer modified flag.
|
||||
set guitablabel=%M%t
|
||||
|
||||
|
||||
" Send print jobs to Preview.app. This does not delete the temporary ps file
|
||||
" that is generated by :hardcopy.
|
||||
set printexpr=system('open\ -a\ Preview\ '.v:fname_in)\ +\ v:shell_error
|
||||
|
||||
|
||||
"
|
||||
" Extra menus
|
||||
"
|
||||
|
||||
|
||||
" File menu
|
||||
|
||||
aunmenu File.New
|
||||
aunmenu File.Open\.\.\.
|
||||
aunmenu File.Close
|
||||
aunmenu File.-SEP4-
|
||||
aunmenu File.Exit
|
||||
aunmenu File.Save-Exit
|
||||
|
||||
an <silent> 10.290 File.New\ Window <Nop>
|
||||
an 10.295 File.New\ Tab :tabnew<CR>
|
||||
an <silent> 10.310 File.Open\.\.\. <Nop>
|
||||
an <silent> 10.325 File.Open\ Recent <Nop>
|
||||
an 10.328 File.-SEP0- <Nop>
|
||||
an <silent> 10.330 File.Close\ Window<Tab>:qa :conf qa<CR>
|
||||
an <silent> 10.332 File.Close :conf q<CR>
|
||||
an <silent> 10.341 File.Save\ All :browse conf wa<CR>
|
||||
an 10.350 File.Save\ As\.\.\.<Tab>:sav :browse confirm saveas<CR>
|
||||
|
||||
|
||||
" Edit menu
|
||||
|
||||
" The following function is aken from menu.vim
|
||||
fun! s:FixFText()
|
||||
" Fix text in nameless register to be used with :promptfind.
|
||||
return substitute(@", "[\r\n]", '\\n', 'g')
|
||||
endfun
|
||||
|
||||
aunmenu Edit.Find
|
||||
aunmenu Edit.Find\ and\ Replace
|
||||
|
||||
an <silent> 20.410.10 Edit.Find.Find\.\.\. :promptfind<CR>
|
||||
vunmenu Edit.Find.Find\.\.\.
|
||||
vnoremenu <silent> Edit.Find.Find\.\.\. y:promptfind <C-R>=<SID>FixFText()<CR><CR>
|
||||
an 20.410.20 Edit.Find.Find\ Next <Nop>
|
||||
an 20.410.30 Edit.Find.Find\ Previous <Nop>
|
||||
vmenu 20.410.35 Edit.Find.Use\ Selection\ for\ Find y:let @/=@"<CR>:<BS>
|
||||
|
||||
an 20.460 Edit.-SEP4- <Nop>
|
||||
an 20.465.10 Edit.Font.Show\ Fonts <Nop>
|
||||
an 20.465.20 Edit.Font.-SEP5- <Nop>
|
||||
an 20.465.30 Edit.Font.Bigger <Nop>
|
||||
an 20.465.40 Edit.Font.Smaller <Nop>
|
||||
an 20.470 Edit.Special\ Characters\.\.\. <Nop>
|
||||
|
||||
|
||||
" Window menu (should be next to Help so give it a high priority)
|
||||
aunmenu Window
|
||||
|
||||
an <silent> 9900.300 Window.Minimize <Nop>
|
||||
an <silent> 9900.301 Window.Minimize\ All <Nop>
|
||||
an <silent> 9900.310 Window.Zoom <Nop>
|
||||
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 9900.360 Window.-SEP2- <Nop>
|
||||
an <silent> 9900.370 Window.Bring\ All\ To\ Front <Nop>
|
||||
|
||||
|
||||
" Help menu
|
||||
an 9999.1 Help.MacVim\ Help :h gui_mac<CR>
|
||||
an <silent> 9999.2 Help.MacVim\ Website <Nop>
|
||||
an 9999.3 Help.-sep0- <Nop>
|
||||
|
||||
|
||||
"
|
||||
" Toolbar
|
||||
"
|
||||
" These items are special ('*' means zero or more arbitrary characters):
|
||||
" -space*- an empty space
|
||||
" -flexspace*- a flexible space
|
||||
" -*- a separator item
|
||||
|
||||
" Remove some items so that all items are visible at the default window size.
|
||||
"aunmenu ToolBar.Undo
|
||||
"aunmenu ToolBar.Redo
|
||||
"aunmenu ToolBar.-sep2-
|
||||
"aunmenu ToolBar.Cut
|
||||
"aunmenu ToolBar.Copy
|
||||
"aunmenu ToolBar.Paste
|
||||
"aunmenu ToolBar.-sep3-
|
||||
aunmenu ToolBar.Replace
|
||||
aunmenu ToolBar.FindNext
|
||||
aunmenu ToolBar.FindPrev
|
||||
aunmenu ToolBar.-sep5-
|
||||
aunmenu ToolBar.-sep6-
|
||||
aunmenu ToolBar.RunCtags
|
||||
aunmenu ToolBar.TagJump
|
||||
"aunmenu ToolBar.-sep7-
|
||||
aunmenu ToolBar.FindHelp
|
||||
|
||||
"an 1.295 ToolBar.-flexspace7- <Nop>
|
||||
|
||||
|
||||
|
||||
" This is so that HIG Cmd and Option movement mappings can be disabled by
|
||||
" adding the line
|
||||
" let macvim_skip_cmd_opt_movement = 1
|
||||
@@ -205,65 +101,6 @@ if exists("macvim_hig_shift_movement")
|
||||
endif " exists("macvim_hig_shift_movement")
|
||||
|
||||
|
||||
|
||||
"
|
||||
" Set up menu key equivalents (these should always have the 'D' modifier set),
|
||||
" action bindings, and alternate items.
|
||||
"
|
||||
" Note: menu items which should execute an action are bound to <Nop>; the
|
||||
" action message is specified here via the :macmenu command.
|
||||
"
|
||||
|
||||
macm File.New\ Window key=<D-n> action=newWindow:
|
||||
macm File.New\ Tab key=<D-t>
|
||||
macm File.Open\.\.\. key=<D-o> action=fileOpen:
|
||||
macm File.Open\ Tab\.\.\. key=<D-T>
|
||||
macm File.Open\ Recent action=recentFilesDummy:
|
||||
macm File.Close\ Window key=<D-W>
|
||||
macm File.Close key=<D-w> action=performClose:
|
||||
macm File.Save key=<D-s>
|
||||
macm File.Save\ All key=<D-M-s> alt=YES
|
||||
macm File.Save\ As\.\.\. key=<D-S>
|
||||
macm File.Print key=<D-p>
|
||||
|
||||
macm Edit.Undo key=<D-z> action=undo:
|
||||
macm Edit.Redo key=<D-Z> action=redo:
|
||||
macm Edit.Cut key=<D-x> action=cut:
|
||||
macm Edit.Copy key=<D-c> action=copy:
|
||||
macm Edit.Paste key=<D-v> action=paste:
|
||||
macm Edit.Select\ All key=<D-a> action=selectAll:
|
||||
macm Edit.Find.Find\.\.\. key=<D-f>
|
||||
macm Edit.Find.Find\ Next key=<D-g> action=findNext:
|
||||
macm Edit.Find.Find\ Previous key=<D-G> action=findPrevious:
|
||||
macm Edit.Find.Use\ Selection\ for\ Find key=<D-e>
|
||||
macm Edit.Special\ Characters\.\.\. key=<D-M-t>
|
||||
macm Edit.Font.Show\ Fonts action=orderFrontFontPanel:
|
||||
macm Edit.Font.Bigger key=<D-=> action=fontSizeUp:
|
||||
macm Edit.Font.Smaller key=<D--> action=fontSizeDown:
|
||||
macm Edit.Special\ Characters\.\.\. action=orderFrontCharacterPalette:
|
||||
|
||||
macm Tools.Spelling.To\ Next\ error key=<D-;>
|
||||
macm Tools.Spelling.Suggest\ Corrections key=<D-:>
|
||||
macm Tools.Make key=<D-b>
|
||||
macm Tools.List\ Errors key=<D-l>
|
||||
macm Tools.List\ Messages key=<D-L>
|
||||
macm Tools.Next\ Error key=<D-C-Right>
|
||||
macm Tools.Previous\ Error key=<D-C-Left>
|
||||
macm Tools.Older\ List key=<D-C-Up>
|
||||
macm Tools.Newer\ List key=<D-C-Down>
|
||||
|
||||
macm Window.Minimize key=<D-m> action=performMiniaturize:
|
||||
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.Bring\ All\ To\ Front action=arrangeInFront:
|
||||
|
||||
macm Help.MacVim\ Help key=<D-?>
|
||||
macm Help.MacVim\ Website action=openWebsite:
|
||||
|
||||
" Restore the previous value of 'cpoptions'.
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
@@ -49,14 +49,21 @@ class Surface(object):
|
||||
def data(self):
|
||||
"""Returns data in ARGB order (on intel, at least)."""
|
||||
r = self.bitmapRep
|
||||
if r.bitmapFormat() != (NSAlphaNonpremultipliedBitmapFormat |
|
||||
NSAlphaFirstBitmapFormat) or \
|
||||
if (r.bitmapFormat() & ~NSAlphaFirstBitmapFormat !=
|
||||
NSAlphaNonpremultipliedBitmapFormat) or \
|
||||
r.bitsPerPixel() != 32 or \
|
||||
r.isPlanar() or \
|
||||
r.samplesPerPixel() != 4:
|
||||
raise Exception("Unsupported image format")
|
||||
return self.bitmapRep.bitmapData()
|
||||
|
||||
def rgbaIndices(self):
|
||||
r = self.bitmapRep
|
||||
if r.bitmapFormat() & NSAlphaFirstBitmapFormat != 0:
|
||||
return 1, 2, 3, 0
|
||||
else:
|
||||
return 0, 1, 2, 3
|
||||
|
||||
def save(self, filename):
|
||||
"""Saves image as png file."""
|
||||
self.bitmapRep.representationUsingType_properties_(NSPNGFileType, None) \
|
||||
@@ -216,6 +223,7 @@ def splitGenericDocumentIcon(img, s):
|
||||
r = img.surfaceOfSize(w, h)
|
||||
bps = 4*w
|
||||
data = r.data()
|
||||
dr, dg, db, da = r.rgbaIndices()
|
||||
|
||||
ground = Surface(w, h, premultiplyAlpha=False)
|
||||
shadow = Surface(w, h, premultiplyAlpha=False)
|
||||
@@ -226,7 +234,10 @@ def splitGenericDocumentIcon(img, s):
|
||||
for y in xrange(h):
|
||||
for x in xrange(w):
|
||||
idx = y*bps + 4*x
|
||||
ia, ir, ig, ib = data[idx:idx + 4]
|
||||
ia = data[idx + da]
|
||||
ir = data[idx + dr]
|
||||
ig = data[idx + dg]
|
||||
ib = data[idx + db]
|
||||
if ia != chr(255):
|
||||
# buffer objects don't support slice assignment :-(
|
||||
grounddata[idx] = ia
|
||||
|
||||
@@ -20,7 +20,8 @@ try:
|
||||
from AppKit import *
|
||||
|
||||
dont_create = False
|
||||
except:
|
||||
except Exception, e:
|
||||
print e
|
||||
dont_create = True # most likely because we're on tiger
|
||||
|
||||
import os
|
||||
@@ -104,6 +105,9 @@ 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],
|
||||
'MacVim-vba': [u'VBA', LINK],
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -176,6 +176,8 @@
|
||||
|
||||
@end
|
||||
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED <= 1050 // Scrap Manager has been nixed on Snow Leopard
|
||||
// Methods for interfacing with the Carbon Scrap Manager (analogous to and
|
||||
// interoperable with the Cocoa Pasteboard).
|
||||
@interface IconFamily (ScrapAdditions)
|
||||
@@ -184,3 +186,5 @@
|
||||
- initWithScrap;
|
||||
- (BOOL) putOnScrap;
|
||||
@end
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1498,6 +1498,7 @@ enum {
|
||||
|
||||
@end
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED <= 1050 // Scrap Manager has been nixed on Snow Leopard
|
||||
// Methods for interfacing with the Carbon Scrap Manager (analogous to and
|
||||
// interoperable with the Cocoa Pasteboard).
|
||||
|
||||
@@ -1573,4 +1574,4 @@ enum {
|
||||
|
||||
@end
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -40,6 +40,65 @@
|
||||
Sparkle supports updates in zip, tar, tbz, tgz, or dmg format.
|
||||
-->
|
||||
|
||||
<item>
|
||||
<title>Snapshot 49 released</title>
|
||||
<description><![CDATA[
|
||||
<h1>MacVim snapshot 49 released</h1>
|
||||
|
||||
<p> Changes since snapshot 47:
|
||||
<ul>
|
||||
<li> ATSUI clips text to display cell to avoid "bleeding" </li>
|
||||
<li> The pwd is set properly when dropping a folder on the Dock </li>
|
||||
<li> Add Vimball (.vba) as a supported filetype </li>
|
||||
<li> Refactored input code (e.g. can now bind to numeric keypad) </li>
|
||||
<li> Improved IM support (separate keyboard layouts in normal/insert modes using the 'noimd' option, see ":h macvim-international") </li>
|
||||
<li> Draw marked text inline (listed as +xim in ":ver") </li>
|
||||
<li> Add user default MMUseInlineIm (use to disable above feature) </li>
|
||||
<li> Update Vim source and runtime files </li>
|
||||
</ul>
|
||||
</p>
|
||||
]]></description>
|
||||
<pubDate>Sun, 16 Aug 2009 01:17 CET</pubDate>
|
||||
<enclosure type="application/octet-stream"
|
||||
url="http://newmacvim.muskokamug.org/mirror/files/MacVim-snapshot-49.tbz"
|
||||
length="8212194"
|
||||
sparkle:version="49"
|
||||
sparkle:shortVersionString="7.2"
|
||||
/>
|
||||
</item>
|
||||
|
||||
|
||||
<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[
|
||||
|
||||
+6
-1
@@ -1,10 +1,15 @@
|
||||
" System vimrc file for MacVim
|
||||
"
|
||||
" Maintainer: Bjorn Winckler <bjorn.winckler@gmail.com>
|
||||
" Last Change: Sun May 25 2008
|
||||
" Last Change: Sat Aug 29 2009
|
||||
|
||||
set nocompatible
|
||||
|
||||
" The default for 'backspace' is very confusing to new users, so change it to a
|
||||
" more sensible value. Add "set backspace&" to your ~/.vimrc to reset it.
|
||||
set backspace+=indent,eol,start
|
||||
|
||||
" Disable localized menus for now since only some items are translated (e.g.
|
||||
" the entire MacVim menu is set up in a nib file which currently only is
|
||||
" translated to English).
|
||||
set langmenu=none
|
||||
|
||||
+31
-1
@@ -212,13 +212,34 @@ ifndef MZSCHEME_VER
|
||||
MZSCHEME_VER = 209_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 (yes, $(DYNAMIC_MZSCHEME))
|
||||
DEFINES += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"libmzsch$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
|
||||
else
|
||||
ifndef MZSCHEME_DLLS
|
||||
MZSCHEME_DLLS = $(MZSCHEME)
|
||||
endif
|
||||
EXTRA_LIBS += -L$(MZSCHEME_DLLS) -lmzsch$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
|
||||
ifeq (yes,$(MZSCHEME_PRECISE_GC))
|
||||
MZSCHEME_LIB=-lmzsch$(MZSCHEME_VER)
|
||||
else
|
||||
MZSCHEME_LIB = -lmzsch$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
|
||||
endif
|
||||
EXTRA_LIBS += -L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)/lib $(MZSCHEME_LIB)
|
||||
endif
|
||||
ifeq (yes,$(MZSCHEME_GENERATE_BASE))
|
||||
DEFINES += -DINCLUDE_MZSCHEME_BASE
|
||||
MZ_EXTRA_DEP += mzscheme_base.c
|
||||
endif
|
||||
ifeq (yes,$(MZSCHEME_PRECISE_GC))
|
||||
DEFINES += -DMZ_PRECISE_GC
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -472,6 +493,9 @@ clean:
|
||||
-$(DEL) $(EXE) vimrun.exe install.exe uninstal.exe
|
||||
ifdef PERL
|
||||
-$(DEL) if_perl.c
|
||||
endif
|
||||
ifdef MZSCHEME
|
||||
-$(DEL) mzscheme_base.c
|
||||
endif
|
||||
-$(DEL) pathdef.c
|
||||
$(MAKE) -C xxd -f Make_cyg.mak clean
|
||||
@@ -523,9 +547,15 @@ endif
|
||||
$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_DEP)
|
||||
$(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
|
||||
|
||||
$(OUTDIR)/vimrc.o: vim.rc version.h gui_w32_rc.h
|
||||
$(RC) $(RCFLAGS) vim.rc -o $(OUTDIR)/vimrc.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
|
||||
|
||||
+30
-1
@@ -115,14 +115,27 @@ 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
|
||||
MZSCHEME_DLLS=$(MZSCHEME)
|
||||
endif
|
||||
MZSCHEME_LIBDIR=-L$(MZSCHEME_DLLS)
|
||||
MZSCHEME_LIBDIR=-L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)\lib
|
||||
endif
|
||||
|
||||
endif
|
||||
@@ -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
|
||||
@@ -542,6 +562,9 @@ clean:
|
||||
-$(DEL) pathdef.c
|
||||
ifdef PERL
|
||||
-$(DEL) if_perl.c
|
||||
endif
|
||||
ifdef MZSCHEME
|
||||
-$(DEL) mzscheme_base.c
|
||||
endif
|
||||
$(MAKE) -C GvimExt -f Make_ming.mak clean
|
||||
$(MAKE) -C xxd -f Make_cyg.mak clean
|
||||
@@ -588,6 +611,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
|
||||
|
||||
+38
-9
@@ -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
|
||||
@@ -839,6 +865,7 @@ clean:
|
||||
- if exist dimm_i.c del dimm_i.c
|
||||
- if exist dimm.tlb del dimm.tlb
|
||||
- if exist dosinst.exe del dosinst.exe
|
||||
- if exist mzscheme_base.c del mzscheme_base.c
|
||||
cd xxd
|
||||
$(MAKE) /NOLOGO -f Make_mvc.mak clean
|
||||
cd ..
|
||||
@@ -930,9 +957,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 +1041,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
|
||||
|
||||
|
||||
+46
-17
@@ -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.
|
||||
@@ -1246,7 +1257,7 @@ MACVIMGUI_SRC = gui.c MacVim/gui_macvim.m MacVim/MMBackend.m \
|
||||
MACVIMGUI_OBJ = objects/gui.o objects/pty.o objects/gui_macvim.o \
|
||||
objects/MMBackend.o objects/MacVim.o
|
||||
MACVIMGUI_DEFS = -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe
|
||||
MACVIMGUI_IPATH = -I. -Iproto
|
||||
MACVIMGUI_IPATH =
|
||||
MACVIMGUI_LIBS_DIR =
|
||||
MACVIMGUI_LIBS1 = -framework Cocoa -framework Carbon
|
||||
MACVIMGUI_LIBS2 =
|
||||
@@ -1254,7 +1265,7 @@ MACVIMGUI_INSTALL = install_normal
|
||||
MACVIMGUI_TARGETS =
|
||||
MACVIMGUI_MAN_TARGETS =
|
||||
MACVIMGUI_TESTTARGET = gui
|
||||
MACVIMGUI_BUNDLE =
|
||||
MACVIMGUI_BUNDLE = macvim
|
||||
|
||||
# All GUI files
|
||||
ALL_GUI_SRC = gui.c gui_gtk.c gui_gtk_f.c gui_motif.c gui_xmdlg.c gui_xmebw.c gui_athena.c gui_gtk_x11.c gui_x11.c gui_at_sb.c gui_at_fs.c pty.c
|
||||
@@ -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)
|
||||
@@ -2198,11 +2211,12 @@ uninstall_runtime:
|
||||
|
||||
# Clean up all the files that have been produced, except configure's.
|
||||
# We support common typing mistakes for Juergen! :-)
|
||||
clean celan: testclean
|
||||
clean celan: testclean macvimclean
|
||||
-rm -f *.o objects/* core $(VIMTARGET).core $(VIMTARGET) vim xxd/*.o
|
||||
-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
|
||||
@@ -2669,6 +2686,18 @@ $(APPDIR)/Contents:
|
||||
-$(SHELL) ./mkinstalldirs $(RESDIR)/English.lproj
|
||||
|
||||
|
||||
##############################################################################
|
||||
### MacVim GUI
|
||||
.PHONY: macvim macvimclean
|
||||
macvim: $(VIMTARGET)
|
||||
xcodebuild -project MacVim/MacVim.xcodeproj $(XCODEFLAGS)
|
||||
|
||||
macvimclean:
|
||||
if test -d MacVim; then \
|
||||
xcodebuild -project MacVim/MacVim.xcodeproj clean; \
|
||||
fi
|
||||
|
||||
|
||||
###############################################################################
|
||||
### (automatically generated by 'make depend')
|
||||
### Dependencies:
|
||||
|
||||
+171
-154
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
//
|
||||
|
||||
@@ -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
|
||||
|
||||
Vendored
+3759
-4114
File diff suppressed because it is too large
Load Diff
+65
-62
@@ -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;
|
||||
|
||||
+20
-14
@@ -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;
|
||||
|
||||
@@ -174,6 +174,11 @@ buf_init_chartab(buf, global)
|
||||
if (VIM_ISDIGIT(*p))
|
||||
c = getdigits(&p);
|
||||
else
|
||||
#ifdef FEAT_MBYTE
|
||||
if (has_mbyte)
|
||||
c = mb_ptr2char_adv(&p);
|
||||
else
|
||||
#endif
|
||||
c = *p++;
|
||||
c2 = -1;
|
||||
if (*p == '-' && p[1] != NUL)
|
||||
@@ -664,7 +669,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 +679,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 +889,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 +1031,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 +1094,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,19 +1205,21 @@ 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);
|
||||
if (width2 <= 0)
|
||||
return FALSE;
|
||||
return ((vcol - width1) % width2 == width2 - 1);
|
||||
}
|
||||
#endif /* FEAT_MBYTE */
|
||||
@@ -1396,13 +1402,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
|
||||
|
||||
@@ -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().
|
||||
|
||||
@@ -21,6 +21,7 @@ CC = @CC@
|
||||
DEFS = @DEFS@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
XCODEFLAGS = @XCODEFLAGS@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
@@ -41,6 +42,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@
|
||||
|
||||
Vendored
+7597
-6598
File diff suppressed because it is too large
Load Diff
+203
-93
@@ -111,56 +111,65 @@ if test "`(uname) 2>/dev/null`" = Darwin; then
|
||||
AC_MSG_RESULT([yes, Darwin support excluded])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(--with-mac-arch argument)
|
||||
AC_ARG_WITH(mac-arch, [ --with-mac-arch=ARCH current, intel, ppc or both],
|
||||
MACARCH="$withval"; AC_MSG_RESULT($MACARCH),
|
||||
MACARCH="current"; AC_MSG_RESULT(defaulting to $MACARCH))
|
||||
|
||||
if test "x$MACARCH" = "xboth"; then
|
||||
AC_MSG_CHECKING(for 10.4 universal SDK)
|
||||
dnl There is a terrible inconsistency (but we appear to get away with it):
|
||||
dnl $CFLAGS uses the 10.4u SDK library for the headers, while $CPPFLAGS
|
||||
dnl doesn't, because "gcc -E" doesn't grok it. That means the configure
|
||||
dnl tests using the preprocessor are actually done with the wrong header
|
||||
dnl files. $LDFLAGS is set at the end, because configure uses it together
|
||||
dnl with $CFLAGS and we can only have one -sysroot argument.
|
||||
save_cppflags="$CPPFLAGS"
|
||||
AC_MSG_CHECKING(--with-macsdk argument)
|
||||
AC_ARG_WITH(macsdk,
|
||||
[ --with-macsdk=SDK SDK version (10.4, 10.5, 10.6, ...)],
|
||||
[ MACSDK="$withval"; AC_MSG_RESULT($MACSDK) ],
|
||||
[ MACSDK=""; AC_MSG_RESULT(using default) ])
|
||||
|
||||
if test -n "$MACSDK"; then
|
||||
AC_MSG_CHECKING(if SDK is supported)
|
||||
save_cflags="$CFLAGS"
|
||||
save_ldflags="$LDFLAGS"
|
||||
CFLAGS="$CFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
|
||||
sdkflags="/Developer/SDKs/MacOSX$MACSDK"
|
||||
if test "x$MACSDK" = "x10.4"; then
|
||||
sdkflags="$sdkflags""u"
|
||||
fi
|
||||
sdkflags="$sdkflags.sdk -mmacosx-version-min=$MACSDK"
|
||||
CFLAGS="$CFLAGS -isysroot $sdkflags"
|
||||
LDFLAGS="$LDFLAGS -Wl,-syslibroot,$sdkflags"
|
||||
AC_TRY_LINK([ ], [ ],
|
||||
AC_MSG_RESULT(found, will make universal binary),
|
||||
|
||||
AC_MSG_RESULT(not found)
|
||||
CFLAGS="$save_cflags"
|
||||
AC_MSG_CHECKING(if Intel architecture is supported)
|
||||
CPPFLAGS="$CPPFLAGS -arch i386"
|
||||
LDFLAGS="$save_ldflags -arch i386"
|
||||
AC_TRY_LINK([ ], [ ],
|
||||
AC_MSG_RESULT(yes); MACARCH="intel",
|
||||
AC_MSG_RESULT(no, using PowerPC)
|
||||
MACARCH="ppc"
|
||||
CPPFLAGS="$save_cppflags -arch ppc"
|
||||
LDFLAGS="$save_ldflags -arch ppc"))
|
||||
elif test "x$MACARCH" = "xintel"; then
|
||||
CPPFLAGS="$CPPFLAGS -arch intel"
|
||||
LDFLAGS="$LDFLAGS -arch intel"
|
||||
elif test "x$MACARCH" = "xppc"; then
|
||||
CPPFLAGS="$CPPFLAGS -arch ppc"
|
||||
LDFLAGS="$LDFLAGS -arch ppc"
|
||||
[ AC_MSG_RESULT([yes])
|
||||
XCODEFLAGS="$XCODEFLAGS -sdk macosx$MACSDK MACOSX_DEPLOYMENT_TARGET=$MACSDK" ],
|
||||
[ AC_MSG_RESULT([no])
|
||||
dnl Important to clear MACSDK so later on in the script we can assume
|
||||
dnl that no SDK was chosen if it is empty.
|
||||
MACSDK=""
|
||||
CFLAGS="$save_cflags"
|
||||
LDFLAGS="$save_ldflags" ])
|
||||
fi
|
||||
|
||||
|
||||
AC_MSG_CHECKING(--with-macarchs argument)
|
||||
AC_ARG_WITH(macarchs,
|
||||
[ --with-macarchs=ARCHS space separated list of archs (i386 x86_64 ppc ...)],
|
||||
[ ARCHS="$withval"; AC_MSG_RESULT($ARCHS) ],
|
||||
[ ARCHS=""; AC_MSG_RESULT(defaulting to native arch) ])
|
||||
|
||||
if test -n "$ARCHS"; then
|
||||
AC_MSG_CHECKING(if architectures are supported)
|
||||
save_cflags="$CFLAGS"
|
||||
save_ldflags="$LDFLAGS"
|
||||
archflags=`echo "$ARCHS" | sed -e 's/[[[:<:]]]/-arch /g'`
|
||||
CFLAGS="$CFLAGS $archflags"
|
||||
LDFLAGS="$LDFLAGS $archflags"
|
||||
AC_TRY_LINK([ ], [ ],
|
||||
[ AC_MSG_RESULT([yes])
|
||||
XCODEFLAGS="$XCODEFLAGS ARCHS=\"$ARCHS\" ONLY_ACTIVE_ARCH=\"NO\"" ],
|
||||
[ AC_MSG_RESULT([no, will build for native arch only])
|
||||
ARCHS=""
|
||||
CFLAGS="$save_cflags"
|
||||
LDFLAGS="$save_ldflags" ])
|
||||
fi
|
||||
|
||||
|
||||
if test "$enable_darwin" = "yes"; then
|
||||
MACOSX=yes
|
||||
OS_EXTRA_SRC="os_macosx.c os_mac_conv.c";
|
||||
OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o"
|
||||
dnl TODO: use -arch i386 on Intel machines
|
||||
CPPFLAGS="$CPPFLAGS -DMACOS_X_UNIX -no-cpp-precomp"
|
||||
if test "x$MACARCH" = "xboth"; then
|
||||
CPPFLAGS="$CPPFLAGS -I/Developer/SDKs/MacOSX10.4u.sdk/Developer/Headers/FlatCarbon"
|
||||
else
|
||||
CPPFLAGS="$CPPFLAGS -I/Developer/Headers/FlatCarbon"
|
||||
fi
|
||||
|
||||
dnl If Carbon or Cocoa is found, assume we don't want
|
||||
dnl X11 unless it was specifically asked for (--with-x)
|
||||
@@ -181,14 +190,6 @@ if test "`(uname) 2>/dev/null`" = Darwin; then
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Avoid a bug with -O2 with gcc 4.0.1. Symptom: malloc() reports double
|
||||
dnl free. This happens in expand_filename(), because the optimizer swaps
|
||||
dnl two blocks of code, both using "repl", that can't be swapped.
|
||||
if test "$MACARCH" = "intel" -o "$MACARCH" = "both"; then
|
||||
CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-Oz/'`
|
||||
fi
|
||||
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
@@ -423,7 +424,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 +440,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 +458,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 +483,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 +526,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
|
||||
|
||||
|
||||
@@ -551,6 +579,14 @@ if test "$enable_perlinterp" = "yes"; then
|
||||
perlldflags=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed \
|
||||
-e 'ccdlflags' | sed -e 's/-bE:perl.exp//'`
|
||||
|
||||
if test "x$MACOSX" = "xyes"; then
|
||||
dnl Perl on Mac OS X 10.5 and later adds "-arch" flags but these
|
||||
dnl should only be included if requested by passing --with-archs
|
||||
dnl to configure, so strip these flags first (if present)
|
||||
perllibs=`echo "$perllibs" | sed -e 's/-arch[[^-]]*//g'`
|
||||
perlcppflags=`echo "$perlcppflags" | sed -e 's/-arch[[^-]]*//g'`
|
||||
fi
|
||||
|
||||
dnl check that compiling a simple program still works with the flags
|
||||
dnl added for Perl.
|
||||
AC_MSG_CHECKING([if compile and link flags for Perl are sane])
|
||||
@@ -764,6 +800,16 @@ eof
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
dnl On Mac OS X, when an SDK has been explicitly chosen we can't rely
|
||||
dnl on any of the search paths set above. The -framework flag does it
|
||||
dnl all for us.
|
||||
if test -n "$MACSDK"; then
|
||||
PYTHON_CFLAGS=
|
||||
PYTHON_LIBS=-framework Python
|
||||
PYTHON_CONFDIR=
|
||||
PYTHON_GETPATH_CFLAGS=
|
||||
fi
|
||||
|
||||
dnl check that compiling a simple program still works with the flags
|
||||
dnl added for Python.
|
||||
AC_MSG_CHECKING([if compile and link flags for Python are sane])
|
||||
@@ -951,7 +997,11 @@ if test "$enable_rubyinterp" = "yes"; then
|
||||
librubyarg="$rubyhdrdir/$librubyarg"
|
||||
else
|
||||
rubylibdir=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["libdir"]])'`
|
||||
if test -f "$rubylibdir/$librubyarg"; then
|
||||
if test -d "/System/Library/Frameworks/Ruby.framework"; then
|
||||
dnl On Mac OS X it is safer to just use the -framework flag
|
||||
RUBY_LIBS="-framework Ruby"
|
||||
librubyarg=
|
||||
elif test -f "$rubylibdir/$librubyarg"; then
|
||||
librubyarg="$rubylibdir/$librubyarg"
|
||||
elif test "$librubyarg" = "libruby.a"; then
|
||||
dnl required on Mac OS 10.3 where libruby.a doesn't exist
|
||||
@@ -965,12 +1015,27 @@ if test "$enable_rubyinterp" = "yes"; then
|
||||
RUBY_LIBS="$librubyarg $RUBY_LIBS"
|
||||
fi
|
||||
rubyldflags=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LDFLAGS"]]'`
|
||||
if test "X$rubyldflags" != "X"; then
|
||||
LDFLAGS="$rubyldflags $LDFLAGS"
|
||||
if test "x$MACOSX" = "xyes"; then
|
||||
dnl Ruby on Mac OS X 10.5 and later adds "-arch" flags but these
|
||||
dnl should only be included if requested by passing --with-archs
|
||||
dnl to configure, so strip these flags first (if present)
|
||||
rubyldflags=`echo "$rubyldflags" | sed -e 's/-arch[[^-]]*//g'`
|
||||
fi
|
||||
if test "X$rubyldflags" != "X"; then
|
||||
LDFLAGS="$rubyldflags $LDFLAGS"
|
||||
fi
|
||||
RUBY_SRC="if_ruby.c"
|
||||
RUBY_OBJ="objects/if_ruby.o"
|
||||
RUBY_PRO="if_ruby.pro"
|
||||
|
||||
dnl On Mac OS X, when an SDK has been explicitly chosen we can't rely
|
||||
dnl on any of the search paths set above. The -framework flag does it
|
||||
dnl all for us.
|
||||
if test -n "$MACSDK"; then
|
||||
RUBY_CFLAGS=
|
||||
RUBY_LIBS="-framework Ruby"
|
||||
fi
|
||||
|
||||
AC_DEFINE(FEAT_RUBY)
|
||||
else
|
||||
AC_MSG_RESULT(not found, disabling Ruby)
|
||||
@@ -1202,6 +1267,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
|
||||
|
||||
@@ -1377,7 +1464,7 @@ fi
|
||||
if test "x$SKIP_MACVIM" != "xYES" -a "$enable_gui_canon" != "macvim"; then
|
||||
AC_MSG_CHECKING(whether or not to look for MacVim)
|
||||
AC_ARG_ENABLE(macvim-check,
|
||||
[ --enable-macvim-check If auto-select GUI, check for MacVim [default=yes]],
|
||||
[ --enable-macvim-check If auto-select GUI, check for MacVim [default=yes]],
|
||||
, enable_macvim_check="yes")
|
||||
AC_MSG_RESULT($enable_macvim_check);
|
||||
if test "x$enable_macvim_check" = "xno"; then
|
||||
@@ -1386,29 +1473,32 @@ if test "x$SKIP_MACVIM" != "xYES" -a "$enable_gui_canon" != "macvim"; then
|
||||
fi
|
||||
|
||||
if test "x$MACOSX" = "xyes"; then
|
||||
if test -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then
|
||||
AC_MSG_CHECKING(for Carbon GUI)
|
||||
dnl already did the check, just give the message
|
||||
AC_MSG_RESULT(yes);
|
||||
GUITYPE=CARBONGUI
|
||||
elif test -z "$SKIP_MACVIM" -a "x$COCOA" = "xyes"; then
|
||||
AC_MSG_CHECKING(for MacVim GUI)
|
||||
dnl already did the check, just give the message
|
||||
AC_MSG_RESULT(yes);
|
||||
GUITYPE=MACVIMGUI
|
||||
fi
|
||||
|
||||
if test "$VIMNAME" = "vim"; then
|
||||
VIMNAME=Vim
|
||||
fi
|
||||
|
||||
dnl Default install directory is not /usr/local
|
||||
if test x$prefix = xNONE; then
|
||||
prefix=/Applications
|
||||
fi
|
||||
|
||||
dnl Sorry for the hard coded default
|
||||
datadir='${prefix}/Vim.app/Contents/Resources'
|
||||
if test -z "$SKIP_MACVIM" -a "x$COCOA" = "xyes"; then
|
||||
AC_MSG_CHECKING(for MacVim GUI)
|
||||
dnl already did the check, just give the message
|
||||
AC_MSG_RESULT(yes);
|
||||
GUITYPE=MACVIMGUI
|
||||
dnl Sorry for the hard coded default
|
||||
datadir='${prefix}/MacVim.app/Contents/Resources'
|
||||
elif test -z "$SKIP_CARBON" -a "x$CARBON" = "xyes"; then
|
||||
AC_MSG_CHECKING(for Carbon GUI)
|
||||
dnl already did the check, just give the message
|
||||
AC_MSG_RESULT(yes);
|
||||
GUITYPE=CARBONGUI
|
||||
dnl Sorry for the hard coded default
|
||||
datadir='${prefix}/Vim.app/Contents/Resources'
|
||||
|
||||
CPPFLAGS="$CPPFLAGS -I/Developer/Headers/FlatCarbon"
|
||||
fi
|
||||
|
||||
if test "$VIMNAME" = "vim"; then
|
||||
VIMNAME=Vim
|
||||
fi
|
||||
|
||||
dnl skip everything else
|
||||
SKIP_GTK=YES;
|
||||
@@ -2103,6 +2193,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 +2226,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 +2234,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 +3007,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 +3088,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 +3104,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 +3116,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"
|
||||
@@ -3180,10 +3281,19 @@ if test "x$MACOSX" = "xyes" && test "x$CARBON" = "xyes" \
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
if test "x$MACARCH" = "xboth"; then
|
||||
LDFLAGS="$LDFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
|
||||
|
||||
if test "x$MACOSX" = "xyes"; then
|
||||
AC_MSG_CHECKING(--with-xcodecfg argument)
|
||||
AC_ARG_WITH(xcodecfg,
|
||||
[ --with-xcodecfg=CFG Debug, Release (default: Release)],
|
||||
[ XCODEFLAGS="$XCODEFLAGS -configuration $withval"
|
||||
AC_MSG_RESULT($withval) ],
|
||||
[ AC_MSG_RESULT(using default) ])
|
||||
|
||||
AC_SUBST(XCODEFLAGS)
|
||||
fi
|
||||
|
||||
|
||||
dnl gcc 3.1 changed the meaning of -MM. The only solution appears to be to
|
||||
dnl use "-isystem" instead of "-I" for all non-Vim include dirs.
|
||||
dnl But only when making dependencies, cproto and lint don't take "-isystem".
|
||||
@@ -3203,7 +3313,7 @@ if test "$GCC" = yes; then
|
||||
dnl declared as char x[1] but actually longer. Introduced in gcc 4.0.
|
||||
AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
|
||||
if test "$gccmajor" -gt "3"; then
|
||||
CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1"
|
||||
CFLAGS=`echo "$CFLAGS -D_FORTIFY_SOURCE=1" | sed -e 's/-Wp,-D_FORTIFY_SOURCE=2//g' -e 's/-D_FORTIFY_SOURCE=2//g'`
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
|
||||
+48
-37
@@ -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
|
||||
@@ -891,6 +893,7 @@ ex_diffpatch(eap)
|
||||
char_u *browseFile = NULL;
|
||||
int browse_flag = cmdmod.browse;
|
||||
#endif
|
||||
struct stat st;
|
||||
|
||||
#ifdef FEAT_BROWSE
|
||||
if (cmdmod.browse)
|
||||
@@ -920,11 +923,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 +965,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
|
||||
@@ -995,44 +1000,51 @@ ex_diffpatch(eap)
|
||||
STRCAT(buf, ".rej");
|
||||
mch_remove(buf);
|
||||
|
||||
if (curbuf->b_fname != NULL)
|
||||
/* Only continue if the output file was created. */
|
||||
if (mch_stat((char *)tmp_new, &st) < 0 || st.st_size == 0)
|
||||
EMSG(_("E816: Cannot read patch output"));
|
||||
else
|
||||
{
|
||||
newname = vim_strnsave(curbuf->b_fname,
|
||||
if (curbuf->b_fname != NULL)
|
||||
{
|
||||
newname = vim_strnsave(curbuf->b_fname,
|
||||
(int)(STRLEN(curbuf->b_fname) + 4));
|
||||
if (newname != NULL)
|
||||
STRCAT(newname, ".new");
|
||||
}
|
||||
if (newname != NULL)
|
||||
STRCAT(newname, ".new");
|
||||
}
|
||||
|
||||
#ifdef FEAT_GUI
|
||||
need_mouse_correct = TRUE;
|
||||
need_mouse_correct = TRUE;
|
||||
#endif
|
||||
/* don't use a new tab page, each tab page has its own diffs */
|
||||
cmdmod.tab = 0;
|
||||
/* don't use a new tab page, each tab page has its own diffs */
|
||||
cmdmod.tab = 0;
|
||||
|
||||
if (win_split(0, (diff_flags & DIFF_VERTICAL) ? WSP_VERT : 0) != FAIL)
|
||||
{
|
||||
/* Pretend it was a ":split fname" command */
|
||||
eap->cmdidx = CMD_split;
|
||||
eap->arg = tmp_new;
|
||||
do_exedit(eap, old_curwin);
|
||||
|
||||
if (curwin != old_curwin) /* split must have worked */
|
||||
if (win_split(0, (diff_flags & DIFF_VERTICAL) ? WSP_VERT : 0) != FAIL)
|
||||
{
|
||||
/* Set 'diff', 'scrollbind' on and 'wrap' off. */
|
||||
diff_win_options(curwin, TRUE);
|
||||
diff_win_options(old_curwin, TRUE);
|
||||
/* Pretend it was a ":split fname" command */
|
||||
eap->cmdidx = CMD_split;
|
||||
eap->arg = tmp_new;
|
||||
do_exedit(eap, old_curwin);
|
||||
|
||||
if (newname != NULL)
|
||||
/* check that split worked and editing tmp_new */
|
||||
if (curwin != old_curwin && win_valid(old_curwin))
|
||||
{
|
||||
/* do a ":file filename.new" on the patched buffer */
|
||||
eap->arg = newname;
|
||||
ex_file(eap);
|
||||
/* Set 'diff', 'scrollbind' on and 'wrap' off. */
|
||||
diff_win_options(curwin, TRUE);
|
||||
diff_win_options(old_curwin, TRUE);
|
||||
|
||||
if (newname != NULL)
|
||||
{
|
||||
/* do a ":file filename.new" on the patched buffer */
|
||||
eap->arg = newname;
|
||||
ex_file(eap);
|
||||
|
||||
#ifdef FEAT_AUTOCMD
|
||||
/* Do filetype detection with the new name. */
|
||||
if (au_has_group((char_u *)"filetypedetect"))
|
||||
do_cmdline_cmd((char_u *)":doau filetypedetect BufRead");
|
||||
/* Do filetype detection with the new name. */
|
||||
if (au_has_group((char_u *)"filetypedetect"))
|
||||
do_cmdline_cmd((char_u *)":doau filetypedetect BufRead");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1089,10 +1101,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
@@ -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);
|
||||
|
||||
+70
-56
@@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -8887,7 +8898,7 @@ ins_left()
|
||||
tpos = curwin->w_cursor;
|
||||
if (oneleft() == OK)
|
||||
{
|
||||
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
|
||||
#if defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM))
|
||||
/* Only call start_arrow() when not busy with preediting, it will
|
||||
* break undo. K_LEFT is inserted in im_correct_cursor(). */
|
||||
if (!im_is_preediting())
|
||||
@@ -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);
|
||||
|
||||
+223
-292
File diff suppressed because it is too large
Load Diff
+274
-71
@@ -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(®match,
|
||||
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)
|
||||
|
||||
+3
-1
@@ -598,7 +598,7 @@ EX(CMD_match, "match", ex_match,
|
||||
EX(CMD_macaction, "macaction", ex_macaction,
|
||||
EXTRA|NOSPC|NEEDARG),
|
||||
EX(CMD_macmenu, "macmenu", ex_macmenu,
|
||||
EXTRA|TRLBAR|CMDWIN),
|
||||
EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
|
||||
EX(CMD_menu, "menu", ex_menu,
|
||||
RANGE|NOTADR|ZEROR|BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
|
||||
EX(CMD_menutranslate, "menutranslate", ex_menutranslate,
|
||||
@@ -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
@@ -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
@@ -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)
|
||||
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);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user