Compare commits

...

131 Commits

Author SHA1 Message Date
Bjorn Winckler ddd5a2bd4b Snapshot 50 2009-10-10 02:55:31 +02:00
Bjorn Winckler 5bc897df9d Update UTIs in Info.plist
Ideally all org.vim.*-file UTIs should be replaced with proper UTIs, but
they can be hard to find so they will be replaced as new UTIs are found.
2009-10-09 22:23:52 +02:00
Bjorn Winckler 2f3a9d7740 Remove "No connection ..." warning with --remote 2009-10-09 20:38:31 +02:00
Bjorn Winckler 3aaef67b85 Merge upstream
Conflicts:
	src/auto/configure
2009-10-07 16:21:00 +02:00
vimboss 9f957bcd6c updated for version 7.2-267 2009-10-07 14:20:30 +00:00
Bjorn Winckler 9a01753529 Fix wide character support for 64 bit 2009-10-01 21:13:17 +02:00
Bjorn Winckler ac4412ace2 Add missing defines to Tiger
CGFloat and NS[U]Integer were introduced in 10.5, make sure they are
defined when compiling for 10.4.
2009-09-30 23:04:12 +02:00
Bjorn Winckler b712dd06eb Clean Python and Ruby flags when macsdk is set
Most importantly there are no explicit -I.. flags that break the
--with-macsdk functionality.  Also use -framework Ruby and include Ruby
properly.
2009-09-30 21:46:31 +02:00
Bjorn Winckler 8cad670f16 Don't include Carbon.h in os_mac.h
This avoid polluting the global namespace with Carbon symbols (there was
a conflict between Carbon and Ruby both defining "ID").  To accomodate
this the Carbon types OSErr and OSType have been changed to int16_t and
uint32_t, respectively.
2009-09-30 21:42:50 +02:00
Bjorn Winckler fe79caddfa Enable 64 bit compilation (Vim and MacVim)
Note that Sparkle currently is not 64 bit so automatic updating won't
work when MacVim is compiled for 64 bit.
2009-09-30 19:38:06 +02:00
Bjorn Winckler 33c4dd0eef Deprecate mac-arch, superseded by --with-macarchs
Move --with-macarchs and --with-macsdk to an earlier place in the
configure script.  The flag --with-macsdk is now enabled but it should
also set the MACOSX_DEPLOYMENT_TARGET environment variable (how?).
2009-09-30 15:21:32 +02:00
vimboss d5365574cc updated for version 7.2-266 2009-09-30 13:17:02 +00:00
Bjorn Winckler 615d7dd609 Remove unnecessary include paths in Makefile 2009-09-30 13:30:10 +02:00
vimboss e411119903 updated for version 7.2-265 2009-09-30 11:24:36 +00:00
Bjorn Winckler 1ab1bec908 Strip all -arch flags from Perl and Ruby
The system provided Perl and Ruby libraries adds -arch flags since they
were built as universal binaries.  This causes Vim to build with these
flags which is undesirable (the default should be to only build for the
native architecture).  The solution is to strip any -arch flags from
Perl and Ruby.

A universal binary can be built by using the --with-archs configure
flag.
2009-09-30 10:19:06 +02:00
Bjorn Winckler 770796042e Fix 64 bit compilation warnings in backend 2009-09-29 23:31:32 +02:00
Bjorn Winckler f5a8f4f083 Clean up Carbon includes
Don't use FlatCarbon when building MacVim (only for Carbon GUI).
2009-09-29 23:12:26 +02:00
Bjorn Winckler c36f69c013 Add --with-macsdk flag to configure
Compilation fails for some reason, so this option is disabled.
2009-09-29 22:39:29 +02:00
Bjorn Winckler b05db8d377 Add --with-xcodecfg configure flag 2009-09-29 21:32:00 +02:00
Bjorn Winckler b262a38339 Add --with-archs configure flag 2009-09-29 20:17:38 +02:00
Bjorn Winckler 3b2784e277 Use MacVim instead of Carbon GUI by default 2009-09-29 18:35:16 +02:00
Bjorn Winckler 04a6eb68d0 Build xcode project from Makefile 2009-09-29 03:02:30 +02:00
Bjorn Winckler 25d39a282a Remove Universal configuration from 'Edit in ...' 2009-09-29 02:23:29 +02:00
Bjorn Winckler fdd9622c00 Force 32 bit, remove Universal configuration
The Sparkle framework does not include a 64 bit binary, so force 32 bit
until it is updated.
2009-09-28 22:58:33 +02:00
Bjorn Winckler be45005f25 Prepare for 64 bit
Mostly fixes problems involving NSUInteger.
2009-09-28 22:55:16 +02:00
Bjorn Winckler 281f280eb1 Disable MacVim plugins for now
The supporting files for CTGradient and RBSplitView causes several
warnings when compiling for 64 bit.  Since nobody uses MacVim plugins
I have decided to disable them instead of having to support these files
(although these warnings are easy enough to fix for anybody interested).
2009-09-28 21:26:39 +02:00
Bjorn Winckler 9c1037f556 Prepare PSMTabBarControl for 64 bit
Change unsigned -> NSUInteger, float -> CGFloat as necessary.
2009-09-28 19:44:13 +02:00
Bjorn Winckler 2b77fe974e Don't pass 'long' vars over process boundary
The only place 'long' was used was in scrollbar identifiers.  These are
now "truncated" to fit inside 32 bit (when compiling for 64 bit).
2009-09-27 21:52:06 +02:00
Bjorn Winckler fc05fb5e3e Strip x86_64 arch from Ruby LDFLAGS 2009-09-25 19:08:58 +02:00
Nicolas Weber b7b4e364c4 Really fix icon generation on Snow Leopard 2009-09-24 00:50:18 -07:00
vimboss ed55437203 updated for version 7.2-264 2009-09-23 16:14:49 +00:00
vimboss b07059a739 updated for version 7.2-263 2009-09-23 15:35:48 +00:00
Bjorn Winckler 00a63422ca Update help file 2009-09-23 13:28:05 +02:00
Bjorn Winckler a3bc1d1a86 Fix typo in help file 2009-09-20 14:46:06 +02:00
Bjorn Winckler 629eb02403 Fix Ctrl-C handling
This fixes a bug where mappings to e.g. <C-c>g would fail.
2009-09-18 19:24:11 +02:00
vimboss a81d84df1f updated for version 7.2-262 2009-09-18 15:25:52 +00:00
vimboss 19314f214b updated for version 7.2-261 2009-09-18 13:17:09 +00:00
vimboss baeec8addc updated for version 7.2-260 2009-09-18 12:59:26 +00:00
vimboss 49c9e43d59 updated for version 7.2-259 2009-09-11 15:24:31 +00:00
vimboss 0b5eab9c89 updated for version 7.2-258 2009-09-11 14:48:27 +00:00
vimboss 49a5d8fbab updated for version 7.2-257 2009-09-11 14:17:54 +00:00
vimboss 5f972f11ac updated for version 7.2-256 2009-09-11 13:46:41 +00:00
vimboss 554448b77f updated for version 7.2-255 2009-09-11 13:20:33 +00:00
vimboss c8d08d3d53 updated for version 7.2-254 2009-09-11 13:04:24 +00:00
vimboss 9539d1240e updated for version 7.2-253 2009-09-11 12:19:51 +00:00
vimboss f6785cd6c8 updated for version 7.2-252 2009-09-11 12:02:34 +00:00
vimboss 2688634afb updated for version 7.2-251 2009-09-11 11:44:54 +00:00
vimboss 2a1aff523b updated for version 7.2-250 2009-09-11 11:26:56 +00:00
vimboss d2d8135617 updated for version 7.2-249 2009-09-11 11:00:05 +00:00
vimboss e33ea64952 updated for version 7.2-248 2009-09-11 10:49:58 +00:00
vimboss 6a36ea9a4f updated for version 7.2-247 2009-09-11 10:21:41 +00:00
vimboss 98d113300f updated for version 7.2-246 2009-09-11 09:30:34 +00:00
Bjorn Winckler 814f3a5ed0 Fix "New Document Here" Service
Expand leading tilde in paths, else NSFileManager thinks the path does
not exists.
2009-09-04 18:23:56 +02:00
Bjorn Winckler 99805e6988 Make Services work on 10.6
Services need a (possibly empty) NSRequiredContext dictionary in the
application's Info.plist on 10.6.
2009-09-04 18:22:44 +02:00
Bjorn Winckler fd2804b9df MAC_OS_X_VERSION_10_6 not defined on pre-10.6
Just use a literal 1060 in header files which do not (and should not)
include MacVim.h.
2009-09-02 21:21:12 +02:00
Bjorn Winckler 6f553b7ad5 Use availability macros correctly
Always use >= when checking lower bounds and < when checking upper
bounds. The problem is that MAC_OS_X_MAX_ALLOWED and
MAC_OS_X_MIN_REQUIRED need not be equal to one of the MAC_OS_X_VERSION_*
macros.  For example, on 10.5.8 MAC_OS_X_VERSION_MAX_ALLOWED is 1058
whereas MAC_OS_X_VERSION_10_5 is 1050.

(Based on a patch by Michael Guntsche.)
2009-09-02 20:07:08 +02:00
Bjorn Winckler 67df700615 Disable the ATSUI renderer on 10.6
ATSUI has been deprecated on 10.6.  As it stands the ATSUI renderer does
not even work and it spews out masses of warnings when building, so
ATSUI is disabled when compiling for 10.6 for now.
2009-09-01 22:43:56 +02:00
Bjorn Winckler ad7da68f84 Fix some Xcode static analyzer warnings
The only relevant complaint was a memory leak when opening files from
Finder.
2009-09-02 00:29:14 +02:00
Bjorn Winckler a396b2f7bf Ensure Vim compiles as 32 bit
The MacVim binary always builds as 32 bit so make sure the Vim binary is
32 bit as well (GCC defaults to 64 bit on Leopard).
2009-09-02 00:26:42 +02:00
Bjorn Winckler bb28facdad Don't use +[NSConnection defaultConnection]
The defaultConnection message was deprecated in 10.6.
2009-09-02 00:03:50 +02:00
Bjorn Winckler 25133f7d03 Avoid compilation warnings on 10.6 2009-09-01 22:42:35 +02:00
Bjorn Winckler 6907a6b43e Declare PSMTabBarControl delegate on 10.6
This avoids a compilation warning, nothing else.
2009-09-01 22:14:12 +02:00
Bjorn Winckler 6a87e8cc02 Fix warning in ODBEditor (10.6) 2009-09-01 22:13:16 +02:00
Bjorn Winckler d04263aee2 Autosave window rows and columns 2009-09-01 22:13:10 +02:00
Nicolas Weber 64d84c49fa Fix icon generation on Snow Leopard
Snow Leopard seems to not support Scrap Manager, so don't use the Scrap
Manager code.
2009-08-30 17:11:42 -07:00
Bjorn Winckler 823ab3d45a Copy Sparkle framework into app bundle
The previous commit accidentally removed the step where the Sparkle
framework got copied into the app bundle.
2009-08-30 21:03:40 +02:00
Bjorn Winckler 2a5bbeead5 Include PSMTabBarControl framework properly 2009-08-30 20:43:33 +02:00
Bjorn Winckler 935ea1a658 Don't use Carbon framework from 10.4u sdk 2009-08-30 20:32:25 +02:00
Bjorn Winckler bf68c50168 Fix warnings in Edit in ODBEditor 2009-08-30 20:31:24 +02:00
Bjorn Winckler 84c844a956 Ignore user files in Edit in ODBEditor framework 2009-08-30 20:15:58 +02:00
Bjorn Winckler 889b7064e3 Build Edit in ODBEditor against current OS version 2009-08-30 20:12:27 +02:00
Bjorn Winckler 7a5e3f51cb Disable prebinding of PSMTabBarControl framework 2009-08-30 20:07:13 +02:00
Bjorn Winckler f03063e1cf Ignore user files in PSMTabBar framework 2009-08-30 20:04:13 +02:00
Bjorn Winckler 32c1d587d8 Fix warnings in PSMTabBarControl 2009-08-30 19:31:44 +02:00
Bjorn Winckler 497535c098 Build PSMTabBar against current OS version 2009-08-30 19:31:43 +02:00
Bjorn Winckler 8624d40d53 Delete user config files from PSMTabBar project 2009-08-30 19:26:48 +02:00
Bjorn Winckler dc8a6b7bec Change runtime fall-back directory 2009-08-30 17:35:30 +02:00
Bjorn Winckler c5d549a4e0 Set $VIM and $VIMRUNTIME early
Otherwise bindtextdomain() gets the wrong runtime path inside
init_locale() causing messages never to be translated.
2009-08-29 22:52:00 +02:00
Bjorn Winckler 3eb0ca1305 Make Find and Replace dialog localizable 2009-08-29 19:27:20 +02:00
Bjorn Winckler 6ab612e357 Disable localized menus in system vimrc
Can be enabled by setting/clearing 'langmenu' in ~/.vimrc.
2009-08-29 18:39:35 +02:00
Bjorn Winckler 16caec3a2b Move menus to menu.vim 2009-08-29 18:30:35 +02:00
Bjorn Winckler 3506261522 Fix handling of built-in toolbar icons
In particular, this patch ensures that built-in toolbar icons are
properly used when menus are translated.
2009-08-29 15:36:07 +02:00
Bjorn Winckler 6cc607a2f4 Disallow comments in :macmenu command
This is necessary, otherwise e.g. Edit.Paste<Tab>"+gP does not parse
properly.
2009-08-29 14:47:46 +02:00
Bjorn Winckler 4894e8fb74 Fix window cascading
Windows always cascade a fixed amount down and right from the topmost
window.  If the window sticks out on the right/bottom then it is moved
as far left/up as possible.
2009-08-28 18:25:32 +02:00
Kazuki Sakamoto a2e0526744 IM enhancements
By the default the keyboard layout matching the current locale is used.
Also fix bug where IM switching got confused after manually changing the
IM with Cmd-Space.  Finally, fix support for Ctrl-^ when IM is enabled
(e.g. this did not previously work with the Kotoeri input manager).
2009-08-28 13:22:06 +09:00
Bjorn Winckler d69e140c24 Avoid race condition (e.g. when closing windows)
The app may become multithreaded e.g. due to the open panel being
displayed.  In this case connectionDidDie notifications may arrive
outside the main thread, possibly leading to windows being closed
simultaneously on multiple threads.  This scenario could happen e.g.
when quitting with multiple windows open.

To avoid this situation performSelectorOnMainThread: is used instead of
performSelector:.
2009-08-27 18:16:44 +02:00
Bjorn Winckler 7cae9e965c Fix Cmd key regression
Shift and Alt modifiers now register in combination with Cmd and e.g.
arrow keys.
2009-08-27 17:41:42 +02:00
Bjorn Winckler 2d7c78f24c Snapshot 49 2009-08-16 01:19:58 +02:00
Bjorn Winckler a8da347a13 Fix Ctrl key regression
Fix Ctrl-h, Ctrl-@ and Ctrl-o regression.  Also remove all key bindings
involving arrays from KeyBinding.dict.
2009-08-16 01:09:02 +02:00
Bjorn Winckler 2e45751630 Fix arrow and function key bug on Tiger
The bug caused arrow (and function) key presses to be sent twice.
2009-08-15 02:49:17 +02:00
Bjorn Winckler 8cd984a56b Snapshot 48 2009-08-15 01:07:26 +02:00
Bjorn Winckler 650cb7ac61 Remove feat/inline-im from README-repo.txt 2009-08-15 00:21:44 +02:00
Bjorn Winckler ae400c2dbb Add user default MMUseInlineIm
Use inline IM (Vim draws marked text) when on, use old IM drawing code
otherwise.
2009-08-09 21:27:30 +02:00
Bjorn Winckler 507a68ef81 Add support for +xim
Inline marked text editing, underline marked text (even on command
line), etc.
2009-08-09 19:12:10 +02:00
Bjorn Winckler 271ef88821 Add rudimentary inline IM support
Not possible to move cursor in marked text.
2009-08-09 19:11:10 +02:00
Bjorn Winckler 9a248b819d Fix compilation errors on Tiger 2009-08-09 18:38:19 +02:00
Bjorn Winckler 6aeca470b5 Don't remember IM source if ASCII
This fixes a bug where the IM source would be forgotten whenever command
line mode was entered (with 'noimd' set).
2009-08-09 02:28:28 +02:00
Bjorn Winckler 936863de98 Add feat/inline-im to README-repo.txt 2009-08-09 02:20:42 +02:00
Bjorn Winckler d96b64262d Delete feat/input from README-repo.txt 2009-08-09 00:01:22 +02:00
Bjorn Winckler 200d3e5957 Only set ASCII IM source when setting 'noimd'
The layout used in normal mode (IM disabled) no longer changes when IM
is disabled.  It only changes when the 'noimd' option is set.
2009-08-08 23:37:29 +02:00
Bjorn Winckler 4ca28fccbd Merge upstream 2009-07-29 18:26:00 +02:00
vimboss 9c08729d42 updated for version 7.2-245 2009-07-29 16:25:31 +00:00
vimboss 8e0d50c1ed updated for version 7.2-244 2009-07-29 16:06:27 +00:00
vimboss 865619bc65 updated for version 7.2-243 2009-07-29 14:24:36 +00:00
vimboss 3b1a4d48f0 updated for version 7.2-242 2009-07-29 13:42:05 +00:00
vimboss 6c124f1604 updated for version 7.2-241 2009-07-29 10:10:29 +00:00
vimboss 44c21d0863 updated for version 7.2-240 2009-07-29 09:11:15 +00:00
Bjorn Winckler ad1b34005d Add note on improved IM support to the help 2009-07-26 17:02:10 +02:00
Bjorn Winckler 107a1cf7cc Improve IM support for 10.5
When using "set noimd" remember which input source was used in normal
mode separately from the input source used in insert mode.  This way it
is possible to e.g. use a US layout in normal mode and a non-US layout
in insert mode.

The input source used in normal mode must be ASCII capable or it won't
be remembered -- any input source used in insert mode is remembered.

On 10.4 the IM code is unchanged because 10.4 does not support the Text
Input Source Services.
2009-07-25 00:25:32 +02:00
Bjorn Winckler cbe2f307b1 Fix numeric key pad support 2009-07-24 12:42:42 +02:00
Bjorn Winckler 5213b783d7 Refactor keyboard input code
This both cleans up the code as well as improve support for binding to
more key combinations.  The Cocoa key bindings system is effectively
disabled; a custom key binding dictionary is set up in KeyBinding.plist
(so that keyboard navigation works in dialogs).
2009-07-23 18:28:34 +02:00
vimboss c6babee370 updated for version 7.2-239 2009-07-22 14:23:13 +00:00
vimboss b4b97fe905 updated for version 7.2-238 2009-07-22 12:28:17 +00:00
Bjorn Winckler cd37d01770 Add Vimball (vba) as supported filetype 2009-07-22 13:51:30 +02:00
vimboss d8b193e98b updated for version 7.2-237 2009-07-22 11:28:11 +00:00
vimboss 629579e8a0 updated for version 7.2-236 2009-07-22 09:17:23 +00:00
vimboss 9d6d075726 updated for version 7.2-235 2009-07-22 09:04:20 +00:00
Bjorn Winckler 7d6909d353 Set right pwd when dropping a folder on Dock icon
The last path component of the folder that was dropped is no longer
disregarded.
2009-07-21 03:34:15 +02:00
Bjorn Winckler b75c36581f ATSUI clips text to avoid bleeding 2009-07-20 20:13:42 +02:00
Bjorn Winckler ae253a2dad Fix typo in README-repo.txt 2009-07-19 00:29:47 +02:00
Bjorn Winckler 21cced3fc6 Add README-repo.txt file
For the "readme" section on the repo web page.  Pandoc is used to
generate the HTML file.
2009-07-18 21:18:39 +02:00
Bjorn Winckler 29745cf124 Snapshot 47 2009-07-16 20:08:56 +02:00
Bjorn Winckler 699de3c049 Change some logging messages 2009-07-16 14:35:27 +02:00
Bjorn Winckler 5560396666 Dialog sheet animation can no longer cause a crash
Explicitly force the sheet animation to be performed before passing the
result of the sheet on to the backend.  Before this patch the animation
was performed asynchronously and this could lead to a Vim controller
being released at the same time as the animation was being performed
since the animation took place in the default run loop mode.
2009-07-15 00:54:08 +02:00
Bjorn Winckler 8570b5df1f Merge upstream 2009-07-14 21:41:00 +02:00
vimboss 7391be3977 updated for version 7.2-234 2009-07-14 19:40:21 +00:00
vimboss 7068f9086c updated for version 7.2-233 2009-07-14 16:38:36 +00:00
vimboss af2e8b9e3b updated for version 7.2-232 2009-07-14 15:38:41 +00:00
vimboss 7d87f83e26 updated for version 7.2-231 2009-07-14 14:04:54 +00:00
vimboss eb6512ab82 updated for version 7.2-230 2009-07-14 11:44:30 +00:00
vimboss c2d5277fc9 updated for version 7.2-229 2009-07-14 10:20:22 +00:00
132 changed files with 14606 additions and 17505 deletions
+6
View File
@@ -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
+8 -1
View File
@@ -441,13 +441,20 @@ between files with almost the same name. If there are multiple matches,
those files with an extension that is in the 'suffixes' option are ignored.
The default is ".bak,~,.o,.h,.info,.swp,.obj", which means that files ending
in ".bak", "~", ".o", ".h", ".info", ".swp" and ".obj" are sometimes ignored.
It is impossible to ignore suffixes with two dots. Examples:
An empty entry, two consecutive commas, match a file name that does not
contain a ".", thus has no suffix. This is useful to ignore "prog" and prefer
"prog.c".
Examples:
pattern: files: match: ~
test* test.c test.h test.o test.c
test* test.h test.o test.h and test.o
test* test.i test.h test.c test.i and test.c
It is impossible to ignore suffixes with two dots.
If there is more than one matching file (after ignoring the ones matching
the 'suffixes' option) the first file name is inserted. You can see that
there is only one match when you type 'wildchar' twice and the completed
+40 -17
View File
@@ -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.
@@ -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.
@@ -581,7 +582,7 @@ Cmd-` Cycle to the next window. On an American keyboard the
keyboards this key is often adjacent to the left
Shift-key and it may be not even be marked with "`".
This Cmd-key combination can only be unmapped via the
"Keyboard & Mouse" System Preferences.
"Keyboard" System Preferences.
*Cmd-Left* *<D-Left>*
Cmd-Left Move cursor to the beginning of the line
@@ -625,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.
@@ -648,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.
@@ -692,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: ~
@@ -745,13 +767,14 @@ 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.
+2 -1
View File
@@ -481,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.
+4
View File
@@ -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:
+4 -3
View File
@@ -3881,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)
+1 -1
View File
@@ -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
+134 -15
View File
@@ -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 :
+3 -1
View File
@@ -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,
+1 -2
View File
@@ -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];
+3
View File
@@ -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
+6 -1
View File
@@ -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;
+78 -35
View File
@@ -1140,6 +1140,7 @@
<string>markdown</string>
<string>markd</string>
<string>mdown</string>
<string>md</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-markdown</string>
@@ -1158,6 +1159,18 @@
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Vimball Archive</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>vba</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-vba</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
@@ -1189,7 +1202,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>46</string>
<string>50</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
@@ -1210,6 +1223,8 @@
<array>
<string>NSStringPboardType</string>
</array>
<key>NSRequiredContext</key>
<dict></dict>
</dict>
<dict>
<key>NSMenuItem</key>
@@ -1227,6 +1242,11 @@
</array>
<key>NSUserData</key>
<string>Window</string>
<key>NSRequiredContext</key>
<dict>
<key>NSTextContent</key>
<string>FilePath</string>
</dict>
</dict>
<dict>
<key>NSMenuItem</key>
@@ -1244,6 +1264,11 @@
</array>
<key>NSUserData</key>
<string>Window</string>
<key>NSRequiredContext</key>
<dict>
<key>NSTextContent</key>
<string>FilePath</string>
</dict>
</dict>
</array>
<key>SUFeedURL</key>
@@ -1252,8 +1277,8 @@
<true/>
<!-- In order for Quick Look to work we must add entries to
UTExportedTypeDeclarations. Instead of trying to come up with
"proper" values for UTTypeIdentifier just use "org.vim.*-file".
UTExportedTypeDeclarations. When possible a "proper" UTI is used,
but in case one could not be found just use "org.vim.*-file".
This array is quite huge and it would be nice to come up with
another way of supporting Quick Look without this.
-->
@@ -1267,7 +1292,7 @@
<key>UTTypeDescription</key>
<string>Vim Script File</string>
<key>UTTypeIdentifier</key>
<string>org.vim.vim-file</string>
<string>org.vim.vim-script</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -1284,7 +1309,7 @@
<key>UTTypeDescription</key>
<string>Plain Text File</string>
<key>UTTypeIdentifier</key>
<string>org.vim.text-file</string>
<string>public.plain-text</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -1325,7 +1350,7 @@
<key>UTTypeDescription</key>
<string>C Header Source File</string>
<key>UTTypeIdentifier</key>
<string>org.vim.h-file</string>
<string>public.c-header</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -1359,7 +1384,7 @@
<key>UTTypeDescription</key>
<string>C++ Header Source File</string>
<key>UTTypeIdentifier</key>
<string>org.vim.hh-file</string>
<string>public.c-plus-plus-header</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -1397,7 +1422,7 @@
<key>UTTypeDescription</key>
<string>C Source File</string>
<key>UTTypeIdentifier</key>
<string>org.vim.c-file</string>
<string>public.c-source</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -1414,7 +1439,7 @@
<key>UTTypeDescription</key>
<string>Objective-C Source File</string>
<key>UTTypeIdentifier</key>
<string>org.vim.m-file</string>
<string>public.objective-c-source</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -1431,7 +1456,7 @@
<key>UTTypeDescription</key>
<string>Objective-C++ Source File</string>
<key>UTTypeIdentifier</key>
<string>org.vim.mm-file</string>
<string>public.objective-c-plus-plus-source</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -1448,7 +1473,7 @@
<key>UTTypeDescription</key>
<string>C++ Source File</string>
<key>UTTypeIdentifier</key>
<string>org.vim.cc-file</string>
<string>public.c-plus-plus-source</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -1469,7 +1494,7 @@
<key>UTTypeDescription</key>
<string>Assembly Source File</string>
<key>UTTypeIdentifier</key>
<string>org.vim.asm-file</string>
<string>public.assembly-source</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -1487,7 +1512,7 @@
<key>UTTypeDescription</key>
<string>Rez Source File</string>
<key>UTTypeIdentifier</key>
<string>org.vim.r-file</string>
<string>com.apple.rez-source</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -1504,7 +1529,7 @@
<key>UTTypeDescription</key>
<string>Java Source File</string>
<key>UTTypeIdentifier</key>
<string>org.vim.java-file</string>
<string>com.sun.java-source</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -1522,7 +1547,7 @@
<key>UTTypeDescription</key>
<string>Lex Source File</string>
<key>UTTypeIdentifier</key>
<string>org.vim.l-file</string>
<string>com.apple.xcode.lex-source</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -1543,7 +1568,7 @@
<key>UTTypeDescription</key>
<string>Yacc Source File</string>
<key>UTTypeIdentifier</key>
<string>org.vim.y-file</string>
<string>com.apple.xcode.yacc-source</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -1564,7 +1589,7 @@
<key>UTTypeDescription</key>
<string>Mig Definition File</string>
<key>UTTypeIdentifier</key>
<string>org.vim.defs-file</string>
<string>public.mig-source</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -1581,7 +1606,7 @@
<key>UTTypeDescription</key>
<string>Symbol Export File</string>
<key>UTTypeIdentifier</key>
<string>org.vim.exp-file</string>
<string>com.apple.symbol-export</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -1598,7 +1623,7 @@
<key>UTTypeDescription</key>
<string>Fortran Source File</string>
<key>UTTypeIdentifier</key>
<string>org.vim.f-file</string>
<string>com.apple.xcode.fortran-source</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -1620,7 +1645,7 @@
<key>UTTypeDescription</key>
<string>Pascal Source file</string>
<key>UTTypeIdentifier</key>
<string>org.vim.pas-file</string>
<string>com.apple.xcode.pascal-source</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -1637,7 +1662,7 @@
<key>UTTypeDescription</key>
<string>Ada Source File</string>
<key>UTTypeIdentifier</key>
<string>org.vim.ada-file</string>
<string>com.apple.xcode.ada-source</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -1656,7 +1681,7 @@
<key>UTTypeDescription</key>
<string>HTML Source File</string>
<key>UTTypeIdentifier</key>
<string>org.vim.html-file</string>
<string>public.html</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -1683,7 +1708,7 @@
<key>UTTypeDescription</key>
<string>XML Source File</string>
<key>UTTypeIdentifier</key>
<string>org.vim.xml-file</string>
<string>public.xml</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -1705,7 +1730,7 @@
<key>UTTypeDescription</key>
<string>JavaScript Source File</string>
<key>UTTypeIdentifier</key>
<string>org.vim.js-file</string>
<string>com.netscape.javascript-source</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -1725,7 +1750,7 @@
<key>UTTypeDescription</key>
<string>Perl source</string>
<key>UTTypeIdentifier</key>
<string>org.vim.pl-file</string>
<string>public.perl-script</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -1745,7 +1770,7 @@
<key>UTTypeDescription</key>
<string>Python source</string>
<key>UTTypeIdentifier</key>
<string>org.vim.py-file</string>
<string>public.python-script</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -1765,7 +1790,7 @@
<key>UTTypeDescription</key>
<string>PHP source</string>
<key>UTTypeIdentifier</key>
<string>org.vim.php-file</string>
<string>public.php-script</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -1788,7 +1813,7 @@
<key>UTTypeDescription</key>
<string>Ruby source</string>
<key>UTTypeIdentifier</key>
<string>org.vim.rb-file</string>
<string>public.ruby-script</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -1809,7 +1834,7 @@
<key>UTTypeDescription</key>
<string>Shell script</string>
<key>UTTypeIdentifier</key>
<string>org.vim.sh-file</string>
<string>public.shell-script</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -1834,7 +1859,7 @@
<key>UTTypeDescription</key>
<string>Java Class File</string>
<key>UTTypeIdentifier</key>
<string>org.vim.class-file</string>
<string>com.sun.java-class</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -1869,7 +1894,7 @@
<key>UTTypeDescription</key>
<string>Strings File</string>
<key>UTTypeIdentifier</key>
<string>org.vim.strings-file</string>
<string>com.apple.xcode.strings-text</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -1886,7 +1911,7 @@
<key>UTTypeDescription</key>
<string>AppleScript source</string>
<key>UTTypeIdentifier</key>
<string>org.vim.applescript-file</string>
<string>com.apple.applescript.text</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -2362,7 +2387,7 @@
<key>UTTypeDescription</key>
<string>PostScript source</string>
<key>UTTypeIdentifier</key>
<string>org.vim.ps-file</string>
<string>com.adobe.postscript</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -2450,7 +2475,7 @@
<key>UTTypeDescription</key>
<string>Electronic business card</string>
<key>UTTypeIdentifier</key>
<string>org.vim.vcf-file</string>
<string>public.vcard</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -2521,7 +2546,7 @@
<key>UTTypeDescription</key>
<string>Markdown document</string>
<key>UTTypeIdentifier</key>
<string>org.vim.markdown-file</string>
<string>net.daringfireball.markdown</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
@@ -2529,6 +2554,7 @@
<string>markdown</string>
<string>markd</string>
<string>mdown</string>
<string>md</string>
</array>
</dict>
</dict>
@@ -2549,6 +2575,23 @@
</array>
</dict>
</dict>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.plain-text</string>
</array>
<key>UTTypeDescription</key>
<string>Vimball Archive</string>
<key>UTTypeIdentifier</key>
<string>org.vim.vba-file</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>vba</string>
</array>
</dict>
</dict>
</array>
</dict>
</plist>
+532
View File
@@ -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>
+168 -76
View File
@@ -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,
@@ -159,6 +171,16 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
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,
@@ -192,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];
@@ -325,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
@@ -636,18 +695,19 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
- (void)removeVimController:(id)controller
{
ASLogDebug(@"Remove Vim controller pid=%d id=%d",
[controller pid], [controller identifier]);
ASLogDebug(@"Remove Vim controller pid=%d id=%d (processingFlag=%d)",
[controller pid], [controller vimControllerId], processingFlag);
int idx = [vimControllers indexOfObject:controller];
NSUInteger idx = [vimControllers indexOfObject:controller];
if (NSNotFound == idx) {
ASLogWarn(@"Controller at index=%d not found", 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
@@ -691,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;
}
[win setFrameTopLeftPoint:topLeft];
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 ([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];
}
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 (1 == [vimControllers count]) {
@@ -1159,15 +1220,20 @@ 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
@@ -1197,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
@@ -1294,6 +1364,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
}
NSString *path = [pboard stringForType:NSStringPboardType];
path = [path stringByExpandingTildeInPath];
BOOL dirIndicator;
if (![[NSFileManager defaultManager] fileExistsAtPath:path
@@ -1492,7 +1563,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
if (openFiles != nil)
*openFiles = dict;
return files;
return [files autorelease];
}
#if MM_HANDLE_XCODE_MOD_EVENT
@@ -1549,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]
@@ -1670,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)
@@ -1859,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
@@ -1870,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)
@@ -1891,6 +1980,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
return date;
}
#undef MM_fileAttributes
- (BOOL)openVimControllerWithArguments:(NSDictionary *)arguments
{
@@ -1936,7 +2026,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
- (void)startWatchingVimDir
{
#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)
@@ -1960,7 +2050,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
- (void)stopWatchingVimDir
{
#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
@@ -2005,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
@@ -2015,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;
@@ -2189,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;
}
@@ -2200,7 +2290,7 @@ 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;
}
@@ -2216,18 +2306,20 @@ 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 identifier]);
ASLogDebug(@"Add Vim controller pid=%d id=%d",
[vc pid], [vc vimControllerId]);
int pid = [vc pid];
NSNumber *pidKey = [NSNumber numberWithInt:pid];
+1 -1
View File
@@ -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
+5
View File
@@ -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"
@@ -69,6 +71,7 @@ enum { MMMaxCellsPerChar = 2 };
- (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
@@ -96,3 +99,5 @@ enum { MMMaxCellsPerChar = 2 };
- (NSSize)constrainRows:(int *)rows columns:(int *)cols toSize:(NSSize)size;
@end
#endif // ENABLE_ATSUI
+20 -2
View File
@@ -25,6 +25,8 @@
* resized.
*/
#if ENABLE_ATSUI
#import "MMAppController.h"
#import "MMAtsuiTextView.h"
#import "MMTextViewHelper.h"
@@ -329,6 +331,11 @@ defaultLineHeightForFont(NSFont *font)
[helper setImControl:enable];
}
- (void)activateIm:(BOOL)enable
{
[helper activateIm:enable];
}
- (void)keyDown:(NSEvent *)event
{
[helper keyDown:event];
@@ -513,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];
@@ -569,6 +577,7 @@ defaultLineHeightForFont(NSFont *font)
shape:MMInsertionPointVertical
fraction:25];
}
#endif // INCLUDE_OLD_IM_CODE
}
- (BOOL) wantsDefaultClipping
@@ -882,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;
@@ -1101,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 };
@@ -1150,6 +1164,8 @@ defaultLineHeightForFont(NSFont *font)
i++;
}
}
CGContextRestoreGState(context);
}
- (void)scrollRect:(NSRect)rect lineCount:(int)count
@@ -1254,3 +1270,5 @@ defaultLineHeightForFont(NSFont *font)
}
@end // MMAtsuiTextView (Drawing)
#endif // ENABLE_ATSUI
+7 -6
View File
@@ -21,6 +21,7 @@
NSMutableArray *inputQueue;
NSMutableData *drawData;
NSConnection *connection;
NSConnection *vimServerConnection;
id appProxy;
unsigned identifier;
NSDictionary *colorDict;
@@ -94,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;
@@ -111,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;
+338 -224
View File
@@ -56,6 +56,9 @@ vimmenu_T *menu_for_descriptor(NSArray *desc);
static id evalExprCocoa(NSString * expr, NSString ** errstr);
extern void im_preedit_start_macvim();
extern void im_preedit_end_macvim();
extern void im_preedit_changed_macvim(char *preedit_string, int cursor_index);
enum {
MMBlinkStateNone = 0,
@@ -70,6 +73,81 @@ static NSString *MMSymlinkWarningString =
"\ta symlink, then your MacVim.app bundle is incomplete.\n\n";
// Keycodes recognized by Vim (struct taken from gui_x11.c and gui_w48.c)
// (The key codes were taken from Carbon/HIToolbox/Events.)
static struct specialkey
{
unsigned key_sym;
char_u vim_code0;
char_u vim_code1;
} special_keys[] =
{
{0x7e /*kVK_UpArrow*/, 'k', 'u'},
{0x7d /*kVK_DownArrow*/, 'k', 'd'},
{0x7b /*kVK_LeftArrow*/, 'k', 'l'},
{0x7c /*kVK_RightArrow*/, 'k', 'r'},
{0x7a /*kVK_F1*/, 'k', '1'},
{0x78 /*kVK_F2*/, 'k', '2'},
{0x63 /*kVK_F3*/, 'k', '3'},
{0x76 /*kVK_F4*/, 'k', '4'},
{0x60 /*kVK_F5*/, 'k', '5'},
{0x61 /*kVK_F6*/, 'k', '6'},
{0x62 /*kVK_F7*/, 'k', '7'},
{0x64 /*kVK_F8*/, 'k', '8'},
{0x65 /*kVK_F9*/, 'k', '9'},
{0x6d /*kVK_F10*/, 'k', ';'},
{0x67 /*kVK_F11*/, 'F', '1'},
{0x6f /*kVK_F12*/, 'F', '2'},
{0x69 /*kVK_F13*/, 'F', '3'},
{0x6b /*kVK_F14*/, 'F', '4'},
{0x71 /*kVK_F15*/, 'F', '5'},
{0x6a /*kVK_F16*/, 'F', '6'},
{0x40 /*kVK_F17*/, 'F', '7'},
{0x4f /*kVK_F18*/, 'F', '8'},
{0x50 /*kVK_F19*/, 'F', '9'},
{0x5a /*kVK_F20*/, 'F', 'A'},
{0x72 /*kVK_Help*/, '%', '1'},
{0x33 /*kVK_Delete*/, 'k', 'b'},
{0x75 /*kVK_ForwardDelete*/, 'k', 'D'},
{0x73 /*kVK_Home*/, 'k', 'h'},
{0x77 /*kVK_End*/, '@', '7'},
{0x74 /*kVK_PageUp*/, 'k', 'P'},
{0x79 /*kVK_PageDown*/, 'k', 'N'},
/* Keypad keys: */
{0x45 /*kVK_ANSI_KeypadPlus*/, 'K', '6'},
{0x4e /*kVK_ANSI_KeypadMinus*/, 'K', '7'},
{0x4b /*kVK_ANSI_KeypadDivide*/, 'K', '8'},
{0x43 /*kVK_ANSI_KeypadMultiply*/, 'K', '9'},
{0x4c /*kVK_ANSI_KeypadEnter*/, 'K', 'A'},
{0x41 /*kVK_ANSI_KeypadDecimal*/, 'K', 'B'},
{0x47 /*kVK_ANSI_KeypadClear*/, KS_EXTRA, (char_u)KE_KDEL},
{0x52 /*kVK_ANSI_Keypad0*/, 'K', 'C'},
{0x53 /*kVK_ANSI_Keypad1*/, 'K', 'D'},
{0x54 /*kVK_ANSI_Keypad2*/, 'K', 'E'},
{0x55 /*kVK_ANSI_Keypad3*/, 'K', 'F'},
{0x56 /*kVK_ANSI_Keypad4*/, 'K', 'G'},
{0x57 /*kVK_ANSI_Keypad5*/, 'K', 'H'},
{0x58 /*kVK_ANSI_Keypad6*/, 'K', 'I'},
{0x59 /*kVK_ANSI_Keypad7*/, 'K', 'J'},
{0x5b /*kVK_ANSI_Keypad8*/, 'K', 'K'},
{0x5c /*kVK_ANSI_Keypad9*/, 'K', 'L'},
/* Keys that we want to be able to use any modifier with: */
{0x31 /*kVK_Space*/, ' ', NUL},
{0x30 /*kVK_Tab*/, TAB, NUL},
{0x35 /*kVK_Escape*/, ESC, NUL},
{0x24 /*kVK_Return*/, CAR, NUL},
/* End of list marker: */
{0, 0, 0}
};
extern GuiFont gui_mch_retain_font(GuiFont font);
@@ -88,9 +166,13 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
- (void)insertVimStateMessage;
- (void)processInputQueue;
- (void)handleInputEvent:(int)msgid data:(NSData *)data;
+ (NSDictionary *)specialKeys;
- (void)handleInsertText:(NSString *)text;
- (void)handleKeyDown:(NSString *)key modifiers:(int)mods;
- (void)doKeyDown:(NSString *)key
keyCode:(unsigned)code
modifiers:(int)mods;
- (BOOL)handleSpecialKey:(NSString *)key
keyCode:(unsigned)code
modifiers:(int)mods;
- (BOOL)handleMacMetaKey:(int)ikey modifiers:(int)mods;
- (void)queueMessage:(int)msgid data:(NSData *)data;
- (void)connectionDidDie:(NSNotification *)notification;
- (void)blinkTimerFired:(NSTimer *)timer;
@@ -108,6 +190,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
- (BOOL)unusedEditor;
- (void)redrawScreen;
- (void)handleFindReplace:(NSDictionary *)args;
- (void)handleMarkedText:(NSData *)data;
@end
@@ -183,6 +266,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
[actionDict release]; actionDict = nil;
[sysColorDict release]; sysColorDict = nil;
[colorDict release]; colorDict = nil;
[vimServerConnection release]; vimServerConnection = nil;
[super dealloc];
}
@@ -346,8 +430,8 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
identifier = [appProxy connectBackend:self pid:pid];
return YES;
}
@catch (NSException *e) {
ASLogWarn(@"Exception caught when trying to connect backend: %@", e);
@catch (NSException *ex) {
ASLogNotice(@"Connect backend failed: reason=%@", ex);
}
return NO;
@@ -510,8 +594,8 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
debugStringForMessageQueue(outputQueue));
[appProxy processInput:outputQueue forIdentifier:identifier];
}
@catch (NSException *e) {
ASLogWarn(@"Exception caught: %@", e);
@catch (NSException *ex) {
ASLogNotice(@"processInput:forIdentifer failed: reason=%@", ex);
if (![connection isValid]) {
ASLogNotice(@"Connection is invalid, exit now!");
ASLogDebug(@"waitForAck=%d got_int=%d", waitForAck, got_int);
@@ -579,8 +663,8 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
debugStringForMessageQueue(outputQueue));
[appProxy processInput:outputQueue forIdentifier:identifier];
}
@catch (NSException *e) {
ASLogWarn(@"Exception caught when sending CloseWindowMsgID: %@", e);
@catch (NSException *ex) {
ASLogNotice(@"CloseWindowMsgID send failed: reason=%@", ex);
}
// NOTE: If Cmd-w was pressed to close the window the menu is briefly
@@ -596,8 +680,10 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
#ifdef MAC_CLIENTSERVER
// The default connection is used for the client/server code.
[[NSConnection defaultConnection] setRootObject:nil];
[[NSConnection defaultConnection] invalidate];
if (vimServerConnection) {
[vimServerConnection setRootObject:nil];
[vimServerConnection invalidate];
}
#endif
}
@@ -702,8 +788,8 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
[dialogReturn release]; dialogReturn = nil;
}
@catch (NSException *e) {
ASLogWarn(@"Exception caught: %@", e);
@catch (NSException *ex) {
ASLogNotice(@"Exception: reason=%@", ex);
}
return (char *)s;
@@ -757,8 +843,8 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
[dialogReturn release]; dialogReturn = nil;
}
@catch (NSException *e) {
ASLogWarn(@"Exception caught: %@", e);
@catch (NSException *ex) {
ASLogNotice(@"Exception: reason=%@", ex);
}
return retval;
@@ -774,39 +860,39 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
[self queueMessage:ShowToolbarMsgID data:data];
}
- (void)createScrollbarWithIdentifier:(long)ident type:(int)type
- (void)createScrollbarWithIdentifier:(int32_t)ident type:(int)type
{
NSMutableData *data = [NSMutableData data];
[data appendBytes:&ident length:sizeof(long)];
[data appendBytes:&ident length:sizeof(int32_t)];
[data appendBytes:&type length:sizeof(int)];
[self queueMessage:CreateScrollbarMsgID data:data];
}
- (void)destroyScrollbarWithIdentifier:(long)ident
- (void)destroyScrollbarWithIdentifier:(int32_t)ident
{
NSMutableData *data = [NSMutableData data];
[data appendBytes:&ident length:sizeof(long)];
[data appendBytes:&ident length:sizeof(int32_t)];
[self queueMessage:DestroyScrollbarMsgID data:data];
}
- (void)showScrollbarWithIdentifier:(long)ident state:(int)visible
- (void)showScrollbarWithIdentifier:(int32_t)ident state:(int)visible
{
NSMutableData *data = [NSMutableData data];
[data appendBytes:&ident length:sizeof(long)];
[data appendBytes:&ident length:sizeof(int32_t)];
[data appendBytes:&visible length:sizeof(int)];
[self queueMessage:ShowScrollbarMsgID data:data];
}
- (void)setScrollbarPosition:(int)pos length:(int)len identifier:(long)ident
- (void)setScrollbarPosition:(int)pos length:(int)len identifier:(int32_t)ident
{
NSMutableData *data = [NSMutableData data];
[data appendBytes:&ident length:sizeof(long)];
[data appendBytes:&ident length:sizeof(int32_t)];
[data appendBytes:&pos length:sizeof(int)];
[data appendBytes:&len length:sizeof(int)];
@@ -814,7 +900,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
}
- (void)setScrollbarThumbValue:(long)val size:(long)size max:(long)max
identifier:(long)ident
identifier:(int32_t)ident
{
float fval = max-size+1 > 0 ? (float)val/(max-size+1) : 0;
float prop = (float)size/(max+1);
@@ -825,7 +911,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
NSMutableData *data = [NSMutableData data];
[data appendBytes:&ident length:sizeof(long)];
[data appendBytes:&ident length:sizeof(int32_t)];
[data appendBytes:&fval length:sizeof(float)];
[data appendBytes:&prop length:sizeof(float)];
@@ -969,7 +1055,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
if (obj) {
NSColor *col = [NSColor performSelector:NSSelectorFromString(obj)];
if (col) {
float r, g, b, a;
CGFloat r, g, b, a;
col = [col colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
[col getRed:&r green:&g blue:&b alpha:&a];
return (((int)(r*255+.5f) & 0xff) << 16)
@@ -983,13 +1069,12 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
return INVALCOLOR;
}
- (BOOL)hasSpecialKeyWithValue:(NSString *)value
- (BOOL)hasSpecialKeyWithValue:(char_u *)value
{
NSEnumerator *e = [[MMBackend specialKeys] objectEnumerator];
id obj;
while ((obj = [e nextObject])) {
if ([value isEqual:obj])
int i;
for (i = 0; special_keys[i].key_sym != 0; i++) {
if (value[0] == special_keys[i].vim_code0
&& value[1] == special_keys[i].vim_code1)
return YES;
}
@@ -1038,21 +1123,27 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
- (oneway void)processInput:(int)msgid data:(in bycopy NSData *)data
{
// Look for Cmd-. and Ctrl-C immediately instead of waiting until the input
// queue is processed since that only happens in waitForInput: (and Vim
// regularly checks for Ctrl-C in between waiting for input).
// Look for Ctrl-C immediately instead of waiting until the input queue is
// processed since that only happens in waitForInput: (and Vim regularly
// checks for Ctrl-C in between waiting for input). Note that the flag
// ctrl_c_interrupts is 0 e.g. when the user has mappings to something like
// <C-c>g. Also it seems the flag intr_char is 0 when MacVim was started
// from Finder whereas it is 0x03 (= Ctrl_C) when started from Terminal.
//
// Similarly, TerminateNowMsgID must be checked immediately otherwise code
// which waits on the run loop will fail to detect this message (e.g. in
// waitForConnectionAcknowledgement).
if (InsertTextMsgID == msgid && data != nil) {
if (KeyDownMsgID == msgid && data != nil && ctrl_c_interrupts) {
const void *bytes = [data bytes];
bytes += sizeof(int);
int len = *((int*)bytes); bytes += sizeof(int);
/*unsigned mods = *((unsigned*)bytes);*/ bytes += sizeof(unsigned);
/*unsigned code = *((unsigned*)bytes);*/ bytes += sizeof(unsigned);
unsigned len = *((unsigned*)bytes); bytes += sizeof(unsigned);
if (1 == len) {
char_u *str = (char_u*)bytes;
if ((str[0] == Ctrl_C && ctrl_c_interrupts) ||
(str[0] == intr_char && intr_char != Ctrl_C)) {
if (str[0] == Ctrl_C || (str[0] == intr_char && intr_char != 0)) {
ASLogDebug(@"Got INT, str[0]=%#x ctrl_c_interrupts=%d "
"intr_char=%#x", str[0], ctrl_c_interrupts, intr_char);
got_int = TRUE;
[inputQueue removeAllObjects];
return;
@@ -1071,14 +1162,13 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
// Remove all previous instances of this message from the input queue, else
// the input queue may fill up as a result of Vim not being able to keep up
// with the speed at which new messages are received.
// Keyboard input is never dropped, unless the input represents and
// Keyboard input is never dropped, unless the input represents an
// auto-repeated key.
BOOL isKeyRepeat = NO;
BOOL isKeyboardInput = NO;
if (data && (InsertTextMsgID == msgid || KeyDownMsgID == msgid ||
CmdKeyMsgID == msgid)) {
if (data && KeyDownMsgID == msgid) {
isKeyboardInput = YES;
// The lowest bit of the first int is set if this key is a repeat.
@@ -1238,22 +1328,28 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
- (void)registerServerWithName:(NSString *)name
{
NSString *svrName = name;
NSConnection *svrConn = [NSConnection defaultConnection];
unsigned i;
if (vimServerConnection) // Paranoia check, should always be nil
[vimServerConnection release];
vimServerConnection = [[NSConnection alloc]
initWithReceivePort:[NSPort port]
sendPort:nil];
for (i = 0; i < MMServerMax; ++i) {
NSString *connName = [self connectionNameFromServerName:svrName];
if ([svrConn registerName:connName]) {
if ([vimServerConnection registerName:connName]) {
ASLogInfo(@"Registered server with name: %@", svrName);
// TODO: Set request/reply time-outs to something else?
//
// Don't wait for requests (time-out means that the message is
// dropped).
[svrConn setRequestTimeout:0];
//[svrConn setReplyTimeout:MMReplyTimeout];
[svrConn setRootObject:self];
[vimServerConnection setRequestTimeout:0];
//[vimServerConnection setReplyTimeout:MMReplyTimeout];
[vimServerConnection setRootObject:self];
// NOTE: 'serverName' is a global variable
serverName = [svrName vimStringSave];
@@ -1263,8 +1359,8 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
#ifdef FEAT_TITLE
need_maketitle = TRUE;
#endif
[self queueMessage:SetServerNameMsgID data:
[svrName dataUsingEncoding:NSUTF8StringEncoding]];
[self queueMessage:SetServerNameMsgID
data:[svrName dataUsingEncoding:NSUTF8StringEncoding]];
break;
}
@@ -1320,8 +1416,8 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
[proxy addInput:string client:self];
}
}
@catch (NSException *e) {
ASLogWarn(@"Caught exception: %@", e);
@catch (NSException *ex) {
ASLogNotice(@"Exception: reason=%@", ex);
return NO;
}
@@ -1339,11 +1435,12 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
@try {
list = [proxy serverList];
}
@catch (NSException *e) {
ASLogWarn(@"Exception caught when listing servers: %@", e);
@catch (NSException *ex) {
ASLogNotice(@"serverList failed: reason=%@", ex);
}
} else {
EMSG(_("E???: No connection to MacVim, server listing not possible."));
// We get here if a --remote flag is used before MacVim has started.
ASLogInfo(@"No connection to MacVim, server listing not possible.");
}
return list;
@@ -1409,11 +1506,11 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
[client addReply:reply server:self];
return YES;
}
@catch (NSException *e) {
ASLogWarn(@"Exception caught: %@", e);
@catch (NSException *ex) {
ASLogNotice(@"addReply:server: failed: reason=%@", ex);
}
} else {
EMSG2(_("E???: server2client failed; no client with id 0x%x"), port);
ASLogNotice(@"server2client failed; no client with id %d", port);
}
return NO;
@@ -1653,24 +1750,21 @@ static void netbeansReadCallback(CFSocketRef s,
[q release];
}
- (void)handleInputEvent:(int)msgid data:(NSData *)data
{
if (InsertTextMsgID == msgid || KeyDownMsgID == msgid ||
CmdKeyMsgID == msgid) {
if (KeyDownMsgID == msgid) {
if (!data) return;
const void *bytes = [data bytes];
int mods = *((int*)bytes); bytes += sizeof(int);
int len = *((int*)bytes); bytes += sizeof(int);
unsigned mods = *((unsigned*)bytes); bytes += sizeof(unsigned);
unsigned code = *((unsigned*)bytes); bytes += sizeof(unsigned);
unsigned len = *((unsigned*)bytes); bytes += sizeof(unsigned);
NSString *key = [[NSString alloc] initWithBytes:bytes
length:len
encoding:NSUTF8StringEncoding];
mods = eventModifierFlagsToVimModMask(mods);
if (InsertTextMsgID == msgid)
[self handleInsertText:key];
else
[self handleKeyDown:key modifiers:mods];
[self doKeyDown:key keyCode:code modifiers:mods];
[key release];
} else if (ScrollWheelMsgID == msgid) {
if (!data) return;
@@ -1841,31 +1935,26 @@ static void netbeansReadCallback(CFSocketRef s,
#ifdef FEAT_NETBEANS_INTG
messageFromNetbeansMacVim();
#endif
} else if (SetMarkedTextMsgID == msgid) {
[self handleMarkedText:data];
} else {
ASLogWarn(@"Unknown message received (msgid=%d)", msgid);
}
}
+ (NSDictionary *)specialKeys
- (void)doKeyDown:(NSString *)key
keyCode:(unsigned)code
modifiers:(int)mods
{
static NSDictionary *specialKeys = nil;
ASLogDebug(@"key='%@' code=%#x mods=%#x length=%d", key, code, mods,
[key length]);
if (!key) return;
if (!specialKeys) {
NSBundle *mainBundle = [NSBundle mainBundle];
NSString *path = [mainBundle pathForResource:@"SpecialKeys"
ofType:@"plist"];
specialKeys = [[NSDictionary alloc] initWithContentsOfFile:path];
}
char_u *str = (char_u*)[key UTF8String];
int i, len = [key lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
return specialKeys;
}
- (void)handleInsertText:(NSString *)text
{
if (!text) return;
char_u *str = (char_u*)[text UTF8String];
int i, len = [text lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
if ([self handleSpecialKey:key keyCode:code modifiers:mods])
return;
#ifdef FEAT_MBYTE
char_u *conv_str = NULL;
@@ -1876,13 +1965,45 @@ static void netbeansReadCallback(CFSocketRef s,
}
#endif
if (mods & MOD_MASK_CMD) {
// NOTE: For normal input (non-special, 'macmeta' off) the modifier
// flags are already included in the key event. However, the Cmd key
// flag is special and must always be added manually.
// The Shift flag is already included in the key when the Command
// key is held. The same goes for Alt, unless Ctrl is held or
// 'macmeta' is set. It is important that these flags are cleared
// _after_ special keys have been handled, since they should never be
// cleared for special keys.
mods &= ~MOD_MASK_SHIFT;
if (!(mods & MOD_MASK_CTRL)) {
BOOL mmta = curbuf ? curbuf->b_p_mmta : YES;
if (!mmta)
mods &= ~MOD_MASK_ALT;
}
ASLogDebug(@"add mods=%#x", mods);
char_u modChars[3] = { CSI, KS_MODIFIER, mods };
add_to_input_buf(modChars, 3);
} else if (mods & MOD_MASK_ALT && 1 == len && str[0] < 0x80
&& curbuf && curbuf->b_p_mmta) {
// HACK! The 'macmeta' is set so we have to handle Alt key presses
// separately. Normally Alt key presses are interpreted by the
// frontend but now we have to manually set the 8th bit and deal with
// UTF-8 conversion.
if ([self handleMacMetaKey:str[0] modifiers:mods])
return;
}
for (i = 0; i < len; ++i) {
ASLogDebug(@"add byte [%d/%d]: %#x", i, len, str[i]);
add_to_input_buf(str+i, 1);
if (CSI == str[i]) {
// NOTE: If the converted string contains the byte CSI, then it
// must be followed by the bytes KS_EXTRA, KE_CSI or things
// won't work.
static char_u extra[2] = { KS_EXTRA, KE_CSI };
ASLogDebug(@"add KS_EXTRA, KE_CSI");
add_to_input_buf(extra, 2);
}
}
@@ -1893,158 +2014,127 @@ static void netbeansReadCallback(CFSocketRef s,
#endif
}
- (void)handleKeyDown:(NSString *)key modifiers:(int)mods
- (BOOL)handleSpecialKey:(NSString *)key
keyCode:(unsigned)code
modifiers:(int)mods
{
// TODO: This code is a horrible mess -- clean up!
char_u special[3];
char_u modChars[3];
char_u *chars = (char_u*)[key UTF8String];
int i;
for (i = 0; special_keys[i].key_sym != 0; i++) {
if (special_keys[i].key_sym == code) {
ASLogDebug(@"Special key: %#x", code);
break;
}
}
if (special_keys[i].key_sym == 0)
return NO;
int ikey = special_keys[i].vim_code1 == NUL ? special_keys[i].vim_code0 :
TO_SPECIAL(special_keys[i].vim_code0, special_keys[i].vim_code1);
ikey = simplify_key(ikey, &mods);
if (ikey == CSI)
ikey = K_CSI;
char_u chars[4];
int len = 0;
if (IS_SPECIAL(ikey)) {
chars[0] = CSI;
chars[1] = K_SECOND(ikey);
chars[2] = K_THIRD(ikey);
len = 3;
} else if (mods & MOD_MASK_ALT && special_keys[i].vim_code1 == 0
#ifdef FEAT_MBYTE
char_u *conv_str = NULL;
&& !enc_dbcs // TODO: ? (taken from gui_gtk_x11.c)
#endif
int length = [key lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
) {
ASLogDebug(@"Alt special=%d", ikey);
// Special keys (arrow keys, function keys, etc.) are stored in a plist so
// that new keys can easily be added.
NSString *specialString = [[MMBackend specialKeys]
objectForKey:key];
if (specialString && [specialString length] > 1) {
//ASLogDebug(@"special key: %@", specialString);
int ikey = TO_SPECIAL([specialString characterAtIndex:0],
[specialString characterAtIndex:1]);
ikey = simplify_key(ikey, &mods);
if (ikey == CSI)
ikey = K_CSI;
special[0] = CSI;
special[1] = K_SECOND(ikey);
special[2] = K_THIRD(ikey);
chars = special;
length = 3;
} else if (1 == length && TAB == chars[0]) {
// Tab is a trouble child:
// - <Tab> is added to the input buffer as is
// - <S-Tab> is translated to, {CSI,'k','B'} (i.e. 'Back-tab')
// - <M-Tab> should be 0x80|TAB but this is not valid utf-8 so it needs
// to be converted to utf-8
// - <S-M-Tab> is translated to <S-Tab> with ALT modifier
// - <C-Tab> is reserved by Mac OS X
// - <D-Tab> is reserved by Mac OS X
chars = special;
special[0] = TAB;
length = 1;
if (mods & MOD_MASK_SHIFT) {
mods &= ~MOD_MASK_SHIFT;
special[0] = CSI;
special[1] = K_SECOND(K_S_TAB);
special[2] = K_THIRD(K_S_TAB);
length = 3;
} else if (mods & MOD_MASK_ALT) {
int mtab = 0x80 | TAB;
// NOTE: The last entries in the special_keys struct when pressed
// together with Alt need to be handled separately or they will not
// work.
// The following code was gleaned from gui_gtk_x11.c.
mods &= ~MOD_MASK_ALT;
int mkey = 0x80 | ikey;
#ifdef FEAT_MBYTE
if (enc_utf8) {
// Convert to utf-8
special[0] = (mtab >> 6) + 0xc0;
special[1] = mtab & 0xbf;
length = 2;
} else
#endif
{
special[0] = mtab;
length = 1;
}
mods &= ~MOD_MASK_ALT;
}
} else if (1 == length && chars[0] < 0x80 && (mods & MOD_MASK_ALT)) {
// META key is treated separately. This code was taken from gui_w48.c
// and gui_gtk_x11.c.
char_u string[7];
int ch = simplify_key(chars[0], &mods);
// Remove the SHIFT modifier for keys where it's already included,
// e.g., '(' and '*'
if (ch < 0x100 && !isalpha(ch) && isprint(ch))
mods &= ~MOD_MASK_SHIFT;
// Interpret the ALT key as making the key META, include SHIFT, etc.
ch = extract_modifiers(ch, &mods);
if (ch == CSI)
ch = K_CSI;
int len = 0;
if (mods) {
string[len++] = CSI;
string[len++] = KS_MODIFIER;
string[len++] = mods;
}
if (IS_SPECIAL(ch)) {
string[len++] = CSI;
string[len++] = K_SECOND(ch);
string[len++] = K_THIRD(ch);
} else {
string[len++] = ch;
#ifdef FEAT_MBYTE
// TODO: What if 'enc' is not "utf-8"?
if (enc_utf8 && (ch & 0x80)) { // convert to utf-8
string[len++] = ch & 0xbf;
string[len-2] = ((unsigned)ch >> 6) + 0xc0;
if (string[len-1] == CSI) {
string[len++] = KS_EXTRA;
string[len++] = (int)KE_CSI;
}
if (enc_utf8) { // TODO: What about other encodings?
// Convert to utf-8
chars[0] = (mkey >> 6) + 0xc0;
chars[1] = mkey & 0xbf;
if (chars[1] == CSI) {
// We end up here when ikey == ESC
chars[2] = KS_EXTRA;
chars[3] = KE_CSI;
len = 4;
} else {
len = 2;
}
} else
#endif
{
chars[0] = mkey;
len = 1;
}
add_to_input_buf(string, len);
return;
} else if (length > 0) {
unichar c = [key characterAtIndex:0];
//ASLogDebug(@"non-special: %@ (hex=%x, mods=%d)", key,
// [key characterAtIndex:0], mods);
// HACK! In most circumstances the Ctrl and Shift modifiers should be
// cleared since they are already added to the key by the AppKit.
// Unfortunately, the only way to deal with when to clear the modifiers
// or not seems to be to have hard-wired rules like this.
if ( !((' ' == c) || (0xa0 == c) || (mods & MOD_MASK_CMD)
|| 0x9 == c || 0xd == c || ESC == c) ) {
mods &= ~MOD_MASK_SHIFT;
mods &= ~MOD_MASK_CTRL;
//ASLogDebug(@"clear shift ctrl");
}
#ifdef FEAT_MBYTE
if (input_conv.vc_type != CONV_NONE) {
conv_str = string_convert(&input_conv, chars, &length);
if (conv_str)
chars = conv_str;
}
#endif
} else {
ASLogDebug(@"Just ikey=%d", ikey);
chars[0] = ikey;
len = 1;
}
if (chars && length > 0) {
if (len > 0) {
if (mods) {
//ASLogDebug(@"adding mods: %d", mods);
modChars[0] = CSI;
modChars[1] = KS_MODIFIER;
modChars[2] = mods;
ASLogDebug(@"Adding mods to special: %d", mods);
char_u modChars[3] = { CSI, KS_MODIFIER, (char_u)mods };
add_to_input_buf(modChars, 3);
}
//ASLogDebug(@"add to input buf: 0x%x", chars[0]);
// TODO: Check for CSI bytes?
add_to_input_buf(chars, length);
ASLogDebug(@"Adding special (%d): %x,%x,%x", len,
chars[0], chars[1], chars[2]);
add_to_input_buf(chars, len);
}
return YES;
}
- (BOOL)handleMacMetaKey:(int)ikey modifiers:(int)mods
{
ASLogDebug(@"ikey=%d mods=%d", ikey, mods);
// This code was taken from gui_w48.c and gui_gtk_x11.c.
char_u string[7];
int ch = simplify_key(ikey, &mods);
// Remove the SHIFT modifier for keys where it's already included,
// e.g., '(' and '*'
if (ch < 0x100 && !isalpha(ch) && isprint(ch))
mods &= ~MOD_MASK_SHIFT;
// Interpret the ALT key as making the key META, include SHIFT, etc.
ch = extract_modifiers(ch, &mods);
if (ch == CSI)
ch = K_CSI;
int len = 0;
if (mods) {
string[len++] = CSI;
string[len++] = KS_MODIFIER;
string[len++] = mods;
}
string[len++] = ch;
#ifdef FEAT_MBYTE
if (conv_str)
vim_free(conv_str);
// TODO: What if 'enc' is not "utf-8"?
if (enc_utf8 && (ch & 0x80)) { // convert to utf-8
string[len++] = ch & 0xbf;
string[len-2] = ((unsigned)ch >> 6) + 0xc0;
if (string[len-1] == CSI) {
string[len++] = KS_EXTRA;
string[len++] = (int)KE_CSI;
}
}
#endif
add_to_input_buf(string, len);
return YES;
}
- (void)queueMessage:(int)msgid data:(NSData *)data
@@ -2133,7 +2223,7 @@ static void netbeansReadCallback(CFSocketRef s,
if (!data) return;
const void *bytes = [data bytes];
long ident = *((long*)bytes); bytes += sizeof(long);
int32_t ident = *((int32_t*)bytes); bytes += sizeof(int32_t);
int hitPart = *((int*)bytes); bytes += sizeof(int);
float fval = *((float*)bytes); bytes += sizeof(float);
scrollbar_T *sb = gui_find_scrollbar(ident);
@@ -2178,12 +2268,12 @@ static void netbeansReadCallback(CFSocketRef s,
// need to set the knob position in the other cases.
if (sb->wp) {
// Update both the left&right vertical scrollbars.
long identLeft = sb->wp->w_scrollbars[SBAR_LEFT].ident;
long identRight = sb->wp->w_scrollbars[SBAR_RIGHT].ident;
int32_t idL = (int32_t)sb->wp->w_scrollbars[SBAR_LEFT].ident;
int32_t idR = (int32_t)sb->wp->w_scrollbars[SBAR_RIGHT].ident;
[self setScrollbarThumbValue:value size:size max:max
identifier:identLeft];
identifier:idL];
[self setScrollbarThumbValue:value size:size max:max
identifier:identRight];
identifier:idR];
} else {
// Update the horizontal scrollbar.
[self setScrollbarThumbValue:value size:size max:max
@@ -2417,7 +2507,11 @@ static void netbeansReadCallback(CFSocketRef s,
if (openFiles && numFiles > 0 && ![args objectForKey:@"remoteID"]
&& (starting || [self unusedEditor]) ) {
char_u *s = [[filenames objectAtIndex:0] vimStringSave];
vim_chdirfile(s);
if (mch_isdir(s)) {
mch_chdir((char*)s);
} else {
vim_chdirfile(s);
}
vim_free(s);
}
@@ -2700,6 +2794,26 @@ static void netbeansReadCallback(CFSocketRef s,
vim_free(replace);
}
- (void)handleMarkedText:(NSData *)data
{
const void *bytes = [data bytes];
unsigned pos = *((unsigned*)bytes); bytes += sizeof(unsigned);
unsigned len = *((unsigned*)bytes); bytes += sizeof(unsigned);
char *chars = (char *)bytes;
ASLogDebug(@"pos=%d len=%d chars=%s", pos, len, chars);
if (len == 0) {
im_preedit_end_macvim();
} else {
if (!preedit_get_status())
im_preedit_start_macvim();
im_preedit_changed_macvim(chars, pos);
}
}
@end // MMBackend (Private)
+1 -1
View File
@@ -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
+1 -1
View File
@@ -227,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.
+3 -5
View File
@@ -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;
+10 -18
View File
@@ -112,25 +112,12 @@ 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
{
@@ -326,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
@@ -363,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];
@@ -777,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;
@@ -792,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;
@@ -805,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];
+1
View File
@@ -33,6 +33,7 @@
- (void)setMouseShape:(int)shape;
- (void)setAntialias:(BOOL)antialias;
- (void)setImControl:(BOOL)enable;
- (void)activateIm:(BOOL)enable;
//
// MMTextStorage methods
+20 -3
View File
@@ -312,6 +312,11 @@
[helper setImControl:enable];
}
- (void)activateIm:(BOOL)enable
{
[helper activateIm:enable];
}
- (NSFont *)font
{
return [(MMTextStorage*)[self textStorage] font];
@@ -517,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];
@@ -575,6 +581,7 @@
}
}
}
#endif // INCLUDE_OLD_IM_CODE
if (shouldDrawInsertionPoint) {
MMTextStorage *ts = (MMTextStorage*)[self textStorage];
@@ -584,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])
@@ -597,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;
@@ -857,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:)
@@ -920,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
+13
View File
@@ -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;
@@ -41,6 +48,10 @@ enum {
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;
@@ -83,5 +94,7 @@ enum {
- (void)setMarkedRange:(NSRange)range;
- (NSRect)firstRectForCharacterRange:(NSRange)range;
- (void)setImControl:(BOOL)enable;
- (void)activateIm:(BOOL)enable;
- (BOOL)useInlineIm;
@end
+405 -253
View File
@@ -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,18 +34,39 @@ 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
@@ -59,6 +77,17 @@ static float MMDragAreaSize = 73.0f;
[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];
}
@@ -83,247 +112,214 @@ static float MMDragAreaSize = 73.0f;
- (void)keyDown:(NSEvent *)event
{
//ASLogDebug(@"%@", event);
// HACK! If control modifier is held, don't pass the event along to
// interpretKeyEvents: since some keys are bound to multiple commands which
// means doCommandBySelector: is called several times. Do the same for
// 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);
// 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];
// 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: 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
{
//ASLogDebug(@"%@", string);
// NOTE! This method is called for normal key presses but also for
// Option-key presses --- even when Ctrl is held as well as Option. When
// Ctrl is held, the AppKit translates the character to a Ctrl+key stroke,
// 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];
NSMutableData *data = [NSMutableData data];
int len = [string lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
int flags = [event modifierFlags] & 0xffff0000U;
if ([event type] == NSKeyDown && [event isARepeat])
flags |= 1;
//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);
[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
{
//ASLogDebug(@"%@", NSStringFromSelector(selector));
// By ignoring the selector we effectively disable the key binding
// mechanism of Cocoa. Hopefully this is what the user will expect
// (pressing Ctrl+P would otherwise result in moveUp: instead of previous
// 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
{
//ASLogDebug(@"%@", 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.
if (imControl)
[self checkImState];
// NOTE: If the event that triggered this method represents a function key
// down then we do nothing, otherwise the input method never gets the key
// stroke (some input methods use e.g. arrow keys). The function key down
// 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;
}
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;
@@ -345,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])
@@ -377,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])
@@ -396,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];
@@ -426,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.
@@ -618,6 +626,7 @@ static float MMDragAreaSize = 73.0f;
- (void)setMarkedTextAttributes:(NSDictionary *)attr
{
ASLogDebug(@"%@", attr);
if (attr != markedTextAttributes) {
[markedTextAttributes release];
markedTextAttributes = [attr retain];
@@ -626,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;
@@ -667,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];
@@ -754,8 +780,76 @@ static float MMDragAreaSize = 73.0f;
{
// This flag corresponds to the (negation of the) 'imd' option. When
// enabled changes to the input method are detected and forwarded to the
// backend.
// 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
@@ -778,76 +872,100 @@ 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];
//ASLogDebug(@"chars[0]=0x%x unmodchars[0]=0x%x (chars=%@ unmodchars=%@)",
// c, imc, chars, unmodchars);
if (' ' == imc && 0xa0 != c) {
// HACK! The AppKit turns <C-Space> into <C-@> which is not standard
// 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];
//ASLogDebug(@"len=%d chars=0x%x", 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.)
@@ -862,6 +980,7 @@ static float MMDragAreaSize = 73.0f;
int msgid = state ? ActivatedImMsgID : DeactivatedImMsgID;
[[self vimController] sendMessage:msgid data:nil];
}
#endif
}
- (void)hideMouseCursor
@@ -981,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)
+6 -6
View File
@@ -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;
@@ -103,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];
@@ -160,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;
+7 -3
View File
@@ -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;
+50 -27
View File
@@ -27,7 +27,6 @@
*/
#import "MMAppController.h"
#import "MMAtsuiTextView.h"
#import "MMFindReplaceController.h"
#import "MMTextView.h"
#import "MMVimController.h"
@@ -185,7 +184,7 @@ static BOOL isUnsafeMessage(int msgid);
[super dealloc];
}
- (unsigned)identifier
- (unsigned)vimControllerId
{
return identifier;
}
@@ -348,8 +347,9 @@ static BOOL isUnsafeMessage(int msgid);
@try {
[backendProxy processInput:msgid data:data];
}
@catch (NSException *e) {
ASLogWarn(@"Exception caught during DO call: %@", e);
@catch (NSException *ex) {
ASLogNotice(@"processInput:data: failed: pid=%d id=%d msg=%s reason=%@",
pid, identifier, MessageStrings[msgid], ex);
}
}
@@ -378,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];
@@ -410,7 +412,8 @@ static BOOL isUnsafeMessage(int msgid);
ASLogDebug(@"eval(%@)=%@", expr, eval);
}
@catch (NSException *ex) {
ASLogWarn(@"Exception caught: %@", ex);
ASLogNotice(@"evaluateExpression: failed: pid=%d id=%d reason=%@",
pid, identifier, ex);
}
return eval;
@@ -426,7 +429,8 @@ static BOOL isUnsafeMessage(int msgid);
errorString:errstr];
ASLogDebug(@"eval(%@)=%@", expr, eval);
} @catch (NSException *ex) {
ASLogWarn(@"Exception caught: %@", ex);
ASLogNotice(@"evaluateExpressionCocoa: failed: pid=%d id=%d reason=%@",
pid, identifier, ex);
*errstr = [ex reason];
}
@@ -464,7 +468,7 @@ static BOOL isUnsafeMessage(int msgid);
[windowController processInputQueueDidFinish];
}
@catch (NSException *ex) {
ASLogWarn(@"Caught exception (pid=%d): %@", pid, ex);
ASLogNotice(@"Exception: pid=%d id=%d reason=%@", pid, identifier, ex);
}
}
@@ -652,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);
@@ -677,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);
@@ -802,11 +806,9 @@ static BOOL isUnsafeMessage(int msgid);
flags:[[dict objectForKey:@"flags"] intValue]];
}
} else if (ActivateKeyScriptMsgID == msgid) {
// NOTE: The IM code is delegated to the frontend since calling it in
// the backend caused weird bugs (second dock icon appearing etc.).
KeyScript(smKeySysScript);
[[[windowController vimView] textView] activateIm:YES];
} else if (DeactivateKeyScriptMsgID == msgid) {
KeyScript(smKeyRoman);
[[[windowController vimView] textView] activateIm:NO];
} else if (EnableImControlMsgID == msgid) {
[[[windowController vimView] textView] setImControl:YES];
} else if (DisableImControlMsgID == msgid) {
@@ -830,9 +832,15 @@ 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
// so that we can be fairly certain that Vim doesn't think the dialog box
@@ -850,8 +858,8 @@ static BOOL isUnsafeMessage(int msgid);
[[NSDocumentController sharedDocumentController]
noteNewRecentFilePath:path];
}
@catch (NSException *e) {
ASLogWarn(@"Exception caught: %@", e);
@catch (NSException *ex) {
ASLogNotice(@"Exception: pid=%d id=%d reason=%@", pid, identifier, ex);
}
@finally {
[conn setRequestTimeout:oldTimeout];
@@ -873,11 +881,19 @@ static BOOL isUnsafeMessage(int msgid);
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) {
ASLogWarn(@"Exception caught: %@", e);
@catch (NSException *ex) {
ASLogNotice(@"setDialogReturn: failed: pid=%d id=%d reason=%@",
pid, identifier, ex);
}
}
@@ -970,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];
@@ -1090,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];
}
@@ -1259,6 +1275,8 @@ static BOOL isUnsafeMessage(int msgid);
- (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
@@ -1266,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
+5 -5
View File
@@ -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;
+36 -26
View File
@@ -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];
}
@@ -371,7 +374,7 @@ enum {
return tvi;
}
- (void)createScrollbarWithIdentifier:(long)ident type:(int)type
- (void)createScrollbarWithIdentifier:(int32_t)ident type:(int)type
{
MMScroller *scroller = [[MMScroller alloc] initWithIdentifier:ident
type:type];
@@ -383,7 +386,7 @@ enum {
[scroller release];
}
- (BOOL)destroyScrollbarWithIdentifier:(long)ident
- (BOOL)destroyScrollbarWithIdentifier:(int32_t)ident
{
unsigned idx = 0;
MMScroller *scroller = [self scrollbarForIdentifier:ident index:&idx];
@@ -397,7 +400,7 @@ 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;
@@ -411,10 +414,15 @@ enum {
}
- (void)setScrollbarThumbValue:(float)val proportion:(float)prop
identifier:(long)ident
identifier:(int32_t)ident
{
MMScroller *scroller = [self scrollbarForIdentifier:ident index:NULL];
#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];
}
@@ -422,18 +430,18 @@ 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);
@@ -470,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];
}
}
@@ -488,8 +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];
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;
@@ -506,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]
@@ -516,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]) {
@@ -740,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;
}
@@ -779,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;
@@ -863,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
@@ -884,7 +894,7 @@ enum {
return self;
}
- (long)identifier
- (int32_t)scrollerId
{
return identifier;
}
+2 -2
View File
@@ -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;
+2 -2
View File
@@ -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];
+12 -7
View File
@@ -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;
+21 -23
View File
@@ -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;
@@ -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];
}
@@ -998,8 +995,9 @@
@try {
reply = [backendProxy starRegisterToPasteboard:pb];
}
@catch (NSException *e) {
ASLogWarn(@"Caught exception: \"%@\"", e);
@catch (NSException *ex) {
ASLogNotice(@"starRegisterToPasteboard: failed: pid=%d reason=%@",
[vimController pid], ex);
}
}
+36 -5
View File
@@ -13,11 +13,23 @@
//
// 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.
@@ -103,9 +115,7 @@ extern char *MessageStrings[];
enum {
OpenWindowMsgID = 1, // NOTE: FIRST IN ENUM MUST BE 1
InsertTextMsgID,
KeyDownMsgID,
CmdKeyMsgID,
BatchDrawMsgID,
SelectTabMsgID,
CloseTabMsgID,
@@ -179,6 +189,7 @@ enum {
BrowseForFileMsgID,
ShowDialogMsgID,
NetBeansMsgID,
SetMarkedTextMsgID,
LastMsgID // NOTE: MUST BE LAST MESSAGE IN ENUM!
};
@@ -236,6 +247,9 @@ extern NSString *MMLogToStdErrKey;
// (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;
@@ -283,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;
@@ -292,8 +306,24 @@ 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.
@@ -345,3 +375,4 @@ void ASLInit();
#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__)
+4 -2
View File
@@ -18,9 +18,7 @@ char *MessageStrings[] =
{
"INVALID MESSAGE ID",
"OpenWindowMsgID",
"InsertTextMsgID",
"KeyDownMsgID",
"CmdKeyMsgID",
"BatchDrawMsgID",
"SelectTabMsgID",
"CloseTabMsgID",
@@ -94,6 +92,7 @@ char *MessageStrings[] =
"BrowseForFileMsgID",
"ShowDialogMsgID",
"NetBeansMsgID",
"SetMarkedTextMsgID",
"END OF MESSAGE IDs" // NOTE: Must be last!
};
@@ -107,6 +106,9 @@ NSString *MMLogToStdErrKey = @"MMLogToStdErr";
// (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";
+47 -80
View File
@@ -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 = 46;
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 = 46;
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 = 46;
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;
+15 -3
View File
@@ -13,6 +13,14 @@
#import "MacVim.h"
// TODO: Remove this when the inline IM code has been tested
#define INCLUDE_OLD_IM_CODE
// 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
extern NSString *MMTabMinWidthKey;
@@ -47,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
@@ -105,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
@@ -117,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
+10 -6
View File
@@ -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];
}
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];
+4 -2
View File
@@ -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;
}
+2
View File
@@ -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
+2
View File
@@ -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
+23
View File
@@ -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/
-62
View File
@@ -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];
+85 -44
View File
@@ -38,6 +38,43 @@ 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
@@ -47,22 +84,6 @@ vimmenu_T *menu_for_descriptor(NSArray *desc);
void
gui_mch_prepare(int *argc, char **argv)
{
// 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) {
@@ -96,6 +117,29 @@ gui_mch_prepare(int *argc, char **argv)
int
gui_mch_init_check(void)
{
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;
}
@@ -107,7 +151,6 @@ gui_mch_init_check(void)
int
gui_mch_init(void)
{
ASLInit();
ASLogDebug(@"");
if (![[MMBackend sharedInstance] checkin]) {
@@ -781,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:
@@ -1079,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(
@@ -1086,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];
}
@@ -1094,7 +1146,7 @@ gui_mch_create_scrollbar(
gui_mch_destroy_scrollbar(scrollbar_T *sb)
{
[[MMBackend sharedInstance]
destroyScrollbarWithIdentifier:sb->ident];
destroyScrollbarWithIdentifier:(int32_t)sb->ident];
}
@@ -1104,7 +1156,7 @@ gui_mch_enable_scrollbar(
int flag)
{
[[MMBackend sharedInstance]
showScrollbarWithIdentifier:sb->ident state:flag];
showScrollbarWithIdentifier:(int32_t)sb->ident state:flag];
}
@@ -1124,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];
}
@@ -1136,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];
}
@@ -1589,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];
}
@@ -1985,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))
@@ -1994,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];
@@ -2019,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);
@@ -2042,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;
+1 -164
View File
@@ -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.Select\ Next\ Tab :tabnext<CR>
an <silent> 9900.350 Window.Select\ Previous\ Tab :tabprevious<CR>
an 9900.360 Window.-SEP2- <Nop>
an <silent> 9900.370 Window.Bring\ All\ To\ Front <Nop>
" 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.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:
" Restore the previous value of 'cpoptions'.
let &cpo = s:cpo_save
unlet s:cpo_save
+14 -3
View File
@@ -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
+3 -1
View File
@@ -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
@@ -106,6 +107,7 @@ vimIcons = {
'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],
}
+4
View File
@@ -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
+2 -1
View File
@@ -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
+35 -6
View File
@@ -41,9 +41,37 @@
-->
<item>
<title>Snapshot 46 released</title>
<title>Snapshot 49 released</title>
<description><![CDATA[
<h1>MacVim snapshot 46 released</h1>
<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>
@@ -56,15 +84,16 @@
<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, 10 Jul 2009 23:50 CET</pubDate>
<pubDate>Fri, 16 Jul 2009 19:43 CET</pubDate>
<enclosure type="application/octet-stream"
url="http://newmacvim.muskokamug.org/mirror/files/MacVim-snapshot-46.tbz"
length="8198862"
sparkle:version="46"
url="http://newmacvim.muskokamug.org/mirror/files/MacVim-snapshot-47.tbz"
length="8200839"
sparkle:version="47"
sparkle:shortVersionString="7.2"
/>
</item>
+6 -1
View File
@@ -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
View File
@@ -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
+4 -1
View File
@@ -135,7 +135,7 @@ endif
ifndef MZSCHEME_DLLS
MZSCHEME_DLLS=$(MZSCHEME)
endif
MZSCHEME_LIBDIR=-L$(MZSCHEME_DLLS)
MZSCHEME_LIBDIR=-L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)\lib
endif
endif
@@ -562,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
+1
View File
@@ -865,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 ..
+15 -3
View File
@@ -1257,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 =
@@ -1265,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
@@ -2211,7 +2211,7 @@ 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
@@ -2686,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:
+3761 -4363
View File
File diff suppressed because it is too large Load Diff
+7
View File
@@ -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)
@@ -1213,6 +1218,8 @@ in_win_border(wp, vcol)
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 */
+1
View File
@@ -21,6 +21,7 @@ CC = @CC@
DEFS = @DEFS@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
XCODEFLAGS = @XCODEFLAGS@
srcdir = @srcdir@
VPATH = @srcdir@
LDFLAGS = @LDFLAGS@
+7597 -6598
View File
File diff suppressed because it is too large Load Diff
+121 -71
View File
@@ -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
@@ -578,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])
@@ -791,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])
@@ -978,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
@@ -992,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)
@@ -1426,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
@@ -1435,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;
@@ -3240,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".
@@ -3263,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)
+34 -26
View File
@@ -893,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)
@@ -999,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
}
}
}
}
+1 -1
View File
@@ -8898,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())
+25
View File
@@ -18121,6 +18121,31 @@ get_vim_var_list(idx)
return vimvars[idx].vv_list;
}
/*
* Set v:char to character "c".
*/
void
set_vim_var_char(c)
int c;
{
#ifdef FEAT_MBYTE
char_u buf[MB_MAXBYTES];
#else
char_u buf[2];
#endif
#ifdef FEAT_MBYTE
if (has_mbyte)
buf[(*mb_char2bytes)(c, buf)] = NUL;
else
#endif
{
buf[0] = c;
buf[1] = NUL;
}
set_vim_var_string(VV_CHAR, buf, -1);
}
/*
* Set v:count to "count" and v:count1 to "count1".
* When "set_prevcount" is TRUE first set v:prevcount from v:count.
+1 -1
View File
@@ -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,
+1 -1
View File
@@ -2702,7 +2702,7 @@ doend:
{
/* messages could be enabled for a serious error, need to check if the
* counters don't become negative */
if (!did_emsg)
if (!did_emsg || msg_silent > save_msg_silent)
msg_silent = save_msg_silent;
emsg_silent -= did_esilent;
if (emsg_silent < 0)
+20 -14
View File
@@ -93,7 +93,7 @@ static void draw_cmdline __ARGS((int start, int len));
static void save_cmdline __ARGS((struct cmdline_info *ccp));
static void restore_cmdline __ARGS((struct cmdline_info *ccp));
static int cmdline_paste __ARGS((int regname, int literally, int remcr));
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
#if defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM))
static void redrawcmd_preedit __ARGS((void));
#endif
#ifdef FEAT_WILDMENU
@@ -2390,7 +2390,8 @@ cmdline_at_end()
}
#endif
#if (defined(FEAT_XIM) && (defined(FEAT_GUI_GTK))) || defined(PROTO)
#if (defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM))) \
|| defined(PROTO)
/*
* Return the virtual column number at the current cursor position.
* This is used by the IM code to obtain the start of the preedit string.
@@ -2418,7 +2419,7 @@ cmdline_getvcol_cursor()
}
#endif
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
#if defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM))
/*
* If part of the command line is an IM preedit string, redraw it with
* IM feedback attributes. The cursor position is restored after drawing.
@@ -2427,7 +2428,9 @@ cmdline_getvcol_cursor()
redrawcmd_preedit()
{
if ((State & CMDLINE)
# ifndef FEAT_GUI_MACVIM
&& xic != NULL
# endif
/* && im_get_status() doesn't work when using SCIM */
&& !p_imdisable
&& im_is_preediting())
@@ -2488,7 +2491,7 @@ redrawcmd_preedit()
msg_col = old_col;
}
}
#endif /* FEAT_XIM && FEAT_GUI_GTK */
#endif /* FEAT_XIM && (FEAT_GUI_GTK || FEAT_GUI_MACVIM) */
/*
* Allocate a new command line buffer.
@@ -3211,7 +3214,7 @@ cursorcmd()
}
windgoto(msg_row, msg_col);
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
#if defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM))
redrawcmd_preedit();
#endif
#ifdef MCH_CURSOR_SHAPE
@@ -3266,7 +3269,6 @@ nextwild(xp, type, options)
int i, j;
char_u *p1;
char_u *p2;
int oldlen;
int difflen;
int v;
@@ -3291,7 +3293,7 @@ nextwild(xp, type, options)
out_flush();
i = (int)(xp->xp_pattern - ccline.cmdbuff);
oldlen = ccline.cmdpos - i;
xp->xp_pattern_len = ccline.cmdpos - i;
if (type == WILD_NEXT || type == WILD_PREV)
{
@@ -3305,18 +3307,20 @@ nextwild(xp, type, options)
/*
* Translate string into pattern and expand it.
*/
if ((p1 = addstar(&ccline.cmdbuff[i], oldlen, xp->xp_context)) == NULL)
if ((p1 = addstar(xp->xp_pattern, xp->xp_pattern_len,
xp->xp_context)) == NULL)
p2 = NULL;
else
{
p2 = ExpandOne(xp, p1, vim_strnsave(&ccline.cmdbuff[i], oldlen),
p2 = ExpandOne(xp, p1,
vim_strnsave(&ccline.cmdbuff[i], xp->xp_pattern_len),
WILD_HOME_REPLACE|WILD_ADD_SLASH|WILD_SILENT|WILD_ESCAPE
|options, type);
vim_free(p1);
/* longest match: make sure it is not shorter (happens with :help */
if (p2 != NULL && type == WILD_LONGEST)
{
for (j = 0; j < oldlen; ++j)
for (j = 0; j < xp->xp_pattern_len; ++j)
if (ccline.cmdbuff[i + j] == '*'
|| ccline.cmdbuff[i + j] == '?')
break;
@@ -3331,7 +3335,7 @@ nextwild(xp, type, options)
if (p2 != NULL && !got_int)
{
difflen = (int)STRLEN(p2) - oldlen;
difflen = (int)STRLEN(p2) - xp->xp_pattern_len;
if (ccline.cmdlen + difflen > ccline.cmdbufflen - 4)
{
v = realloc_cmdbuff(ccline.cmdlen + difflen);
@@ -3620,6 +3624,7 @@ ExpandInit(xp)
expand_T *xp;
{
xp->xp_pattern = NULL;
xp->xp_pattern_len = 0;
xp->xp_backslash = XP_BS_NONE;
#ifndef BACKSLASH_IN_FILENAME
xp->xp_shell = FALSE;
@@ -4311,8 +4316,8 @@ expand_cmdline(xp, str, col, matchcount, matches)
}
/* add star to file name, or convert to regexp if not exp. files. */
file_str = addstar(xp->xp_pattern,
(int)(str + col - xp->xp_pattern), xp->xp_context);
xp->xp_pattern_len = (int)(str + col - xp->xp_pattern);
file_str = addstar(xp->xp_pattern, xp->xp_pattern_len, xp->xp_context);
if (file_str == NULL)
return EXPAND_UNSUCCESSFUL;
@@ -4784,7 +4789,7 @@ call_user_expand_func(user_expand_func, xp, num_file, file)
sprintf((char *)num, "%d", ccline.cmdpos);
args[1] = ccline.cmdbuff;
}
args[0] = xp->xp_pattern;
args[0] = vim_strnsave(xp->xp_pattern, xp->xp_pattern_len);
args[2] = num;
/* Save the cmdline, we don't know what the function may do. */
@@ -4800,6 +4805,7 @@ call_user_expand_func(user_expand_func, xp, num_file, file)
if (ccline.cmdbuff != NULL)
ccline.cmdbuff[ccline.cmdlen] = keep;
vim_free(args[0]);
return ret;
}
+4 -1
View File
@@ -666,10 +666,13 @@
* Both are for Unix and VMS only.
*/
#ifndef FEAT_XIM
# if defined(FEAT_GUI_MACVIM) && defined(FEAT_MBYTE)
# define FEAT_XIM
# endif
/* #define FEAT_XIM */
#endif
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_MACVIM)
# define USE_XIM 1 /* needed for GTK include files */
#endif
+96 -32
View File
@@ -121,6 +121,8 @@ struct bw_info
char_u *bw_conv_buf; /* buffer for writing converted chars */
int bw_conv_buflen; /* size of bw_conv_buf */
int bw_conv_error; /* set for conversion error */
linenr_T bw_conv_error_lnum; /* first line with error or zero */
linenr_T bw_start_lnum; /* line number at start of buffer */
# ifdef USE_ICONV
iconv_t bw_iconv_fd; /* descriptor for iconv() or -1 */
# endif
@@ -132,7 +134,7 @@ static int buf_write_bytes __ARGS((struct bw_info *ip));
#ifdef FEAT_MBYTE
static linenr_T readfile_linenr __ARGS((linenr_T linecnt, char_u *p, char_u *endp));
static int ucs2bytes __ARGS((unsigned c, char_u **pp, int flags));
static int same_encoding __ARGS((char_u *a, char_u *b));
static int need_conversion __ARGS((char_u *fenc));
static int get_fio_flags __ARGS((char_u *ptr));
static char_u *check_for_bom __ARGS((char_u *p, long size, int *lenp, int flags));
static int make_bom __ARGS((char_u *buf, char_u *name));
@@ -1041,13 +1043,12 @@ retry:
}
/*
* Conversion is required when the encoding of the file is different
* from 'encoding' or 'encoding' is UTF-16, UCS-2 or UCS-4 (requires
* conversion to UTF-8).
* Conversion may be required when the encoding of the file is different
* from 'encoding' or 'encoding' is UTF-16, UCS-2 or UCS-4.
*/
fio_flags = 0;
converted = (*fenc != NUL && !same_encoding(p_enc, fenc));
if (converted || enc_unicode != 0)
converted = need_conversion(fenc);
if (converted)
{
/* "ucs-bom" means we need to check the first bytes of the file
@@ -2924,6 +2925,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit,
linenr_T lnum;
long nchars;
char_u *errmsg = NULL;
int errmsg_allocated = FALSE;
char_u *errnum = NULL;
char_u *buffer;
char_u smallbuf[SMBUFSIZE];
@@ -2987,6 +2989,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit,
/* must init bw_conv_buf and bw_iconv_fd before jumping to "fail" */
write_info.bw_conv_buf = NULL;
write_info.bw_conv_error = FALSE;
write_info.bw_conv_error_lnum = 0;
write_info.bw_restlen = 0;
# ifdef USE_ICONV
write_info.bw_iconv_fd = (iconv_t)-1;
@@ -3965,10 +3968,9 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit,
fenc = buf->b_p_fenc;
/*
* The file needs to be converted when 'fileencoding' is set and
* 'fileencoding' differs from 'encoding'.
* Check if the file needs to be converted.
*/
converted = (*fenc != NUL && !same_encoding(p_enc, fenc));
converted = need_conversion(fenc);
/*
* Check if UTF-8 to UCS-2/4 or Latin1 conversion needs to be done. Or
@@ -4243,6 +4245,7 @@ restore_backup:
nchars += write_info.bw_len;
}
}
write_info.bw_start_lnum = start;
#endif
write_info.bw_len = bufsize;
@@ -4278,6 +4281,9 @@ restore_backup:
nchars += bufsize;
s = buffer;
len = 0;
#ifdef FEAT_MBYTE
write_info.bw_start_lnum = lnum;
#endif
}
/* write failed or last line has no EOL: stop here */
if (end == 0
@@ -4474,7 +4480,17 @@ restore_backup:
{
#ifdef FEAT_MBYTE
if (write_info.bw_conv_error)
errmsg = (char_u *)_("E513: write error, conversion failed (make 'fenc' empty to override)");
{
if (write_info.bw_conv_error_lnum == 0)
errmsg = (char_u *)_("E513: write error, conversion failed (make 'fenc' empty to override)");
else
{
errmsg_allocated = TRUE;
errmsg = alloc(300);
vim_snprintf((char *)errmsg, 300, _("E513: write error, conversion failed in line %ld (make 'fenc' empty to override)"),
(long)write_info.bw_conv_error_lnum);
}
}
else
#endif
if (got_int)
@@ -4550,6 +4566,12 @@ restore_backup:
{
STRCAT(IObuff, _(" CONVERSION ERROR"));
c = TRUE;
if (write_info.bw_conv_error_lnum != 0)
{
size_t l = STRLEN(IObuff);
vim_snprintf((char *)IObuff + l, IOSIZE - l, _(" in line %ld;"),
(long)write_info.bw_conv_error_lnum);
}
}
else if (notconverted)
{
@@ -4746,6 +4768,8 @@ nofail:
}
STRCAT(IObuff, errmsg);
emsg(IObuff);
if (errmsg_allocated)
vim_free(errmsg);
retval = FAIL;
if (end == 0)
@@ -5109,7 +5133,13 @@ buf_write_bytes(ip)
c = buf[wlen];
}
ip->bw_conv_error |= ucs2bytes(c, &p, flags);
if (ucs2bytes(c, &p, flags) && !ip->bw_conv_error)
{
ip->bw_conv_error = TRUE;
ip->bw_conv_error_lnum = ip->bw_start_lnum;
}
if (c == NL)
++ip->bw_start_lnum;
}
if (flags & FIO_LATIN1)
len = (int)(p - buf);
@@ -5390,6 +5420,7 @@ buf_write_bytes(ip)
#ifdef FEAT_MBYTE
/*
* Convert a Unicode character to bytes.
* Return TRUE for an error, FALSE when it's OK.
*/
static int
ucs2bytes(c, pp, flags)
@@ -5473,20 +5504,37 @@ ucs2bytes(c, pp, flags)
}
/*
* Return TRUE if "a" and "b" are the same 'encoding'.
* Ignores difference between "ansi" and "latin1", "ucs-4" and "ucs-4be", etc.
* Return TRUE if file encoding "fenc" requires conversion from or to
* 'encoding'.
*/
static int
same_encoding(a, b)
char_u *a;
char_u *b;
need_conversion(fenc)
char_u *fenc;
{
int f;
int same_encoding;
int enc_flags;
int fenc_flags;
if (STRCMP(a, b) == 0)
return TRUE;
f = get_fio_flags(a);
return (f != 0 && get_fio_flags(b) == f);
if (*fenc == NUL || STRCMP(p_enc, fenc) == 0)
same_encoding = TRUE;
else
{
/* Ignore difference between "ansi" and "latin1", "ucs-4" and
* "ucs-4be", etc. */
enc_flags = get_fio_flags(p_enc);
fenc_flags = get_fio_flags(fenc);
same_encoding = (enc_flags != 0 && fenc_flags == enc_flags);
}
if (same_encoding)
{
/* Specified encoding matches with 'encoding'. This requires
* conversion when 'encoding' is Unicode but not UTF-8. */
return enc_unicode != 0;
}
/* Encodings differ. However, conversion is not needed when 'enc' is any
* Unicode encoding and the file is UTF-8. */
return !(enc_utf8 && fenc_flags == FIO_UTF8);
}
/*
@@ -8458,6 +8506,10 @@ aucmd_prepbuf(aco, buf)
if (aucmd_win == NULL)
win = curwin;
}
if (win == NULL && aucmd_win_used)
/* Strange recursive autocommand, fall back to using the current
* window. Expect a few side effects... */
win = curwin;
aco->save_curwin = curwin;
aco->save_curbuf = curbuf;
@@ -8466,6 +8518,7 @@ aucmd_prepbuf(aco, buf)
/* There is a window for "buf" in the current tab page, make it the
* curwin. This is preferred, it has the least side effects (esp. if
* "buf" is curbuf). */
aco->use_aucmd_win = FALSE;
curwin = win;
}
else
@@ -8474,9 +8527,20 @@ aucmd_prepbuf(aco, buf)
* effects, insert it in a the current tab page.
* Anything related to a window (e.g., setting folds) may have
* unexpected results. */
aco->use_aucmd_win = TRUE;
aucmd_win_used = TRUE;
aucmd_win->w_buffer = buf;
++buf->b_nwindows;
win_init_empty(aucmd_win); /* set cursor and topline to safe values */
vim_free(aucmd_win->w_localdir);
aucmd_win->w_localdir = NULL;
/* Make sure w_localdir and globaldir are NULL to avoid a chdir() in
* win_enter_ext(). */
aucmd_win->w_localdir = NULL;
aco->globaldir = globaldir;
globaldir = NULL;
#ifdef FEAT_WINDOWS
/* Split the current window, put the aucmd_win in the upper half.
@@ -8510,7 +8574,7 @@ aucmd_restbuf(aco)
int dummy;
#endif
if (aco->new_curwin == aucmd_win)
if (aco->use_aucmd_win)
{
--curbuf->b_nwindows;
#ifdef FEAT_WINDOWS
@@ -8537,6 +8601,7 @@ aucmd_restbuf(aco)
/* Remove the window and frame from the tree of frames. */
(void)winframe_remove(curwin, &dummy, NULL);
win_remove(curwin, NULL);
aucmd_win_used = FALSE;
last_status(FALSE); /* may need to remove last status line */
restore_snapshot(SNAP_AUCMD_IDX, FALSE);
(void)win_comp_pos(); /* recompute window positions */
@@ -8555,6 +8620,9 @@ aucmd_restbuf(aco)
#endif
curbuf = curwin->w_buffer;
vim_free(globaldir);
globaldir = aco->globaldir;
/* the buffer contents may have changed */
check_cursor();
if (curwin->w_topline > curbuf->b_ml.ml_line_count)
@@ -8579,7 +8647,7 @@ aucmd_restbuf(aco)
#endif
{
/* Restore the buffer which was previously edited by curwin, if
* it was chagned, we are still the same window and the buffer is
* it was changed, we are still the same window and the buffer is
* valid. */
if (curwin == aco->new_curwin
&& curbuf != aco->new_curbuf
@@ -9468,15 +9536,10 @@ au_exists(arg)
ap = first_autopat[(int)event];
if (ap == NULL)
goto theend;
if (pattern == NULL)
{
retval = TRUE;
goto theend;
}
/* if pattern is "<buffer>", special handling is needed which uses curbuf */
/* for pattern "<buffer=N>, fnamecmp() will work fine */
if (STRICMP(pattern, "<buffer>") == 0)
if (pattern != NULL && STRICMP(pattern, "<buffer>") == 0)
buflocal_buf = curbuf;
/* Check if there is an autocommand with the given pattern. */
@@ -9485,9 +9548,10 @@ au_exists(arg)
/* For buffer-local autocommands, fnamecmp() works fine. */
if (ap->pat != NULL && ap->cmds != NULL
&& (group == AUGROUP_ALL || ap->group == group)
&& (buflocal_buf == NULL
? fnamecmp(ap->pat, pattern) == 0
: ap->buflocal_nr == buflocal_buf->b_fnum))
&& (pattern == NULL
|| (buflocal_buf == NULL
? fnamecmp(ap->pat, pattern) == 0
: ap->buflocal_nr == buflocal_buf->b_fnum)))
{
retval = TRUE;
break;
+8 -4
View File
@@ -1607,11 +1607,11 @@ foldMarkAdjustRecurse(gap, line1, line2, amount, amount_after)
}
else
{
/* 2, 3, or 5: need to correct nested folds too */
foldMarkAdjustRecurse(&fp->fd_nested, line1 - fp->fd_top,
line2 - fp->fd_top, amount, amount_after);
if (fp->fd_top < top)
{
/* 2 or 3: need to correct nested folds too */
foldMarkAdjustRecurse(&fp->fd_nested, line1 - fp->fd_top,
line2 - fp->fd_top, amount, amount_after);
if (last <= line2)
{
/* 2. fold contains line1, line2 is below fold */
@@ -1628,7 +1628,11 @@ foldMarkAdjustRecurse(gap, line1, line2, amount, amount_after)
}
else
{
/* 5. fold is below line1 and contains line2 */
/* 5. fold is below line1 and contains line2; need to
* correct nested folds too */
foldMarkAdjustRecurse(&fp->fd_nested, line1 - fp->fd_top,
line2 - fp->fd_top, amount,
amount_after + (fp->fd_top - top));
if (amount == MAXLNUM)
{
fp->fd_len -= line2 - fp->fd_top + 1;
+12 -12
View File
@@ -129,7 +129,7 @@ static void map_free __ARGS((mapblock_T **));
static void validate_maphash __ARGS((void));
static void showmap __ARGS((mapblock_T *mp, int local));
#ifdef FEAT_EVAL
static char_u *eval_map_expr __ARGS((char_u *str));
static char_u *eval_map_expr __ARGS((char_u *str, int c));
#endif
/*
@@ -2446,7 +2446,7 @@ vgetorpeek(advance)
if (tabuf.typebuf_valid)
{
vgetc_busy = 0;
s = eval_map_expr(mp->m_str);
s = eval_map_expr(mp->m_str, NUL);
vgetc_busy = save_vgetc_busy;
}
else
@@ -3708,11 +3708,10 @@ get_map_mode(cmdp, forceit)
* Clear all mappings or abbreviations.
* 'abbr' should be FALSE for mappings, TRUE for abbreviations.
*/
/*ARGSUSED*/
void
map_clear(cmdp, arg, forceit, abbr)
char_u *cmdp;
char_u *arg;
char_u *arg UNUSED;
int forceit;
int abbr;
{
@@ -3741,13 +3740,12 @@ map_clear(cmdp, arg, forceit, abbr)
/*
* Clear all mappings in "mode".
*/
/*ARGSUSED*/
void
map_clear_int(buf, mode, local, abbr)
buf_T *buf; /* buffer for local mappings */
int mode; /* mode in which to delete */
int local; /* TRUE for buffer-local mappings */
int abbr; /* TRUE for abbreviations */
buf_T *buf UNUSED; /* buffer for local mappings */
int mode; /* mode in which to delete */
int local UNUSED; /* TRUE for buffer-local mappings */
int abbr; /* TRUE for abbreviations */
{
mapblock_T *mp, **mpp;
int hash;
@@ -4369,9 +4367,9 @@ check_abbr(c, ptr, col, mincol)
* abbreviation, but is not inserted into the input stream.
*/
j = 0;
/* special key code, split up */
if (c != Ctrl_RSB)
{
/* special key code, split up */
if (IS_SPECIAL(c) || c == K_SPECIAL)
{
tb[j++] = K_SPECIAL;
@@ -4400,7 +4398,7 @@ check_abbr(c, ptr, col, mincol)
}
#ifdef FEAT_EVAL
if (mp->m_expr)
s = eval_map_expr(mp->m_str);
s = eval_map_expr(mp->m_str, c);
else
#endif
s = mp->m_str;
@@ -4436,8 +4434,9 @@ check_abbr(c, ptr, col, mincol)
* special characters.
*/
static char_u *
eval_map_expr(str)
eval_map_expr(str, c)
char_u *str;
int c; /* NUL or typed character for abbreviation */
{
char_u *res;
char_u *p;
@@ -4454,6 +4453,7 @@ eval_map_expr(str)
#ifdef FEAT_EX_EXTRA
++ex_normal_lock;
#endif
set_vim_var_char(c); /* set v:char to the typed character */
save_cursor = curwin->w_cursor;
p = eval_to_string(str, NULL, FALSE);
--textlock;
+3 -2
View File
@@ -541,6 +541,7 @@ EXTERN win_T *curwin; /* currently active window */
#ifdef FEAT_AUTOCMD
EXTERN win_T *aucmd_win; /* window used in aucmd_prepbuf() */
EXTERN int aucmd_win_used INIT(= FALSE); /* aucmd_win is being used */
#endif
/*
@@ -840,10 +841,10 @@ EXTERN int* (*iconv_errno) (void);
#endif /* FEAT_MBYTE */
#ifdef FEAT_XIM
# ifdef FEAT_GUI_GTK
# if defined(FEAT_GUI_GTK) || defined (FEAT_GUI_MACVIM)
# ifdef HAVE_GTK2
EXTERN GtkIMContext *xic INIT(= NULL);
# else
# elif !defined(FEAT_GUI_MACVIM)
EXTERN GdkICAttr *xic_attr INIT(= NULL);
EXTERN GdkIC *xic INIT(= NULL);
EXTERN char *draw_feedback INIT(= NULL);
+52 -4
View File
@@ -1206,7 +1206,7 @@ gui_position_components(total_width)
text_area_y,
text_area_width,
text_area_height
#if defined(FEAT_XIM) && !defined(HAVE_GTK2)
#if defined(FEAT_XIM) && !(defined(HAVE_GTK2) || defined(FEAT_GUI_MACVIM))
+ xim_get_status_area_height()
#endif
);
@@ -1337,7 +1337,7 @@ again:
gui_update_scrollbars(TRUE);
gui_update_cursor(FALSE, TRUE);
#if defined(FEAT_XIM) && !defined(HAVE_GTK2)
#if defined(FEAT_XIM) && !(defined(HAVE_GTK2) || defined(FEAT_GUI_MACVIM))
xim_set_status_area();
#endif
@@ -1404,6 +1404,10 @@ gui_set_shellsize(mustset, fit_to_display, direction)
int min_height;
int screen_w;
int screen_h;
#ifdef HAVE_GTK2
int un_maximize = mustset;
int did_adjust = 0;
#endif
if (!gui.shell_created)
return;
@@ -1443,22 +1447,47 @@ gui_set_shellsize(mustset, fit_to_display, direction)
if (Columns < MIN_COLUMNS)
Columns = MIN_COLUMNS;
width = Columns * gui.char_width + base_width;
#ifdef HAVE_GTK2
++did_adjust;
#endif
}
if ((direction & RESIZE_VERT) && height > screen_h)
{
Rows = (screen_h - base_height) / gui.char_height;
check_shellsize();
height = Rows * gui.char_height + base_height;
#ifdef HAVE_GTK2
++did_adjust;
#endif
}
#ifdef HAVE_GTK2
if (did_adjust == 2 || (width + gui.char_width >= screen_w
&& height + gui.char_height >= screen_h))
/* don't unmaximize if at maximum size */
un_maximize = FALSE;
#endif
}
gui.num_cols = Columns;
gui.num_rows = Rows;
min_width = base_width + MIN_COLUMNS * gui.char_width;
min_height = base_height + MIN_LINES * gui.char_height;
# ifdef FEAT_WINDOWS
#ifdef FEAT_WINDOWS
min_height += tabline_height() * gui.char_height;
# endif
#endif
#ifdef HAVE_GTK2
if (un_maximize)
{
/* If the window size is smaller than the screen unmaximize the
* window, otherwise resizing won't work. */
gui_mch_get_screen_dimensions(&screen_w, &screen_h);
if ((width + gui.char_width < screen_w
|| height + gui.char_height * 2 < screen_h)
&& gui_mch_maximized())
gui_mch_unmaximize();
}
#endif
gui_mch_set_shellsize(width, height, min_width, min_height,
base_width, base_height, direction);
@@ -3627,7 +3656,12 @@ gui_create_scrollbar(sb, type, wp)
int type;
win_T *wp;
{
#ifdef FEAT_GUI_MACVIM
/* This is passed over to another process, make sure it fits in 32 bit */
static int32_t sbar_ident = 0;
#else
static int sbar_ident = 0;
#endif
sb->ident = sbar_ident++; /* No check for too big, but would it happen? */
sb->wp = wp;
@@ -5029,6 +5063,19 @@ gui_do_findrepl(flags, find_text, repl_text, down)
char_u *p;
regmatch_T regmatch;
int save_did_emsg = did_emsg;
static int busy = FALSE;
/* When the screen is being updated we should not change buffers and
* windows structures, it may cause freed memory to be used. Also don't
* do this recursively (pressing "Find" quickly several times. */
if (updating_screen || busy)
return FALSE;
/* refuse replace when text cannot be changed */
if ((type == FRD_REPLACE || type == FRD_REPLACEALL) && text_locked())
return FALSE;
busy = TRUE;
ga_init2(&ga, 1, 100);
if (type == FRD_REPLACEALL)
@@ -5119,6 +5166,7 @@ gui_do_findrepl(flags, find_text, repl_text, down)
}
vim_free(ga.ga_data);
busy = FALSE;
return (ga.ga_len > 0);
}
+1 -1
View File
@@ -495,7 +495,7 @@ typedef struct Gui
PhEvent_t *event_buffer;
#endif
#ifdef FEAT_XIM
#if defined(FEAT_XIM) && !defined(FEAT_GUI_MACVIM)
char *rsrc_input_method;
char *rsrc_preedit_type_name;
#endif
+3 -5
View File
@@ -860,11 +860,9 @@ gtk_form_main_filter(GdkXEvent *gdk_xevent,
gtk_form_set_static_gravity(GdkWindow *window, gboolean use_static)
{
#ifdef HAVE_GTK2
gboolean static_gravity_supported;
static_gravity_supported = gdk_window_set_static_gravities(window,
use_static);
g_return_if_fail(static_gravity_supported);
/* We don't check if static gravity is actually supported, because it
* results in an annoying assertion error message. */
gdk_window_set_static_gravities(window, use_static);
#else
XSetWindowAttributes xattributes;
+41 -5
View File
@@ -4066,6 +4066,8 @@ gui_mch_open(void)
{
guicolor_T fg_pixel = INVALCOLOR;
guicolor_T bg_pixel = INVALCOLOR;
guint pixel_width;
guint pixel_height;
#ifdef HAVE_GTK2
/*
@@ -4106,8 +4108,6 @@ gui_mch_open(void)
unsigned int w, h;
int x = 0;
int y = 0;
guint pixel_width;
guint pixel_height;
mask = XParseGeometry((char *)gui.geom, &x, &y, &w, &h);
@@ -4160,9 +4160,16 @@ gui_mch_open(void)
}
}
gtk_form_set_size(GTK_FORM(gui.formwin),
(guint)(gui_get_base_width() + Columns * gui.char_width),
(guint)(gui_get_base_height() + Rows * gui.char_height));
pixel_width = (guint)(gui_get_base_width() + Columns * gui.char_width);
pixel_height = (guint)(gui_get_base_height() + Rows * gui.char_height);
#ifdef HAVE_GTK2
/* For GTK2 changing the size of the form widget doesn't cause window
* resizing. */
if (gtk_socket_id == 0)
gtk_window_resize(GTK_WINDOW(gui.mainwin), pixel_width, pixel_height);
#else
gtk_form_set_size(GTK_FORM(gui.formwin), pixel_width, pixel_height);
#endif
update_window_manager_hints(0, 0);
if (foreground_argument != NULL)
@@ -4369,6 +4376,29 @@ force_shell_resize_idle(gpointer data)
#endif
#endif /* HAVE_GTK2 */
#if defined(HAVE_GTK2) || defined(PROTO)
/*
* Return TRUE if the main window is maximized.
*/
int
gui_mch_maximized()
{
return (gui.mainwin != NULL && gui.mainwin->window != NULL
&& (gdk_window_get_state(gui.mainwin->window)
& GDK_WINDOW_STATE_MAXIMIZED));
}
/*
* Unmaximize the main window
*/
void
gui_mch_unmaximize()
{
if (gui.mainwin != NULL)
gtk_window_unmaximize(GTK_WINDOW(gui.mainwin));
}
#endif
/*
* Set the windows size.
*/
@@ -4729,6 +4759,9 @@ gui_mch_font_dialog(char_u *oldval)
if (oldval != NULL && *oldval != NUL)
gtk_font_selection_dialog_set_font_name(
GTK_FONT_SELECTION_DIALOG(gui.fontdlg), (char *)oldval);
else
gtk_font_selection_dialog_set_font_name(
GTK_FONT_SELECTION_DIALOG(gui.fontdlg), DEFAULT_FONT);
if (gui.fontname)
{
@@ -4816,6 +4849,9 @@ gui_mch_font_dialog(char_u *oldval)
if (oldname != oldval)
vim_free(oldname);
}
else
gtk_font_selection_dialog_set_font_name(
GTK_FONT_SELECTION_DIALOG(dialog), DEFAULT_FONT);
response = gtk_dialog_run(GTK_DIALOG(dialog));
+5 -3
View File
@@ -635,8 +635,10 @@ dynamic_mzscheme_end(void)
#endif /* DYNAMIC_MZSCHEME */
/* need to put it here for dynamic stuff to work */
#ifdef INCLUDE_MZSCHEME_BASE
#if defined(INCLUDE_MZSCHEME_BASE)
# include "mzscheme_base.c"
#elif MZSCHEME_VERSION_MAJOR >= 400
# error MzScheme 4.x must include mzscheme_base.c, for MinGW32 you need to define MZSCHEME_GENERATE_BASE=yes
#endif
/*
@@ -875,14 +877,14 @@ startup_mzscheme(void)
#ifdef INCLUDE_MZSCHEME_BASE
{
/*
* versions 4.x do not provide Scheme bindings by defaults
* versions 4.x do not provide Scheme bindings by default
* we need to add them explicitly
*/
Scheme_Object *scheme_base_symbol = NULL;
MZ_GC_DECL_REG(1);
MZ_GC_VAR_IN_REG(0, scheme_base_symbol);
MZ_GC_REG();
/* invoke function from generated and included base.c */
/* invoke function from generated and included mzscheme_base.c */
declare_modules(environment);
scheme_base_symbol = scheme_intern_symbol("scheme/base");
MZ_GC_CHECK();
+2
View File
@@ -720,9 +720,11 @@ ex_perl(eap)
#ifdef HAVE_SANDBOX
if (sandbox)
{
# ifndef MAKE_TEST /* avoid a warning for unreachable code */
if ((safe = perl_get_sv( "VIM::safe", FALSE )) == NULL || !SvTRUE(safe))
EMSG(_("E299: Perl evaluation forbidden in sandbox without the Safe module"));
else
# endif
{
PUSHMARK(SP);
XPUSHs(safe);
+6 -1
View File
@@ -40,7 +40,12 @@
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#ifdef FEAT_GUI_MACVIM
# include <Python/Python.h>
#else
# include <Python.h>
#endif
#if defined(MACOS) && !defined(MACOS_X_UNIX)
# include "macglue.h"
# include <CodeFragments.h>
+5 -1
View File
@@ -48,7 +48,11 @@
# endif
#endif
#include <ruby.h>
#ifdef FEAT_GUI_MACVIM
# include <Ruby/Ruby.h>
#else
# include <ruby.h>
#endif
#undef EXTERN
#undef _
+64 -4
View File
@@ -3517,7 +3517,14 @@ iconv_end()
#if defined(FEAT_XIM) || defined(PROTO)
# ifdef FEAT_GUI_GTK
# ifdef FEAT_GUI_MACVIM
typedef int GtkIMContext;
typedef int * gpointer;
typedef char gchar;
# define g_return_if_fail(x) if (!(x)) return;
# endif
# if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM)
static int xim_has_preediting INIT(= FALSE); /* IM current status */
/*
@@ -3535,7 +3542,7 @@ init_preedit_start_col(void)
}
# endif
# if defined(HAVE_GTK2) && !defined(PROTO)
# if (defined(HAVE_GTK2) || defined(FEAT_GUI_MACVIM)) && !defined(PROTO)
static int im_is_active = FALSE; /* IM is enabled for current mode */
static int preedit_is_active = FALSE;
@@ -3543,9 +3550,12 @@ static int im_preedit_cursor = 0; /* cursor offset in characters */
static int im_preedit_trailing = 0; /* number of characters after cursor */
static unsigned long im_commit_handler_id = 0;
# ifndef FEAT_GUI_MACVIM
static unsigned int im_activatekey_keyval = GDK_VoidSymbol;
static unsigned int im_activatekey_state = 0;
# endif
# ifndef FEAT_GUI_MACVIM
void
im_set_active(int active)
{
@@ -3557,10 +3567,12 @@ im_set_active(int active)
if (im_is_active != was_active)
xim_reset();
}
# endif
void
xim_set_focus(int focus)
{
# ifndef FEAT_GUI_MACVIM
if (xic != NULL)
{
if (focus)
@@ -3568,8 +3580,10 @@ xim_set_focus(int focus)
else
gtk_im_context_focus_out(xic);
}
# endif
}
# ifndef FEAT_GUI_MACVIM
void
im_set_position(int row, int col)
{
@@ -3585,6 +3599,7 @@ im_set_position(int row, int col)
gtk_im_context_set_cursor_location(xic, &area);
}
}
# endif
# if 0 || defined(PROTO) /* apparently only used in gui_x11.c */
void
@@ -3609,8 +3624,10 @@ im_add_to_input(char_u *str, int len)
if (input_conv.vc_type != CONV_NONE)
vim_free(str);
# ifndef FEAT_GUI_MACVIM
if (p_mh) /* blank out the pointer if necessary */
gui_mch_mousehide(TRUE);
# endif
}
static void
@@ -3651,8 +3668,10 @@ im_correct_cursor(int num_move_back)
add_to_input_buf(backkey, (int)sizeof(backkey));
}
# ifndef FEAT_GUI_MACVIM
static int xim_expected_char = NUL;
static int xim_ignored_char = FALSE;
# endif
/*
* Update the mode and cursor while in an IM callback.
@@ -3670,6 +3689,7 @@ im_show_info(void)
out_flush();
}
# ifndef FEAT_GUI_MACVIM
/*
* Callback invoked when the user finished preediting.
* Put the final string into the input buffer.
@@ -3759,12 +3779,18 @@ im_commit_cb(GtkIMContext *context UNUSED,
if (gtk_main_level() > 0)
gtk_main_quit();
}
# endif
/*
* Callback invoked after start to the preedit.
*/
# ifndef FEAT_GUI_MACVIM
static void
im_preedit_start_cb(GtkIMContext *context UNUSED, gpointer data UNUSED)
# else
void
im_preedit_start_macvim()
# endif
{
#ifdef XIM_DEBUG
xim_log("im_preedit_start_cb()\n");
@@ -3779,8 +3805,13 @@ im_preedit_start_cb(GtkIMContext *context UNUSED, gpointer data UNUSED)
/*
* Callback invoked after end to the preedit.
*/
# ifndef FEAT_GUI_MACVIM
static void
im_preedit_end_cb(GtkIMContext *context UNUSED, gpointer data UNUSED)
# else
void
im_preedit_end_macvim()
# endif
{
#ifdef XIM_DEBUG
xim_log("im_preedit_end_cb()\n");
@@ -3839,19 +3870,28 @@ im_preedit_end_cb(GtkIMContext *context UNUSED, gpointer data UNUSED)
* remaining input from within the "retrieve_surrounding" signal handler, this
* might not be necessary. Gotta ask on vim-dev for opinions.
*/
# ifndef FEAT_GUI_MACVIM
static void
im_preedit_changed_cb(GtkIMContext *context, gpointer data UNUSED)
# else
void
im_preedit_changed_macvim(char *preedit_string, int cursor_index)
# endif
{
# ifndef FEAT_GUI_MACVIM
char *preedit_string = NULL;
int cursor_index = 0;
# endif
int num_move_back = 0;
char_u *str;
char_u *p;
int i;
# ifndef FEAT_GUI_MACVIM
gtk_im_context_get_preedit_string(context,
&preedit_string, NULL,
&cursor_index);
# endif
#ifdef XIM_DEBUG
xim_log("im_preedit_changed_cb(): %s\n", preedit_string);
@@ -3921,12 +3961,15 @@ im_preedit_changed_cb(GtkIMContext *context, gpointer data UNUSED)
im_correct_cursor(num_move_back);
}
# ifndef FEAT_GUI_MACVIM
g_free(preedit_string);
if (gtk_main_level() > 0)
gtk_main_quit();
# endif
}
# ifndef FEAT_GUI_MACVIM
/*
* Translate the Pango attributes at iter to Vim highlighting attributes.
* Ignore attributes not supported by Vim highlighting. This shouldn't have
@@ -3965,6 +4008,7 @@ translate_pango_attributes(PangoAttrIterator *iter)
return char_attr;
}
# endif
/*
* Retrieve the highlighting attributes at column col in the preedit string.
@@ -3973,6 +4017,7 @@ translate_pango_attributes(PangoAttrIterator *iter)
int
im_get_feedback_attr(int col)
{
# ifndef FEAT_GUI_MACVIM
char *preedit_string = NULL;
PangoAttrList *attr_list = NULL;
int char_attr = -1;
@@ -4017,6 +4062,9 @@ im_get_feedback_attr(int col)
g_free(preedit_string);
return char_attr;
# else
return HL_UNDERLINE;
# endif
}
void
@@ -4026,6 +4074,7 @@ xim_init(void)
xim_log("xim_init()\n");
#endif
# ifndef FEAT_GUI_MACVIM
g_return_if_fail(gui.drawarea != NULL);
g_return_if_fail(gui.drawarea->window != NULL);
@@ -4042,6 +4091,7 @@ xim_init(void)
G_CALLBACK(&im_preedit_end_cb), NULL);
gtk_im_context_set_client_window(xic, gui.drawarea->window);
# endif
}
void
@@ -4051,18 +4101,21 @@ im_shutdown(void)
xim_log("im_shutdown()\n");
#endif
# ifndef FEAT_GUI_MACVIM
if (xic != NULL)
{
gtk_im_context_focus_out(xic);
g_object_unref(xic);
xic = NULL;
}
# endif
im_is_active = FALSE;
im_commit_handler_id = 0;
preedit_start_col = MAXCOL;
xim_has_preediting = FALSE;
}
# ifndef FEAT_GUI_MACVIM
/*
* Convert the string argument to keyval and state for GdkEventKey.
* If str is valid return TRUE, otherwise FALSE.
@@ -4168,10 +4221,12 @@ im_synthesize_keypress(unsigned int keyval, unsigned int state)
g_free(event);
# endif
}
# endif // FEAT_GUI_MACVIM
void
xim_reset(void)
{
# ifndef FEAT_GUI_MACVIM
if (xic != NULL)
{
/*
@@ -4229,11 +4284,13 @@ xim_reset(void)
}
}
}
# endif
preedit_start_col = MAXCOL;
xim_has_preediting = FALSE;
}
# ifndef FEAT_GUI_MACVIM
int
xim_queue_key_press_event(GdkEventKey *event, int down)
{
@@ -4363,12 +4420,15 @@ xim_queue_key_press_event(GdkEventKey *event, int down)
return FALSE;
}
# endif
# ifndef FEAT_GUI_MACVIM
int
im_get_status(void)
{
return im_is_active;
}
# endif
# else /* !HAVE_GTK2 */
@@ -5808,7 +5868,7 @@ im_get_status()
# endif /* !HAVE_GTK2 */
# if defined(HAVE_GTK2) || defined(PROTO)
# if (defined(HAVE_GTK2) || defined(FEAT_GUI_MACVIM)) || defined(PROTO)
int
preedit_get_status(void)
{
@@ -5816,7 +5876,7 @@ preedit_get_status(void)
}
# endif
# if defined(FEAT_GUI_GTK) || defined(PROTO)
# if (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM)) || defined(PROTO)
int
im_is_preediting()
{
+11
View File
@@ -2859,6 +2859,17 @@ theend:
#endif
}
char_u *
lookup_toolbar_item(idx)
int idx;
{
if (idx >= 0 && idx < TOOLBAR_NAME_COUNT)
return (char_u*)toolbar_names[idx];
return NULL;
}
#endif /* FEAT_GUI_MACVIM */
#endif /* FEAT_MENU */
+21 -6
View File
@@ -2473,7 +2473,7 @@ skip_to_option_part(p)
void
changed()
{
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
#if defined(FEAT_XIM) && (defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MACVIM))
/* The text of the preediting area is inserted, but this doesn't
* mean a change of the buffer yet. That is delayed until the
* text is committed. (this means preedit becomes empty) */
@@ -3276,6 +3276,7 @@ prompt_for_number(mouse_used)
cmdline_row = msg_row - 1;
need_wait_return = FALSE;
msg_didany = FALSE;
msg_didout = FALSE;
}
else
cmdline_row = save_cmdline_row;
@@ -8533,11 +8534,25 @@ match_suffix(fname)
for (setsuf = p_su; *setsuf; )
{
setsuflen = copy_option_part(&setsuf, suf_buf, MAXSUFLEN, ".,");
if (fnamelen >= setsuflen
&& fnamencmp(suf_buf, fname + fnamelen - setsuflen,
(size_t)setsuflen) == 0)
break;
setsuflen = 0;
if (setsuflen == 0)
{
char_u *tail = gettail(fname);
/* empty entry: match name without a '.' */
if (vim_strchr(tail, '.') == NULL)
{
setsuflen = 1;
break;
}
}
else
{
if (fnamelen >= setsuflen
&& fnamencmp(suf_buf, fname + fnamelen - setsuflen,
(size_t)setsuflen) == 0)
break;
setsuflen = 0;
}
}
return (setsuflen != 0);
}

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