Compare commits

...

322 Commits

Author SHA1 Message Date
Bjorn Winckler e9d2694dce Snapshot 46 2009-07-11 00:34:33 +02:00
Bjorn Winckler 36154dd8c0 More normalization of filenames, use NFC
Apparently NTFS uses NFC so switch to NFC instead of using NFKC.
2009-07-10 19:01:28 +02:00
Bjorn Winckler 0d778b28a4 Merge upstream 2009-07-10 15:12:00 +02:00
vimboss fa7096a6ee updated for version 7.2-228 2009-07-10 13:11:26 +00:00
vimboss cc2b9e2245 updated for version 7.2-227 2009-07-09 18:13:49 +00:00
vimboss 2cd4c80953 updated for version 7.2-226 2009-07-09 18:06:49 +00:00
vimboss 8303ab1b1a updated for version 7.2-225 2009-07-09 16:24:19 +00:00
vimboss 3ef707c468 updated for version 7.2-224 2009-07-09 16:15:16 +00:00
vimboss b3ec0ad87a updated for version 7.2-223 2009-07-09 13:55:43 +00:00
Bjorn Winckler 4486bb71fb Replace NSLog() with ASLogXXX() 2009-07-07 21:01:13 +02:00
Bjorn Winckler 176ab5d393 Add simple logging facility (using ASL) 2009-07-07 18:34:32 +02:00
Bjorn Winckler aff8366139 Fix typo in help file 2009-07-03 14:46:23 +02:00
vimboss d05fb395d1 updated for version 7.2-222 2009-07-01 18:18:57 +00:00
vimboss e764e25045 updated for version 7.2-221 2009-07-01 16:04:58 +00:00
vimboss bd178a9659 updated for version 7.2-220 2009-07-01 15:13:56 +00:00
vimboss 5a5cd60221 updated for version 7.2-219 2009-07-01 14:13:18 +00:00
Kazuki Sakamoto 7c3e218035 Add NetBeans support 2009-06-26 06:32:14 +09:00
vimboss 760e36dc8b updated for version 7.2-218 2009-06-24 16:32:08 +00:00
vimboss 941e7a992d updated for version 7.2-217 2009-06-24 16:08:18 +00:00
vimboss 7108d56061 updated for version 7.2-216 2009-06-24 15:51:37 +00:00
vimboss d5a9cdd9c8 updated for version 7.2-215 2009-06-24 15:32:01 +00:00
vimboss 60ed6e1213 updated for version 7.2-214 2009-06-24 15:05:00 +00:00
vimboss d628c3711d updated for version 7.2-213 2009-06-24 14:50:12 +00:00
vimboss 3344f11140 updated for version 7.2-212 2009-06-24 14:41:19 +00:00
vimboss f047b3aa3e updated for version 7.2-211 2009-06-24 14:25:49 +00:00
vimboss 31ad5d0472 updated for version 7.2-210 2009-06-24 09:58:32 +00:00
Bjorn Winckler edbdca29e1 Normalize filenames to NFKC before opening
Vim does not cope very well with Unicode decomposed form NFD (i.e. it
does not normalize to composed form before rendering) which causes
problems since HFS+ stores filenames in NFD.  To work around this issue
normalize to compatibility form C before passing filenames to Vim.

(This is not a solution to the problem with NFD since files stored in
NFD will still be problematic but at least a user can work around this
issue by making sure files are in composed form before opening them.)
2009-06-23 20:38:39 +02:00
Bjorn Winckler 5433ca7d4c Support Quick Look for all known file extensions 2009-06-20 22:13:51 +02:00
Bjorn Winckler 816ac0a441 Change name of window menu items
Change "Next/Previous Tab" to "Select Next/Previous Tab" to keep titles
the same as in e.g. Safari.
2009-06-20 20:26:14 +02:00
Bjorn Winckler 90e4752df4 Update 'gfw' on Cmd--/Cmd-+ 2009-06-20 01:58:06 +02:00
Bjorn Winckler 0978ebc1c6 Add help on binding Cmd-keys 2009-06-20 00:14:09 +02:00
Bjorn Winckler f486bb41d6 Avoid exceptions in charRangeForRow::: 2009-06-19 23:09:03 +02:00
Bjorn Winckler 44227b9a93 Fix typo in comment 2009-06-18 21:08:43 +02:00
Bjorn Winckler ad02696d27 Merge upstream
Conflicts:
	src/buffer.c
	src/eval.c
	src/option.c
	src/vim.h
2009-06-16 18:30:00 +02:00
vimboss 87658a916a updated for version 7.2-209 2009-06-16 16:29:10 +00:00
vimboss 66299b9ed5 updated for version 7.2-208 2009-06-16 15:50:33 +00:00
vimboss fc072b7b61 updated for version 7.2-207 2009-06-16 15:22:12 +00:00
vimboss fef8272db2 updated for version 7.2-206 2009-06-16 14:57:26 +00:00
vimboss b04c78a6a0 updated for version 7.2-205 2009-06-16 14:44:48 +00:00
vimboss 99b7765c18 updated for version 7.2-204 2009-06-16 14:34:38 +00:00
vimboss c8e331a5f5 updated for version 7.2-203 2009-06-16 14:01:43 +00:00
vimboss 03f0a92f69 updated for version 7.2-202 2009-06-16 13:35:20 +00:00
vimboss ca96b60e9a updated for version 7.2-201 2009-06-16 13:23:06 +00:00
vimboss ea811731f0 updated for version 7.2-200 2009-06-16 13:12:07 +00:00
vimboss 11b068fc25 updated for version 7.2-199 2009-06-16 12:31:33 +00:00
vimboss 097577c351 updated for version 7.2-198 2009-06-16 09:07:49 +00:00
vimboss 250b62c9a8 updated for version 7.2-197 2009-06-10 16:15:40 +00:00
vimboss 54fea5fe67 updated for version 7.2-196 2009-06-03 20:08:14 +00:00
vimboss e63aad92b1 updated for version 7.2-195 2009-06-03 14:20:21 +00:00
vimboss 8ac99eed90 updated for version 7.2-194 2009-06-03 13:05:07 +00:00
vimboss 25b4e351c9 updated for version 7.2-193 2009-06-03 12:26:06 +00:00
vimboss 20da24a60c updated for version 7.2-192 2009-06-03 11:22:45 +00:00
vimboss 0873fb8f49 updated for version 7.2-191 2009-05-26 20:59:55 +00:00
vimboss 839717064f updated for version 7.2-190 2009-05-26 16:12:37 +00:00
vimboss cee529f197 updated for version 7.2-189 2009-05-26 09:02:10 +00:00
vimboss a3935654b8 updated for version 7.2-188 2009-05-24 11:40:58 +00:00
vimboss ff7ca495c1 updated for version 7.2-187 2009-05-23 12:28:15 +00:00
vimboss 335f08054d updated for version 7.2-186 2009-05-22 19:08:31 +00:00
vimboss fa0d5e0ba9 updated for version 7.2-185 2009-05-22 16:20:57 +00:00
vimboss 1f4d8dd8e1 updated for version 7.2-184 2009-05-21 21:27:43 +00:00
vimboss b465ee5bbe updated for version 7.2-183 2009-05-21 13:20:59 +00:00
vimboss 919b11d301 updated for version 7.2-182 2009-05-17 21:25:42 +00:00
vimboss f5cfc6a148 updated for version 7.2-181 2009-05-17 14:24:23 +00:00
vimboss 915fba8a25 updated for version 7.2-180 2009-05-17 11:33:22 +00:00
vimboss 6b64a62626 updated for version 7.2-179 2009-05-16 19:16:33 +00:00
vimboss 0ee0fbc2d4 updated for version 7.2-178 2009-05-16 19:07:03 +00:00
vimboss 8db81befc3 updated for version 7.2-177 2009-05-16 15:31:32 +00:00
vimboss 47b763090e updated for version 7.2-176 2009-05-16 14:41:10 +00:00
vimboss 99b962f986 updated for version 7.2-175 2009-05-16 14:16:02 +00:00
vimboss e6b7f4ff3b updated for version 7.2-174 2009-05-15 19:33:18 +00:00
vimboss 11f7764bd6 updated for version 7.2-173 2009-05-14 20:20:33 +00:00
vimboss 3f2fbccc21 updated for version 7.2-172 2009-05-14 20:01:05 +00:00
vimboss 84602997b6 updated for version 7.2-171 2009-05-14 19:51:46 +00:00
vimboss 19a1e1db6b updated for version 7.2-170 2009-05-13 18:48:16 +00:00
vimboss 0949ad4f8b updated for version 7.2-169 2009-05-13 16:56:33 +00:00
vimboss 8f5131b2d7 updated for version 7.2-168 2009-05-13 12:49:39 +00:00
vimboss 682e144672 updated for version 7.2-167fix 2009-05-13 12:15:37 +00:00
vimboss a05172e1db updated for version 7.2-168 2009-05-13 10:51:08 +00:00
Travis Jeffery 9b0f42ed24 Add reStructuredText as supported file type 2009-05-11 18:23:50 +02:00
vimboss 7b900cf55a updated for version 7.2-166 2009-04-29 16:47:23 +00:00
vimboss 82c9ce9eeb updated for version 7.2-165 2009-04-29 16:03:38 +00:00
vimboss 104a7e6484 updated for version 7.2-164 2009-04-29 15:41:40 +00:00
vimboss 1e2844207d updated for version 7.2-163 2009-04-29 10:05:51 +00:00
vimboss b39439f386 updated for version 7.2-162 2009-04-29 09:52:12 +00:00
vimboss 185e34337d updated for version 7.2-161 2009-04-29 09:02:44 +00:00
Bjorn Winckler e711158eed Update credits 2009-04-28 23:11:13 +02:00
Kazuki Sakamoto f43ffacda1 Move all IM code into frontend 2009-04-25 22:32:54 +09:00
vimboss 160f5fa78f updated for version 7.2-160 2009-04-22 16:45:21 +00:00
vimboss 7ebc297d1d updated for version 7.2-159 2009-04-22 15:53:09 +00:00
vimboss 3a9b07d2d2 updated for version 7.2-158 2009-04-22 15:45:05 +00:00
vimboss 86d424677a updated for version 7.2-157 2009-04-22 14:44:41 +00:00
vimboss 1666886eaa updated for version 7.2-156 2009-04-22 14:25:01 +00:00
vimboss 7f3a4e21e7 updated for version 7.2-155 2009-04-22 14:10:39 +00:00
vimboss 49b3032c6d updated for version 7.2-154 2009-04-22 13:58:46 +00:00
vimboss 153c893e9e updated for version 7.2-153 2009-04-22 13:39:36 +00:00
vimboss e07aeca8c3 updated for version 7.2-152 2009-04-22 12:44:48 +00:00
vimboss 788aadad0a updated for version 7.2-151 2009-04-22 11:52:33 +00:00
vimboss 396732e9af updated for version 7.2-150 2009-04-22 11:08:26 +00:00
vimboss 1c74207cd6 updated for version 7.2-149 2009-04-22 10:56:16 +00:00
Nicolas Weber eb9ece5bf1 Add markdown as supported file type 2009-04-19 22:29:27 -07:00
Bjorn Winckler 204e14b994 Snapshot 45 2009-04-13 19:28:18 +02:00
Bjorn Winckler 2e8bea32db Fix compilation problems on Tiger
The NSRunLoopCommonModes constant is not defined in the Tiger API so
explicitly enumerate the necessary modes instead.
2009-04-13 16:04:49 +02:00
Bjorn Winckler e70fb38670 Add "show hidden files" checkbox to save dialog 2009-04-13 13:48:54 +02:00
Bjorn Winckler 3d56969f47 Add function to print message queue 2009-04-10 19:05:49 +02:00
Bjorn Winckler 294d03baf6 Beware exceptions when processing input
Added comment on the dangers of exceptions being raised when processing
input in the frontend.  Shuffled the exception handling around in the
vim controller.
2009-04-10 18:33:02 +02:00
Bjorn Winckler ac96dc67ba Fix Quickstart regression
Output from a Vim process may reach the frontend even if the process is
cached.  Thus when processing input queues in the frontend, also check
if the input came from a cached controller else it could be silently
ignored.
2009-04-10 18:11:18 +02:00
Bjorn Winckler 0413dcf3f1 Make dialog sheet messages unsafe 2009-04-08 20:41:32 +02:00
Bjorn Winckler 40263195cb Avoid enumerating vim controllers
Don't enumerate vim controllers when processing input since it may
potentially be a huge operation.  If the vim controller array were to be
modified during input processing (should never happen) MacVim would crash.
2009-04-08 20:38:28 +02:00
Bjorn Winckler dd76f85f0b Deprecate performSelectorOnMainThread calls
Use performSelector:withObject:after:delay instead since it
automatically only triggers in default mode.
2009-04-08 19:36:00 +02:00
Bjorn Winckler e93e9c4201 Do not modify frontend state in DO calls
In particular, delay all state changes that used to be made inside
connectBackend:pid such add adding vim controllers to the vimControllers
array.
2009-04-05 21:43:00 +02:00
Bjorn Winckler a4a14b39ac Cleanup 2009-04-05 20:21:36 +02:00
Bjorn Winckler 49eeb133ac Add comment on DO timeouts 2009-04-05 20:00:02 +02:00
Bjorn Winckler 28de969ae3 Deprecate inProcessCommandQueue related code
We are guarding against re-entrant calls in the app controller now so
the inProcessCommandQueue related code is now obsolete.
2009-04-05 19:56:21 +02:00
Bjorn Winckler 6961a51e9a Cleanup 2009-04-05 19:21:16 +02:00
Bjorn Winckler f679af784b Update README 2009-04-05 19:20:42 +02:00
Bjorn Winckler fd8e8e0b4f Clear delayed vim controller calls on cleanup 2009-04-05 19:02:08 +02:00
Bjorn Winckler cd5ca1918d Add support for dialogs 2009-04-05 18:57:56 +02:00
Bjorn Winckler 27d4ee55ae Add support for live resizing 2009-04-05 18:22:59 +02:00
Bjorn Winckler 23e38c4298 Guard against re-entrant calls to process input 2009-04-05 18:12:23 +02:00
Bjorn Winckler 0486075221 Vim talks only to app controller
- dialog support not implemented yet
- live resizing not supported
2009-04-05 17:32:37 +02:00
Kazuki Sakamoto 7a010c4a46 Avoid forever bouncing dock icon
This problem was caused by calling the Carbon function KeyScript() from
the Vim process.
2009-04-03 21:54:15 +09:00
Bjorn Winckler 9aeade7147 Use "guisp" color for underline in ATSUI 2009-04-01 20:12:26 +02:00
Bjorn Winckler 5663536b1f Do not hide toolbar unless requested
Commit 2d497eabe995ed7f667d67166b396dff6389d12f introduced a regression
where the toolbar automatically hid upon startup regardless whether 'go'
included the "T" flag or not.
2009-03-30 19:41:50 +02:00
Bjorn Winckler 95f42c734a Snapshot 44 2009-03-29 17:34:18 +02:00
Bjorn Winckler e1ece272fa Exit full-screen if the window moves
The window is not supposed to move in full-screen mode so if this
happens then exit full-screen.  This situation can occur e.g. if the
window is on a screen that gets unplugged.
2009-03-29 16:40:59 +02:00
Bjorn Winckler 73b5d1837c Validate screen before constraining window
If a window is on a screen that gets unplugged it may happen that
[NSWindow screen] returns nil.  Guard against this when constraining
the window frame to the screen frame.

This fixes a bug where a window could "disappear" if it was on a screen
that got unplugged.
2009-03-29 16:35:47 +02:00
Bjorn Winckler 790f685006 Merge upstream
Conflicts:
	src/vim.h
2009-03-18 20:10:00 +02:00
vimboss a680267d49 updated for version 7.2-148 2009-03-18 18:09:03 +00:00
vimboss 5f1547b288 updated for version 7.2-147 2009-03-18 15:28:08 +00:00
vimboss 9d9a5983f5 updated for version 7.2-146 2009-03-18 14:42:00 +00:00
vimboss 16e57e6189 updated for version 7.2-145 2009-03-18 13:32:24 +00:00
vimboss 5d45d4a4d2 updated for version 7.2-144 2009-03-18 13:21:18 +00:00
vimboss 0546647038 updated for version 7.2-143 2009-03-18 11:52:53 +00:00
vimboss c9ad0b6d4d updated for version 7.2-142 2009-03-18 11:22:25 +00:00
Bjorn Winckler 25306ee0c5 Fix full-screen zooming with Dock visible
This fixes a bug where 'set fu=maxvert' would not cover the screen
vertically if the Dock was visible.
2009-03-16 17:36:05 +01:00
Bjorn Winckler 2e024248fa Use /usr/bin/python in icons/Makefile 2009-03-16 17:05:17 +01:00
Bjorn Winckler 85879328b0 Fix "set go+=rT" bug
The number of columns now matches the width of the window after calling
"set go+=rT".
2009-03-15 14:12:48 +01:00
Bjorn Winckler 9c530a8030 Revert temp patch, fixed properly in 7.2.121
This patch ensures that Ctrl-C works during lengthy :grep operations in
GUI mode.
2009-03-15 15:58:46 +01:00
Bjorn Winckler 9105eb1fd0 Tab labels only shows file name tail 2009-03-15 15:15:23 +01:00
Bjorn Winckler c49868a11f Fix <C-Tab> regression
This fixes a regression introduced with commmit
c79be7f927aff8b2b52a6d8d917b899154ab0ff9 where Ctrl+Unprintable key
presses could no longer be mapped to.
2009-03-13 22:35:12 +01:00
vimboss 795860de7c updated for version 7.2-141 2009-03-11 16:58:40 +00:00
vimboss 90a729a8e4 updated for version 7.2-140 2009-03-11 16:47:21 +00:00
vimboss 1a328483b7 updated for version 7.2-139 2009-03-11 16:29:20 +00:00
vimboss 5e09d64d77 updated for version 7.2-138 2009-03-11 15:37:53 +00:00
vimboss 4591403b7e updated for version 7.2-137 2009-03-11 15:28:26 +00:00
vimboss e90f76c1aa updated for version 7.2-136 2009-03-11 14:37:32 +00:00
vimboss 8745e4380e updated for version 7.2-135 2009-03-11 14:10:38 +00:00
vimboss cd7a1f6539 updated for version 7.2-134 2009-03-11 12:11:02 +00:00
vimboss bb21f9f120 updated for version 7.2-133 2009-03-11 11:47:18 +00:00
vimboss 38c7ababf6 updated for version 7.2-132 2009-03-05 02:15:53 +00:00
vimboss 5aea857883 updated for version 7.2-131 2009-03-04 03:13:35 +00:00
vimboss 322b4eec7e updated for version 7.2-130 2009-03-02 01:47:02 +00:00
vimboss 886d3d7aed updated for version 7.2-129 2009-03-02 01:12:48 +00:00
vimboss b2f7a2f021 updated for version 7.2-128 2009-03-01 01:45:35 +00:00
Zvezdan Petkovic 4374e9787e Colors.plist autogenerated from "showrgb" command
The Colors.plist dictionary is now generated from "showrgb" to properly
match rgb.txt.  Also add three colors which were missing from the output
of "showrgb" (darkyellow, lightmagenta, lightred).
2009-02-25 20:09:30 +01:00
vimboss 080a7c2c6c updated for version 7.2-127 2009-02-24 03:38:04 +00:00
vimboss ffef064005 updated for version 7.2-126 2009-02-24 03:30:14 +00:00
vimboss d23a68d047 updated for version 7.2-125 2009-02-24 03:12:40 +00:00
vimboss c973e12d3e updated for version 7.2-124 2009-02-22 23:54:59 +00:00
vimboss 5e0543116b updated for version 7.2-123 2009-02-22 22:43:27 +00:00
vimboss d9f633dbb3 updated for version 7.2-122 2009-02-22 20:13:39 +00:00
vimboss 32cb07dd61 updated for version 7.2-121 2009-02-22 01:52:59 +00:00
vimboss 40ae005819 updated for version 7.2-120 2009-02-22 01:37:59 +00:00
vimboss c4e8fcc338 updated for version 7.2-119 2009-02-22 00:14:58 +00:00
vimboss 9dbb79f942 updated for version 7.2-118 2009-02-21 23:59:19 +00:00
vimboss 031479c46b updated for version 7.2-117 2009-02-21 23:03:09 +00:00
vimboss 843a3a41bf updated for version 7.2-116 2009-02-21 21:58:24 +00:00
vimboss 01973d329c updated for version 7.2-115 2009-02-21 21:30:39 +00:00
vimboss bcfeb7c895 updated for version 7.2-114 2009-02-21 21:14:00 +00:00
vimboss 46b250b75f updated for version 7.2-113 2009-02-21 21:04:20 +00:00
vimboss 9b06b0a4b2 updated for version 7.2-112 2009-02-21 20:23:59 +00:00
vimboss 80b36e7995 updated for version 7.2-111 2009-02-21 20:11:41 +00:00
vimboss d29599b7ea updated for version 7.2-110 2009-02-21 19:37:46 +00:00
vimboss a63fc2427e updated for version 7.2-109 2009-02-21 19:28:48 +00:00
Bjorn Winckler 393e47945b Snapshot 43 2009-02-20 14:43:08 +01:00
Bjorn Winckler 5100db4427 Set correct protocol for frontend proxy 2009-02-18 23:21:46 +01:00
Bjorn Winckler 19ee857237 Merge upstream
Conflicts:
	src/buffer.c
2009-02-11 22:49:00 +01:00
vimboss 781ac5b687 updated for version 7.2-108 2009-02-11 21:48:40 +00:00
vimboss 9b52c915d9 updated for version 7.2-107 2009-02-11 17:47:54 +00:00
vimboss 7a68824771 updated for version 7.2-106 2009-02-11 16:58:49 +00:00
vimboss c2aed127ca updated for version 7.2-105 2009-02-11 15:47:05 +00:00
vimboss 12b3ecfdcd updated for version 7.2-104 2009-02-11 15:03:45 +00:00
vimboss 4143f69655 updated for version 7.2-103 2009-02-11 10:35:36 +00:00
Bjorn Winckler 7a720947c8 Mention that 'go' does not support "f" in help 2009-02-10 22:11:43 +01:00
Bjorn Winckler 9393a4151c Revert "Don't init backend if Vim is about to fork"
This reverts commit ef03c36272e9a45f71659df7cecfce7aa15c2cbf.

Conflicts:

	src/MacVim/gui_macvim.m
2009-02-10 22:06:18 +01:00
Bjorn Winckler 95a678d204 Don't update 'fuoptions' before GUI has started
This avoids allocating the MMBackend object before forking.
2009-02-10 22:03:36 +01:00
Bjorn Winckler 68cec2f91b Fork directly after command line scan
This fixes a bug with relative paths as arguments when 'autochdir' was
enabled and also cuts down on startup times.  However, it also has the
negative side-effect that 'f' is no longer supported in 'guioptions'.
2009-02-10 22:00:40 +01:00
Bjorn Winckler 5ed292ebfb Revert old forking code 2009-02-10 21:19:37 +01:00
Bjorn Winckler 6d70e1a179 Fix untitled window on reopen with quickstart
This reverts commit 662aa32b399c1149daa1cd3a2b5bccc8e75f589a and
clarifies the comment regarding how 'pidArguments' is used.
2009-02-08 22:29:58 +01:00
Bjorn Winckler 355d2ec231 Fix untitled window on reopen bug
When MacVim is started from Terminal "-MMNoWindow yes" is passed as an
argument.  This argument will no longer stop new windows from opening on
"reactivate" events -- it only affects "activate" events.
2009-02-08 22:08:34 +01:00
Bjorn Winckler c6ceb6c969 Decrease delay in gui_macvim_flush() 2009-02-07 15:56:17 +01:00
Nicolas Weber 60c1c58967 Fix icon generation Makefile 2009-02-06 22:43:54 +01:00
Bjorn Winckler ba43ddb524 Add more files in MacVim/icons to .gitignore 2009-02-06 18:21:59 +01:00
Nicolas Weber 2a032c05b7 Make icon module compilation more portable 2009-02-05 17:11:45 -08:00
vimboss 8d8aecf662 updated for version 7.2-102 2009-02-05 19:48:25 +00:00
Bjorn Winckler 380d7b2cbf Update credits 2009-02-04 22:04:32 +01:00
Bjorn Winckler 30a12fc740 Ignore temporary files in src/MacVim/icons folder 2009-02-04 21:28:15 +01:00
vimboss 43050b40f8 updated for version 7.2-101 2009-02-04 17:35:52 +00:00
vimboss d5dfed9cfc updated for version 7.2-100 2009-02-04 16:50:47 +00:00
vimboss 0e2e98e570 updated for version 7.2-099 2009-02-04 16:29:07 +00:00
vimboss d0a875e3af updated for version 7.2-098 2009-02-04 15:27:06 +00:00
vimboss b770256474 updated for version 7.2-097 2009-02-04 13:19:42 +00:00
vimboss e14b8cd599 updated for version 7.2-096 2009-02-04 12:14:51 +00:00
vimboss 938149499b updated for version 7.2-095 2009-02-04 10:46:25 +00:00
vimboss 9245af7148 updated for version 7.2-094 2009-02-04 10:20:58 +00:00
Nicolas Weber a874eae869 Update credits 2009-02-01 10:37:58 -08:00
Nicolas Weber cca95bae41 Use text-based 16x16 icons 2009-02-01 10:20:32 -08:00
Bjorn Winckler 243fcce65c Ensure viminfo is written on Cmd-q 2009-02-01 10:15:40 +01:00
Bjorn Winckler b8c8a68a5c Fix <C-]> on German keyboard layout
Instead of checking for Ctrl-character, check when Cocoa translates a
keypress to an unprintable character (in particular, this happens on
Ctrl-character).  This ensures keys like <C-]> work on (some) keyboards
where ] requires the use of Alt.
2009-01-30 20:34:41 +01:00
Bjorn Winckler 8502d5f2b2 Avoid exception in key handling routine 2009-01-30 18:30:21 +01:00
vimboss da857362b0 updated for version 7.2-093 2009-01-28 20:23:17 +00:00
vimboss 4c50d72cdf updated for version 7.2-092 2009-01-28 18:09:38 +00:00
vimboss 9af39a7cb2 updated for version 7.2-091 2009-01-28 15:04:42 +00:00
vimboss d4038f59f4 updated for version 7.2-090 2009-01-28 14:42:59 +00:00
vimboss 9150d82be1 updated for version 7.2-089 2009-01-28 13:18:26 +00:00
Bjorn Winckler 87694dc1bf Tell Git to ignore .pyc files in icons folder 2009-01-23 23:36:12 +01:00
Bjorn Winckler 22704e2bb4 Remove .pyc files from icons folder on clean 2009-01-23 23:33:02 +01:00
Nico Weber 95676cfcd4 Doc icon generation cleanup 2009-01-23 23:28:07 +01:00
Bjorn Winckler 1e901456a5 Fix two minor memory leaks
The MMTextViewHelper class failed to release two objects on dealloc.
2009-01-23 23:23:10 +01:00
vimboss 899f9a6260 updated for version 7.2-088 2009-01-22 20:50:10 +00:00
vimboss 6b989afdb1 updated for version 7.2-087 2009-01-22 20:32:12 +00:00
vimboss 4f48c32bc3 updated for version 7.2-086 2009-01-22 19:48:55 +00:00
vimboss c2ea4b240d updated for version 7.2-085 2009-01-22 17:33:49 +00:00
Bjorn Winckler f81158c840 Always respect MMLayoutVerticalSplit
This flag used to be ignored when dropping a file onto a window.
2009-01-17 20:34:51 +01:00
Bjorn Winckler 3950b3a6b1 Respect layout pref when raising an open file
For example, with layout set to "arglist" and with 'hidden' enabled,
double-clicking an already open (but hidden) file will no longer cause
it to open in a new tab.  Instead it opens as if the ":buf" command had
been used.
2009-01-17 20:25:48 +01:00
vimboss ae65cb89b3 updated for version 7.2-084 2009-01-13 17:11:05 +00:00
vimboss f90e3c31ab updated for version 7.2-083 2009-01-13 16:28:21 +00:00
vimboss 014700ca55 updated for version 7.2-082 2009-01-13 15:58:01 +00:00
vimboss f86423097b updated for version 7.2-081 2009-01-13 15:38:37 +00:00
vimboss a4cdb9b1c4 updated for version 7.2-080 2009-01-13 11:29:48 +00:00
Jonathon Mah 03a1a0ea74 Opening with search text does inclusive search 2009-01-13 06:27:01 +10:30
Jonathon Mah 4e1a1cad93 Fix typo in debug message string 2009-01-13 06:25:24 +10:30
Bjorn Winckler e4abcd6741 Snapshot 42 2009-01-12 16:35:09 +01:00
Bjorn Winckler b0f34cac04 Update appcast 2009-01-10 21:09:43 +01:00
Bjorn Winckler dd243c8ab1 Snapshot 41 2009-01-10 20:57:33 +01:00
Bjorn Winckler 02592cfe41 Prune draw queue before sending to frontend
If the draw queue fills up with lots (i.e. twice the number of max rows)
of insert/delete line commands we can remove draw commands from the
beginning of the draw queue.  This reduces the possibility of the draw
queue overflowing.
2009-01-10 17:39:29 +01:00
Bjorn Winckler e706fca4d6 Cmd-. sends SIGINT
Ctrl-C does not always work to interrupt a stuck Vim process. By making
Cmd-. send SIGINT it is more likely to succeed where Ctrl-C has failed.
(E.g. Ctrl-C may fail if a DO message is dropped, or if the Vim process
is stuck in a loop and isn't checking for new input.)
2009-01-10 17:38:11 +01:00
Bjorn Winckler 8d00a30b0a Show output from external commands as it happens
Previously, all output was sent to the frontend at once so only the last
few rows were visible.  This was a bit disconcerting when a command took
a bit of time because there was no feedback that anything was happening.
The downside to this patch is that it takes a bit longer for a command
to finish since the frontend has to do more drawing.
2009-01-10 17:37:49 +01:00
Bjorn Winckler 76200b7c03 Allow interrupt during external commands 2009-01-08 21:25:37 +01:00
Bjorn Winckler e648d3b011 Don't ignore SIGCHLD (fix automatic updating)
Ignoring SIGCHLD caused problems with automatic updating (Sparkle) since
it uses popen() (and hence implicitly uses wait4()) to unpack archives.
Now that SIGCHLD is no longer ignored we have to reap child processes
after exiting a Vim process as well as when MacVim is about to
terminate.
2009-01-08 16:11:30 +01:00
Bjorn Winckler 1db4b7903b Make no DO calls during app termination 2009-01-07 21:01:47 +01:00
Bjorn Winckler e5e129b933 Prune unnecessary code, clarify comment 2009-01-07 20:19:44 +01:00
Bjorn Winckler 354968a9b9 Add comment 2009-01-07 20:16:01 +01:00
Bjorn Winckler 87e4ef758b Clean up process termination code
Exiting immediately on TerminateNowMsgID simplifies the code a bit and
also minimizes the probability of a process not terminating before
MacVim.
2009-01-07 20:14:03 +01:00
Bjorn Winckler 2b721c9e9c New user default MMLoadDefaultFont
When enabled the default font is loaded from within the app bundle each
time MacVim is started (the default setting).  Startup times are shorter
if this is disabled.  Note that if the default font has already been
installed on the system then this may as well be disabled.
2009-01-07 14:19:27 +01:00
Bjorn Winckler c50143db47 Fix deprecated API compiler warning 2009-01-06 22:05:50 +01:00
Bjorn Winckler 2153ab22d7 Don't load default font in Vim (faster startup)
Loading and unloading a font can take a substantial amount of time so
this cuts down on the startup time.
2009-01-06 21:41:47 +01:00
Bjorn Winckler aefc975f1b Fix compiler issues on Tiger 2009-01-06 22:58:38 +01:00
Bjorn Winckler 79851d47b1 Build Debug and Release using default SDK
The Universal target still builds using the 10.4u SDK.
2009-01-06 17:51:36 +01:00
Bjorn Winckler 2c9f69f2bf Fix double free memory problem
This bug was introduced in commit:
    e162109d6f022942edb7281736f587ee79e20bfe
2009-01-06 18:31:38 +01:00
vimboss 9dc3e9172c updated for version 7.2-079 2009-01-06 15:14:30 +00:00
vimboss 2e69b16f67 updated for version 7.2-078 2009-01-06 14:02:45 +00:00
Bjorn Winckler 462fb78a85 Deprecate "redr|f" in addInput: calls
The previous commit ensures these are no longer neeeded (they used to be
there to avoid the "Press ENTER..." prompt).
2009-01-04 22:13:48 +01:00
Bjorn Winckler d2dbd62e7b Avoid "Press ENTER..." prompt
When adding input programmatically the 'silent' flag is automatically
set.  Hopefully this will mean the end of the annoying "Press ENTER..."
prompt.  This also means that it should no longer be necessary to
manually try to make commands silent (e.g. ":redr|f" should not be
needed).
2009-01-04 21:44:27 +01:00
Bjorn Winckler e1c4adc8c9 Add user default to toggle the "add tab" button
The user default MMShowAddTabButton controls whether the "add tab"
button is displayed on the tab bar or not.
2009-01-04 17:58:57 +01:00
Bjorn Winckler 2ffc552c25 Avoid switching Spaces when using 'mvim' 2009-01-04 17:46:48 +01:00
Nico Weber 7845992803 Toggle menu bar on focus change in full-screen 2009-01-02 13:55:11 -08:00
vimboss 3142e74a3a updated for version 7.2-077 2008-12-31 15:21:32 +00:00
Nico Weber 1eb73428b0 Icon generation works on Tiger again 2008-12-30 23:36:50 -08:00
vimboss c5b2d1b5b4 updated for version 7.2-076 2008-12-30 15:15:57 +00:00
Bjorn Winckler 2ab7e98bb8 Snapshot 40 2008-12-28 17:58:44 +01:00
Bjorn Winckler ebf311d2df List all non-standard options and commands in help 2008-12-28 17:20:30 +01:00
Bjorn Winckler 88d6d362c3 Show dialog when clicking to close modified tab 2008-12-26 17:46:36 +01:00
Bjorn Winckler daf5b3430a Look for toolbar icons in runtime path 2008-12-26 18:56:05 +01:00
Bjorn Winckler b13dede64d Merge upstream 2008-12-24 14:26:00 +01:00
vimboss bd1000809d updated for version 7.2-075 2008-12-24 13:25:14 +00:00
vimboss 2614f8ee3e updated for version 7.2-074 2008-12-24 12:06:26 +00:00
vimboss dd3577db8c updated for version 7.2-073 2008-12-24 11:54:31 +00:00
vimboss ff92260a55 updated for version 7.2-072 2008-12-24 11:43:49 +00:00
vimboss 90c9bf33a2 updated for version 7.2-071 2008-12-24 11:20:53 +00:00
vimboss 8f0b9d6525 updated for version 7.2-070 2008-12-23 22:52:58 +00:00
Bjorn Winckler b9eb197443 Clean up 'guitabtooltip' patch 2008-12-23 23:05:06 +01:00
Jonathon Mah a61f1bf714 Add support for 'guitabtooltip' 2008-12-23 22:52:14 +01:00
Nico Weber c7323339d9 Make icon generation script faster and more flexible 2008-12-23 22:33:41 +01:00
Nico Weber 48fc2be299 Small doc icons look sharper, faster generation 2008-12-23 21:11:42 +01:00
Nico Weber a5be20ba89 Automatically generate document icons
Document icons are generated using the makeicns program and a Python
script.  Note that the script uses PyObjC and hence requires Mac OS X
10.5 or later (on earlier systems a blank icon will be used for all
document types).

This patch also adds more filetypes to Info.plist.

Integration into Xcode project by Bjorn Winckler
<bjorn.winckler@gmail.com> with the help of Keith Hubbard
<keith@bangj.com>
2008-12-23 20:19:33 +01:00
Bjorn Winckler 48874c704b Fix character escaping for "New File Here" service
This also makes this service work on Tiger.
2008-12-22 16:12:21 +01:00
Kent Sibilev b8d2ad693a Add clipboard support in non-GUI mode 2008-12-11 18:00:57 +01:00
vimboss d11de6c31d updated for version 7.2-069 2008-12-09 21:34:39 +00:00
vimboss 4c5d17ec00 updated for version 7.2-068 2008-12-09 11:13:06 +00:00
vimboss 34207703d8 updated for version 7.2-067 2008-12-09 10:18:03 +00:00
vimboss 8ff21dbb7c updated for version 7.2-066 2008-12-09 09:57:49 +00:00
vimboss 1cd2bd4a21 updated for version 7.2-065 2008-12-03 17:50:45 +00:00
Bjorn Winckler 32561e2742 Input Method is disabled by default
The IM code is a bit flakey so keep IM disabled by default for now.
2008-12-03 15:45:04 +01:00
vimboss fe0e293cb9 updated for version 7.2-064 2008-12-03 12:38:36 +00:00
vimboss dcaf01ff54 updated for version 7.2-063 2008-12-03 12:18:55 +00:00
vimboss adac29fc57 updated for version 7.2-062 2008-12-03 10:21:57 +00:00
vimboss 341e36b48d updated for version 7.2-061 2008-12-03 08:52:26 +00:00
vimboss 7b26c6980f updated for version 7.2-060 2008-11-30 20:12:46 +00:00
Bjorn Winckler 668c778621 Handle TerminateNow input message immediately
Fixes a bug where code which waits on the run loop fails to detect
TerminateNow input messages (this could e.g. result in a "leak" of Vim
processes when Quickstart was enabled).
2008-11-30 18:04:13 +01:00
vimboss 279e83bccc updated for version 7.2-059 2008-11-30 14:16:57 +00:00
vimboss c1a71eedb5 updated for version 7.2-058 2008-11-30 11:15:09 +00:00
vimboss 4dea3b30d0 updated for version 7.2-057 2008-11-29 19:19:19 +00:00
vimboss 05b47ac89e updated for version 7.2-056 2008-11-29 19:11:40 +00:00
vimboss 3965aefc79 updated for version 7.2-055 2008-11-28 20:29:07 +00:00
vimboss be089b8aa0 updated for version 7.2-053 2008-11-28 10:47:47 +00:00
vimboss 7aab071854 updated for version 7.2-052 2008-11-28 10:16:05 +00:00
vimboss cff1a9e3c9 updated for version 7.2-051 2008-11-28 10:01:10 +00:00
vimboss 7d03b73992 updated for version 7.2-050 2008-11-28 09:08:51 +00:00
Bjorn Winckler 213d223679 Snapshot 39 2008-11-23 19:53:20 +01:00
Bjorn Winckler f00a001406 Update README 2008-11-22 14:50:25 +01:00
Ben Schmidt 7ae32a1bef Avoid "Stray process..." warning messages 2008-11-22 14:32:12 +01:00
Nico Weber 62b5aae721 Add <D-BS> and <M-BS> insert mode mappings
These are standard shortcuts in Mac OS X.  <D-BS> deletes a whole line,
<M-BS> deletes the previous word.
2008-11-21 20:32:41 +01:00
Bjorn Winckler 1741da563b Merge upstream 2008-11-21 20:20:00 +01:00
vimboss 09eb973f44 updated for version 7.2-049 2008-11-20 16:10:17 +00:00
vimboss 1dfdf3ebaa updated for version 7.2-048 2008-11-20 15:12:02 +00:00
vimboss d50de2f2f0 updated for version 7.2-047 2008-11-20 13:12:36 +00:00
vimboss 233164a7d2 updated for version 7.2-046 2008-11-20 10:56:33 +00:00
vimboss ae96eb8469 updated for version 7.2-045 2008-11-20 10:04:53 +00:00
vimboss d676af07ec updated for version 7.2-044 2008-11-20 09:37:01 +00:00
vimboss 73827e6e15 updated for version 7.2-043 2008-11-20 09:27:32 +00:00
vimboss 09c7a21e4f fix truncation 2008-11-15 15:16:46 +00:00
vimboss 9e75f31ff2 updated for version 7.2-042 2008-11-15 15:06:17 +00:00
vimboss 950ef8ff2f updated for version 7.2-041 2008-11-15 13:12:07 +00:00
vimboss 5d900f6f7e updated for version 7.2-040 2008-11-12 15:05:21 +00:00
vimboss 6907698f60 updated for version 7.2-039 2008-11-12 14:29:28 +00:00
vimboss ce49edcc1e updated for version 7.2-038 2008-11-12 13:52:46 +00:00
vimboss 911a34fed0 updated for version 7.2-037 2008-11-12 13:10:15 +00:00
vimboss a57ecd4e2e updated for version 7.2-036 2008-11-12 12:36:30 +00:00
vimboss 81a5c6dd4e updated for version 7.2-035 2008-11-12 12:08:45 +00:00
vimboss a53e7167fc updated for version 7.2-034 2008-11-12 11:52:19 +00:00
vimboss 6cf044c8fc updated for version 7.2-033 2008-11-11 20:57:11 +00:00
208 changed files with 15804 additions and 6384 deletions
+10
View File
@@ -3,6 +3,16 @@
src/MacVim/MacVim.xcodeproj/*.mode1
src/MacVim/MacVim.xcodeproj/*.mode1v3
src/MacVim/MacVim.xcodeproj/*.pbxuser
src/MacVim/icons/*.pyc
src/MacVim/icons/*.ttf
src/MacVim/icons/*.reg
src/MacVim/icons/*.zip
src/MacVim/icons/*.txt
src/MacVim/icons/*.so
src/MacVim/icons/*.egg-info
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/*.pbxuser
src/MacVim/PSMTabBarControl/build
-2
View File
@@ -683,9 +683,7 @@ LANG_GEN = \
runtime/spell/??/main.aap \
runtime/spell/yi/README.txt \
runtime/spell/main.aap \
runtime/spell/cleanadd.vim \
runtime/spell/*.vim \
runtime/spell/fixdup \
# generic language files, binary
LANG_GEN_BIN = \
+10 -2
View File
@@ -335,6 +335,8 @@ BufDelete Before deleting a buffer from the buffer list.
NOTE: When this autocommand is executed, the
current buffer "%" may be different from the
buffer being deleted "<afile>" and "<abuf>".
Don't change to another buffer, it will cause
problems.
*BufEnter*
BufEnter After entering a buffer. Useful for setting
options for a file type. Also executed when
@@ -397,6 +399,8 @@ BufUnload Before unloading a buffer. This is when the
NOTE: When this autocommand is executed, the
current buffer "%" may be different from the
buffer being unloaded "<afile>".
Don't change to another buffer, it will cause
problems.
*BufWinEnter*
BufWinEnter After a buffer is displayed in a window. This
can be when the buffer is loaded (after
@@ -428,6 +432,8 @@ BufWipeout Before completely deleting a buffer. The
NOTE: When this autocommand is executed, the
current buffer "%" may be different from the
buffer being deleted "<afile>".
Don't change to another buffer, it will cause
problems.
*BufWrite* *BufWritePre*
BufWrite or BufWritePre Before writing the whole buffer to a file.
*BufWriteCmd*
@@ -748,8 +754,10 @@ SwapExists Detected an existing swap file when starting
'a' abort, like hitting CTRL-C
When set to an empty string the user will be
asked, as if there was no SwapExists autocmd.
Note: Do not try to change the buffer, the
results are unpredictable.
*E812*
It is not allowed to change to another buffer,
change a buffer name or change directory
here.
*Syntax*
Syntax When the 'syntax' option has been set. The
pattern is matched against the syntax name.
+24 -14
View File
@@ -1,4 +1,4 @@
*eval.txt* For Vim version 7.2. Last change: 2008 Nov 02
*eval.txt* For Vim version 7.2. Last change: 2008 Nov 27
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1706,7 +1706,7 @@ executable( {expr}) Number 1 if executable {expr} exists
exists( {expr}) Number TRUE if {expr} exists
extend({expr1}, {expr2} [, {expr3}])
List/Dict insert items of {expr2} into {expr1}
expand( {expr}) String expand special keywords in {expr}
expand( {expr} [, {flag}]) String expand special keywords in {expr}
feedkeys( {string} [, {mode}]) Number add key sequence to typeahead buffer
filereadable( {file}) Number TRUE if {file} is a readable file
filewritable( {file}) Number TRUE if {file} is a writable file
@@ -1758,8 +1758,9 @@ gettabwinvar( {tabnr}, {winnr}, {name})
getwinposx() Number X coord in pixels of GUI Vim window
getwinposy() Number Y coord in pixels of GUI Vim window
getwinvar( {nr}, {varname}) any variable {varname} in window {nr}
glob( {expr}) String expand file wildcards in {expr}
globpath( {path}, {expr}) String do glob({expr}) for all dirs in {path}
glob( {expr} [, {flag}]) String expand file wildcards in {expr}
globpath( {path}, {expr} [, {flag}])
String do glob({expr}) for all dirs in {path}
has( {feature}) Number TRUE if feature {feature} supported
has_key( {dict}, {key}) Number TRUE if {dict} has entry {key}
haslocaldir() Number TRUE if current window executed |:lcd|
@@ -2413,6 +2414,7 @@ cursor({list})
When 'virtualedit' is used {off} specifies the offset in
screen columns from the start of the character. E.g., a
position within a <Tab> or after the last character.
Returns 0 when the position could be set, -1 otherwise.
deepcopy({expr}[, {noref}]) *deepcopy()* *E698*
@@ -3286,14 +3288,16 @@ getwinvar({winnr}, {varname}) *getwinvar()*
:let list_is_on = getwinvar(2, '&list')
:echo "myvar = " . getwinvar(1, 'myvar')
<
*glob()*
glob({expr}) Expand the file wildcards in {expr}. See |wildcards| for the
glob({expr} [, {flag}]) *glob()*
Expand the file wildcards in {expr}. See |wildcards| for the
use of special characters.
The result is a String.
When there are several matches, they are separated by <NL>
characters.
The 'wildignore' option applies: Names matching one of the
patterns in 'wildignore' will be skipped.
Unless the optional {flag} argument is given and is non-zero,
the 'suffixes' and 'wildignore' options apply: Names matching
one of the patterns in 'wildignore' will be skipped and
'suffixes' affect the ordering of matches.
If the expansion fails, the result is an empty string.
A name for a non-existing file is not included.
@@ -3307,20 +3311,22 @@ glob({expr}) Expand the file wildcards in {expr}. See |wildcards| for the
See |expand()| for expanding special Vim variables. See
|system()| for getting the raw output of an external command.
globpath({path}, {expr}) *globpath()*
globpath({path}, {expr} [, {flag}]) *globpath()*
Perform glob() on all directories in {path} and concatenate
the results. Example: >
:echo globpath(&rtp, "syntax/c.vim")
< {path} is a comma-separated list of directory names. Each
directory name is prepended to {expr} and expanded like with
glob(). A path separator is inserted when needed.
|glob()|. A path separator is inserted when needed.
To add a comma inside a directory name escape it with a
backslash. Note that on MS-Windows a directory may have a
trailing backslash, remove it if you put a comma after it.
If the expansion fails for one of the directories, there is no
error message.
The 'wildignore' option applies: Names matching one of the
patterns in 'wildignore' will be skipped.
Unless the optional {flag} argument is given and is non-zero,
the 'suffixes' and 'wildignore' options apply: Names matching
one of the patterns in 'wildignore' will be skipped and
'suffixes' affect the ordering of matches.
The "**" item can be used to search in a directory tree.
For example, to find all "README.txt" files in the directories
@@ -4511,6 +4517,7 @@ rename({from}, {to}) *rename()*
should also work to move files across file systems. The
result is a Number, which is 0 if the file was renamed
successfully, and non-zero when the renaming failed.
NOTE: If {to} exists it is overwritten without warning.
This function is not available in the |sandbox|.
repeat({expr}, {count}) *repeat()*
@@ -5343,10 +5350,12 @@ synIDattr({synID}, {what} [, {mode}]) *synIDattr()*
"fg" foreground color (GUI: color name used to set
the color, cterm: color number as a string,
term: empty string)
"bg" background color (like "fg")
"bg" background color (as with "fg")
"sp" special color (as with "fg") |highlight-guisp|
"fg#" like "fg", but for the GUI and the GUI is
running the name in "#RRGGBB" form
"bg#" like "fg#" for "bg"
"sp#" like "fg#" for "sp"
"bold" "1" if bold
"italic" "1" if italic
"reverse" "1" if reverse
@@ -5836,7 +5845,8 @@ mouse_netterm Compiled with support for netterm mouse.
mouse_pterm Compiled with support for qnx pterm mouse.
mouse_sysmouse Compiled with support for sysmouse (*BSD console mouse)
mouse_xterm Compiled with support for xterm mouse.
multi_byte Compiled with support for editing Korean et al.
multi_byte Compiled with support for 'encoding'
multi_byte_encoding 'encoding' is set to a multi-byte encoding.
multi_byte_ime Compiled with support for IME input method.
multi_lang Compiled with support for multiple languages.
mzscheme Compiled with MzScheme interface |mzscheme|.
+33 -6
View File
@@ -1,4 +1,4 @@
*gui_mac.txt* For Vim version 7.2. Last change: 2008 Oct 25
*gui_mac.txt* For Vim version 7.2. Last change: 2009 Mar 15
VIM REFERENCE MANUAL by Bjorn Winckler
@@ -117,9 +117,19 @@ really bad once you start using tabs. For example, dropping two files, then
dropping two more, and switching back to the first tab would cause weird
strings like "((3) of 2)" to appear in the window title.
*macvim-tablabel*
Tab labels only show the tail of the file name to make the tabs more readable
when editing files in deeply nested folders. Add the line "set guitablabel="
to your .gvimrc file to revert back to the default Vim tab label.
*macvim-options*
These are the non-standard options that MacVim supports:
'fullscreen' 'fuoptions' 'toolbariconsize' 'transparency' 'antialias'
'antialias' 'fullscreen' 'fuoptions'
'macmeta' 'toolbariconsize' 'transparency'
*macvim-commands*
These are the non-standard commands that MacVim supports:
|:macaction| |:macmenu|
*macvim-find*
Whenever you search for something in Vim (e.g. using "/") the search query is
@@ -255,9 +265,11 @@ Here is a list of relevant dictionary entries:
KEY VALUE ~
MMCellWidthMultiplier width of a normal glyph in em units [float]
MMDialogsTrackPwd open/save dialogs track the Vim pwd [bool]
MMLoadDefaultFont load font (disable for faster startup) [bool]
MMLoginShellArgument login shell parameter [string]
MMLoginShellCommand which shell to use to launch Vim [string]
MMNoFontSubstitution disable automatic font substitution [bool]
MMShowAddTabButton enable "add tab" button on tabline [bool]
MMTabMaxWidth maximum width of a tab [int]
MMTabMinWidth minimum width of a tab [int]
MMTabOptimumWidth default width of a tab [int]
@@ -338,7 +350,7 @@ The color scheme uses the the system "Highlight Color", which can be changed in
the "Appearance" pane of the System Preferences. It also changes the
highlight color when a window becomes inactive.
If you have any comments regarding this colors cheme (is it better or worse
If you have any comments regarding this color scheme (is it better or worse
than the default?) then post them to |vim_mac|.
==============================================================================
@@ -556,15 +568,20 @@ discovered by looking through the menus (see |macvim-menus| on how to create
your own menu shortcuts). The remaining shortcuts are listed here:
*Cmd-.* *<D-.>*
Cmd-. Interrupt Vim. This is synonymous with CTRL-C and can
hence be used instead of Esc to exit insert mode (in
case you find Esc a bit hard to reach).
Cmd-. Interrupt Vim. Unlike Ctrl-C which is sent as normal
keyboard input (and hence has to be received and then
interpreted) this sends a SIGINT signal to the Vim
process. Use this shortcut if the Vim process appears
to have locked up and is not responding to key presses.
This Cmd-key combination cannot be unmapped.
*Cmd-`* *<D-`>*
Cmd-` Cycle to the next window. On an American keyboard the
`-key is located under the Esc-key. On European
keyboards this key is often adjacent to the left
Shift-key and it may be not even be marked with "`".
This Cmd-key combination can only be unmapped via the
"Keyboard & Mouse" System Preferences.
*Cmd-Left* *<D-Left>*
Cmd-Left Move cursor to the beginning of the line
@@ -736,6 +753,16 @@ this makes Caps Lock "drop" key presses. To work around this problem go into
the "Keyboard & Mouse" System Preference and remap Caps Lock to Ctrl first
(click the "Modifier Keys..." button).
Scenario: ~
You have problems creating custom mappings involving the Cmd key.
Solution: ~
To bind to a key involving Cmd you use the "<D-..>" syntax. Many Cmd-key
mappings are already used by the menus so if your mapping doesn't work then
the solution is usually to first unmap the menu binding (see |macvim-menus|,
in particular read the end of that section). Also see the section on
|macvim-shortcuts| for some Cmd-key combinations which are not used by the
menus but still need to be freed up before they can be used in custom bindings.
Scenario: ~
You can't find the information on MacVim you thought should be in this manual
page.
+2 -1
View File
@@ -63,7 +63,8 @@ already running vim will never fork in MacVim.
"gvim --nofork" does the same as "gvim -f".
If you want the GUI to run in the foreground always, include the 'f'
flag in 'guioptions'. |-f|.
flag in 'guioptions'. |-f|. MacVim does not support this flag in
'guioptions'.
==============================================================================
2. GUI Resources *gui-resources* *.Xdefaults*
+16 -10
View File
@@ -1,4 +1,4 @@
*if_cscop.txt* For Vim version 7.2. Last change: 2005 Mar 29
*if_cscop.txt* For Vim version 7.2. Last change: 2009 Mar 18
VIM REFERENCE MANUAL by Andy Kahn
@@ -131,11 +131,22 @@ The available subcommands are:
7 or f: Find this file
8 or i: Find files #including this file
For all types, except 4 and 6, leading white space for {name} is
removed. For 4 and 6 there is exactly one space between {querytype}
and {name}. Further white space is included in {name}.
EXAMPLES >
:cscope find c vim_free
:cscope find 3 vim_free
:cscope find 3 vim_free
<
These two examples perform the same query. >
These two examples perform the same query: functions calling
"vim_free". >
:cscope find t initOnce
:cscope find t initOnce
<
The first one searches for the text "initOnce", the second one for
" initOnce". >
:cscope find 0 DEFAULT_TERM
<
@@ -344,13 +355,8 @@ cscope version for Win32 see:
The DJGPP-built version from http://cscope.sourceforge.net is known to not
work with Vim.
There are a couple of hard-coded limitations:
1. The maximum number of cscope connections allowed is 8. Do you
really need more?
2. Doing a |:tjump| when |:cstag| searches the tag files is not
configurable (e.g., you can't do a tselect instead).
Hard-coded limitation: doing a |:tjump| when |:cstag| searches the tag files
is not configurable (e.g., you can't do a tselect instead).
==============================================================================
6. Suggested usage *cscope-suggestions*
+39 -58
View File
@@ -1,4 +1,4 @@
*if_mzsch.txt* For Vim version 7.2. Last change: 2008 Jun 28
*if_mzsch.txt* For Vim version 7.2. Last change: 2009 Jun 24
VIM REFERENCE MANUAL by Sergey Khorev
@@ -42,10 +42,6 @@ Note: On FreeBSD you should use the "drscheme" port.
*:mzfile* *:mzf*
:[range]mzf[ile] {file} Execute the MzScheme script in {file}. {not in Vi}
All statements are executed in the namespace of the
buffer that was current during :mzfile start.
If you want to access other namespaces, use
'parameterize'.
All of these commands do essentially the same thing - they execute a piece of
MzScheme code, with the "current range" set to the given line
@@ -54,8 +50,6 @@ range.
In the case of :mzscheme, the code to execute is in the command-line.
In the case of :mzfile, the code to execute is the contents of the given file.
Each buffer has its own MzScheme namespace. Global namespace is bound to
the "global-namespace" value from the 'vimext' module.
MzScheme interface defines exception exn:vim, derived from exn.
It is raised for various Vim errors.
@@ -79,40 +73,8 @@ To avoid clashes with MzScheme, consider using prefix when requiring module,
e.g.: >
:mzscheme (require (prefix vim- vimext))
<
All the examples below assume this naming scheme. Note that you need to do
this again for every buffer.
All the examples below assume this naming scheme.
The auto-instantiation can be achieved with autocommands, e.g. you can put
something like this in your .vimrc (EOFs should not have indentation): >
function s:MzRequire()
if has("mzscheme")
:mz << EOF
(require (prefix vim- vimext))
(let ((buf (vim-get-buff-by-name (vim-eval "expand(\"<afile>\")"))))
(when (and buf (not (eq? buf (vim-curr-buff))))
(parameterize ((current-namespace (vim-get-buff-namespace buf)))
(namespace-attach-module vim-global-namespace 'vimext)
(namespace-require '(prefix vim vimext)))))
EOF
endif
endfunction
function s:MzStartup()
if has("mzscheme")
au BufNew,BufNewFile,BufAdd,BufReadPre * :call s:MzRequire()
:mz << EOF
(current-library-collection-paths
(cons
(build-path (find-system-path 'addon-dir) (version) "collects")
(current-library-collection-paths)))
EOF
endif
endfunction
call s:MzStartup()
<
The global namespace just instantiated this module with the prefix "vimext:".
*mzscheme-sandbox*
When executed in the |sandbox|, access to some filesystem and Vim interface
procedures is restricted.
@@ -121,15 +83,20 @@ procedures is restricted.
2. Examples *mzscheme-examples*
>
:mzscheme (display "Hello")
:mz (display (string-append "Using MzScheme version " (version)))
:mzscheme (require (prefix vim- vimext)) ; for MzScheme < 4.x
:mzscheme (require (prefix-in vim- 'vimext)) ; MzScheme 4.x
:mzscheme (vim-set-buff-line 10 "This is line #10")
<
Inline script usage: >
function! <SID>SetFirstLine()
:mz << EOF
(display "!!!")
(require (prefix vim- vimext))
; for newer versions (require (prefix-in vim- 'vimext))
(vim-set-buff-line 1 "This is line #1")
(vim-beep)
EOF
EOF
endfunction
nmap <F9> :call <SID>SetFirstLine() <CR>
@@ -137,17 +104,33 @@ Inline script usage: >
File execution: >
:mzfile supascript.scm
<
Accessing the current buffer namespace from an MzScheme program running in
another buffer within |:mzfile|-executed script : >
; Move to the window below
(vim-command "wincmd j")
; execute in the context of buffer, to which window belongs
; assume that buffer has 'textstring' defined
(parameterize ((current-namespace
(vim-get-buff-namespace (vim-curr-buff))))
(eval '(vim-set-buff-line 1 textstring)))
Vim exception handling: >
:mz << EOF
(require (prefix vim- vimext))
; for newer versions (require (prefix-in vim- 'vimext))
(with-handlers
([exn:vim? (lambda (e) (display (exn-message e)))])
(vim-eval "nonsense-string"))
EOF
<
Auto-instantiation of vimext module (can be placed in your |vimrc|): >
function! MzRequire()
:redir => l:mzversion
:mz (version)
:redir END
if strpart(l:mzversion, 1, 1) < "4"
" MzScheme versions < 4.x:
:mz (require (prefix vim- vimext))
else
" newer versions:
:mz (require (prefix-in vim- 'vimext))
endif
endfunction
if has("mzscheme")
silent call MzRequire()
endif
<
==============================================================================
3. Threads *mzscheme-threads*
@@ -168,11 +151,11 @@ interface.
Common
------
(command {command-string}) Perform the vim ":Ex" style command.
(eval {expr-string}) Evaluate the vim expression to a string.
A |List| is turned into a string by
joining the items and inserting line
breaks.
NOTE clashes with MzScheme eval
(eval {expr-string}) Evaluate the vim expression into
respective MzScheme object: |Lists| are
represented as Scheme lists,
|Dictionaries| as hash tables.
NOTE the name clashes with MzScheme eval
(range-start) Start/End of the range passed with
(range-end) the Scheme command.
(beep) beep
@@ -186,7 +169,6 @@ Common
be set. The symbol 'global can be passed
as {buffer-or-window}. Then |:setglobal|
will be used.
global-namespace The MzScheme main namespace.
Buffers *mzscheme-buffer*
-------
@@ -228,7 +210,6 @@ Buffers *mzscheme-buffer*
if there is no such buffer.
(get-buff-by-num {buffernum}) Get a buffer by its number (return #f if
there is no buffer with this number).
(get-buff-namespace [buffer]) Get buffer namespace.
Windows *mzscheme-window*
------
@@ -250,7 +231,7 @@ Windows *mzscheme-window*
(set-cursor (line . col) [window]) Set cursor position.
==============================================================================
5. Dynamic loading *mzscheme-dynamic*
5. Dynamic loading *mzscheme-dynamic* *E815*
On MS-Windows the MzScheme libraries can be loaded dynamically. The |:version|
output then includes |+mzscheme/dyn|.
+5 -3
View File
@@ -1,4 +1,4 @@
*netbeans.txt* For Vim version 7.2. Last change: 2008 Jun 28
*netbeans.txt* For Vim version 7.2. Last change: 2009 Jan 06
VIM REFERENCE MANUAL by Gordon Prieur et al.
@@ -722,8 +722,10 @@ keyAtPos keyName lnum/col
of the cursor.
New in version 2.1.
killed A file was closed by the user. Only for files that have been
assigned a number by the IDE.
killed A file was deleted or wiped out by the user and the buffer
annotations have been removed. The bufID number for this
buffer has become invalid. Only for files that have been
assigned a bufID number by the IDE.
newDotAndMark off off
Reports the position of the cursor being at "off" bytes into
+16 -7
View File
@@ -1,4 +1,4 @@
*options.txt* For Vim version 7.2. Last change: 2008 Aug 06
*options.txt* For Vim version 7.2. Last change: 2008 Nov 25
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1448,6 +1448,14 @@ A jump table for the options with a short description can be found at |Q_op|.
autoselectml Like "autoselect", but for the modeless selection
only. Compare to the 'A' flag in 'guioptions'.
html When the clipboard contains HTML, use this when
pasting. When putting text on the clipboard, mark it
as HTML. This works to copy rendered HTML from
Firefox, paste it as raw HTML in Vim, select the HTML
in Vim and paste it in a rich edit box in Firefox.
Only supported for GTK version 2 and later.
Only available with the |+multi_byte| feature.
exclude:{pattern}
Defines a pattern that is matched against the name of
the terminal 'term'. If there is a match, no
@@ -3490,6 +3498,8 @@ A jump table for the options with a short description can be found at |Q_op|.
foreground. |gui-fork|
Note: Set this option in the vimrc file. The forking may have
happened already when the |gvimrc| file is read.
MacVim does not support this flag due to limitations with
forking on Mac OS X.
*'go-i'*
'i' Use a Vim icon. For GTK with KDE it is used in the left-upper
corner of the window. It's black&white on non-GTK, because of
@@ -3867,14 +3877,14 @@ A jump table for the options with a short description can be found at |Q_op|.
characters with dead keys.
*'imdisable'* *'imd'* *'nodisable'* *'noimd'*
'imdisable' 'imd' boolean (default off, on for some systems (SGI))
'imdisable' 'imd' boolean (default off, on for SGI and MacVim)
global
{not in Vi}
{only available when compiled with the |+xim|
|+multi_byte_ime| or |global-ime| feature}
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 machines. This
Currently this option is on by default for SGI/IRIX and MacVim. This
may change in later releases.
*'iminsert'* *'imi'*
@@ -4273,9 +4283,6 @@ A jump table for the options with a short description can be found at |Q_op|.
be able to execute Normal mode commands.
This is the opposite of the 'keymap' option, where characters are
mapped in Insert mode.
This only works for 8-bit characters. The value of 'langmap' may be
specified with multi-byte characters (e.g., UTF-8), but only the lower
8 bits of each character will be used.
Example (for Greek, in UTF-8): *greek* >
:set langmap=ΑA,ΒB,ΨC,ΔD,ΕE,ΦF,ΓG,ΗH,ΙI,ΞJ,ΚK,ΛL,ΜM,ΝN,ΟO,ΠP,QQ,ΡR,ΣS,ΤT,ΘU,ΩV,WW,ΧX,ΥY,ΖZ,αa,βb,ψc,δd,εe,φf,γg,ηh,ιi,ξj,κk,λl,μm,νn,οo,πp,qq,ρr,σs,τt,θu,ωv,ςw,χx,υy,ζz
@@ -7595,7 +7602,9 @@ A jump table for the options with a short description can be found at |Q_op|.
{not available when compiled without the |+wildignore|
feature}
A list of file patterns. A file that matches with one of these
patterns is ignored when completing file or directory names.
patterns is ignored when completing file or directory names, and
influences the result of |expand()|, |glob()| and |globpath()| unless
a flag is passed to disable this.
The pattern is used like with |:autocmd|, see |autocmd-patterns|.
Also see 'suffixes'.
Example: >
+43 -13
View File
@@ -1,4 +1,4 @@
*spell.txt* For Vim version 7.2. Last change: 2008 Jun 21
*spell.txt* For Vim version 7.2. Last change: 2008 Nov 30
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -831,8 +831,11 @@ Comment lines in the .aff file start with a '#':
# comment line ~
With some items it's also possible to put a comment after it, but this isn't
supported in general.
Items with a fixed number of arguments can be followed by a comment. But only
if none of the arguments can contain white space. The comment must start with
a "#" character. Example:
KEEPCASE = # fix case for words with this flag ~
ENCODING *spell-SET*
@@ -965,6 +968,9 @@ common items and two-character flags for uncommon items.
Note: When using utf-8 only characters up to 65000 may be used for flags.
Note: even when using "num" or "long" the number of flags available to
compounding and prefixes is limited to about 250.
AFFIXES
*spell-PFX* *spell-SFX*
@@ -1178,6 +1184,9 @@ word as good.
The flag also applies to the word with affixes, thus this can be used to mark
a whole bunch of related words as bad.
*spell-FORBIDDENWORD*
FORBIDDENWORD can be used just like BAD. For compatibility with Hunspell.
*spell-NEEDAFFIX*
The NEEDAFFIX flag is used to require that a word is used with an affix. The
word itself is not a good word (unless there is an empty affix). Example:
@@ -1268,6 +1277,10 @@ compound word. The word itself is not a good word. Example:
NEEDCOMPOUND & ~
*spell-ONLYINCOMPOUND*
The ONLYINCOMPOUND does exactly the same as NEEDCOMPOUND. Supported for
compatiblity with Hunspell.
*spell-COMPOUNDMIN*
The minimal character length of a word used for compounding is specified with
COMPOUNDMIN. Example:
@@ -1328,6 +1341,20 @@ compound. This means it counts for two words when checking the compounding
rules. Can also be used for an affix to count the affix as a compounding
word.
*spell-CHECKCOMPOUNDPATTERN*
CHECKCOMPOUNDPATTERN is used to define patterns that, when matching at the
position where two words are compounded together forbids the compound.
For example:
CHECKCOMPOUNDPATTERN o e ~
This forbids compounding if the first word ends in "o" and the second word
starts with "e".
The arguments must be plain text, no patterns are actually supported, despite
the item name. Case is always ignored.
The Hunspell feature to use three arguments and flags is not supported.
*spell-SYLLABLE*
The SYLLABLE item defines characters or character sequences that are used to
count the number of syllables in a word. Example:
@@ -1496,6 +1523,10 @@ ignored, not supported or defined in another way.
ACCENT (Hunspell) *spell-ACCENT*
Use MAP instead. |spell-MAP|
BREAK (Hunspell) *spell-BREAK*
Define break points. Unclear how it works exactly.
Not supported.
CHECKCOMPOUNDCASE (Hunspell) *spell-CHECKCOMPOUNDCASE*
Disallow uppercase letters at compound word boundaries.
Not supported.
@@ -1512,9 +1543,6 @@ CHECKCOMPOUNDTRIPLE (Hunspell) *spell-CHECKCOMPOUNDTRIPLE*
Forbid three identical characters when compounding. Not
supported.
CHECKCOMPOUNDPATTERN (Hunspell) *spell-CHECKCOMPOUNDPATTERN*
Forbid compounding when patterns match. Not supported.
COMPLEXPREFIXES (Hunspell) *spell-COMPLEXPREFIXES*
Enables using two prefixes. Not supported.
@@ -1536,13 +1564,18 @@ COMPOUNDEND (Hunspell) *spell-COMPOUNDEND*
COMPOUNDMIDDLE (Hunspell) *spell-COMPOUNDMIDDLE*
Use COMPOUNDRULE instead. |spell-COMPOUNDRULE|
COMPOUNDRULES (Hunspell) *spell-COMPOUNDRULES*
Number of COMPOUNDRULE lines following. Ignored, but the
argument must be a number.
COMPOUNDSYLLABLE (Hunspell) *spell-COMPOUNDSYLLABLE*
Use SYLLABLE and COMPOUNDSYLMAX instead. |spell-SYLLABLE|
|spell-COMPOUNDSYLMAX|
FORBIDDENWORD (Hunspell) *spell-FORBIDDENWORD*
Use BAD instead. |spell-BAD|
KEY (Hunspell) *spell-KEY*
Define characters that are close together on the keyboard.
Used to give better suggestions. Not supported.
LANG (Hunspell) *spell-LANG*
This specifies language-specific behavior. This actually
moves part of the language knowledge into the program,
@@ -1553,10 +1586,7 @@ LEMMA_PRESENT (Hunspell) *spell-LEMMA_PRESENT*
Only needed for morphological analysis.
MAXNGRAMSUGS (Hunspell) *spell-MAXNGRAMSUGS*
Not supported.
ONLYINCOMPOUND (Hunspell) *spell-ONLYINCOMPOUND*
Use NEEDCOMPOUND instead. |spell-NEEDCOMPOUND|
Set number of n-gram suggestions. Not supported.
PSEUDOROOT (Hunspell) *spell-PSEUDOROOT*
Use NEEDAFFIX instead. |spell-NEEDAFFIX|
+11
View File
@@ -511,6 +511,17 @@ N *+X11* Unix only: can restore window title |X11|
messages though. Use ":silent" in the command itself
to avoid that: ":silent menu .... :silent command".
*:uns* *:unsilent*
:uns[ilent] {command} Execute {command} not silently. Only makes a
difference when |:silent| was used to get to this
command.
Use this for giving a message even when |:silent| was
used. In this example |:silent| is used to avoid the
message about reading the file and |:unsilent| to be
able to list the first line of each file. >
:silent argdo unsilent echo expand('%') . ": " . getline(1)
<
*:verb* *:verbose*
:[count]verb[ose] {command}
Execute {command} with 'verbose' set to [count]. If
-27
View File
@@ -1,27 +0,0 @@
" Vim script to fix duplicate words in a .dic file vim: set ft=vim:
"
" Usage: Edit the .dic file and source this script.
let deleted = 0
" Start below the word count.
let lnum = 2
while lnum <= line('$')
let word = getline(lnum)
if word !~ '/'
if search('^' . word . '/', 'w') != 0
let deleted += 1
exe lnum . "d"
continue " don't increment lnum, it's already at the next word
endif
endif
let lnum += 1
endwhile
if deleted == 0
echomsg "No duplicate words found"
elseif deleted == 1
echomsg "Deleted 1 duplicate word"
else
echomsg printf("Deleted %d duplicate words", deleted)
endif
+464 -461
View File
File diff suppressed because it is too large Load Diff
+5 -4
View File
@@ -1,4 +1,4 @@
{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf350
{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf430
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\vieww9000\viewh8400\viewkind0
@@ -31,6 +31,7 @@ Matt Tolton\
Kaoru Yoshida\
Ron Olson\
Jonathon Mah\
Kazuki Sakamoto\
\i0 \
...and many others who have helped by reporting bugs etc.\
@@ -40,8 +41,6 @@ Thank you to {\field{\*\fldinst{HYPERLINK "http://www.positivespinmedia.com"}}{\
\
Toolbar icons by {\field{\*\fldinst{HYPERLINK "http://www.mattballdesign.com/"}}{\fldrslt Matt Ball}} (free Developer Icons), {\field{\*\fldinst{HYPERLINK "http://www.jonasraskdesign.com/"}}{\fldrslt Jonas Rask}} (Danish Royalty Free icon set), and {\field{\*\fldinst{HYPERLINK "http://www.everaldo.com"}}{\fldrslt Everaldo Coelho}} (Crystal Project Icons, released under LGPL license).\
\
Vim icons made by {\field{\*\fldinst{HYPERLINK "http://www.cs.princeton.edu/~mtwebb/vim_icon/vim_icons.html"}}{\fldrslt Matthew Webb}}.\
\
The default font in MacVim, DejaVu Sans Mono, is based on the Bitstream Vera\'99 and Arev fonts. Bitstream Vera\'99 is \'a9 2003 by Bitstream, Inc. Arev is \'a9 2006 by Tavmjong Bah. The DejaVu changes to these fonts are in the public domain.\
\
Thanks to Andy Matuschak for {\field{\*\fldinst{HYPERLINK "http://sparkle.andymatuschak.org/"}}{\fldrslt Sparkle}}.\
@@ -52,4 +51,6 @@ Thanks to Allan Odgaard for making the "Edit in TextMate" input manager source c
\
Thanks to Rainer Brockerhoff for RBSplitView.\
\
Thanks to Chad Weider for CTGradient.}
Thanks to Chad Weider for CTGradient.\
\
Thanks to Damien Guard for {\field{\*\fldinst{HYPERLINK "http://damieng.com/blog/2008/05/26/envy-code-r-preview-7-coding-font-released"}}{\fldrslt Envy Code R}} (used in MacVim's 16x16 document icons).}
+1946 -38
View File
File diff suppressed because it is too large Load Diff
+3
View File
@@ -28,6 +28,9 @@
NSMutableArray *cachedVimControllers;
int preloadPid;
BOOL shouldActivateWhenNextWindowOpens;
int numChildProcesses;
NSMutableDictionary *inputQueues;
int processingFlag;
#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4)
FSEventStreamRef fsEventStream;
File diff suppressed because it is too large Load Diff
+1
View File
@@ -68,6 +68,7 @@ enum { MMMaxCellsPerChar = 2 };
- (void)setPreEditRow:(int)row column:(int)col;
- (void)setMouseShape:(int)shape;
- (void)setAntialias:(BOOL)state;
- (void)setImControl:(BOOL)enable;
- (BOOL)convertPoint:(NSPoint)point toRow:(int *)row column:(int *)column;
- (NSPoint)pointForRow:(int)row column:(int)col;
- (NSRect)rectForRow:(int)row column:(int)col numRows:(int)nr
+30 -38
View File
@@ -139,7 +139,7 @@ defaultLineHeightForFont(NSFont *font)
- (void)dealloc
{
LOG_DEALLOC
ASLogDebug(@"");
[self disposeAtsuStyles];
[font release]; font = nil;
@@ -324,6 +324,11 @@ defaultLineHeightForFont(NSFont *font)
antialias = state;
}
- (void)setImControl:(BOOL)enable
{
[helper setImControl:enable];
}
- (void)keyDown:(NSEvent *)event
{
[helper keyDown:event];
@@ -583,7 +588,7 @@ defaultLineHeightForFont(NSFont *font)
[self resizeContentImage];
#if MM_DEBUG_DRAWING
NSLog(@"====> BEGIN %s", _cmd);
ASLogDebug(@"====> BEGIN %s", _cmd);
#endif
[self beginDrawing];
@@ -594,7 +599,7 @@ defaultLineHeightForFont(NSFont *font)
if (ClearAllDrawType == type) {
#if MM_DEBUG_DRAWING
NSLog(@" Clear all");
ASLogDebug(@" Clear all");
#endif
[self clearAll];
} else if (ClearBlockDrawType == type) {
@@ -605,8 +610,8 @@ defaultLineHeightForFont(NSFont *font)
int col2 = *((int*)bytes); bytes += sizeof(int);
#if MM_DEBUG_DRAWING
NSLog(@" Clear block (%d,%d) -> (%d,%d)", row1, col1,
row2,col2);
ASLogDebug(@" Clear block (%d,%d) -> (%d,%d)", row1, col1,
row2,col2);
#endif
[self clearBlockFromRow:row1 column:col1
toRow:row2 column:col2
@@ -620,7 +625,7 @@ defaultLineHeightForFont(NSFont *font)
int right = *((int*)bytes); bytes += sizeof(int);
#if MM_DEBUG_DRAWING
NSLog(@" Delete %d line(s) from %d", count, row);
ASLogDebug(@" Delete %d line(s) from %d", count, row);
#endif
[self deleteLinesFromRow:row lineCount:count
scrollBottom:bot left:left right:right
@@ -642,8 +647,8 @@ defaultLineHeightForFont(NSFont *font)
freeWhenDone:NO];
bytes += len;
#if MM_DEBUG_DRAWING
NSLog(@" Draw string at (%d,%d) length=%d flags=%d fg=0x%x "
"bg=0x%x sp=0x%x", row, col, len, flags, fg, bg, sp);
ASLogDebug(@" Draw string at (%d,%d) length=%d flags=%d fg=0x%x "
"bg=0x%x sp=0x%x", row, col, len, flags, fg, bg, sp);
#endif
unichar *characters = malloc(sizeof(unichar) * [string length]);
[string getCharacters:characters];
@@ -667,7 +672,7 @@ defaultLineHeightForFont(NSFont *font)
int right = *((int*)bytes); bytes += sizeof(int);
#if MM_DEBUG_DRAWING
NSLog(@" Insert %d line(s) at row %d", count, row);
ASLogDebug(@" Insert %d line(s) at row %d", count, row);
#endif
[self insertLinesAtRow:row lineCount:count
scrollBottom:bot left:left right:right
@@ -680,7 +685,7 @@ defaultLineHeightForFont(NSFont *font)
int percent = *((int*)bytes); bytes += sizeof(int);
#if MM_DEBUG_DRAWING
NSLog(@" Draw cursor at (%d,%d)", row, col);
ASLogDebug(@" Draw cursor at (%d,%d)", row, col);
#endif
[helper setInsertionPointColor:[NSColor colorWithRgbInt:color]];
[self drawInsertionPointAtRow:row column:col shape:shape
@@ -693,8 +698,8 @@ defaultLineHeightForFont(NSFont *font)
/*int invert = *((int*)bytes);*/ bytes += sizeof(int);
#if MM_DEBUG_DRAWING
NSLog(@" Draw inverted rect: row=%d col=%d nrows=%d ncols=%d",
row, col, nr, nc);
ASLogDebug(@" Draw inverted rect: row=%d col=%d nrows=%d "
"ncols=%d", row, col, nr, nc);
#endif
[self drawInvertedRectAtRow:row column:col numRows:nr
numColumns:nc];
@@ -704,7 +709,7 @@ defaultLineHeightForFont(NSFont *font)
/*cursorRow = *((int*)bytes);*/ bytes += sizeof(int);
/*cursorCol = *((int*)bytes);*/ bytes += sizeof(int);
} else {
NSLog(@"WARNING: Unknown draw type (type=%d)", type);
ASLogWarn(@"Unknown draw type (type=%d)", type);
}
}
@@ -718,7 +723,7 @@ defaultLineHeightForFont(NSFont *font)
[self display];
#if MM_DEBUG_DRAWING
NSLog(@"<==== END %s", _cmd);
ASLogDebug(@"<==== END %s", _cmd);
#endif
}
@@ -775,24 +780,7 @@ defaultLineHeightForFont(NSFont *font)
- (void)changeFont:(id)sender
{
NSFont *newFont = [sender convertFont:font];
if (newFont) {
NSString *name = [newFont displayName];
unsigned len = [name lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
if (len > 0) {
NSMutableData *data = [NSMutableData data];
float pointSize = [newFont pointSize];
[data appendBytes:&pointSize length:sizeof(float)];
++len; // include NUL byte
[data appendBytes:&len length:sizeof(unsigned)];
[data appendBytes:[name UTF8String] length:len];
[[self vimController] sendMessage:SetFontMsgID data:data];
}
}
[helper changeFont:sender];
}
@@ -892,10 +880,19 @@ defaultLineHeightForFont(NSFont *font)
return NSNotFound;
}
// 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)
- (NSInteger)conversationIdentifier
{
return (NSInteger)self;
}
#else
- (long)conversationIdentifier
{
return (long)self;
}
#endif
- (NSRange)selectedRange
{
@@ -1035,7 +1032,6 @@ defaultLineHeightForFont(NSFont *font)
- (void)resizeContentImage
{
//NSLog(@"resizeContentImage");
[contentImage release];
contentImage = [[NSImage alloc] initWithSize:[self textAreaSize]];
[contentImage setFlipped:YES];
@@ -1093,8 +1089,6 @@ defaultLineHeightForFont(NSFont *font)
ATSUSetAttributes(style, sizeof(attribValues) / sizeof(attribValues[0]),
attribTags, attribSizes, attribValues);
// NSLog(@"drawString: %d", length);
ATSUCreateTextLayout(&layout);
ATSUSetTextPointerLocation(layout, string,
kATSUFromTextBeginning, kATSUToTextEnd,
@@ -1130,7 +1124,7 @@ defaultLineHeightForFont(NSFont *font)
if (flags & DRAW_UNDERL)
{
[fg set];
[sp set];
NSRectFill(NSMakeRect(rect.origin.x,
(row + 1) * cellSize.height + kUnderlineOffset,
rect.size.width, kUnderlineHeight));
@@ -1222,8 +1216,6 @@ defaultLineHeightForFont(NSFont *font)
NSRect rect = NSMakeRect(origin.x, origin.y,
cellSize.width, cellSize.height);
// NSLog(@"shape = %d, fraction: %d", shape, percent);
if (MMInsertionPointHorizontal == shape) {
int frac = (cellSize.height * percent + 99)/100;
rect.origin.y += rect.size.height - frac;
+15 -5
View File
@@ -21,7 +21,8 @@
NSMutableArray *inputQueue;
NSMutableData *drawData;
NSConnection *connection;
id frontendProxy;
id appProxy;
unsigned identifier;
NSDictionary *colorDict;
NSDictionary *sysColorDict;
NSDictionary *actionDict;
@@ -41,12 +42,16 @@
NSMutableDictionary *clientProxyDict;
NSMutableDictionary *serverReplyDict;
NSString *alternateServerName;
ATSFontContainerRef fontContainerRef;
NSFont *oldWideFont;
GuiFont oldWideFont;
BOOL isTerminating;
BOOL waitForAck;
int initialWindowLayout;
BOOL flushDisabled;
unsigned numWholeLineChanges;
unsigned offsetForDrawDataPrune;
BOOL imState;
CFSocketRef netbeansSocket;
CFRunLoopSourceRef netbeansRunLoopSource;
}
+ (MMBackend *)sharedInstance;
@@ -95,8 +100,7 @@
- (void)setScrollbarPosition:(int)pos length:(int)len identifier:(long)ident;
- (void)setScrollbarThumbValue:(long)val size:(long)size max:(long)max
identifier:(long)ident;
- (void)setFont:(NSFont *)font;
- (void)setWideFont:(NSFont *)font;
- (void)setFont:(GuiFont)font wide:(BOOL)wide;
- (void)executeActionWithName:(NSString *)name;
- (void)setMouseShape:(int)shape;
- (void)setBlinkWait:(int)wait on:(int)on off:(int)off;
@@ -130,6 +134,12 @@
- (void)setWaitForAck:(BOOL)yn;
- (void)waitForConnectionAcknowledgement;
- (BOOL)imState;
- (void)setImState:(BOOL)activated;
- (void)messageFromNetbeans;
- (void)setNetbeansSocket:(int)socket;
@end
+344 -225
View File
File diff suppressed because it is too large Load Diff
+29 -29
View File
@@ -38,12 +38,10 @@
#define FUOPT_BGCOLOR_HLGROUP 0x004
static int numFullscreenWindows = 0;
@interface MMFullscreenWindow (Private)
- (BOOL)isOnPrimaryScreen;
- (void)hideDockIfAppropriate;
- (void)revealDockIfAppropriate;
- (void)handleWindowDidBecomeMainNotification:(NSNotification *)notification;
- (void)handleWindowDidResignMainNotification:(NSNotification *)notification;
@end
@implementation MMFullscreenWindow
@@ -79,12 +77,26 @@ static int numFullscreenWindows = 0;
[self setBackgroundColor:back];
[self setReleasedWhenClosed:NO];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(handleWindowDidBecomeMainNotification:)
name:NSWindowDidBecomeMainNotification
object:self];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(handleWindowDidResignMainNotification:)
name:NSWindowDidResignMainNotification
object:self];
return self;
}
- (void)dealloc
{
LOG_DEALLOC
ASLogDebug(@"");
[[NSNotificationCenter defaultCenter] removeObserver:self];
[target release]; target = nil;
[view release]; view = nil;
@@ -94,8 +106,6 @@ static int numFullscreenWindows = 0;
- (void)enterFullscreen:(int)fuoptions
{
[self hideDockIfAppropriate];
// fade to black
Boolean didBlend = NO;
CGDisplayFadeReservationToken token;
@@ -139,8 +149,10 @@ static int numFullscreenWindows = 0;
int fuRows = currRows, fuColumns = currColumns;
// NOTE: Do not use [NSScreen visibleFrame] when determining the screen
// size since it compensates for menu and dock.
int maxRows, maxColumns;
NSSize size = [[self screen] visibleFrame].size;
NSSize size = [[self screen] frame].size;
[view constrainRows:&maxRows columns:&maxColumns toSize:size];
// Store current pre-fu vim size
@@ -277,8 +289,6 @@ static int numFullscreenWindows = 0;
CGReleaseDisplayFadeReservation(token);
}
[self revealDockIfAppropriate];
[self autorelease]; // Balance the above retain
}
@@ -298,7 +308,6 @@ static int numFullscreenWindows = 0;
- (void)centerView
{
NSRect outer = [self frame], inner = [view frame];
//NSLog(@"%s %@%@", _cmd, NSStringFromRect(outer), NSStringFromRect(inner));
NSPoint origin = NSMakePoint((outer.size.width - inner.size.width)/2,
(outer.size.height - inner.size.height)/2);
@@ -347,38 +356,29 @@ static int numFullscreenWindows = 0;
return [self screen] == [screens objectAtIndex:0];
}
- (void)hideDockIfAppropriate
- (void)handleWindowDidBecomeMainNotification:(NSNotification *)notification
{
// Hide menu and dock, both appear on demand.
//
// Don't hide the dock if going fullscreen on a non-primary screen. Also,
// if there are several fullscreen windows on the primary screen, only
// hide dock and friends for the first fullscreen window (and display
// them again after the last fullscreen window has been closed).
//
// Another way to deal with several fullscreen windows would be to hide/
// reveal the dock each time a fullscreen window gets/loses focus, but
// this way it's less distracting.
// reveal the dock only when the first fullscreen window is created and
// show it again after the last one has been closed, but toggling on each
// focus gain/loss works better with Spaces. The downside is that the
// menu bar flashes shortly when switching between two fullscreen windows.
// XXX: If you have a fullscreen window on a secondary monitor and unplug
// the monitor, this will probably not work right.
if ([self isOnPrimaryScreen]) {
if (numFullscreenWindows == 0) {
SetSystemUIMode(kUIModeAllSuppressed, 0); //requires 10.3
}
++numFullscreenWindows;
SetSystemUIMode(kUIModeAllSuppressed, 0); //requires 10.3
}
}
- (void)revealDockIfAppropriate
- (void)handleWindowDidResignMainNotification:(NSNotification *)notification
{
// order menu and dock back in
// order menu and dock back in
if ([self isOnPrimaryScreen]) {
--numFullscreenWindows;
if (numFullscreenWindows == 0) {
SetSystemUIMode(kUIModeNormal, 0);
}
SetSystemUIMode(kUIModeNormal, 0);
}
}
+5 -3
View File
@@ -50,6 +50,8 @@ static MMPlugInManager *plugInManager = nil;
- (void)dealloc
{
ASLogDebug(@"");
[plugInClasses release]; plugInClasses = nil;
[super dealloc];
}
@@ -123,13 +125,13 @@ static MMPlugInManager *plugInManager = nil;
if(currPrincipalClass && [self plugInClassIsValid:currPrincipalClass]) {
if ([currPrincipalClass initializePlugIn:
[MMPlugInAppMediator sharedAppMediator]]) {
//NSLog(@"Plug-in initialized: %@", currPath);
ASLogInfo(@"Plug-in initialized: %@", currPath);
[plugInClasses addObject:currPrincipalClass];
} else {
NSLog(@"Plug-in failed to initialize: %@", currPath);
ASLogErr(@"Plug-in failed to initialize: %@", currPath);
}
} else {
NSLog(@"Plug-in did not conform to protocol: %@", currPath);
ASLogErr(@"Plug-in did not conform to protocol: %@", currPath);
}
}
}
+10 -5
View File
@@ -40,9 +40,12 @@ static void loadSymbols()
}
static CFStringRef ODBEDITOR = CFSTR("org.slashpunt.edit_in_odbeditor");
static CFStringRef ODB_BUNDLE_IDENTIFIER = CFSTR("ODBEditorBundleIdentifier");
static CFStringRef ODB_EDITOR_NAME = CFSTR("ODBEditorName");
// The compiler on OS X 10.4 balks at using CFSTR() for globals so we get
// around with this some ugly type casting.
static CFStringRef ODBEDITOR = (CFStringRef)@"org.slashpunt.edit_in_odbeditor";
static CFStringRef ODB_BUNDLE_IDENTIFIER =
(CFStringRef)@"ODBEditorBundleIdentifier";
static CFStringRef ODB_EDITOR_NAME = (CFStringRef)@"ODBEditorName";
static NSString *ODBEDITOR_DIR =
@"/Library/InputManagers/Edit in ODBEditor";
static NSString *ODBEDITOR_PATH =
@@ -112,6 +115,8 @@ NSString *kOdbEditorIdentifierWriteRoom = @"com.hogbaysoftware.WriteRoom";
- (void)dealloc
{
ASLogDebug(@"");
[supportedOdbEditors release]; supportedOdbEditors = nil;
[super dealloc];
}
@@ -380,7 +385,7 @@ NSString *kOdbEditorIdentifierWriteRoom = @"com.hogbaysoftware.WriteRoom";
[self setOdbEditorByName:kOdbEditorNameMacVim];
}
} else {
NSLog(@"Failed to install input manager, error is %d", err);
ASLogErr(@"Failed to install input manager, error is %d", err);
}
[au release];
@@ -399,7 +404,7 @@ NSString *kOdbEditorIdentifierWriteRoom = @"com.hogbaysoftware.WriteRoom";
initWithCommands:cmd];
OSStatus err = [au run];
if (err != errAuthorizationSuccess)
NSLog(@"Failed to uninstall input manager, error is %d", err);
ASLogErr(@"Failed to uninstall input manager, error is %d", err);
[au release];
[self updateIntegrationPane];
+42 -44
View File
@@ -84,7 +84,7 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
- (void)dealloc
{
LOG_DEALLOC
ASLogDebug(@"");
#if MM_USE_ROW_CACHE
if (rowCache) {
@@ -135,15 +135,13 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
withString:(NSString *)string
{
#if MM_TS_PARANOIA_LOG
NSLog(@"WARNING: calling %s on MMTextStorage is unsupported", _cmd);
ASLogWarn(@"Calling %s on MMTextStorage is unsupported", _cmd);
#endif
//[attribString replaceCharactersInRange:range withString:string];
}
- (void)setAttributes:(NSDictionary *)attributes range:(NSRange)range
{
//NSLog(@"%s%@", _cmd, NSStringFromRange(range));
// NOTE! This method must be implemented since the text system calls it
// constantly to 'fix attributes', apply font substitution, etc.
#if 0
@@ -185,7 +183,6 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
[attribString setAttributes:newAttr range:range];
} else {
//NSLog(@"NOT fixing font attribute!");
[attribString setAttributes:attributes range:range];
}
#endif
@@ -220,7 +217,7 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
{
NSLayoutManager *lm = [[self layoutManagers] objectAtIndex:0];
if (!lm) {
NSLog(@"WARNING: No layout manager available in call to %s", _cmd);
ASLogWarn(@"No layout manager available");
return;
}
@@ -253,9 +250,6 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
foregroundColor:(NSColor *)fg backgroundColor:(NSColor *)bg
specialColor:(NSColor *)sp
{
//NSLog(@"replaceString:atRow:%d column:%d withFlags:%d "
// "foreground:%@ background:%@ special:%@",
// row, col, flags, fg, bg, sp);
[self lazyResize:NO];
if (row < 0 || row >= maxRows || col < 0 || col >= maxColumns
@@ -278,7 +272,7 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
NSRange range = [self charRangeForRow:row column:&acol cells:&acells];
if (NSNotFound == range.location) {
#if MM_TS_PARANOIA_LOG
NSLog(@"INTERNAL ERROR [%s] Out of bounds", _cmd);
ASLogErr(@"INTERNAL ERROR: Out of bounds");
#endif
return;
}
@@ -344,13 +338,11 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
++changeInLength;
#if 0
} else if (acol == col - 1) {
NSLog(@"acol == col - 1");
[attribString replaceCharactersInRange:NSMakeRange(r.location,0)
withAttributedString:[emptyRowString
attributedSubstringFromRange:NSMakeRange(0,1)]];
++changeInLength;
} else if (acol == col + 1) {
NSLog(@"acol == col + 1");
[attribString replaceCharactersInRange:NSMakeRange(r.location-1,1)
withAttributedString:[emptyRowString
attributedSubstringFromRange:NSMakeRange(0,2)]];
@@ -360,8 +352,8 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
// NOTE: It seems that this never gets called. If it ever does,
// then there is another case to treat.
#if MM_TS_PARANOIA_LOG
NSLog(@"row=%d col=%d acol=%d cells=%d acells=%d", row, col, acol,
cells, acells);
ASLogWarn(@"row=%d col=%d acol=%d cells=%d acells=%d", row, col,
acol, cells, acells);
#endif
}
}
@@ -387,7 +379,6 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
scrollBottom:(int)bottom left:(int)left right:(int)right
color:(NSColor *)color
{
//NSLog(@"deleteLinesFromRow:%d lineCount:%d color:%@", row, count, color);
[self lazyResize:NO];
if (row < 0 || row+count > maxRows || bottom > maxRows || left < 0
@@ -407,7 +398,7 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
destRange = [self charRangeForRow:destRow column:&acol cells:&acells];
#if MM_TS_PARANOIA_LOG
if (acells != width || acol != left)
NSLog(@"INTERNAL ERROR [%s]", _cmd);
ASLogErr(@"INTERNAL ERROR");
#endif
acol = left; acells = width;
@@ -415,13 +406,13 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
cells:&acells];
#if MM_TS_PARANOIA_LOG
if (acells != width || acol != left)
NSLog(@"INTERNAL ERROR [%s]", _cmd);
ASLogErr(@"INTERNAL ERROR");
#endif
if (NSNotFound == destRange.location || NSNotFound == srcRange.location)
{
#if MM_TS_PARANOIA_LOG
NSLog(@"INTERNAL ERROR [%s] Out of bounds", _cmd);
ASLogErr(@"INTERNAL ERROR: Out of bounds");
#endif
return;
}
@@ -453,11 +444,11 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
destRange = [self charRangeForRow:destRow column:&acol cells:&acells];
#if MM_TS_PARANOIA_LOG
if (acells != width || acol != left)
NSLog(@"INTERNAL ERROR [%s]", _cmd);
ASLogErr(@"INTERNAL ERROR");
#endif
if (NSNotFound == destRange.location) {
#if MM_TS_PARANOIA_LOG
NSLog(@"INTERNAL ERROR [%s] Out of bounds", _cmd);
ASLogErr(@"INTERNAL ERROR: Out of bounds");
#endif
return;
}
@@ -485,7 +476,6 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
scrollBottom:(int)bottom left:(int)left right:(int)right
color:(NSColor *)color
{
//NSLog(@"insertLinesAtRow:%d lineCount:%d color:%@", row, count, color);
[self lazyResize:NO];
if (row < 0 || row+count > maxRows || bottom > maxRows || left < 0
@@ -506,19 +496,19 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
destRange = [self charRangeForRow:destRow column:&acol cells:&acells];
#if MM_TS_PARANOIA_LOG
if (acells != width || acol != left)
NSLog(@"INTERNAL ERROR [%s]", _cmd);
ASLogErr(@"INTERNAL ERROR");
#endif
acol = left; acells = width;
srcRange = [self charRangeForRow:srcRow column:&acol cells:&acells];
#if MM_TS_PARANOIA_LOG
if (acells != width || acol != left)
NSLog(@"INTERNAL ERROR [%s]", _cmd);
ASLogErr(@"INTERNAL ERROR");
#endif
if (NSNotFound == destRange.location || NSNotFound == srcRange.location)
{
#if MM_TS_PARANOIA_LOG
NSLog(@"INTERNAL ERROR [%s] Out of bounds", _cmd);
ASLogErr(@"INTERNAL ERROR: Out of bounds");
#endif
return;
}
@@ -549,11 +539,11 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
destRange = [self charRangeForRow:destRow column:&acol cells:&acells];
#if MM_TS_PARANOIA_LOG
if (acells != width || acol != left)
NSLog(@"INTERNAL ERROR [%s]", _cmd);
ASLogErr(@"INTERNAL ERROR");
#endif
if (NSNotFound == destRange.location) {
#if MM_TS_PARANOIA_LOG
NSLog(@"INTERNAL ERROR [%s] Out of bounds", _cmd);
ASLogErr(@"INTERNAL ERROR: Out of bounds");
#endif
return;
}
@@ -576,8 +566,6 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
- (void)clearBlockFromRow:(int)row1 column:(int)col1 toRow:(int)row2
column:(int)col2 color:(NSColor *)color
{
//NSLog(@"clearBlockFromRow:%d column:%d toRow:%d column:%d color:%@",
// row1, col1, row2, col2, color);
[self lazyResize:NO];
if (row1 < 0 || row2 >= maxRows || col1 < 0 || col2 > maxColumns)
@@ -598,11 +586,11 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
range = [self charRangeForRow:r column:&acol cells:&acells];
#if MM_TS_PARANOIA_LOG
if (acells != cells || acol != col1)
NSLog(@"INTERNAL ERROR [%s]", _cmd);
ASLogErr(@"INTERNAL ERROR");
#endif
if (NSNotFound == range.location) {
#if MM_TS_PARANOIA_LOG
NSLog(@"INTERNAL ERROR [%s] Out of bounds", _cmd);
ASLogErr(@"INTERNAL ERROR: Out of bounds");
#endif
return;
}
@@ -624,7 +612,6 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
- (void)clearAll
{
//NSLog(@"%s", _cmd);
[self lazyResize:YES];
}
@@ -683,7 +670,7 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
cellSize.height = linespace + [lm defaultLineHeightForFont:font];
} else {
// Should never happen, set some bogus value for cell height.
NSLog(@"WARNING: No layout manager available in call to %s", _cmd);
ASLogWarn(@"No layout manager available");
cellSize.height = linespace + 16.0;
}
@@ -1009,15 +996,16 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
return NSMakeRange(row*(actualColumns+1) + col, cells);
NSString *string = [attribString string];
unsigned stringLen = [string length];
NSRange r, range = { NSNotFound, 0 };
unsigned idx, rowEnd;
unsigned idx;
int i;
if (row < 0 || row >= actualRows || col < 0 || col >= actualColumns
|| col+cells > actualColumns) {
#if MM_TS_PARANOIA_LOG
NSLog(@"%s row=%d col=%d cells=%d is out of range (length=%d)",
_cmd, row, col, cells, [string length]);
ASLogErr(@"row=%d col=%d cells=%d is out of range (length=%d)",
row, col, cells, stringLen);
#endif
return range;
}
@@ -1029,12 +1017,12 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
for (i = 0; i < row; ++i, ++cache)
idx += cache->length;
rowEnd = idx + cache->length;
int rowEnd = idx + cache->length;
#else
// Locate the beginning of the row by scanning for EOL characters.
r.location = 0;
for (i = 0; i < row; ++i) {
r.length = [string length] - r.location;
r.length = stringLen - r.location;
r = [string rangeOfString:@"\n" options:NSLiteralSearch range:r];
if (NSNotFound == r.location)
return range;
@@ -1070,6 +1058,8 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
if (col > i) {
// Forward search
while (col > i) {
if (idx >= stringLen)
return NSMakeRange(NSNotFound, 0);
r = [string rangeOfComposedCharacterSequenceAtIndex:idx];
// Wide chars take up two display cells.
@@ -1084,6 +1074,8 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
} else if (col < i) {
// Backward search
while (col < i) {
if (idx-1 >= stringLen)
return NSMakeRange(NSNotFound, 0);
r = [string rangeOfComposedCharacterSequenceAtIndex:idx-1];
idx -= r.length;
--i;
@@ -1111,6 +1103,8 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
// Forward search
while (col > i) {
if (idx >= stringLen)
return NSMakeRange(NSNotFound, 0);
r = [string rangeOfComposedCharacterSequenceAtIndex:idx];
// Wide chars take up two display cells.
@@ -1131,6 +1125,8 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
#else
idx = r.location;
for (i = 0; i < col; ++i) {
if (idx >= stringLen)
return NSMakeRange(NSNotFound, 0);
r = [string rangeOfComposedCharacterSequenceAtIndex:idx];
// Wide chars take up two display cells.
@@ -1146,6 +1142,8 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
// Count the number of characters that cover the cells.
range.location = idx;
for (i = 0; i < cells; ++i) {
if (idx >= stringLen)
return NSMakeRange(NSNotFound, 0);
r = [string rangeOfComposedCharacterSequenceAtIndex:idx];
// Wide chars take up two display cells.
@@ -1163,20 +1161,20 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
#if MM_TS_PARANOIA_LOG
#if MM_USE_ROW_CACHE
if (range.location >= rowEnd-1) {
NSLog(@"INTERNAL ERROR [%s] : row=%d col=%d cells=%d --> range=%@",
_cmd, row, col, cells, NSStringFromRange(range));
ASLogErr(@"INTERNAL ERROR: row=%d col=%d cells=%d --> range=%@",
row, col, cells, NSStringFromRange(range));
range.location = rowEnd - 2;
range.length = 1;
} else if (NSMaxRange(range) >= rowEnd) {
NSLog(@"INTERNAL ERROR [%s] : row=%d col=%d cells=%d --> range=%@",
_cmd, row, col, cells, NSStringFromRange(range));
ASLogErr(@"INTERNAL ERROR: row=%d col=%d cells=%d --> range=%@",
row, col, cells, NSStringFromRange(range));
range.length = rowEnd - range.location - 1;
}
#endif
if (NSMaxRange(range) > [string length]) {
NSLog(@"INTERNAL ERROR [%s] : row=%d col=%d cells=%d --> range=%@",
_cmd, row, col, cells, NSStringFromRange(range));
if (NSMaxRange(range) > stringLen) {
ASLogErr(@"INTERNAL ERROR: row=%d col=%d cells=%d --> range=%@",
row, col, cells, NSStringFromRange(range));
range.location = NSNotFound;
range.length = 0;
}
+1
View File
@@ -32,6 +32,7 @@
- (void)performBatchDrawWithData:(NSData *)data;
- (void)setMouseShape:(int)shape;
- (void)setAntialias:(BOOL)antialias;
- (void)setImControl:(BOOL)enable;
//
// MMTextStorage methods
+23 -44
View File
@@ -63,10 +63,12 @@
NSTypesetter *typesetter = [[MMTypesetter alloc] init];
[lm setTypesetter:typesetter];
[typesetter release];
#if MM_USE_ROW_CACHE
} else if ([typesetterString isEqual:@"MMTypesetter2"]) {
NSTypesetter *typesetter = [[MMTypesetter2 alloc] init];
[lm setTypesetter:typesetter];
[typesetter release];
#endif // MM_USE_ROW_CACHE
} else {
// Only MMTypesetter supports different cell width multipliers.
[[NSUserDefaults standardUserDefaults]
@@ -110,7 +112,7 @@
- (void)dealloc
{
LOG_DEALLOC
ASLogDebug(@"");
if (invertRects) {
free(invertRects);
@@ -151,7 +153,7 @@
int cursorRow = -1, cursorCol = 0;
#if MM_DEBUG_DRAWING
NSLog(@"====> BEGIN %s", _cmd);
ASLogDebug(@"====> BEGIN %s", _cmd);
#endif
[textStorage beginEditing];
@@ -162,7 +164,7 @@
if (ClearAllDrawType == type) {
#if MM_DEBUG_DRAWING
NSLog(@" Clear all");
ASLogDebug(@" Clear all");
#endif
[textStorage clearAll];
} else if (ClearBlockDrawType == type) {
@@ -173,8 +175,8 @@
int col2 = *((int*)bytes); bytes += sizeof(int);
#if MM_DEBUG_DRAWING
NSLog(@" Clear block (%d,%d) -> (%d,%d)", row1, col1,
row2,col2);
ASLogDebug(@" Clear block (%d,%d) -> (%d,%d)", row1, col1,
row2,col2);
#endif
[textStorage clearBlockFromRow:row1 column:col1
toRow:row2 column:col2
@@ -188,7 +190,7 @@
int right = *((int*)bytes); bytes += sizeof(int);
#if MM_DEBUG_DRAWING
NSLog(@" Delete %d line(s) from %d", count, row);
ASLogDebug(@" Delete %d line(s) from %d", count, row);
#endif
[textStorage deleteLinesFromRow:row lineCount:count
scrollBottom:bot left:left right:right
@@ -208,9 +210,9 @@
bytes += len;
#if MM_DEBUG_DRAWING
NSLog(@" Draw string at (%d,%d) length=%d flags=%d fg=0x%x "
"bg=0x%x sp=0x%x (%@)", row, col, len, flags, fg, bg, sp,
len > 0 ? [string substringToIndex:1] : @"");
ASLogDebug(@" Draw string at (%d,%d) length=%d flags=%d fg=0x%x "
"bg=0x%x sp=0x%x (%@)", row, col, len, flags, fg, bg, sp,
len > 0 ? [string substringToIndex:1] : @"");
#endif
// NOTE: If this is a call to draw the (block) cursor, then cancel
// any previous request to draw the insertion point, or it might
@@ -235,7 +237,7 @@
int right = *((int*)bytes); bytes += sizeof(int);
#if MM_DEBUG_DRAWING
NSLog(@" Insert %d line(s) at row %d", count, row);
ASLogDebug(@" Insert %d line(s) at row %d", count, row);
#endif
[textStorage insertLinesAtRow:row lineCount:count
scrollBottom:bot left:left right:right
@@ -248,7 +250,7 @@
int percent = *((int*)bytes); bytes += sizeof(int);
#if MM_DEBUG_DRAWING
NSLog(@" Draw cursor at (%d,%d)", row, col);
ASLogDebug(@" Draw cursor at (%d,%d)", row, col);
#endif
[helper setInsertionPointColor:[NSColor colorWithRgbInt:color]];
[self drawInsertionPointAtRow:row column:col shape:shape
@@ -261,8 +263,8 @@
int invert = *((int*)bytes); bytes += sizeof(int);
#if MM_DEBUG_DRAWING
NSLog(@" Draw inverted rect: row=%d col=%d nrows=%d ncols=%d",
row, col, nr, nc);
ASLogDebug(@" Draw inverted rect: row=%d col=%d nrows=%d "
"ncols=%d", row, col, nr, nc);
#endif
[self drawInvertedRectAtRow:row column:col numRows:nr numColumns:nc
invert:invert];
@@ -270,7 +272,7 @@
cursorRow = *((int*)bytes); bytes += sizeof(int);
cursorCol = *((int*)bytes); bytes += sizeof(int);
} else {
NSLog(@"WARNING: Unknown draw type (type=%d)", type);
ASLogWarn(@"Unknown draw type (type=%d)", type);
}
}
@@ -291,7 +293,7 @@
[self display];
#if MM_DEBUG_DRAWING
NSLog(@"<==== END %s", _cmd);
ASLogDebug(@"<==== END %s", _cmd);
#endif
}
@@ -305,6 +307,11 @@
antialias = state;
}
- (void)setImControl:(BOOL)enable
{
[helper setImControl:enable];
}
- (NSFont *)font
{
return [(MMTextStorage*)[self textStorage] font];
@@ -444,9 +451,6 @@
if (row) *row = floor((point.y-origin.y-1) / cellSize.height);
if (column) *column = floor((point.x-origin.x-1) / cellSize.width);
//NSLog(@"convertPoint:%@ toRow:%d column:%d", NSStringFromPoint(point),
// *row, *column);
return YES;
}
@@ -617,10 +621,6 @@
// NOTE: We only draw the cursor once and rely on Vim to say when it
// should be drawn again.
shouldDrawInsertionPoint = NO;
//NSLog(@"%s draw insertion point %@ shape=%d color=%@", _cmd,
// NSStringFromRect(ipRect), insertionPointShape,
// [helper insertionPointColor]);
}
#if 0
@@ -808,28 +808,7 @@
- (void)changeFont:(id)sender
{
MMTextStorage *ts = (MMTextStorage*)[self textStorage];
if (!ts) return;
NSFont *oldFont = [ts font];
NSFont *newFont = [sender convertFont:oldFont];
if (newFont) {
NSString *name = [newFont displayName];
unsigned len = [name lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
if (len > 0) {
NSMutableData *data = [NSMutableData data];
float pointSize = [newFont pointSize];
[data appendBytes:&pointSize length:sizeof(float)];
++len; // include NUL byte
[data appendBytes:&len length:sizeof(unsigned)];
[data appendBytes:[name UTF8String] length:len];
[[self vimController] sendMessage:SetFontMsgID data:data];
}
}
[helper changeFont:sender];
}
- (void)resetCursorRects
+4
View File
@@ -39,6 +39,8 @@ enum {
NSMutableAttributedString *markedText;
int preEditRow;
int preEditColumn;
BOOL imControl;
BOOL imState;
}
- (void)setTextView:(id)view;
@@ -63,6 +65,7 @@ enum {
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender;
- (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender;
- (void)setMouseShape:(int)shape;
- (void)changeFont:(id)sender;
// Input Manager
- (BOOL)hasMarkedText;
@@ -79,5 +82,6 @@ enum {
- (NSRange)imRange;
- (void)setMarkedRange:(NSRange)range;
- (NSRect)firstRectForCharacterRange:(NSRange)range;
- (void)setImControl:(BOOL)enable;
@end
+98 -34
View File
@@ -40,6 +40,7 @@ static float MMDragAreaSize = 73.0f;
- (void)dispatchKeyEvent:(NSEvent *)event;
- (void)sendKeyDown:(const char *)chars length:(int)len modifiers:(int)flags
isARepeat:(BOOL)isARepeat;
- (void)checkImState;
- (void)hideMouseCursor;
- (void)startDragTimerWithInterval:(NSTimeInterval)t;
- (void)dragTimerFired:(NSTimer *)timer;
@@ -52,7 +53,11 @@ static float MMDragAreaSize = 73.0f;
- (void)dealloc
{
ASLogDebug(@"");
[insertionPointColor release]; insertionPointColor = nil;
[markedText release]; markedText = nil;
[markedTextAttributes release]; markedTextAttributes = nil;
[super dealloc];
}
@@ -78,7 +83,7 @@ static float MMDragAreaSize = 73.0f;
- (void)keyDown:(NSEvent *)event
{
//NSLog(@"%s %@", _cmd, event);
//ASLogDebug(@"%@", event);
// HACK! If control modifier is held, don't pass the event along to
// interpretKeyEvents: since some keys are bound to multiple commands which
// means doCommandBySelector: is called several times. Do the same for
@@ -89,6 +94,9 @@ static float MMDragAreaSize = 73.0f;
// TODO: Figure out a way to disable Cocoa key bindings entirely, without
// affecting input management.
if (imControl)
[self checkImState];
// When the Input Method is activated, some special key inputs
// should be treated as key inputs for Input Method.
if ([textView hasMarkedText]) {
@@ -100,14 +108,19 @@ static float MMDragAreaSize = 73.0f;
int flags = [event modifierFlags];
if ((flags & NSControlKeyMask) ||
((flags & NSAlternateKeyMask) && (flags & NSFunctionKeyMask))) {
BOOL unmodIsPrintable = YES;
NSString *unmod = [event charactersIgnoringModifiers];
if ([unmod length] == 1 && [unmod characterAtIndex:0] <= 0x7f
&& [unmod characterAtIndex:0] >= 0x60) {
// HACK! Send Ctrl-letter keys (and 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:[event characters]];
if (unmod && [unmod length] > 0 && [unmod characterAtIndex:0] < 0x20)
unmodIsPrintable = NO;
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];
}
@@ -129,7 +142,7 @@ static float MMDragAreaSize = 73.0f;
- (void)insertText:(id)string
{
//NSLog(@"%s %@", _cmd, string);
//ASLogDebug(@"%@", string);
// NOTE! This method is called for normal key presses but also for
// Option-key presses --- even when Ctrl is held as well as Option. When
// Ctrl is held, the AppKit translates the character to a Ctrl+key stroke,
@@ -167,8 +180,6 @@ static float MMDragAreaSize = 73.0f;
if ([string isKindOfClass:[NSAttributedString class]])
string = [string string];
//NSLog(@"send InsertTextMsgID: %@", string);
NSMutableData *data = [NSMutableData data];
int len = [string lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
int flags = [event modifierFlags] & 0xffff0000U;
@@ -184,7 +195,7 @@ static float MMDragAreaSize = 73.0f;
- (void)doCommandBySelector:(SEL)selector
{
//NSLog(@"%s %@", _cmd, NSStringFromSelector(selector));
//ASLogDebug(@"%@", NSStringFromSelector(selector));
// By ignoring the selector we effectively disable the key binding
// mechanism of Cocoa. Hopefully this is what the user will expect
// (pressing Ctrl+P would otherwise result in moveUp: instead of previous
@@ -223,7 +234,7 @@ static float MMDragAreaSize = 73.0f;
- (BOOL)performKeyEquivalent:(NSEvent *)event
{
//NSLog(@"%s %@", _cmd, event);
//ASLogDebug(@"%@", event);
// Called for Cmd+key keystrokes, function keys, arrow keys, page
// up/down, home, end.
//
@@ -231,6 +242,9 @@ static float MMDragAreaSize = 73.0f;
// passed to keyDown:. It seems as if the main menu consumes Cmd-key
// strokes, unless the key is a function key.
if (imControl)
[self checkImState];
// NOTE: If the event that triggered this method represents a function key
// down then we do nothing, otherwise the input method never gets the key
// stroke (some input methods use e.g. arrow keys). The function key down
@@ -264,15 +278,17 @@ static float MMDragAreaSize = 73.0f;
if ([unmodchars isEqual:@"?"])
return NO;
// Cmd-. is hard-wired to send an interrupt (like Ctrl-C).
// 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:@"."]) {
[[self vimController] sendMessage:InterruptMsgID data:nil];
kill([[self vimController] pid], SIGINT);
return YES;
}
//NSLog(@"%s%@", _cmd, event);
NSString *chars = [event characters];
int len = [unmodchars lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
NSMutableData *data = [NSMutableData data];
@@ -433,15 +449,11 @@ static float MMDragAreaSize = 73.0f;
[data appendBytes:&col length:sizeof(int)];
[[self vimController] sendMessage:MouseMovedMsgID data:data];
//NSLog(@"Moved %d %d\n", col, row);
}
}
- (void)mouseEntered:(NSEvent *)event
{
//NSLog(@"%s", _cmd);
// NOTE: This event is received even when the window is not key; thus we
// have to take care not to enable mouse moved events unless our window is
// key.
@@ -452,8 +464,6 @@ static float MMDragAreaSize = 73.0f;
- (void)mouseExited:(NSEvent *)event
{
//NSLog(@"%s", _cmd);
[[textView window] setAcceptsMouseMovedEvents:NO];
// NOTE: This event is received even when the window is not key; if the
@@ -469,8 +479,6 @@ static float MMDragAreaSize = 73.0f;
- (void)setFrame:(NSRect)frame
{
//NSLog(@"%s", _cmd);
// When the frame changes we also need to update the tracking rect.
[textView removeTrackingRect:trackingRectTag];
trackingRectTag = [textView addTrackingRect:[self trackingRect]
@@ -481,8 +489,6 @@ static float MMDragAreaSize = 73.0f;
- (void)viewDidMoveToWindow
{
//NSLog(@"%s (window=%@)", _cmd, [self window]);
// Set a tracking rect which covers the text.
// NOTE: While the mouse cursor is in this rect the view will receive
// 'mouseMoved:' events so that Vim can take care of updating the mouse
@@ -498,8 +504,6 @@ static float MMDragAreaSize = 73.0f;
- (void)viewWillMoveToWindow:(NSWindow *)newWindow
{
//NSLog(@"%s%@", _cmd, newWindow);
// Remove tracking rect if view moves or is removed.
if ([textView window] && trackingRectTag) {
[textView removeTrackingRect:trackingRectTag];
@@ -560,6 +564,40 @@ static float MMDragAreaSize = 73.0f;
[self setCursor];
}
- (void)changeFont:(id)sender
{
NSFont *newFont = [sender convertFont:[textView font]];
NSFont *newFontWide = [sender convertFont:[textView fontWide]];
if (newFont) {
NSString *name = [newFont displayName];
NSString *wideName = [newFontWide displayName];
unsigned len = [name lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
unsigned wideLen = [wideName lengthOfBytesUsingEncoding:
NSUTF8StringEncoding];
if (len > 0) {
NSMutableData *data = [NSMutableData data];
float pointSize = [newFont pointSize];
[data appendBytes:&pointSize length:sizeof(float)];
++len; // include NUL byte
[data appendBytes:&len length:sizeof(unsigned)];
[data appendBytes:[name UTF8String] length:len];
if (wideLen > 0) {
++wideLen; // include NUL byte
[data appendBytes:&wideLen length:sizeof(unsigned)];
[data appendBytes:[wideName UTF8String] length:wideLen];
} else {
[data appendBytes:&wideLen length:sizeof(unsigned)];
}
[[self vimController] sendMessage:SetFontMsgID data:data];
}
}
}
- (BOOL)hasMarkedText
{
return markedRange.length > 0 ? YES : NO;
@@ -712,6 +750,14 @@ static float MMDragAreaSize = 73.0f;
return rect;
}
- (void)setImControl:(BOOL)enable
{
// This flag corresponds to the (negation of the) 'imd' option. When
// enabled changes to the input method are detected and forwarded to the
// backend.
imControl = enable;
}
@end // MMTextViewHelper
@@ -741,13 +787,13 @@ static float MMDragAreaSize = 73.0f;
NSString *chars = [event characters];
NSString *unmodchars = [event charactersIgnoringModifiers];
unichar c = [chars characterAtIndex:0];
unichar imc = [unmodchars characterAtIndex:0];
unichar imc = [unmodchars length] > 0 ? [unmodchars characterAtIndex:0] : 0;
int len = 0;
const char *bytes = 0;
int mods = [event modifierFlags];
//NSLog(@"%s chars[0]=0x%x unmodchars[0]=0x%x (chars=%@ unmodchars=%@)",
// _cmd, c, imc, chars, unmodchars);
//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
@@ -795,11 +841,29 @@ static float MMDragAreaSize = 73.0f;
[self hideMouseCursor];
//NSLog(@"%s len=%d chars=0x%x", _cmd, len, chars[0]);
//ASLogDebug(@"len=%d chars=0x%x", len, chars[0]);
[[self vimController] sendMessage:KeyDownMsgID data:data];
}
}
- (void)checkImState
{
// IM is active whenever the current script is the system script and the
// system script isn't roman. (Hence IM can only be active when using
// non-roman scripts.)
// NOTE: The IM code is delegated to the frontend since calling it in the
// backend caused weird bugs (second dock icon appearing etc.).
SInt32 currentScript = GetScriptManagerVariable(smKeyScript);
SInt32 systemScript = GetScriptManagerVariable(smSysScript);
BOOL state = currentScript != smRoman && currentScript == systemScript;
if (imState != state) {
imState = state;
int msgid = state ? ActivatedImMsgID : DeactivatedImMsgID;
[[self vimController] sendMessage:msgid data:nil];
}
}
- (void)hideMouseCursor
{
// Check 'mousehide' option
@@ -876,7 +940,7 @@ static float MMDragAreaSize = 73.0f;
initWithImage:ibeamImage hotSpot:hotSpot];
}
if (!customIbeamCursor) {
NSLog(@"WARNING: Failed to load custom Ibeam cursor");
ASLogWarn(@"Failed to load custom Ibeam cursor");
customIbeamCursor = [NSCursor IBeamCursor];
}
}
+7 -4
View File
@@ -60,7 +60,6 @@
- (NSTypesetterControlCharacterAction)
actionForControlCharacterAtIndex:(unsigned)charIndex
{
//NSLog(@"%s%d", _cmd, charIndex);
/*NSTextStorage *ts = [[self layoutManager] textStorage];
if ('\n' == [[ts string] characterAtIndex:charIndex])
@@ -75,9 +74,9 @@
withAdvancements:(const float *)advancements
forStartOfGlyphRange:(NSRange)glyphRange
{
NSLog(@"setLocation:%@ withAdvancements:%f forStartOfGlyphRange:%@",
NSStringFromPoint(location), advancements ? *advancements : 0,
NSStringFromRange(glyphRange));
ASLogDebug(@"setLocation:%@ withAdvancements:%f forStartOfGlyphRange:%@",
NSStringFromPoint(location), advancements ? *advancements : 0,
NSStringFromRange(glyphRange));
[super setLocation:location withAdvancements:advancements
forStartOfGlyphRange:glyphRange];
}
@@ -89,6 +88,8 @@
#if MM_USE_ROW_CACHE
@implementation MMTypesetter2
//
@@ -188,3 +189,5 @@
@end // MMTypesetter2
#endif // MM_USE_ROW_CACHE
+7 -6
View File
@@ -20,14 +20,11 @@
@interface MMVimController : NSObject <MMFrontendProtocol>
{
@interface MMVimController : NSObject {
unsigned identifier;
BOOL isInitialized;
MMWindowController *windowController;
id backendProxy;
BOOL inProcessCommandQueue;
NSMutableArray *sendQueue;
NSMutableArray *receiveQueue;
NSMenu *mainMenu;
NSMutableArray *popupMenuItems;
NSToolbar *toolbar;
@@ -43,12 +40,14 @@
}
- (id)initWithBackend:(id)backend pid:(int)processIdentifier;
- (unsigned)identifier;
- (id)backendProxy;
- (int)pid;
- (void)setServerName:(NSString *)name;
- (NSString *)serverName;
- (MMWindowController *)windowController;
- (NSDictionary *)vimState;
- (id)objectForVimStateKey:(NSString *)key;
- (NSMenu *)mainMenu;
- (BOOL)isPreloading;
- (void)setIsPreloading:(BOOL)yn;
@@ -64,7 +63,9 @@
timeout:(NSTimeInterval)timeout;
- (void)addVimInput:(NSString *)string;
- (NSString *)evaluateVimExpression:(NSString *)expr;
- (id)evaluateVimExpressionCocoa:(NSString *)expr errorString:(NSString **)errstr;
- (id)evaluateVimExpressionCocoa:(NSString *)expr
errorString:(NSString **)errstr;
- (void)processInputQueue:(NSArray *)queue;
#ifdef MM_ENABLE_PLUGINS
- (MMPlugInInstanceMediator *)instanceMediator;
#endif
+302 -316
View File
@@ -10,17 +10,20 @@
/*
* MMVimController
*
* Coordinates input/output to/from backend. Each MMBackend communicates
* directly with a MMVimController.
* Coordinates input/output to/from backend. A MMVimController sends input
* directly to a MMBackend, but communication from MMBackend to MMVimController
* goes via MMAppController so that it can coordinate all incoming distributed
* object messages.
*
* MMVimController does not deal with visual presentation. Essentially it
* should be able to run with no window present.
*
* Output from the backend is received in processCommandQueue:. Input is sent
* to the backend via sendMessage:data: or addVimInput:. The latter allows
* execution of arbitrary strings in the Vim process, much like the Vim script
* function remote_send() does. The messages that may be passed between
* frontend and backend are defined in an enum in MacVim.h.
* Output from the backend is received in processInputQueue: (this message is
* called from MMAppController so it is not a DO call). Input is sent to the
* backend via sendMessage:data: or addVimInput:. The latter allows execution
* of arbitrary strings in the Vim process, much like the Vim script function
* remote_send() does. The messages that may be passed between frontend and
* backend are defined in an enum in MacVim.h.
*/
#import "MMAppController.h"
@@ -49,9 +52,7 @@ static NSTimeInterval MMBackendProxyRequestTimeout = 0;
// Timeout used for setDialogReturn:.
static NSTimeInterval MMSetDialogReturnTimeout = 1.0;
// Maximum number of items in the receiveQueue. (It is hard to predict what
// consequences changing this number will have.)
static int MMReceiveQueueCap = 100;
static unsigned identifierCounter = 1;
static BOOL isUnsafeMessage(int msgid);
@@ -65,7 +66,7 @@ static BOOL isUnsafeMessage(int msgid);
@interface MMVimController (Private)
- (void)doProcessCommandQueue:(NSArray *)queue;
- (void)doProcessInputQueue:(NSArray *)queue;
- (void)handleMessage:(int)msgid data:(NSData *)data;
- (void)savePanelDidEnd:(NSSavePanel *)panel code:(int)code
context:(void *)context;
@@ -95,6 +96,8 @@ static BOOL isUnsafeMessage(int msgid);
- (void)popupMenuWithAttributes:(NSDictionary *)attrs;
- (void)connectionDidDie:(NSNotification *)notification;
- (void)scheduleClose;
- (void)handleBrowseForFile:(NSDictionary *)attr;
- (void)handleShowDialog:(NSDictionary *)attr;
@end
@@ -107,11 +110,12 @@ static BOOL isUnsafeMessage(int msgid);
if (!(self = [super init]))
return nil;
// TODO: Come up with a better way of creating an identifier.
identifier = identifierCounter++;
windowController =
[[MMWindowController alloc] initWithVimController:self];
backendProxy = [backend retain];
sendQueue = [NSMutableArray new];
receiveQueue = [NSMutableArray new];
popupMenuItems = [[NSMutableArray alloc] init];
toolbarItemDict = [[NSMutableDictionary alloc] init];
pid = processIdentifier;
@@ -158,7 +162,7 @@ static BOOL isUnsafeMessage(int msgid);
- (void)dealloc
{
LOG_DEALLOC
ASLogDebug(@"");
isInitialized = NO;
@@ -168,8 +172,6 @@ static BOOL isUnsafeMessage(int msgid);
[serverName release]; serverName = nil;
[backendProxy release]; backendProxy = nil;
[sendQueue release]; sendQueue = nil;
[receiveQueue release]; receiveQueue = nil;
[toolbarItemDict release]; toolbarItemDict = nil;
[toolbar release]; toolbar = nil;
@@ -183,6 +185,11 @@ static BOOL isUnsafeMessage(int msgid);
[super dealloc];
}
- (unsigned)identifier
{
return identifier;
}
- (MMWindowController *)windowController
{
return windowController;
@@ -200,6 +207,11 @@ static BOOL isUnsafeMessage(int msgid);
return vimState;
}
- (id)objectForVimStateKey:(NSString *)key
{
return [vimState objectForKey:key];
}
- (NSMenu *)mainMenu
{
return mainMenu;
@@ -240,6 +252,9 @@ static BOOL isUnsafeMessage(int msgid);
- (void)dropFiles:(NSArray *)filenames forceOpen:(BOOL)force
{
filenames = normalizeFilenames(filenames);
ASLogInfo(@"filenames=%@ force=%d", filenames, force);
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
// Default to opening in tabs if layout is invalid or set to "windows".
@@ -247,6 +262,10 @@ static BOOL isUnsafeMessage(int msgid);
if (layout < 0 || layout > MMLayoutTabs)
layout = MMLayoutTabs;
BOOL splitVert = [ud boolForKey:MMVerticalSplitKey];
if (splitVert && MMLayoutHorizontalSplit == layout)
layout = MMLayoutVerticalSplit;
NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:layout], @"layout",
filenames, @"filenames",
@@ -258,6 +277,9 @@ static BOOL isUnsafeMessage(int msgid);
- (void)file:(NSString *)filename draggedToTabAtIndex:(NSUInteger)tabIndex
{
filename = normalizeFilename(filename);
ASLogInfo(@"filename=%@ index=%d", filename, tabIndex);
NSString *fnEsc = [filename stringByEscapingSpecialFilenameCharacters];
NSString *input = [NSString stringWithFormat:@"<C-\\><C-N>:silent "
"tabnext %d |"
@@ -267,6 +289,9 @@ static BOOL isUnsafeMessage(int msgid);
- (void)filesDraggedToTabBar:(NSArray *)filenames
{
filenames = normalizeFilenames(filenames);
ASLogInfo(@"%@", filenames);
NSUInteger i, count = [filenames count];
NSMutableString *input = [NSMutableString stringWithString:@"<C-\\><C-N>"
":silent! tabnext 9999"];
@@ -281,6 +306,7 @@ static BOOL isUnsafeMessage(int msgid);
- (void)dropString:(NSString *)string
{
ASLogInfo(@"%@", string);
int len = [string lengthOfBytesUsingEncoding:NSUTF8StringEncoding] + 1;
if (len > 0) {
NSMutableData *data = [NSMutableData data];
@@ -296,6 +322,8 @@ static BOOL isUnsafeMessage(int msgid);
{
if (!args) return;
ASLogDebug(@"args=%@", args);
[self sendMessage:OpenWithArgumentsMsgID data:[args dictionaryAsData]];
// HACK! Fool findUnusedEditor into thinking that this controller is not
@@ -312,27 +340,16 @@ static BOOL isUnsafeMessage(int msgid);
- (void)sendMessage:(int)msgid data:(NSData *)data
{
//NSLog(@"sendMessage:%s (isInitialized=%d inProcessCommandQueue=%d)",
// MessageStrings[msgid], isInitialized, inProcessCommandQueue);
ASLogDebug(@"msg=%s (isInitialized=%d)",
MessageStrings[msgid], isInitialized);
if (!isInitialized) return;
if (inProcessCommandQueue) {
//NSLog(@"In process command queue; delaying message send.");
[sendQueue addObject:[NSNumber numberWithInt:msgid]];
if (data)
[sendQueue addObject:data];
else
[sendQueue addObject:[NSNull null]];
return;
}
@try {
[backendProxy processInput:msgid data:data];
}
@catch (NSException *e) {
//NSLog(@"%@ %s Exception caught during DO call: %@",
// [self className], _cmd, e);
ASLogWarn(@"Exception caught during DO call: %@", e);
}
}
@@ -344,7 +361,10 @@ static BOOL isUnsafeMessage(int msgid);
// ball forever. In almost all circumstances sendMessage:data: should be
// used instead.
if (!isInitialized || inProcessCommandQueue)
ASLogDebug(@"msg=%s (isInitialized=%d)",
MessageStrings[msgid], isInitialized);
if (!isInitialized)
return NO;
if (timeout < 0) timeout = 0;
@@ -370,6 +390,8 @@ static BOOL isUnsafeMessage(int msgid);
- (void)addVimInput:(NSString *)string
{
ASLogDebug(@"%@", string);
// This is a very general method of adding input to the Vim process. It is
// basically the same as calling remote_send() on the process (see
// ':h remote_send').
@@ -385,20 +407,26 @@ static BOOL isUnsafeMessage(int msgid);
@try {
eval = [backendProxy evaluateExpression:expr];
ASLogDebug(@"eval(%@)=%@", expr, eval);
}
@catch (NSException *ex) {
ASLogWarn(@"Exception caught: %@", ex);
}
@catch (NSException *ex) { /* do nothing */ }
return eval;
}
- (id)evaluateVimExpressionCocoa:(NSString *)expr errorString:(NSString **)errstr
- (id)evaluateVimExpressionCocoa:(NSString *)expr
errorString:(NSString **)errstr
{
id eval = nil;
@try {
eval = [backendProxy evaluateExpressionCocoa:expr
errorString:errstr];
ASLogDebug(@"eval(%@)=%@", expr, eval);
} @catch (NSException *ex) {
ASLogWarn(@"Exception caught: %@", ex);
*errstr = [ex reason];
}
@@ -414,6 +442,9 @@ static BOOL isUnsafeMessage(int msgid);
{
if (!isInitialized) return;
// Remove any delayed calls made on this object.
[NSObject cancelPreviousPerformRequestsWithTarget:self];
isInitialized = NO;
[toolbar setDelegate:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self];
@@ -422,204 +453,19 @@ static BOOL isUnsafeMessage(int msgid);
[windowController cleanup];
}
- (oneway void)showSavePanelWithAttributes:(in bycopy NSDictionary *)attr
- (void)processInputQueue:(NSArray *)queue
{
if (!isInitialized) return;
BOOL inDefaultMode = [[[NSRunLoop currentRunLoop] currentMode]
isEqual:NSDefaultRunLoopMode];
if (!inDefaultMode) {
// Delay call until run loop is in default mode.
[self performSelectorOnMainThread:
@selector(showSavePanelWithAttributes:)
withObject:attr
waitUntilDone:NO
modes:[NSArray arrayWithObject:
NSDefaultRunLoopMode]];
return;
// NOTE: This method must not raise any exceptions (see comment in the
// calling method).
@try {
[self doProcessInputQueue:queue];
[windowController processInputQueueDidFinish];
}
NSString *dir = [attr objectForKey:@"dir"];
BOOL saving = [[attr objectForKey:@"saving"] boolValue];
if (!dir) {
// 'dir == nil' means: set dir to the pwd of the Vim process, or let
// open dialog decide (depending on the below user default).
BOOL trackPwd = [[NSUserDefaults standardUserDefaults]
boolForKey:MMDialogsTrackPwdKey];
if (trackPwd)
dir = [vimState objectForKey:@"pwd"];
@catch (NSException *ex) {
ASLogWarn(@"Caught exception (pid=%d): %@", pid, ex);
}
if (saving) {
[[NSSavePanel savePanel] beginSheetForDirectory:dir file:nil
modalForWindow:[windowController window]
modalDelegate:self
didEndSelector:@selector(savePanelDidEnd:code:context:)
contextInfo:NULL];
} else {
NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setAllowsMultipleSelection:NO];
[panel setAccessoryView:openPanelAccessoryView()];
[panel beginSheetForDirectory:dir file:nil types:nil
modalForWindow:[windowController window]
modalDelegate:self
didEndSelector:@selector(savePanelDidEnd:code:context:)
contextInfo:NULL];
}
}
- (oneway void)presentDialogWithAttributes:(in bycopy NSDictionary *)attr
{
if (!isInitialized) return;
BOOL inDefaultMode = [[[NSRunLoop currentRunLoop] currentMode]
isEqual:NSDefaultRunLoopMode];
if (!inDefaultMode) {
// Delay call until run loop is in default mode.
[self performSelectorOnMainThread:
@selector(presentDialogWithAttributes:)
withObject:attr
waitUntilDone:NO
modes:[NSArray arrayWithObject:
NSDefaultRunLoopMode]];
return;
}
NSArray *buttonTitles = [attr objectForKey:@"buttonTitles"];
if (!(buttonTitles && [buttonTitles count])) return;
int style = [[attr objectForKey:@"alertStyle"] intValue];
NSString *message = [attr objectForKey:@"messageText"];
NSString *text = [attr objectForKey:@"informativeText"];
NSString *textFieldString = [attr objectForKey:@"textFieldString"];
MMAlert *alert = [[MMAlert alloc] init];
// NOTE! This has to be done before setting the informative text.
if (textFieldString)
[alert setTextFieldString:textFieldString];
[alert setAlertStyle:style];
if (message) {
[alert setMessageText:message];
} else {
// If no message text is specified 'Alert' is used, which we don't
// want, so set an empty string as message text.
[alert setMessageText:@""];
}
if (text) {
[alert setInformativeText:text];
} else if (textFieldString) {
// Make sure there is always room for the input text field.
[alert setInformativeText:@""];
}
unsigned i, count = [buttonTitles count];
for (i = 0; i < count; ++i) {
NSString *title = [buttonTitles objectAtIndex:i];
// NOTE: The title of the button may contain the character '&' to
// indicate that the following letter should be the key equivalent
// associated with the button. Extract this letter and lowercase it.
NSString *keyEquivalent = nil;
NSRange hotkeyRange = [title rangeOfString:@"&"];
if (NSNotFound != hotkeyRange.location) {
if ([title length] > NSMaxRange(hotkeyRange)) {
NSRange keyEquivRange = NSMakeRange(hotkeyRange.location+1, 1);
keyEquivalent = [[title substringWithRange:keyEquivRange]
lowercaseString];
}
NSMutableString *string = [NSMutableString stringWithString:title];
[string deleteCharactersInRange:hotkeyRange];
title = string;
}
[alert addButtonWithTitle:title];
// Set key equivalent for the button, but only if NSAlert hasn't
// already done so. (Check the documentation for
// - [NSAlert addButtonWithTitle:] to see what key equivalents are
// automatically assigned.)
NSButton *btn = [[alert buttons] lastObject];
if ([[btn keyEquivalent] length] == 0 && keyEquivalent) {
[btn setKeyEquivalent:keyEquivalent];
}
}
[alert beginSheetModalForWindow:[windowController window]
modalDelegate:self
didEndSelector:@selector(alertDidEnd:code:context:)
contextInfo:NULL];
[alert release];
}
- (oneway void)processCommandQueue:(in bycopy NSArray *)queue
{
if (!isInitialized) return;
if (inProcessCommandQueue) {
// NOTE! If a synchronous DO call is made during
// doProcessCommandQueue: below it may happen that this method is
// called a second time while the synchronous message is waiting for a
// reply (could also happen if doProcessCommandQueue: enters a modal
// loop, see comment below). Since this method cannot be considered
// reentrant, we queue the input and return immediately.
//
// If doProcessCommandQueue: enters a modal loop (happens e.g. on
// ShowPopupMenuMsgID) then the receiveQueue could grow to become
// arbitrarily large because DO calls still get processed. To avoid
// this we set a cap on the size of the queue and simply clear it if it
// becomes too large. (That is messages will be dropped and hence Vim
// and MacVim will at least temporarily be out of sync.)
if ([receiveQueue count] >= MMReceiveQueueCap)
[receiveQueue removeAllObjects];
[receiveQueue addObject:queue];
return;
}
inProcessCommandQueue = YES;
[self doProcessCommandQueue:queue];
int i;
for (i = 0; i < [receiveQueue count]; ++i) {
// Note that doProcessCommandQueue: may cause the receiveQueue to grow
// or get cleared (due to cap being hit). Make sure to retain the item
// to process or it may get released from under us.
NSArray *q = [[receiveQueue objectAtIndex:i] retain];
[self doProcessCommandQueue:q];
[q release];
}
// We assume that the remaining calls make no synchronous DO calls. If
// that did happen anyway, the command queue could get processed out of
// order.
// See comment below why this is called here and not later.
[windowController processCommandQueueDidFinish];
// NOTE: Ensure that no calls are made after this "if" clause that may call
// sendMessage::. If this happens anyway, such messages will be put on the
// send queue and then the queue will not be flushed until the next time
// this method is called.
if ([sendQueue count] > 0) {
@try {
[backendProxy processInputAndData:sendQueue];
}
@catch (NSException *e) {
// Connection timed out, just ignore this.
//NSLog(@"WARNING! Connection timed out in %s", _cmd);
}
[sendQueue removeAllObjects];
}
[receiveQueue removeAllObjects];
inProcessCommandQueue = NO;
}
- (NSToolbarItem *)toolbar:(NSToolbar *)theToolbar
@@ -628,7 +474,7 @@ static BOOL isUnsafeMessage(int msgid);
{
NSToolbarItem *item = [toolbarItemDict objectForKey:itemId];
if (!item) {
NSLog(@"WARNING: No toolbar item with id '%@'", itemId);
ASLogWarn(@"No toolbar item with id '%@'", itemId);
}
return item;
@@ -650,76 +496,63 @@ static BOOL isUnsafeMessage(int msgid);
@implementation MMVimController (Private)
- (void)doProcessCommandQueue:(NSArray *)queue
- (void)doProcessInputQueue:(NSArray *)queue
{
NSMutableArray *delayQueue = nil;
@try {
unsigned i, count = [queue count];
if (count % 2) {
NSLog(@"WARNING: Uneven number of components (%d) in command "
"queue. Skipping...", count);
return;
}
//NSLog(@"======== %s BEGIN ========", _cmd);
for (i = 0; i < count; i += 2) {
NSData *value = [queue objectAtIndex:i];
NSData *data = [queue objectAtIndex:i+1];
int msgid = *((int*)[value bytes]);
//NSLog(@"%s%s", _cmd, MessageStrings[msgid]);
BOOL inDefaultMode = [[[NSRunLoop currentRunLoop] currentMode]
isEqual:NSDefaultRunLoopMode];
if (!inDefaultMode && isUnsafeMessage(msgid)) {
// NOTE: Because we may be listening to DO messages in "event
// tracking mode" we have to take extra care when doing things
// like releasing view items (and other Cocoa objects).
// Messages that may be potentially "unsafe" are delayed until
// the run loop is back to default mode at which time they are
// safe to call again.
// A problem with this approach is that it is hard to
// classify which messages are unsafe. As a rule of thumb, if
// a message may release an object used by the Cocoa framework
// (e.g. views) then the message should be considered unsafe.
// Delaying messages may have undesired side-effects since it
// means that messages may not be processed in the order Vim
// sent them, so beware.
if (!delayQueue)
delayQueue = [NSMutableArray array];
//NSLog(@"Adding unsafe message '%s' to delay queue (mode=%@)",
// MessageStrings[msgid],
// [[NSRunLoop currentRunLoop] currentMode]);
[delayQueue addObject:value];
[delayQueue addObject:data];
} else {
[self handleMessage:msgid data:data];
}
}
//NSLog(@"======== %s END ========", _cmd);
unsigned i, count = [queue count];
if (count % 2) {
ASLogWarn(@"Uneven number of components (%d) in command queue. "
"Skipping...", count);
return;
}
@catch (NSException *e) {
NSLog(@"Exception caught whilst processing command queue: %@", e);
for (i = 0; i < count; i += 2) {
NSData *value = [queue objectAtIndex:i];
NSData *data = [queue objectAtIndex:i+1];
int msgid = *((int*)[value bytes]);
BOOL inDefaultMode = [[[NSRunLoop currentRunLoop] currentMode]
isEqual:NSDefaultRunLoopMode];
if (!inDefaultMode && isUnsafeMessage(msgid)) {
// NOTE: Because we may be listening to DO messages in "event
// tracking mode" we have to take extra care when doing things
// like releasing view items (and other Cocoa objects).
// Messages that may be potentially "unsafe" are delayed until
// the run loop is back to default mode at which time they are
// safe to call again.
// A problem with this approach is that it is hard to
// classify which messages are unsafe. As a rule of thumb, if
// a message may release an object used by the Cocoa framework
// (e.g. views) then the message should be considered unsafe.
// Delaying messages may have undesired side-effects since it
// means that messages may not be processed in the order Vim
// sent them, so beware.
if (!delayQueue)
delayQueue = [NSMutableArray array];
ASLogDebug(@"Adding unsafe message '%s' to delay queue (mode=%@)",
MessageStrings[msgid],
[[NSRunLoop currentRunLoop] currentMode]);
[delayQueue addObject:value];
[delayQueue addObject:data];
} else {
[self handleMessage:msgid data:data];
}
}
if (delayQueue) {
//NSLog(@" Flushing delay queue (%d items)", [delayQueue count]/2);
[self performSelectorOnMainThread:@selector(processCommandQueue:)
withObject:delayQueue
waitUntilDone:NO
modes:[NSArray arrayWithObject:
NSDefaultRunLoopMode]];
ASLogDebug(@" Flushing delay queue (%d items)",
[delayQueue count]/2);
[self performSelector:@selector(processInputQueue:)
withObject:delayQueue
afterDelay:0];
}
}
- (void)handleMessage:(int)msgid data:(NSData *)data
{
//if (msgid != AddMenuMsgID && msgid != AddMenuItemMsgID &&
// msgid != EnableMenuItemMsgID)
// NSLog(@"%@ %s%s", [self className], _cmd, MessageStrings[msgid]);
if (OpenWindowMsgID == msgid) {
[windowController openWindow];
@@ -733,7 +566,6 @@ static BOOL isUnsafeMessage(int msgid);
#if 0 // NOTE: Tab selection is done inside updateTabsWithData:.
const void *bytes = [data bytes];
int idx = *((int*)bytes);
//NSLog(@"Selecting tab with index %d", idx);
[windowController selectTabWithIndex:idx];
#endif
} else if (UpdateTabBarMsgID == msgid) {
@@ -859,10 +691,14 @@ static BOOL isUnsafeMessage(int msgid);
initWithBytes:(void*)bytes length:len
encoding:NSUTF8StringEncoding];
NSFont *font = [NSFont fontWithName:name size:size];
if (!font) {
// This should only happen if the default font was not loaded in
// which case we fall back on using the Cocoa default fixed width
// font.
font = [NSFont userFixedPitchFontOfSize:size];
}
if (font)
[windowController setFont:font];
[windowController setFont:font];
[name release];
} else if (SetWideFontMsgID == msgid) {
const void *bytes = [data bytes];
@@ -902,12 +738,10 @@ static BOOL isUnsafeMessage(int msgid);
NSDictionary *attrs = [NSDictionary dictionaryWithData:data];
// The popup menu enters a modal loop so delay this call so that we
// don't block inside processCommandQueue:.
[self performSelectorOnMainThread:@selector(popupMenuWithAttributes:)
withObject:attrs
waitUntilDone:NO
modes:[NSArray arrayWithObject:
NSDefaultRunLoopMode]];
// don't block inside processInputQueue:.
[self performSelector:@selector(popupMenuWithAttributes:)
withObject:attrs
afterDelay:0];
} else if (SetMouseShapeMsgID == msgid) {
const void *bytes = [data bytes];
int shape = *((int*)bytes); bytes += sizeof(int);
@@ -919,7 +753,6 @@ static BOOL isUnsafeMessage(int msgid);
[windowController adjustLinespace:linespace];
} else if (ActivateMsgID == msgid) {
//NSLog(@"ActivateMsgID");
[NSApp activateIgnoringOtherApps:YES];
[[windowController window] makeKeyAndOrderFront:self];
} else if (SetServerNameMsgID == msgid) {
@@ -968,10 +801,28 @@ static BOOL isUnsafeMessage(int msgid);
showWithText:[dict objectForKey:@"text"]
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);
} else if (DeactivateKeyScriptMsgID == msgid) {
KeyScript(smKeyRoman);
} else if (EnableImControlMsgID == msgid) {
[[[windowController vimView] textView] setImControl:YES];
} else if (DisableImControlMsgID == msgid) {
[[[windowController vimView] textView] setImControl:NO];
} else if (BrowseForFileMsgID == msgid) {
NSDictionary *dict = [NSDictionary dictionaryWithData:data];
if (dict)
[self handleBrowseForFile:dict];
} else if (ShowDialogMsgID == msgid) {
NSDictionary *dict = [NSDictionary dictionaryWithData:data];
if (dict)
[self handleShowDialog:dict];
// IMPORTANT: When adding a new message, make sure to update
// isUnsafeMessage() if necessary!
} else {
NSLog(@"WARNING: Unknown message received (msgid=%d)", msgid);
ASLogWarn(@"Unknown message received (msgid=%d)", msgid);
}
}
@@ -980,6 +831,8 @@ static BOOL isUnsafeMessage(int msgid);
{
NSString *path = (code == NSOKButton) ? [panel filename] : nil;
ASLogDebug(@"Open/save panel path=%@", path);
// 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
@@ -998,7 +851,7 @@ static BOOL isUnsafeMessage(int msgid);
noteNewRecentFilePath:path];
}
@catch (NSException *e) {
NSLog(@"Exception caught in %s %@", _cmd, e);
ASLogWarn(@"Exception caught: %@", e);
}
@finally {
[conn setRequestTimeout:oldTimeout];
@@ -1018,11 +871,13 @@ static BOOL isUnsafeMessage(int msgid);
ret = [NSArray arrayWithObject:[NSNumber numberWithInt:code]];
}
ASLogDebug(@"Alert return=%@", ret);
@try {
[backendProxy setDialogReturn:ret];
}
@catch (NSException *e) {
NSLog(@"Exception caught in %s %@", _cmd, e);
ASLogWarn(@"Exception caught: %@", e);
}
}
@@ -1182,8 +1037,8 @@ static BOOL isUnsafeMessage(int msgid);
NSMenu *parent = [self parentMenuForDescriptor:desc];
if (!parent) {
NSLog(@"WARNING: Menu item '%@' has no parent",
[desc componentsJoinedByString:@"->"]);
ASLogWarn(@"Menu item '%@' has no parent",
[desc componentsJoinedByString:@"->"]);
return;
}
@@ -1245,8 +1100,8 @@ static BOOL isUnsafeMessage(int msgid);
NSMenuItem *item = [self menuItemForDescriptor:desc];
if (!item) {
NSLog(@"Failed to remove menu item, descriptor not found: %@",
[desc componentsJoinedByString:@"->"]);
ASLogWarn(@"Failed to remove menu item, descriptor not found: %@",
[desc componentsJoinedByString:@"->"]);
return;
}
@@ -1269,9 +1124,6 @@ static BOOL isUnsafeMessage(int msgid);
{
if (!(desc && [desc count] > 0)) return;
/*NSLog(@"%sable item %@", on ? "En" : "Dis",
[desc componentsJoinedByString:@"->"]);*/
NSString *rootName = [desc objectAtIndex:0];
if ([rootName isEqual:@"ToolBar"]) {
if (toolbar && [desc count] == 2) {
@@ -1311,10 +1163,10 @@ static BOOL isUnsafeMessage(int msgid);
img = nil;
}
if (!img) {
NSLog(@"WARNING: Could not find image with name '%@' to use as toolbar"
" image for identifier '%@';"
" using default toolbar icon '%@' instead.",
icon, title, MMDefaultToolbarImageName);
ASLogNotice(@"Could not find image with name '%@' to use as toolbar"
" image for identifier '%@';"
" using default toolbar icon '%@' instead.",
icon, title, MMDefaultToolbarImageName);
img = [NSImage imageNamed:MMDefaultToolbarImageName];
}
@@ -1401,7 +1253,7 @@ static BOOL isUnsafeMessage(int msgid);
- (void)connectionDidDie:(NSNotification *)notification
{
//NSLog(@"%@ %s%@", [self className], _cmd, notification);
ASLogDebug(@"%@", notification);
[self scheduleClose];
}
@@ -1415,21 +1267,153 @@ static BOOL isUnsafeMessage(int msgid);
// following call ensures that the vim controller is not released until the
// run loop is back in the 'default' mode.
[[MMAppController sharedInstance]
performSelectorOnMainThread:@selector(removeVimController:)
withObject:self
waitUntilDone:NO
modes:[NSArray arrayWithObject:
NSDefaultRunLoopMode]];
performSelector:@selector(removeVimController:)
withObject:self
afterDelay:0];
}
// NSSavePanel delegate
- (void)panel:(id)sender willExpand:(BOOL)expanding
{
// Show or hide the "show hidden files" button
if (expanding) {
[sender setAccessoryView:showHiddenFilesView()];
} else {
[sender setShowsHiddenFiles:NO];
[sender setAccessoryView:nil];
}
}
- (void)handleBrowseForFile:(NSDictionary *)attr
{
if (!isInitialized) return;
NSString *dir = [attr objectForKey:@"dir"];
BOOL saving = [[attr objectForKey:@"saving"] boolValue];
if (!dir) {
// 'dir == nil' means: set dir to the pwd of the Vim process, or let
// open dialog decide (depending on the below user default).
BOOL trackPwd = [[NSUserDefaults standardUserDefaults]
boolForKey:MMDialogsTrackPwdKey];
if (trackPwd)
dir = [vimState objectForKey:@"pwd"];
}
if (saving) {
NSSavePanel *panel = [NSSavePanel savePanel];
// The delegate will be notified when the panel is expanded at which
// time we may hide/show the "show hidden files" button (this button is
// always visible for the open panel since it is always expanded).
[panel setDelegate:self];
if ([panel isExpanded])
[panel setAccessoryView:showHiddenFilesView()];
[panel beginSheetForDirectory:dir file:nil
modalForWindow:[windowController window]
modalDelegate:self
didEndSelector:@selector(savePanelDidEnd:code:context:)
contextInfo:NULL];
} else {
NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setAllowsMultipleSelection:NO];
[panel setAccessoryView:showHiddenFilesView()];
[panel beginSheetForDirectory:dir file:nil types:nil
modalForWindow:[windowController window]
modalDelegate:self
didEndSelector:@selector(savePanelDidEnd:code:context:)
contextInfo:NULL];
}
}
- (void)handleShowDialog:(NSDictionary *)attr
{
if (!isInitialized) return;
NSArray *buttonTitles = [attr objectForKey:@"buttonTitles"];
if (!(buttonTitles && [buttonTitles count])) return;
int style = [[attr objectForKey:@"alertStyle"] intValue];
NSString *message = [attr objectForKey:@"messageText"];
NSString *text = [attr objectForKey:@"informativeText"];
NSString *textFieldString = [attr objectForKey:@"textFieldString"];
MMAlert *alert = [[MMAlert alloc] init];
// NOTE! This has to be done before setting the informative text.
if (textFieldString)
[alert setTextFieldString:textFieldString];
[alert setAlertStyle:style];
if (message) {
[alert setMessageText:message];
} else {
// If no message text is specified 'Alert' is used, which we don't
// want, so set an empty string as message text.
[alert setMessageText:@""];
}
if (text) {
[alert setInformativeText:text];
} else if (textFieldString) {
// Make sure there is always room for the input text field.
[alert setInformativeText:@""];
}
unsigned i, count = [buttonTitles count];
for (i = 0; i < count; ++i) {
NSString *title = [buttonTitles objectAtIndex:i];
// NOTE: The title of the button may contain the character '&' to
// indicate that the following letter should be the key equivalent
// associated with the button. Extract this letter and lowercase it.
NSString *keyEquivalent = nil;
NSRange hotkeyRange = [title rangeOfString:@"&"];
if (NSNotFound != hotkeyRange.location) {
if ([title length] > NSMaxRange(hotkeyRange)) {
NSRange keyEquivRange = NSMakeRange(hotkeyRange.location+1, 1);
keyEquivalent = [[title substringWithRange:keyEquivRange]
lowercaseString];
}
NSMutableString *string = [NSMutableString stringWithString:title];
[string deleteCharactersInRange:hotkeyRange];
title = string;
}
[alert addButtonWithTitle:title];
// Set key equivalent for the button, but only if NSAlert hasn't
// already done so. (Check the documentation for
// - [NSAlert addButtonWithTitle:] to see what key equivalents are
// automatically assigned.)
NSButton *btn = [[alert buttons] lastObject];
if ([[btn keyEquivalent] length] == 0 && keyEquivalent) {
[btn setKeyEquivalent:keyEquivalent];
}
}
[alert beginSheetModalForWindow:[windowController window]
modalDelegate:self
didEndSelector:@selector(alertDidEnd:code:context:)
contextInfo:NULL];
[alert release];
}
@end // MMVimController (Private)
@implementation MMAlert
- (void)dealloc
{
ASLogDebug(@"");
[textField release]; textField = nil;
[super dealloc];
}
@@ -1512,6 +1496,8 @@ isUnsafeMessage(int msgid)
EnterFullscreenMsgID, // Modifies delegate of window controller
LeaveFullscreenMsgID, // Modifies delegate of window controller
CloseWindowMsgID, // See note below
BrowseForFileMsgID, // Enters modal loop
ShowDialogMsgID, // Enters modal loop
};
// NOTE about CloseWindowMsgID: If this arrives at the same time as say
+39 -37
View File
@@ -88,7 +88,8 @@ enum {
// frameSizeMayHaveChanged.
[self setAutoresizesSubviews:YES];
if ([[NSUserDefaults standardUserDefaults] boolForKey:MMAtsuiRendererKey]) {
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
if ([ud boolForKey:MMAtsuiRendererKey]) {
// Use ATSUI for text rendering.
//
// HACK! 'textView' has type MMTextView, but MMAtsuiTextView is not
@@ -100,7 +101,6 @@ enum {
}
// Allow control of text view inset via MMTextInset* user defaults.
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
int left = [ud integerForKey:MMTextInsetLeftKey];
int top = [ud integerForKey:MMTextInsetTopKey];
[textView setTextContainerInset:NSMakeSize(left, top)];
@@ -129,7 +129,7 @@ enum {
[tabBarControl setCellOptimumWidth:
[ud integerForKey:MMTabOptimumWidthKey]];
[tabBarControl setShowAddTabButton:YES];
[tabBarControl setShowAddTabButton:[ud boolForKey:MMShowAddTabButtonKey]];
[[tabBarControl addTabButton] setTarget:self];
[[tabBarControl addTabButton] setAction:@selector(addNewTab:)];
[tabBarControl setAllowsDragBetweenWindows:NO];
@@ -152,7 +152,7 @@ enum {
- (void)dealloc
{
LOG_DEALLOC
ASLogDebug(@"");
[tabBarControl release]; tabBarControl = nil;
[tabView release]; tabView = nil;
@@ -281,24 +281,41 @@ enum {
NSArray *tabViewItems = [[self tabBarControl] representedTabViewItems];
while (p < end) {
NSTabViewItem *tvi = nil;
//int wincount = *((int*)p); p += sizeof(int);
int length = *((int*)p); p += sizeof(int);
int infoCount = *((int*)p); p += sizeof(int);
unsigned i;
for (i = 0; i < infoCount; ++i) {
int length = *((int*)p); p += sizeof(int);
if (length <= 0)
continue;
NSString *label = [[NSString alloc]
initWithBytes:(void*)p length:length
encoding:NSUTF8StringEncoding];
p += length;
NSString *val = [[NSString alloc]
initWithBytes:(void*)p length:length
encoding:NSUTF8StringEncoding];
p += length;
// Set the label of the tab; add a new tab when needed.
NSTabViewItem *tvi = [[self tabView] numberOfTabViewItems] <= tabIdx
? [self addNewTabViewItem]
: [tabViewItems objectAtIndex:tabIdx];
switch (i) {
case MMTabLabel:
// Set the label of the tab, adding a new tab when needed.
tvi = [[self tabView] numberOfTabViewItems] <= tabIdx
? [self addNewTabViewItem]
: [tabViewItems objectAtIndex:tabIdx];
[tvi setLabel:val];
++tabIdx;
break;
case MMTabToolTip:
if (tvi)
[[self tabBarControl] setToolTip:val
forTabViewItem:tvi];
break;
default:
ASLogWarn(@"Unknown tab info for index: %d", i);
}
[tvi setLabel:label];
[label release];
++tabIdx;
[val release];
}
}
// Remove unused tabs from the NSTabView. Note that when a tab is closed
@@ -309,7 +326,6 @@ enum {
int i, count = [[self tabView] numberOfTabViewItems];
for (i = count-1; i >= tabIdx; --i) {
id tvi = [tabViewItems objectAtIndex:i];
//NSLog(@"Removing tab with index %d", i);
[[self tabView] removeTabViewItem:tvi];
}
vimTaskSelectedTab = NO;
@@ -319,11 +335,9 @@ enum {
- (void)selectTabWithIndex:(int)idx
{
//NSLog(@"%s%d", _cmd, idx);
NSArray *tabViewItems = [[self tabBarControl] representedTabViewItems];
if (idx < 0 || idx >= [tabViewItems count]) {
NSLog(@"WARNING: No tab with index %d exists.", idx);
ASLogWarn(@"No tab with index %d exists.", idx);
return;
}
@@ -359,8 +373,6 @@ enum {
- (void)createScrollbarWithIdentifier:(long)ident type:(int)type
{
//NSLog(@"Create scroller %d of type %d", ident, type);
MMScroller *scroller = [[MMScroller alloc] initWithIdentifier:ident
type:type];
[scroller setTarget:self];
@@ -373,8 +385,6 @@ enum {
- (BOOL)destroyScrollbarWithIdentifier:(long)ident
{
//NSLog(@"Destroy scroller %d", ident);
unsigned idx = 0;
MMScroller *scroller = [self scrollbarForIdentifier:ident index:&idx];
if (!scroller) return NO;
@@ -393,8 +403,6 @@ enum {
if (!scroller) return NO;
BOOL wasVisible = ![scroller isHidden];
//NSLog(@"%s scroller %d (was %svisible)", visible ? "Show" : "Hide",
// ident, wasVisible ? "" : "in");
[scroller setHidden:!visible];
// If a scroller was hidden or shown then the vim view must resize. This
@@ -406,8 +414,6 @@ enum {
identifier:(long)ident
{
MMScroller *scroller = [self scrollbarForIdentifier:ident index:NULL];
//NSLog(@"Set thumb value %.2f proportion %.2f for scroller %d",
// val, prop, ident);
[scroller setFloatValue:val knobProportion:prop];
[scroller setEnabled:prop != 1.f];
}
@@ -432,8 +438,6 @@ enum {
MMScroller *scroller = [self scrollbarForIdentifier:ident index:NULL];
NSRange range = NSMakeRange(pos, len);
if (!NSEqualRanges(range, [scroller range])) {
//NSLog(@"Set range %@ for scroller %d",
// NSStringFromRange(range), ident);
[scroller setRange:range];
// TODO! Should only do this once per update.
@@ -485,7 +489,6 @@ enum {
// on the tab. Instead of letting the tab bar close the tab, we return NO
// and pass a message on to Vim to let it handle the closing.
int idx = [self representedIndexOfTabViewItem:tabViewItem];
//NSLog(@"Closing tab with index %d", idx);
NSData *data = [NSData dataWithBytes:&idx length:sizeof(int)];
[vimController sendMessage:CloseTabMsgID data:data];
@@ -726,7 +729,6 @@ enum {
rect.size.height = 0;
}
//NSLog(@"set scroller #%d frame = %@", i, NSStringFromRect(rect));
NSRect oldRect = [scroller frame];
if (!NSEqualRects(oldRect, rect)) {
[scroller setFrame:rect];
@@ -839,9 +841,9 @@ enum {
int msgid = [self inLiveResize] ? LiveResizeMsgID
: SetTextDimensionsMsgID;
//NSLog(@"Notify Vim that text dimensions changed from %dx%d to %dx%d"
// " (%s)", cols, rows, constrained[1], constrained[0],
// MessageStrings[msgid]);
ASLogDebug(@"Notify Vim that text dimensions changed from %dx%d to "
"%dx%d (%s)", cols, rows, constrained[1], constrained[0],
MessageStrings[msgid]);
[vimController sendMessage:msgid data:data];
+12 -2
View File
@@ -63,7 +63,7 @@
- (void)dealloc
{
LOG_DEALLOC
ASLogDebug(@"");
// TODO: Is there any reason why we would want the following call?
//[tablineSeparator removeFromSuperviewWithoutNeedingDisplay];
@@ -142,8 +142,18 @@
- (IBAction)zoom:(id)sender
{
NSScreen *screen = [self screen];
if (!screen) {
ASLogNotice(@"Window not on screen, zoom to main screen");
screen = [NSScreen mainScreen];
if (!screen) {
ASLogNotice(@"No main screen, abort zoom");
return;
}
}
NSRect frame = [self frame];
NSRect defaultFrame = [[self screen] visibleFrame];
NSRect defaultFrame = [screen visibleFrame];
defaultFrame = [[self delegate] windowWillUseStandardFrame:self
defaultFrame:defaultFrame];
+2 -1
View File
@@ -22,6 +22,7 @@
MMVimView *vimView;
BOOL setupDone;
BOOL shouldResizeVimView;
int updateToolbarFlag;
BOOL keepOnScreen;
BOOL fullscreenEnabled;
NSString *windowAutosaveKey;
@@ -54,7 +55,7 @@
- (void)setDefaultColorsBackground:(NSColor *)back foreground:(NSColor *)fore;
- (void)setFont:(NSFont *)font;
- (void)setWideFont:(NSFont *)font;
- (void)processCommandQueueDidFinish;
- (void)processInputQueueDidFinish;
- (void)showTabBar:(BOOL)on;
- (void)showToolbar:(BOOL)on size:(int)size mode:(int)mode;
- (void)setMouseShape:(int)shape;
+98 -44
View File
@@ -81,6 +81,7 @@
- (BOOL)askBackendForStarRegister:(NSPasteboard *)pb;
- (void)hideTablineSeparator:(BOOL)hide;
- (void)doFindNext:(BOOL)next;
- (void)updateToolbar;
@end
@@ -200,7 +201,7 @@
- (void)dealloc
{
LOG_DEALLOC
ASLogDebug(@"");
[decoratedWindow release]; decoratedWindow = nil;
[windowAutosaveKey release]; windowAutosaveKey = nil;
@@ -240,7 +241,7 @@
- (void)cleanup
{
//NSLog(@"%@ %s", [self className], _cmd);
ASLogDebug(@"%@ %s", [self className], _cmd);
if (fullscreenEnabled) {
// If we are closed while still in fullscreen, end fullscreen mode,
@@ -301,13 +302,13 @@
- (void)setTextDimensionsWithRows:(int)rows columns:(int)cols isLive:(BOOL)live
isReply:(BOOL)reply
{
//NSLog(@"setTextDimensionsWithRows:%d columns:%d isLive:%d isReply:%d",
// rows, cols, live, reply);
ASLogDebug(@"setTextDimensionsWithRows:%d columns:%d isLive:%d isReply:%d",
rows, cols, live, reply);
// NOTE: The only place where the (rows,columns) of the vim view are
// modified is here and when entering/leaving full-screen. Setting these
// values have no immediate effect, the actual resizing of the view is done
// in processCommandQueueDidFinish.
// in processInputQueueDidFinish.
//
// The 'live' flag indicates that this resize originated from a live
// resize; it may very well happen that the view is no longer in live
@@ -418,16 +419,16 @@
[[vimView textView] setWideFont:font];
}
- (void)processCommandQueueDidFinish
- (void)processInputQueueDidFinish
{
// IMPORTANT! No synchronous DO calls are allowed in this method. They
// may cause the command queue to get processed out of order.
// NOTE: Resizing is delayed until after all commands have been processed
// since it often happens that more than one command will cause a resize.
// If we were to immediately resize then the vim view size would jitter
// (e.g. hiding/showing scrollbars often happens several time in one
// update).
// Also delay toggling the toolbar until after scrollbars otherwise
// problems arise when showing toolbar and scrollbar at the same time, i.e.
// on "set go+=rT".
if (shouldResizeVimView) {
shouldResizeVimView = NO;
@@ -448,6 +449,9 @@
keepOnScreen = NO;
}
if (updateToolbarFlag != 0)
[self updateToolbar];
}
- (void)showTabBar:(BOOL)on
@@ -481,21 +485,17 @@
[toolbar setSizeMode:size];
[toolbar setDisplayMode:mode];
[toolbar setVisible:on];
if (([decoratedWindow styleMask] & NSTexturedBackgroundWindowMask) == 0) {
if (!on) {
[self hideTablineSeparator:YES];
} else {
[self hideTablineSeparator:![[vimView tabBarControl] isHidden]];
}
} else {
// Textured windows don't have a line below there title bar, so we
// need the separator in this case as well. In fact, the only case
// where we don't need the separator is when the tab bar control
// is visible (because it brings its own separator).
[self hideTablineSeparator:![[vimView tabBarControl] isHidden]];
}
// Positive flag shows toolbar, negative hides it.
updateToolbarFlag = on ? 1 : -1;
// NOTE: If the window is not visible we must toggle the toolbar
// immediately, otherwise "set go-=T" in .gvimrc will lead to the toolbar
// showing its hide animation every time a new window is opened. (See
// processInputQueueDidFinish for the reason why we need to delay toggling
// the toolbar when the window is visible.)
if (![decoratedWindow isVisible])
[self updateToolbar];
}
- (void)setMouseShape:(int)shape
@@ -551,8 +551,8 @@
[[vimView textView] constrainRows:&constrained[0] columns:&constrained[1]
toSize:textViewSize];
//NSLog(@"End of live resize, notify Vim that text dimensions are %dx%d",
// constrained[1], constrained[0]);
ASLogDebug(@"End of live resize, notify Vim that text dimensions are %dx%d",
constrained[1], constrained[0]);
NSData *data = [NSData dataWithBytes:constrained length:2*sizeof(int)];
BOOL sendOk = [vimController sendMessageNow:SetTextDimensionsMsgID
@@ -757,7 +757,19 @@
- (void)windowDidMove:(NSNotification *)notification
{
if (setupDone && windowAutosaveKey) {
if (!setupDone)
return;
if (fullscreenEnabled) {
// HACK! The full-screen is not supposed to be able to be moved. If we
// do get here while in full-screen something unexpected happened (e.g.
// the full-screen window was on an external display that got
// unplugged) and we handle this situation by leaving full-screen.
[self leaveFullscreen];
return;
}
if (windowAutosaveKey) {
NSRect frame = [decoratedWindow frame];
NSPoint topLeft = { frame.origin.x, NSMaxY(frame) };
NSString *topLeftString = NSStringFromPoint(topLeft);
@@ -774,7 +786,11 @@
// size in updateResizeConstraints since the screen's visible frame may
// change at any time (dock could move, resolution could change, window
// could be moved to another screen, ...).
if (![win screen])
return proposedFrameSize;
// NOTE: Not called in full-screen mode so use "visibleFrame" instead of
// "frame".
NSRect maxFrame = [self constrainFrame:[[win screen] visibleFrame]];
if (proposedFrameSize.width > maxFrame.size.width)
@@ -891,24 +907,28 @@
NSRect newFrame = [decoratedWindow frameRectForContentRect:contentRect];
// Ensure that the window fits inside the visible part of the screen.
NSRect maxFrame = [[decoratedWindow screen] visibleFrame];
maxFrame = [self constrainFrame:maxFrame];
if ([decoratedWindow screen]) {
// Ensure that the window fits inside the visible part of the screen.
// NOTE: Not called in full-screen mode so use "visibleFrame' instead
// of "frame".
NSRect maxFrame = [[decoratedWindow screen] visibleFrame];
maxFrame = [self constrainFrame:maxFrame];
if (newFrame.size.width > maxFrame.size.width) {
newFrame.size.width = maxFrame.size.width;
newFrame.origin.x = maxFrame.origin.x;
}
if (newFrame.size.height > maxFrame.size.height) {
newFrame.size.height = maxFrame.size.height;
newFrame.origin.y = maxFrame.origin.y;
}
if (onScreen) {
if (newFrame.origin.y < maxFrame.origin.y)
if (newFrame.size.width > maxFrame.size.width) {
newFrame.size.width = maxFrame.size.width;
newFrame.origin.x = maxFrame.origin.x;
}
if (newFrame.size.height > maxFrame.size.height) {
newFrame.size.height = maxFrame.size.height;
newFrame.origin.y = maxFrame.origin.y;
if (NSMaxX(newFrame) > NSMaxX(maxFrame))
newFrame.origin.x = NSMaxX(maxFrame) - newFrame.size.width;
}
if (onScreen) {
if (newFrame.origin.y < maxFrame.origin.y)
newFrame.origin.y = maxFrame.origin.y;
if (NSMaxX(newFrame) > NSMaxX(maxFrame))
newFrame.origin.x = NSMaxX(maxFrame) - newFrame.size.width;
}
}
[decoratedWindow setFrame:newFrame display:YES];
@@ -917,7 +937,15 @@
- (NSSize)constrainContentSizeToScreenSize:(NSSize)contentSize
{
NSWindow *win = [self window];
NSRect rect = [win contentRectForFrameRect:[[win screen] visibleFrame]];
if (![win screen])
return contentSize;
// NOTE: This may be called in both windowed and full-screen mode. The
// "visibleFrame" method does not overlap menu and dock so should not be
// used in full-screen.
NSRect screenRect = fullscreenEnabled ? [[win screen] frame]
: [[win screen] visibleFrame];
NSRect rect = [win contentRectForFrameRect:screenRect];
if (contentSize.height > rect.size.height)
contentSize.height = rect.size.height;
@@ -971,7 +999,7 @@
reply = [backendProxy starRegisterToPasteboard:pb];
}
@catch (NSException *e) {
NSLog(@"WARNING: Caught exception in %s: \"%@\"", _cmd, e);
ASLogWarn(@"Caught exception: \"%@\"", e);
}
}
@@ -1025,4 +1053,30 @@
[vimController addVimInput:input];
}
- (void)updateToolbar
{
NSToolbar *toolbar = [decoratedWindow toolbar];
if (nil == toolbar || 0 == updateToolbarFlag) return;
// Positive flag shows toolbar, negative hides it.
BOOL on = updateToolbarFlag > 0 ? YES : NO;
[toolbar setVisible:on];
if (([decoratedWindow styleMask] & NSTexturedBackgroundWindowMask) == 0) {
if (!on) {
[self hideTablineSeparator:YES];
} else {
[self hideTablineSeparator:![[vimView tabBarControl] isHidden]];
}
} else {
// Textured windows don't have a line below there title bar, so we
// need the separator in this case as well. In fact, the only case
// where we don't need the separator is when the tab bar control
// is visible (because it brings its own separator).
[self hideTablineSeparator:![[vimView tabBarControl] isHidden]];
}
updateToolbarFlag = 0;
}
@end // MMWindowController (Private)
+97 -26
View File
@@ -9,6 +9,7 @@
*/
#import <Cocoa/Cocoa.h>
#import <asl.h>
//
@@ -33,7 +34,6 @@
//
@protocol MMBackendProtocol
- (oneway void)processInput:(int)msgid data:(in bycopy NSData *)data;
- (oneway void)processInputAndData:(in bycopy NSArray *)messages;
- (oneway void)setDialogReturn:(in bycopy id)obj;
- (NSString *)evaluateExpression:(in bycopy NSString *)expr;
- (id)evaluateExpressionCocoa:(in bycopy NSString *)expr
@@ -42,30 +42,23 @@
- (oneway void)acknowledgeConnection;
@end
//
// This is the protocol MMVimController implements.
//
// Be very careful if you want to add methods to this protocol. Since DO
// messages may arrive while Cocoa is in the middle of processing some other
// message be sure to consider reentrancy issues. Look at processCommandQueue:
// to see an example of how to deal with this.
//
@protocol MMFrontendProtocol
- (oneway void)processCommandQueue:(in bycopy NSArray *)queue;
- (oneway void)showSavePanelWithAttributes:(in bycopy NSDictionary *)attr;
- (oneway void)presentDialogWithAttributes:(in bycopy NSDictionary *)attr;
@end
//
// This is the protocol MMAppController implements.
//
// It handles connections between MacVim and Vim.
// It handles connections between MacVim and Vim and communication from Vim to
// MacVim.
//
// Do not add methods to this interface without a _very_ good reason (if
// possible, instead add a new message to the *MsgID enum below and pass it via
// processInput:forIdentifier). Methods should not modify the state directly
// but should instead delay any potential modifications (see
// connectBackend:pid: and processInput:forIdentifier:).
//
@protocol MMAppProtocol
- (byref id <MMFrontendProtocol>)
connectBackend:(byref in id <MMBackendProtocol>)backend
pid:(int)pid;
- (unsigned)connectBackend:(byref in id <MMBackendProtocol>)proxy pid:(int)pid;
- (oneway void)processInput:(in bycopy NSArray *)queue
forIdentifier:(unsigned)identifier;
- (NSArray *)serverList;
@end
@@ -109,7 +102,7 @@
extern char *MessageStrings[];
enum {
OpenWindowMsgID = 1,
OpenWindowMsgID = 1, // NOTE: FIRST IN ENUM MUST BE 1
InsertTextMsgID,
KeyDownMsgID,
CmdKeyMsgID,
@@ -174,10 +167,19 @@ enum {
SetDocumentFilenameMsgID,
OpenWithArgumentsMsgID,
CloseWindowMsgID,
InterruptMsgID,
SetFullscreenColorMsgID,
ShowFindReplaceDialogMsgID,
FindReplaceMsgID,
ActivateKeyScriptMsgID,
DeactivateKeyScriptMsgID,
EnableImControlMsgID,
DisableImControlMsgID,
ActivatedImMsgID,
DeactivatedImMsgID,
BrowseForFileMsgID,
ShowDialogMsgID,
NetBeansMsgID,
LastMsgID // NOTE: MUST BE LAST MESSAGE IN ENUM!
};
@@ -209,20 +211,37 @@ enum {
ToolbarSizeRegularFlag = 4
};
enum {
MMTabLabel = 0,
MMTabToolTip,
MMTabInfoCount
};
// Create a string holding the labels of all messages in message queue for
// debugging purposes (condense some messages since there may typically be LOTS
// of them on a queue).
NSString *debugStringForMessageQueue(NSArray *queue);
// Shared user defaults (most user defaults are in Miscellaneous.h).
// Contrary to the user defaults in Miscellaneous.h these defaults are not
// intitialized to any default values. That is, unless the user sets them
// these keys will not be present in the user default database.
extern NSString *MMLogLevelKey;
extern NSString *MMLogToStdErrKey;
// Argument used to stop MacVim from opening an empty window on startup
// (techincally this is a user default but should not be used as such).
extern NSString *MMNoWindowKey;
// Vim pasteboard type (holds motion type + string)
extern NSString *VimPBoardType;
// Loads all fonts in the Resouces folder of the app bundle and returns a font
// container reference (which should be used to deactivate the loaded fonts).
ATSFontContainerRef loadFonts();
@interface NSString (MMExtras)
- (NSString *)stringByEscapingSpecialFilenameCharacters;
@@ -274,3 +293,55 @@ typedef int NSInteger;
typedef unsigned int NSUInteger;
# endif
#endif
// Logging related functions and macros.
//
// This is a very simplistic logging facility built on top of ASL. Two user
// defaults allow for changing the local log filter level (MMLogLevel) and
// whether logs should be sent to stderr (MMLogToStdErr). (These user defaults
// are only checked during startup.) The default is to block level 6 (info)
// and 7 (debug) logs and _not_ to send logs to stderr. Apart from this
// "syslog" (see "man syslog") can be used to modify the ASL filters (it is
// currently not possible to change the local filter at runtime). For example:
// Enable all logs to reach the ASL database (by default 'debug' and 'info'
// are filtered out, see "man syslogd"):
// $ sudo syslog -c syslogd -d
// Reset the ASL database filter:
// $ sudo syslog -c syslogd off
// Change the master filter to block logs less severe than errors:
// $ sudo syslog -c 0 -e
// Change per-process filter for running MacVim process to block logs less
// severe than warnings:
// $ syslog -c MacVim -w
//
// Note that there are four ASL filters:
// 1) The ASL database filter (syslog -c syslogd ...)
// 2) The master filter (syslog -c 0 ...)
// 3) The per-process filter (syslog -c PID ...)
// 4) The local filter (MMLogLevel)
//
// To view the logs, either use "Console.app" or the "syslog" command:
// $ syslog -w | grep Vim
// To get the logs to show up in Xcode enable the MMLogToStdErr user default.
extern int ASLogLevel;
void ASLInit();
#define ASLog(level, fmt, ...) \
if (level <= ASLogLevel) { \
asl_log(NULL, NULL, level, "%s@%d: %s", \
__PRETTY_FUNCTION__, __LINE__, \
[[NSString stringWithFormat:fmt, ##__VA_ARGS__] UTF8String]); \
}
// Note: These macros are used like ASLogErr(@"text num=%d", 42). Objective-C
// style specifiers (%@) are supported.
#define ASLogCrit(fmt, ...) ASLog(ASL_LEVEL_CRIT, fmt, ##__VA_ARGS__)
#define ASLogErr(fmt, ...) ASLog(ASL_LEVEL_ERR, fmt, ##__VA_ARGS__)
#define ASLogWarn(fmt, ...) ASLog(ASL_LEVEL_WARNING, fmt, ##__VA_ARGS__)
#define ASLogNotice(fmt, ...) ASLog(ASL_LEVEL_NOTICE, fmt, ##__VA_ARGS__)
#define ASLogInfo(fmt, ...) ASLog(ASL_LEVEL_INFO, fmt, ##__VA_ARGS__)
#define ASLogDebug(fmt, ...) ASLog(ASL_LEVEL_DEBUG, fmt, ##__VA_ARGS__)
+81 -27
View File
@@ -13,6 +13,7 @@
#import "MacVim.h"
char *MessageStrings[] =
{
"INVALID MESSAGE ID",
@@ -29,7 +30,7 @@ char *MessageStrings[] =
"ShowTabBarMsgID",
"HideTabBarMsgID",
"SetTextRowsMsgID",
"SetTextColumsMsgID",
"SetTextColumnsMsgID",
"SetTextDimensionsMsgID",
"LiveResizeMsgID",
"SetTextDimensionsReplyMsgID",
@@ -81,15 +82,27 @@ char *MessageStrings[] =
"SetDocumentFilenameMsgID",
"OpenWithArgumentsMsgID",
"CloseWindowMsgID",
"InterruptMsgID",
"SetFullscreenColorMsgID",
"ShowFindReplaceDialogMsgID",
"FindReplaceMsgID",
"ActivateKeyScriptMsgID",
"DeactivateKeyScriptMsgID",
"EnableImControlMsgID",
"DisableImControlMsgID",
"ActivatedImMsgID",
"DeactivatedImMsgID",
"BrowseForFileMsgID",
"ShowDialogMsgID",
"NetBeansMsgID",
"END OF MESSAGE IDs" // NOTE: Must be last!
};
NSString *MMLogLevelKey = @"MMLogLevel";
NSString *MMLogToStdErrKey = @"MMLogToStdErr";
// Argument used to stop MacVim from opening an empty window on startup
// (techincally this is a user default but should not be used as such).
NSString *MMNoWindowKey = @"MMNoWindow";
@@ -97,37 +110,47 @@ NSString *MMNoWindowKey = @"MMNoWindow";
// Vim pasteboard type (holds motion type + string)
NSString *VimPBoardType = @"VimPBoardType";
int ASLogLevel = ASL_LEVEL_NOTICE;
ATSFontContainerRef
loadFonts()
// Create a string holding the labels of all messages in message queue for
// debugging purposes (condense some messages since there may typically be LOTS
// of them on a queue).
NSString *
debugStringForMessageQueue(NSArray *queue)
{
// This loads all fonts from the Resources folder. The fonts are only
// available to the process which loaded them, so loading has to be done
// once for MacVim and an additional time for each Vim process. The
// returned container ref should be used to deactiave the font.
//
// (Code taken from cocoadev.com)
ATSFontContainerRef fontContainerRef = 0;
NSString *fontsFolder = [[NSBundle mainBundle] resourcePath];
if (fontsFolder) {
NSURL *fontsURL = [NSURL fileURLWithPath:fontsFolder];
if (fontsURL) {
FSRef fsRef;
FSSpec fsSpec;
CFURLGetFSRef((CFURLRef)fontsURL, &fsRef);
if (FSGetCatalogInfo(&fsRef, kFSCatInfoNone, NULL, NULL, &fsSpec,
NULL) == noErr) {
ATSFontActivateFromFileSpecification(&fsSpec,
kATSFontContextLocal, kATSFontFormatUnspecified, NULL,
kATSOptionFlagsDefault, &fontContainerRef);
}
}
NSMutableString *s = [NSMutableString new];
unsigned i, count = [queue count];
int item = 0, menu = 0, enable = 0, remove = 0;
int sets = 0, sett = 0, shows = 0, cres = 0, dess = 0;
for (i = 0; i < count; i += 2) {
NSData *value = [queue objectAtIndex:i];
int msgid = *((int*)[value bytes]);
if (msgid < 1 || msgid >= LastMsgID)
continue;
if (msgid == AddMenuItemMsgID) ++item;
else if (msgid == AddMenuMsgID) ++menu;
else if (msgid == EnableMenuItemMsgID) ++enable;
else if (msgid == RemoveMenuItemMsgID) ++remove;
else if (msgid == SetScrollbarPositionMsgID) ++sets;
else if (msgid == SetScrollbarThumbMsgID) ++sett;
else if (msgid == ShowScrollbarMsgID) ++shows;
else if (msgid == CreateScrollbarMsgID) ++cres;
else if (msgid == DestroyScrollbarMsgID) ++dess;
else [s appendFormat:@"%s ", MessageStrings[msgid]];
}
if (item > 0) [s appendFormat:@"AddMenuItemMsgID(%d) ", item];
if (menu > 0) [s appendFormat:@"AddMenuMsgID(%d) ", menu];
if (enable > 0) [s appendFormat:@"EnableMenuItemMsgID(%d) ", enable];
if (remove > 0) [s appendFormat:@"RemoveMenuItemMsgID(%d) ", remove];
if (sets > 0) [s appendFormat:@"SetScrollbarPositionMsgID(%d) ", sets];
if (sett > 0) [s appendFormat:@"SetScrollbarThumbMsgID(%d) ", sett];
if (shows > 0) [s appendFormat:@"ShowScrollbarMsgID(%d) ", shows];
if (cres > 0) [s appendFormat:@"CreateScrollbarMsgID(%d) ", cres];
if (dess > 0) [s appendFormat:@"DestroyScrollbarMsgID(%d) ", dess];
return fontContainerRef;
return [s autorelease];
}
@@ -240,3 +263,34 @@ loadFonts()
}
@end
void
ASLInit()
{
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
// Allow for changing the log level via user defaults. If no key is found
// the default log level will be used (which for ASL is to log everything
// up to ASL_LEVEL_NOTICE). This key is an integer which corresponds to
// the ASL_LEVEL_* macros (0 is most severe, 7 is debug level).
id logLevelObj = [ud objectForKey:MMLogLevelKey];
if (logLevelObj) {
int logLevel = [logLevelObj intValue];
if (logLevel < 0) logLevel = 0;
if (logLevel > ASL_LEVEL_DEBUG) logLevel = ASL_LEVEL_DEBUG;
ASLogLevel = logLevel;
asl_set_filter(NULL, ASL_FILTER_MASK_UPTO(logLevel));
}
// Allow for changing whether a copy of each log should be sent to stderr
// (this defaults to NO if this key is missing in the user defaults
// database). The above filter mask is applied to logs going to stderr,
// contrary to how "vanilla" ASL works.
BOOL logToStdErr = [ud boolForKey:MMLogToStdErrKey];
if (logToStdErr)
asl_add_log_file(NULL, 2); // The file descriptor for stderr is 2
}
+58 -87
View File
@@ -12,8 +12,8 @@
0395A95A0D74D47B00881434 /* Integration.png in Resources */ = {isa = PBXBuildFile; fileRef = 0395A9590D74D47B00881434 /* Integration.png */; };
0395A9BF0D75D02400881434 /* AuthorizedShellCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = 0395A9BE0D75D02400881434 /* AuthorizedShellCommand.m */; };
0395A9C30D75D04D00881434 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0395A9C20D75D04D00881434 /* Security.framework */; };
0395AA780D76E77800881434 /* Info in CopyFiles */ = {isa = PBXBuildFile; fileRef = 0395AA770D76E77800881434 /* Info */; };
0395AAAD0D76E94000881434 /* Edit in ODBEditor.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 0395AA210D76E22700881434 /* Edit in ODBEditor.bundle */; };
0395AA780D76E77800881434 /* Info in Copy ODBEditor */ = {isa = PBXBuildFile; fileRef = 0395AA770D76E77800881434 /* Info */; };
0395AAAD0D76E94000881434 /* Edit in ODBEditor.bundle in Copy ODBEditor */ = {isa = PBXBuildFile; fileRef = 0395AA210D76E22700881434 /* Edit in ODBEditor.bundle */; };
1D09AB420C6A4D520045497E /* MMTypesetter.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D09AB400C6A4D520045497E /* MMTypesetter.m */; };
1D0E051C0BA5F83800B6049E /* Colors.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1D0E051B0BA5F83800B6049E /* Colors.plist */; };
1D145C7F0E5227CE00691AA0 /* MMTextViewHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D145C7E0E5227CE00691AA0 /* MMTextViewHelper.m */; };
@@ -28,28 +28,18 @@
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 CopyFiles */ = {isa = PBXBuildFile; fileRef = 1D493D570C5247BF00AB718C /* Vim */; };
1D493DBA0C52534300AB718C /* PSMTabBarControl.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1D493DB90C52533B00AB718C /* PSMTabBarControl.framework */; };
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 */; };
1D71ACB40BC702AB002F2B60 /* doc-bm-c.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D71ACA90BC702AB002F2B60 /* doc-bm-c.icns */; };
1D71ACB50BC702AC002F2B60 /* doc-bm-h.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D71ACAA0BC702AB002F2B60 /* doc-bm-h.icns */; };
1D71ACB60BC702AC002F2B60 /* doc-bm-html.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D71ACAB0BC702AB002F2B60 /* doc-bm-html.icns */; };
1D71ACB70BC702AC002F2B60 /* doc-bm-java.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D71ACAC0BC702AB002F2B60 /* doc-bm-java.icns */; };
1D71ACB80BC702AC002F2B60 /* doc-bm-php.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D71ACAD0BC702AB002F2B60 /* doc-bm-php.icns */; };
1D71ACB90BC702AC002F2B60 /* doc-bm-pl.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D71ACAE0BC702AB002F2B60 /* doc-bm-pl.icns */; };
1D71ACBA0BC702AC002F2B60 /* doc-bm-sh.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D71ACAF0BC702AB002F2B60 /* doc-bm-sh.icns */; };
1D71ACBB0BC702AC002F2B60 /* doc-bm-tex.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D71ACB00BC702AB002F2B60 /* doc-bm-tex.icns */; };
1D71ACBC0BC702AC002F2B60 /* doc-bm-txt.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D71ACB10BC702AB002F2B60 /* doc-bm-txt.icns */; };
1D71ACBD0BC702AC002F2B60 /* doc-bm-xml.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D71ACB20BC702AB002F2B60 /* doc-bm-xml.icns */; };
1D71ACBE0BC702AC002F2B60 /* doc-bm.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D71ACB30BC702AB002F2B60 /* doc-bm.icns */; };
1D7F74580E4CE1AE003225C6 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D7F74570E4CE1AE003225C6 /* Sparkle.framework */; };
1D7F745B0E4CE1CD003225C6 /* Sparkle.framework in CopyFiles */ = {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 */; };
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 */; };
1DCD00C00E50B2B700460166 /* Copy.png in Resources */ = {isa = PBXBuildFile; fileRef = 1DCD00AB0E50B2B700460166 /* Copy.png */; };
1DCD00C10E50B2B700460166 /* Cut.png in Resources */ = {isa = PBXBuildFile; fileRef = 1DCD00AC0E50B2B700460166 /* Cut.png */; };
@@ -72,18 +62,17 @@
1DCD00D20E50B2B700460166 /* TagJump.png in Resources */ = {isa = PBXBuildFile; fileRef = 1DCD00BD0E50B2B700460166 /* TagJump.png */; };
1DCD00D30E50B2B700460166 /* Undo.png in Resources */ = {isa = PBXBuildFile; fileRef = 1DCD00BE0E50B2B700460166 /* Undo.png */; };
1DD04DEC0C529C5E006CDC2B /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 1DD04DEB0C529C5E006CDC2B /* Credits.rtf */; };
1DD0C20C0C60FFB4008CD84A /* gvimrc in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1DD0C20A0C60FF9A008CD84A /* gvimrc */; };
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 */; };
1DD703B90BA9D15D008679E9 /* vim_gloss.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1DD703B80BA9D15D008679E9 /* vim_gloss.icns */; };
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 */; };
1DE608B40C587FDA0055263D /* runtime in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1DE602470C587FD10055263D /* runtime */; };
1DE608B40C587FDA0055263D /* runtime in Copy Vim Runtime Files */ = {isa = PBXBuildFile; fileRef = 1DE602470C587FD10055263D /* runtime */; };
1DE8CC620C5E2AAD003F56E3 /* Actions.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1DE8CC610C5E2AAD003F56E3 /* Actions.plist */; };
1DE9B9500D341AB8008FEDD4 /* MMWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DE9B94E0D341AB8008FEDD4 /* MMWindow.m */; };
1DED78600C6DE43D0079945F /* vimrc in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1DED785F0C6DE43D0079945F /* vimrc */; };
1DED78600C6DE43D0079945F /* vimrc in Copy Vim Runtime Files */ = {isa = PBXBuildFile; fileRef = 1DED785F0C6DE43D0079945F /* vimrc */; };
1DFE25A50C527BC4003000F7 /* PSMTabBarControl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D493DB90C52533B00AB718C /* PSMTabBarControl.framework */; };
8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; };
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
@@ -130,48 +119,52 @@
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
0395AA790D76E77800881434 /* CopyFiles */ = {
0395AA790D76E77800881434 /* Copy ODBEditor */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "Edit in ODBEditor";
dstSubfolderSpec = 7;
files = (
0395AAAD0D76E94000881434 /* Edit in ODBEditor.bundle in CopyFiles */,
0395AA780D76E77800881434 /* Info in CopyFiles */,
0395AAAD0D76E94000881434 /* Edit in ODBEditor.bundle in Copy ODBEditor */,
0395AA780D76E77800881434 /* Info in Copy ODBEditor */,
);
name = "Copy ODBEditor";
runOnlyForDeploymentPostprocessing = 0;
};
1D0DCAD80BA3604D00B6CCFA /* CopyFiles */ = {
1D0DCAD80BA3604D00B6CCFA /* Copy Executables */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 6;
files = (
1D493D580C5247BF00AB718C /* Vim in CopyFiles */,
1D493D580C5247BF00AB718C /* Vim in Copy Executables */,
);
name = "Copy Executables";
runOnlyForDeploymentPostprocessing = 0;
};
1D9EB2840C366D7B0074B739 /* CopyFiles */ = {
1D9EB2840C366D7B0074B739 /* Copy Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
1D7F745B0E4CE1CD003225C6 /* Sparkle.framework in CopyFiles */,
1D493DBA0C52534300AB718C /* PSMTabBarControl.framework in CopyFiles */,
1D7F745B0E4CE1CD003225C6 /* Sparkle.framework in Copy Frameworks */,
1D493DBA0C52534300AB718C /* PSMTabBarControl.framework in Copy Frameworks */,
);
name = "Copy Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
1DE608B80C58807F0055263D /* CopyFiles */ = {
1DE608B80C58807F0055263D /* Copy Vim Runtime Files */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = vim;
dstSubfolderSpec = 7;
files = (
1DED78600C6DE43D0079945F /* vimrc in CopyFiles */,
1DD0C20C0C60FFB4008CD84A /* gvimrc in CopyFiles */,
1DE608B40C587FDA0055263D /* runtime in CopyFiles */,
1DED78600C6DE43D0079945F /* vimrc in Copy Vim Runtime Files */,
1DD0C20C0C60FFB4008CD84A /* gvimrc in Copy Vim Runtime Files */,
1DE608B40C587FDA0055263D /* runtime in Copy Vim Runtime Files */,
);
name = "Copy Vim Runtime Files";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
@@ -215,17 +208,6 @@
1D6008820E96886D003763F0 /* FindAndReplace.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; path = 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>"; };
1D71ACA90BC702AB002F2B60 /* doc-bm-c.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "doc-bm-c.icns"; sourceTree = "<group>"; };
1D71ACAA0BC702AB002F2B60 /* doc-bm-h.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "doc-bm-h.icns"; sourceTree = "<group>"; };
1D71ACAB0BC702AB002F2B60 /* doc-bm-html.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "doc-bm-html.icns"; sourceTree = "<group>"; };
1D71ACAC0BC702AB002F2B60 /* doc-bm-java.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "doc-bm-java.icns"; sourceTree = "<group>"; };
1D71ACAD0BC702AB002F2B60 /* doc-bm-php.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "doc-bm-php.icns"; sourceTree = "<group>"; };
1D71ACAE0BC702AB002F2B60 /* doc-bm-pl.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "doc-bm-pl.icns"; sourceTree = "<group>"; };
1D71ACAF0BC702AB002F2B60 /* doc-bm-sh.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "doc-bm-sh.icns"; sourceTree = "<group>"; };
1D71ACB00BC702AB002F2B60 /* doc-bm-tex.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "doc-bm-tex.icns"; sourceTree = "<group>"; };
1D71ACB10BC702AB002F2B60 /* doc-bm-txt.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "doc-bm-txt.icns"; sourceTree = "<group>"; };
1D71ACB20BC702AB002F2B60 /* doc-bm-xml.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "doc-bm-xml.icns"; sourceTree = "<group>"; };
1D71ACB30BC702AB002F2B60 /* doc-bm.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "doc-bm.icns"; 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>"; };
@@ -236,6 +218,7 @@
1D80FBE30CBBD6F200102A1C /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
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>"; };
1DCD00AA0E50B2B700460166 /* Attention.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Attention.png; path = Toolbar/Attention.png; sourceTree = "<group>"; };
1DCD00AB0E50B2B700460166 /* Copy.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Copy.png; path = Toolbar/Copy.png; sourceTree = "<group>"; };
1DCD00AC0E50B2B700460166 /* Cut.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Cut.png; path = Toolbar/Cut.png; sourceTree = "<group>"; };
@@ -262,7 +245,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>"; };
1DD703B80BA9D15D008679E9 /* vim_gloss.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = vim_gloss.icns; 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>"; };
@@ -442,27 +424,6 @@
name = Products;
sourceTree = "<group>";
};
1DCE78490C460C6C006305A6 /* Icons */ = {
isa = PBXGroup;
children = (
1D71ACA90BC702AB002F2B60 /* doc-bm-c.icns */,
1D71ACAA0BC702AB002F2B60 /* doc-bm-h.icns */,
1D71ACAB0BC702AB002F2B60 /* doc-bm-html.icns */,
1D71ACAC0BC702AB002F2B60 /* doc-bm-java.icns */,
1D71ACAD0BC702AB002F2B60 /* doc-bm-php.icns */,
1D71ACAE0BC702AB002F2B60 /* doc-bm-pl.icns */,
1D71ACAF0BC702AB002F2B60 /* doc-bm-sh.icns */,
1D71ACB00BC702AB002F2B60 /* doc-bm-tex.icns */,
1D71ACB10BC702AB002F2B60 /* doc-bm-txt.icns */,
1D71ACB20BC702AB002F2B60 /* doc-bm-xml.icns */,
1D71ACB30BC702AB002F2B60 /* doc-bm.icns */,
0395A8A90D72D88B00881434 /* General.png */,
0395A9590D74D47B00881434 /* Integration.png */,
1DD703B80BA9D15D008679E9 /* vim_gloss.icns */,
);
name = Icons;
sourceTree = "<group>";
};
1DE602460C587F760055263D /* Vim Resources */ = {
isa = PBXGroup;
children = (
@@ -517,12 +478,14 @@
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
1D9C602E0EF79C0C0034AD44 /* MacVim.icns */,
1D6008820E96886D003763F0 /* FindAndReplace.nib */,
0395A8A90D72D88B00881434 /* General.png */,
0395A9590D74D47B00881434 /* Integration.png */,
1D22374A0E45DF4800E6FFFF /* Advanced.png */,
BD9DF09F0DB2BA020025C97C /* PlugInView.nib */,
1DD3D51D0D82D4C9006E4320 /* ibeam.png */,
1D0F11480D58C77800D5DA09 /* Font */,
1DCE78490C460C6C006305A6 /* Icons */,
1DE9726C0C48050600F96A9F /* Toolbar */,
1DD9F5E40C85D60500E8D5A5 /* SystemColors.plist */,
1DE8CC610C5E2AAD003F56E3 /* Actions.plist */,
@@ -560,10 +523,11 @@
8D1107290486CEB800E47090 /* Resources */,
8D11072C0486CEB800E47090 /* Sources */,
8D11072E0486CEB800E47090 /* Frameworks */,
1D0DCAD80BA3604D00B6CCFA /* CopyFiles */,
1D9EB2840C366D7B0074B739 /* CopyFiles */,
1DE608B80C58807F0055263D /* CopyFiles */,
0395AA790D76E77800881434 /* CopyFiles */,
1D0DCAD80BA3604D00B6CCFA /* Copy Executables */,
1D9EB2840C366D7B0074B739 /* Copy Frameworks */,
1DE608B80C58807F0055263D /* Copy Vim Runtime Files */,
0395AA790D76E77800881434 /* Copy ODBEditor */,
1D1C31F00EFFBFD6003FE9A5 /* Make Document Icons */,
);
buildRules = (
);
@@ -629,19 +593,7 @@
8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */,
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
1D0E051C0BA5F83800B6049E /* Colors.plist in Resources */,
1DD703B90BA9D15D008679E9 /* vim_gloss.icns in Resources */,
1DD704310BA9F9C2008679E9 /* SpecialKeys.plist in Resources */,
1D71ACB40BC702AB002F2B60 /* doc-bm-c.icns in Resources */,
1D71ACB50BC702AC002F2B60 /* doc-bm-h.icns in Resources */,
1D71ACB60BC702AC002F2B60 /* doc-bm-html.icns in Resources */,
1D71ACB70BC702AC002F2B60 /* doc-bm-java.icns in Resources */,
1D71ACB80BC702AC002F2B60 /* doc-bm-php.icns in Resources */,
1D71ACB90BC702AC002F2B60 /* doc-bm-pl.icns in Resources */,
1D71ACBA0BC702AC002F2B60 /* doc-bm-sh.icns in Resources */,
1D71ACBB0BC702AC002F2B60 /* doc-bm-tex.icns in Resources */,
1D71ACBC0BC702AC002F2B60 /* doc-bm-txt.icns in Resources */,
1D71ACBD0BC702AC002F2B60 /* doc-bm-xml.icns in Resources */,
1D71ACBE0BC702AC002F2B60 /* doc-bm.icns in Resources */,
1DD04DEC0C529C5E006CDC2B /* Credits.rtf in Resources */,
1DE8CC620C5E2AAD003F56E3 /* Actions.plist in Resources */,
1DD9F5E50C85D60500E8D5A5 /* SystemColors.plist in Resources */,
@@ -677,11 +629,30 @@
1DCD00D20E50B2B700460166 /* TagJump.png in Resources */,
1DCD00D30E50B2B700460166 /* Undo.png in Resources */,
1D6008830E96886D003763F0 /* FindAndReplace.nib in Resources */,
1D9C60520EF79C0C0034AD44 /* MacVim.icns in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
1D1C31F00EFFBFD6003FE9A5 /* Make Document Icons */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Make Document Icons";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Clear deployment target, else the python script always thinks we're building on Tiger\nunset MACOSX_DEPLOYMENT_TARGET\n\n# Generate the icons (redirect stderr to ignore warnings)\ncd $PROJECT_DIR/icons/\nmake OUTDIR=$TARGET_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH 2> /dev/null\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
8D11072C0486CEB800E47090 /* Sources */ = {
isa = PBXSourcesBuildPhase;
@@ -766,7 +737,7 @@
i386,
);
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 38;
CURRENT_PROJECT_VERSION = 46;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
@@ -807,7 +778,7 @@
buildSettings = {
ARCHS = "$(NATIVE_ARCH)";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 38;
CURRENT_PROJECT_VERSION = 46;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
@@ -826,7 +797,7 @@
HEADER_SEARCH_PATHS = PSMTabBarControl/source/;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
MACOSX_DEPLOYMENT_TARGET = 10.4;
MACOSX_DEPLOYMENT_TARGET = "";
PRODUCT_NAME = MacVim;
VERSIONING_SYSTEM = "apple-generic";
WRAPPER_EXTENSION = app;
@@ -839,7 +810,7 @@
buildSettings = {
ARCHS = "$(NATIVE_ARCH)";
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 38;
CURRENT_PROJECT_VERSION = 46;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
@@ -858,7 +829,7 @@
HEADER_SEARCH_PATHS = PSMTabBarControl/source/;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
MACOSX_DEPLOYMENT_TARGET = 10.4;
MACOSX_DEPLOYMENT_TARGET = "";
PRODUCT_NAME = MacVim;
VERSIONING_SYSTEM = "apple-generic";
WRAPPER_EXTENSION = app;
+17 -12
View File
@@ -12,20 +12,13 @@
#import <Cocoa/Cocoa.h>
#import "MacVim.h"
#define MM_LOG_DEALLOCATIONS 0
#if MM_LOG_DEALLOCATIONS
# define LOG_DEALLOC NSLog(@"%s %@", _cmd, [self className]);
#else
# define LOG_DEALLOC
#endif
// NSUserDefaults keys
extern NSString *MMTabMinWidthKey;
extern NSString *MMTabMaxWidthKey;
extern NSString *MMTabOptimumWidthKey;
extern NSString *MMShowAddTabButtonKey;
extern NSString *MMTextInsetLeftKey;
extern NSString *MMTextInsetRightKey;
extern NSString *MMTextInsetTopKey;
@@ -53,6 +46,7 @@ extern NSString *MMOpenLayoutKey;
extern NSString *MMVerticalSplitKey;
extern NSString *MMPreloadCacheSizeKey;
extern NSString *MMLastWindowClosedBehaviorKey;
extern NSString *MMLoadDefaultFontKey;
// Enum for MMUntitledWindowKey
@@ -93,7 +87,7 @@ enum {
@end
@interface NSOpenPanel (MMExtras)
@interface NSSavePanel (MMExtras)
- (void)hiddenFilesButtonToggled:(id)sender;
- (void)setShowsHiddenFiles:(BOOL)show;
@end
@@ -128,7 +122,18 @@ enum {
// Create a view to be used as accessory for open panel. This function assumes
// ownership of the view so do not release it.
NSView *openPanelAccessoryView();
// Create a view with a "show hidden files" button to be used as accessory for
// open/save panels. This function assumes ownership of the view so do not
// release it.
NSView *showHiddenFilesView();
// Convert filenames (which are in a variant of decomposed form, NFD, on HFS+)
// to normalization form C (NFC). (This is necessary because Vim does not
// automatically compose NFD.) For more information see:
// http://developer.apple.com/technotes/tn/tn1150.html
// http://developer.apple.com/technotes/tn/tn1150table.html
// http://developer.apple.com/qa/qa2001/qa1235.html
// http://www.unicode.org/reports/tr15/
NSString *normalizeFilename(NSString *filename);
NSArray *normalizeFilenames(NSArray *filenames);
+32 -5
View File
@@ -17,6 +17,7 @@
NSString *MMTabMinWidthKey = @"MMTabMinWidth";
NSString *MMTabMaxWidthKey = @"MMTabMaxWidth";
NSString *MMTabOptimumWidthKey = @"MMTabOptimumWidth";
NSString *MMShowAddTabButtonKey = @"MMShowAddTabButton";
NSString *MMTextInsetLeftKey = @"MMTextInsetLeft";
NSString *MMTextInsetRightKey = @"MMTextInsetRight";
NSString *MMTextInsetTopKey = @"MMTextInsetTop";
@@ -44,6 +45,7 @@ NSString *MMOpenLayoutKey = @"MMOpenLayout";
NSString *MMVerticalSplitKey = @"MMVerticalSplit";
NSString *MMPreloadCacheSizeKey = @"MMPreloadCacheSize";
NSString *MMLastWindowClosedBehaviorKey = @"MMLastWindowClosedBehavior";
NSString *MMLoadDefaultFontKey = @"MMLoadDefaultFont";
@@ -91,7 +93,7 @@ NSString *MMLastWindowClosedBehaviorKey = @"MMLastWindowClosedBehavior";
@implementation NSOpenPanel (MMExtras)
@implementation NSSavePanel (MMExtras)
- (void)hiddenFilesButtonToggled:(id)sender
{
@@ -120,7 +122,7 @@ NSString *MMLastWindowClosedBehaviorKey = @"MMLastWindowClosedBehavior";
[invocation invoke];
}
@end // NSOpenPanel (MMExtras)
@end // NSSavePanel (MMExtras)
@@ -261,7 +263,7 @@ NSString *MMLastWindowClosedBehaviorKey = @"MMLastWindowClosedBehavior";
NSView *
openPanelAccessoryView()
showHiddenFilesView()
{
// Return a new button object for each NSOpenPanel -- several of them
// could be displayed at once.
@@ -270,13 +272,13 @@ openPanelAccessoryView()
NSButton *button = [[[NSButton alloc]
initWithFrame:NSMakeRect(0, 0, 140, 18)] autorelease];
[button setTitle:
NSLocalizedString(@"Show Hidden Files", @"Open File Dialog")];
NSLocalizedString(@"Show Hidden Files", @"Show Hidden Files Checkbox")];
[button setButtonType:NSSwitchButton];
[button setTarget:nil];
[button setAction:@selector(hiddenFilesButtonToggled:)];
// use the regular control size (checkbox is a bit smaller without this)
// Use the regular control size (checkbox is a bit smaller without this)
NSControlSize buttonSize = NSRegularControlSize;
float fontSize = [NSFont systemFontSizeForControlSize:buttonSize];
NSCell *theCell = [button cell];
@@ -288,3 +290,28 @@ openPanelAccessoryView()
return button;
}
NSString *
normalizeFilename(NSString *filename)
{
return [filename precomposedStringWithCanonicalMapping];
}
NSArray *
normalizeFilenames(NSArray *filenames)
{
NSMutableArray *outnames = [NSMutableArray array];
if (!filenames)
return outnames;
unsigned i, count = [filenames count];
for (i = 0; i < count; ++i) {
NSString *nfkc = normalizeFilename([filenames objectAtIndex:i]);
[outnames addObject:nfkc];
}
return outnames;
}
@@ -31,6 +31,7 @@
BOOL _isCloseButtonSuppressed;
BOOL _hasIcon;
int _count;
NSString *_toolTip;
}
// creation/destruction
@@ -72,6 +73,8 @@
- (void)setIsPlaceholder:(BOOL)value;
- (int)currentStep;
- (void)setCurrentStep:(int)value;
- (NSString *)toolTip;
- (void)setToolTip:(NSString *)tip;
// component attributes
- (NSRect)indicatorRectForFrame:(NSRect)cellFrame;
@@ -69,6 +69,7 @@
- (void)dealloc
{
[_indicator release];
[_toolTip release];
[super dealloc];
}
@@ -252,6 +253,19 @@
_currentStep = value;
}
- (NSString *)toolTip
{
return _toolTip;
}
- (void)setToolTip:(NSString *)tip
{
if (tip != _toolTip) {
[_toolTip release];
_toolTip = [tip copy];
}
}
#pragma mark -
#pragma mark Component Attributes
@@ -71,7 +71,7 @@ enum {
BOOL _allowsDragBetweenWindows;
BOOL _delegateHandlingDrag;
NSDragOperation _delegateInitialDragOperation;
// MVC help
IBOutlet id delegate;
}
@@ -99,6 +99,9 @@ enum {
- (BOOL)allowsDragBetweenWindows;
- (void)setAllowsDragBetweenWindows:(BOOL)flag;
// tool tips
- (void)setToolTip:(NSString *)value forTabViewItem:(NSTabViewItem *)tvi;
// accessors
- (NSTabView *)tabView;
- (void)setTabView:(NSTabView *)view;
@@ -147,7 +147,7 @@
[_addTabButton setNeedsDisplay:YES];
}
}
- (id)initWithFrame:(NSRect)frame
{
self = [super initWithFrame:frame];
@@ -380,6 +380,22 @@
return _overflowPopUpButton;
}
#pragma mark -
#pragma mark Tool tips
- (void)setToolTip:(NSString *)value forTabViewItem:(NSTabViewItem *)tvi
{
int i, cellCount = [_cells count];
for (i = 0; i < cellCount; i++) {
PSMTabBarCell *cell = [_cells objectAtIndex:i];
if ([cell representedObject] == tvi)
[cell setToolTip:value];
}
[self update];
}
#pragma mark -
#pragma mark Functionality
- (void)addTabViewItem:(NSTabViewItem *)item
@@ -746,6 +762,7 @@
NSRect cellRect = [self genericCellRect];
for(i = 0; i < cellCount; i++){
PSMTabBarCell *cell = [_cells objectAtIndex:i];
NSTabViewItem *tvi = [cell representedObject];
int tabState = 0;
if (i < numberOfVisibleCells) {
// set cell frame
@@ -764,12 +781,13 @@
[cell setCellTrackingTag:tag];
[cell setEnabled:YES];
// add tool tip if label will be truncated
if ([cell desiredWidthOfCell] > NSWidth([cell frame]))
[self addToolTipRect:cellRect owner:[cell stringValue] userData:NULL];
// add tool tip
NSString *tt = [cell toolTip];
if (tt && [tt length] > 0)
[self addToolTipRect:cellRect owner:tt userData:NULL];
// selected? set tab states...
if([[cell representedObject] isEqualTo:[tabView selectedTabViewItem]]){
if([tvi isEqualTo:[tabView selectedTabViewItem]]){
[cell setState:NSOnState];
tabState |= PSMTab_SelectedMask;
// previous cell
@@ -818,13 +836,13 @@
}
menuItem = [[[NSMenuItem alloc] initWithTitle:[[cell attributedStringValue] string] action:@selector(overflowMenuAction:) keyEquivalent:@""] autorelease];
[menuItem setTarget:self];
[menuItem setRepresentedObject:[cell representedObject]];
[menuItem setRepresentedObject:tvi];
[cell setIsInOverflowMenu:YES];
[[cell indicator] removeFromSuperview];
if ([[cell representedObject] isEqualTo:[tabView selectedTabViewItem]])
if ([tvi isEqualTo:[tabView selectedTabViewItem]])
[menuItem setState:NSOnState];
if([cell hasIcon])
[menuItem setImage:[[[[cell representedObject] identifier] content] icon]];
[menuItem setImage:[[[tvi identifier] content] icon]];
if([cell count] > 0)
[menuItem setTitle:[[menuItem title] stringByAppendingFormat:@" (%d)",[cell count]]];
[overflowMenu addItem:menuItem];
+3 -1
View File
@@ -120,7 +120,7 @@ NSString *MMPlugInViewPboardType = @"MMPlugInViewPboardType";
if ((self = [super init]) == nil) return nil;
if (![NSBundle loadNibNamed:@"PlugInView" owner:self])
NSLog(@"Error loading PlugIn nib");
ASLogErr(@"Error loading PlugIn nib");
[titleField setStringValue:title];
@@ -196,6 +196,8 @@ NSString *MMPlugInViewPboardType = @"MMPlugInViewPboardType";
- (void)dealloc
{
ASLogDebug(@"");
[fillerView release]; fillerView = nil;
[super dealloc];
}
+1 -3
View File
@@ -98,7 +98,7 @@ static int MMPlugInArchMinorVersion = 0;
- (void)dealloc
{
//NSLog(@"%@ %s", [self className], _cmd);
ASLogDebug(@"");
[plugInViews release]; plugInViews = nil;
[instances release]; instances = nil;
@@ -126,8 +126,6 @@ static int MMPlugInArchMinorVersion = 0;
- (void)addPlugInView:(NSView *)view withTitle:(NSString *)title
{
//NSLog(@"%@ %s", [self className], _cmd);
// Do this here so that the drawer is never opened automatically when there
// are no plugin views.
if ([[NSUserDefaults standardUserDefaults]
+20 -21
View File
@@ -20,16 +20,16 @@ is very easy to pick up if you know C and some object oriented programming.)
Each editor window in MacVim runs its own Vim process (but there is always
only one MacVim process). Communication between MacVim and a Vim process is
done using Distributed Objects (DO). Each Vim process is represented by a
backend object (MMBackend) and it communicates with a frontend object in the
Vim process (MMVimController). The interface between the backend and frontend
backend object (MMBackend) and it communicates with the frontend object in the
Vim process (MMAppController). The interface between the backend and frontend
is defined in MacVim.h.
The frontend sends input to the backend by calling
-[MMBackend processInput:data:]. The backend queues output on a command queue
and sends it to the frontend at opportune times by calling
-[MMVimController processCommandQueue:]. These are both asynchronous calls so
MacVim can keep drawing and receiving input while Vim is working away, thus
always keeping the user interface responsive.
-[MMAppController processInput:forIdentifier:]. These are both asynchronous
calls so MacVim can keep drawing and receiving input while Vim is working away,
thus always keeping the user interface responsive.
The state of each editor window is kept entirely in the Vim process. MacVim
should remain "ignorant" in the sense that it knows nothing of the actual
@@ -46,7 +46,7 @@ to MacVim inside -[MMBackend queueVimStateMessage].
Vim:
Hooks from within Vim are implmented in gui_macvim.m, the name of such
Hooks from within Vim are implemented in gui_macvim.m, the name of such
functions usually start with "gui_mch_" and they should simply put a message
on the output queue, by calling queueMessage:properties: on the singleton
MMBackend object [MMBackend sharedInstance] (see e.g. gui_mch_destroy_menu()).
@@ -63,32 +63,31 @@ for some reason fails to update the run loop then incoming DO calls will not
be processed and for this reason it is best to avoid making synchronous DO
calls from MacVim. (If synchronous calls must be made then it is important to
set proper timeouts so that MacVim doesn't "hang", see
-[MMVimConroller sendMessageNow:::] to see how this can be done.)
-[MMVimController sendMessageNow:::] to see how this can be done.)
MacVim:
The main nib of MacVim.app is MainMenu.nib which contains the default menu and
an instance of MMAppController, which is connected as the delegate of
NSApplication. That mens, when MacVim starts it will load this nib file and
automatically create an instance of the MMAppController singleton.
NSApplication. That means, when MacVim starts it will load this nib file and
automatically create an instance of the MMAppController singleton. All
incoming distributed object calls go via MMAppController.
A new editor window is opened by calling
-[MMAppController launchVimProcessWithArguments:]. This functions starts a
new Vim process (by executing the Vim binary). The Vim process lets MacVim
know when it has launched by calling -[MMAppController connectBackend:pid:]
and MacVim responds to this message by calling a new frontend object
(MMVimController) and returns a proxy to this object back to the Vim process.
From this point onward the Vim process communicates directly with the
MMVimController.
and MacVim responds to this message by creating a new vim controller and
returns an identifier for this object back to the Vim process.
The MMVimController represents the frontend of a Vim process inside MacVim.
It coordinates all communication with the Vim process and delegates output
that affects visual presentation to a MMWindowController object. Read the
Cocoa documentation on the responsibilities of a window controller.
Input (keyboard & mouse) handling and drawing is handled by a MMTextView
object.
Input (keyboard & mouse) handling and drawing is handled by a helper object
(MMTextViewHelper) to the current text view (MMTextView, MMAtsuiTextView, ...).
Distributed Object dangers:
@@ -106,7 +105,7 @@ message may arrive.
the menu flashes briefly. During this "flash" a modal loop is entered.
Item 1 can cause a problem if MacVim sends a synchronous message and before a
reply reacheds MacVim another message is received. From the source code it
reply reaches MacVim another message is received. From the source code it
looks like the synchronous message blocks but in fact the other message is
executed during this "block". If the other message changes state radically
something may go wrong after the synchronous DO message returns.
@@ -117,8 +116,8 @@ which may be even more puzzling.
One way to alleviate these problems is to ensure a DO message isn't entered
twice by setting a boolean at the beginning of the message and clearing it
afterwards. If the boolean is already set when entering the call must somehow
be delayed. See -[MMVimController processCommandQueue:] for a concrete
example.
be delayed. See processInput:forIdentifier: and processInputQueues: inside
MMAppController for a concrete example.
Another danger is that we must take care when releasing objects that Cocoa may
be using. See -[MMVimController connectionDidDie:] how MacVim releases
@@ -133,7 +132,7 @@ what they contain:
MMAppController.* Everything related to running the application
MMBackend.* Object representing a Vim process in backend
MMTextView.* Handles input and drawing
MMVimController.* Object representing a Vim Process in frontend
MMVimController.* Object representing a Vim process in frontend
MMVimView.* Cocoa view object
MMWindowController.* Coordinates visual presentation
MacVim.* Code shared between MacVim and Vim
@@ -149,7 +148,7 @@ Steps to build MacVim.app (the text before the '$' shows the folder you should
be in when executing these commands):
1. Configure Vim
src/$ configure --enable-gui=macvim
src/$ ./configure --enable-gui=macvim
2. Build Vim executable
src/$ make
@@ -161,4 +160,4 @@ The application bundle can be found inside "src/MacVim/build/Release".
Bjorn Winckler <bjorn.winckler@gmail.com>
June 22, 2008
April 5, 2009
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+213 -128
View File
@@ -22,13 +22,12 @@
// NOTE: The default font is bundled with the application.
static NSString *MMDefaultFontName = @"DejaVu Sans Mono";
static float MMDefaultFontSize = 12.0f;
static float MMMinFontSize = 6.0f;
static float MMMaxFontSize = 100.0f;
static BOOL gui_mch_init_has_finished = NO;
static int MMDefaultFontSize = 12;
static int MMMinFontSize = 6;
static int MMMaxFontSize = 100;
static NSFont *gui_macvim_font_with_name(char_u *name);
static GuiFont gui_macvim_font_with_name(char_u *name);
static int specialKeyToNSKey(int key);
static int vimModMaskToEventModifierFlags(int mods);
@@ -43,12 +42,11 @@ vimmenu_T *menu_for_descriptor(NSArray *desc);
* Parse the GUI related command-line arguments. Any arguments used are
* deleted from argv, and *argc is decremented accordingly. This is called
* when vim is started, whether or not the GUI has been started.
* NOTE: This function will be called twice if the Vim process forks.
*/
void
gui_mch_prepare(int *argc, char **argv)
{
//NSLog(@"gui_mch_prepare(argc=%d)", *argc);
// Set environment variables $VIM and $VIMRUNTIME
// NOTE! If vim_getenv is called with one of these as parameters before
// they have been set here, they will most likely end up with the wrong
@@ -75,6 +73,19 @@ gui_mch_prepare(int *argc, char **argv)
break;
}
}
#ifdef FEAT_NETBEANS_INTG
for (i = 0; i < *argc; ++i) {
if (strncmp(argv[i], "-nb", 3) == 0) {
usingNetbeans++;
netbeansArg = argv[i];
--*argc;
if (*argc > i)
mch_memmove(&argv[i], &argv[i+1], (*argc-i) * sizeof(char*));
break;
}
}
#endif
}
@@ -85,7 +96,6 @@ gui_mch_prepare(int *argc, char **argv)
int
gui_mch_init_check(void)
{
//NSLog(@"gui_mch_init_check()");
return OK;
}
@@ -97,16 +107,8 @@ gui_mch_init_check(void)
int
gui_mch_init(void)
{
//NSLog(@"gui_mch_init()");
// NOTE! Because OS X has to exec after fork we effectively end up doing
// the initialization twice (because this function is called before the
// fork). To avoid all this extra work we check if Vim is about to fork,
// and if so do nothing for now.
//
// TODO: Is this check 100% foolproof?
if (gui.dofork && (vim_strchr(p_go, GO_FORG) == NULL))
return OK;
ASLInit();
ASLogDebug(@"");
if (![[MMBackend sharedInstance] checkin]) {
// TODO: Kill the process if there is no terminal to fall back on,
@@ -140,8 +142,6 @@ gui_mch_init(void)
// in [g]vimrc.
gui_mch_adjust_charheight();
gui_mch_init_has_finished = YES;
return OK;
}
@@ -150,7 +150,7 @@ gui_mch_init(void)
void
gui_mch_exit(int rc)
{
//NSLog(@"gui_mch_exit(rc=%d)", rc);
ASLogDebug(@"rc=%d", rc);
[[MMBackend sharedInstance] exit];
}
@@ -162,12 +162,6 @@ gui_mch_exit(int rc)
int
gui_mch_open(void)
{
//NSLog(@"gui_mch_open()");
// This check is to avoid doing extra work when we're about to fork.
if (!gui_mch_init_has_finished)
return OK;
return [[MMBackend sharedInstance] openGUIWindow];
}
@@ -189,7 +183,8 @@ gui_mch_update(void)
// interrupt Vim by presssing Ctrl-C during lengthy operations (e.g. after
// entering "10gs" it would not be possible to bring Vim out of the 10 s
// sleep prematurely). As a compromise we check for Ctrl-C only once per
// second.
// second. Note that Cmd-. sends SIGINT so it has higher success rate at
// interrupting Vim.
static CFAbsoluteTime lastTime = 0;
CFAbsoluteTime nowTime = CFAbsoluteTimeGetCurrent();
@@ -210,6 +205,48 @@ gui_mch_flush(void)
}
void
gui_macvim_flush(void)
{
// This function counts how many times it is called and only flushes the
// draw queue if called sufficiently often. The first few times it is
// called it will flush often, but the more it is called the less likely is
// it that anything will be flushed. (The counter resets itself if the
// function isn't called for a second.)
//
// NOTE: Should only be used in loops where it is impossible to know how
// often Vim needs to flush. It was written to handle output from external
// commands (see mch_call_shell() in os_unix.c).
static CFAbsoluteTime lastTime = 0;
static int delay = 1;
static int counter = 0;
static int scrolls = 0;
CFAbsoluteTime nowTime = CFAbsoluteTimeGetCurrent();
CFAbsoluteTime delta = nowTime - lastTime;
if (delta > 1.0)
delay = 1;
// We assume that each call corresponds roughly to one line of output.
// When one page has scrolled by we increase the delay before the next
// flush.
if (++scrolls > gui.num_rows) {
delay <<= 1;
if (delay > 2048)
delay = 2048;
scrolls = 0;
}
if (++counter > delay) {
gui_macvim_force_flush();
counter = 0;
}
lastTime = nowTime;
}
/* Force flush output to MacVim. Do not call this method unless absolutely
* necessary. */
void
@@ -428,8 +465,7 @@ gui_mch_new_colors(void)
gui.def_back_pixel = gui.back_pixel;
gui.def_norm_pixel = gui.norm_pixel;
//NSLog(@"gui_mch_new_colors(back=%x, norm=%x)", gui.def_back_pixel,
// gui.def_norm_pixel);
ASLogDebug(@"back=%x norm=%x", gui.def_back_pixel, gui.def_norm_pixel);
[[MMBackend sharedInstance]
setDefaultColorsBackground:gui.def_back_pixel
@@ -695,6 +731,29 @@ gui_mch_add_menu(vimmenu_T *menu, int idx)
}
// Taken from gui_gtk.c (slightly modified)
static int
lookup_menu_iconfile(char_u *iconfile, char_u *dest)
{
expand_env(iconfile, dest, MAXPATHL);
if (mch_isFullName(dest))
return vim_fexists(dest);
static const char suffixes[][4] = {"png", "bmp"};
char_u buf[MAXPATHL];
unsigned int i;
for (i = 0; i < sizeof(suffixes)/sizeof(suffixes[0]); ++i)
if (gui_find_bitmap(dest, buf, (char *)suffixes[i]) == OK) {
STRCPY(dest, buf);
return TRUE;
}
return FALSE;
}
/*
* Add a menu item to a menu
*/
@@ -713,11 +772,17 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx)
if (menu_is_toolbar(menu->parent->name)) {
char_u fname[MAXPATHL];
// TODO: Ensure menu->iconfile exists (if != NULL)
icon = menu->iconfile;
if (!icon && gui_find_bitmap(menu->name, fname, "bmp") == OK)
// Try to use the icon=.. argument
if (menu->iconfile && lookup_menu_iconfile(menu->iconfile, fname))
icon = fname;
if (!icon && menu->iconidx >= 0)
// If not found and not builtin specified try using the menu name
if (!icon && !menu->icon_builtin
&& lookup_menu_iconfile(menu->name, fname))
icon = fname;
// Last resort, use display name (usually signals a builtin icon)
if (!icon)
icon = menu->dname;
}
@@ -867,24 +932,30 @@ gui_mch_free_font(font)
GuiFont font;
{
if (font != NOFONT) {
//NSLog(@"gui_mch_free_font(font=0x%x)", font);
[(NSFont*)font release];
ASLogDebug(@"font=0x%x", font);
[(id)font release];
}
}
GuiFont
gui_mch_retain_font(GuiFont font)
{
return (GuiFont)[(id)font retain];
}
/*
* Get a font structure for highlighting.
*/
GuiFont
gui_mch_get_font(char_u *name, int giveErrorIfMissing)
{
//NSLog(@"gui_mch_get_font(name=%s, giveErrorIfMissing=%d)", name,
// giveErrorIfMissing);
ASLogDebug(@"name='%s' giveErrorIfMissing=%d", name, giveErrorIfMissing);
NSFont *font = gui_macvim_font_with_name(name);
if (font)
return (GuiFont)[font retain];
GuiFont font = gui_macvim_font_with_name(name);
if (font != NOFONT)
return font;
if (giveErrorIfMissing)
EMSG2(_(e_font), name);
@@ -896,14 +967,12 @@ gui_mch_get_font(char_u *name, int giveErrorIfMissing)
#if defined(FEAT_EVAL) || defined(PROTO)
/*
* Return the name of font "font" in allocated memory.
* Don't know how to get the actual name, thus use the provided name.
* TODO: use 'font' instead of 'name'?
*/
char_u *
gui_mch_get_fontname(GuiFont font, char_u *name)
{
if (name == NULL)
return NULL;
return vim_strsave(name);
return name ? vim_strsave(name) : NULL;
}
#endif
@@ -915,7 +984,7 @@ gui_mch_get_fontname(GuiFont font, char_u *name)
int
gui_mch_init_font(char_u *font_name, int fontset)
{
//NSLog(@"gui_mch_init_font(font_name=%s, fontset=%d)", font_name, fontset);
ASLogDebug(@"font_name='%s' fontset=%d", font_name, fontset);
if (font_name && STRCMP(font_name, "*") == 0) {
// :set gfn=* shows the font panel.
@@ -923,24 +992,24 @@ gui_mch_init_font(char_u *font_name, int fontset)
return FAIL;
}
NSFont *font = gui_macvim_font_with_name(font_name);
if (font) {
[(NSFont*)gui.norm_font release];
gui.norm_font = (GuiFont)[font retain];
GuiFont font = gui_macvim_font_with_name(font_name);
if (font == NOFONT)
return FAIL;
// NOTE: MacVim keeps separate track of the normal and wide fonts.
// Unless the user changes 'guifontwide' manually, they are based on
// the same (normal) font. Also note that each time the normal font is
// set, the advancement may change so the wide font needs to be updated
// as well (so that it is always twice the width of the normal font).
[[MMBackend sharedInstance] setFont:font];
[[MMBackend sharedInstance] setWideFont:
(NOFONT == gui.wide_font ? font : (NSFont*)gui.wide_font)];
gui_mch_free_font(gui.norm_font);
gui.norm_font = font;
return OK;
}
// NOTE: MacVim keeps separate track of the normal and wide fonts.
// Unless the user changes 'guifontwide' manually, they are based on
// the same (normal) font. Also note that each time the normal font is
// set, the advancement may change so the wide font needs to be updated
// as well (so that it is always twice the width of the normal font).
[[MMBackend sharedInstance] setFont:font wide:NO];
[[MMBackend sharedInstance] setFont:(NOFONT != gui.wide_font ? gui.wide_font
: font)
wide:YES];
return FAIL;
return OK;
}
@@ -954,63 +1023,58 @@ gui_mch_set_font(GuiFont font)
}
NSFont *
/*
* Return GuiFont in allocated memory. The caller must free it using
* gui_mch_free_font().
*/
GuiFont
gui_macvim_font_with_name(char_u *name)
{
NSFont *font = nil;
NSString *fontName = MMDefaultFontName;
float size = MMDefaultFontSize;
if (!name)
return (GuiFont)[[NSString alloc] initWithFormat:@"%@:%d",
MMDefaultFontName, MMDefaultFontSize];
NSString *fontName = [NSString stringWithVimString:name];
int size = MMDefaultFontSize;
BOOL parseFailed = NO;
#ifdef FEAT_MBYTE
name = CONVERT_TO_UTF8(name);
#endif
if (name) {
fontName = [NSString stringWithUTF8String:(char*)name];
NSArray *components = [fontName componentsSeparatedByString:@":"];
if ([components count] == 2) {
NSString *sizeString = [components lastObject];
if ([sizeString length] > 0
&& [sizeString characterAtIndex:0] == 'h') {
sizeString = [sizeString substringFromIndex:1];
if ([sizeString length] > 0) {
size = [sizeString floatValue];
fontName = [components objectAtIndex:0];
}
} else {
parseFailed = YES;
NSArray *components = [fontName componentsSeparatedByString:@":"];
if ([components count] == 2) {
NSString *sizeString = [components lastObject];
if ([sizeString length] > 0
&& [sizeString characterAtIndex:0] == 'h') {
sizeString = [sizeString substringFromIndex:1];
if ([sizeString length] > 0) {
size = (int)round([sizeString floatValue]);
fontName = [components objectAtIndex:0];
}
} else if ([components count] > 2) {
} else {
parseFailed = YES;
}
} else if ([components count] > 2) {
parseFailed = YES;
}
if (!parseFailed) {
// Replace underscores with spaces.
fontName = [[fontName componentsSeparatedByString:@"_"]
componentsJoinedByString:@" "];
}
if (!parseFailed) {
// Replace underscores with spaces.
fontName = [[fontName componentsSeparatedByString:@"_"]
componentsJoinedByString:@" "];
}
if (!parseFailed && [fontName length] > 0) {
if (size < MMMinFontSize) size = MMMinFontSize;
if (size > MMMaxFontSize) size = MMMaxFontSize;
font = [NSFont fontWithName:fontName size:size];
if (!font && MMDefaultFontName == fontName) {
// If for some reason the MacVim default font is not in the app
// bundle, then fall back on the system default font.
font = [NSFont userFixedPitchFontOfSize:0];
}
// If the default font is requested we don't check if NSFont can load
// it since the font most likely isn't loaded anyway (it may only be
// available to the MacVim binary). If it is not the default font we
// ask NSFont if it can load it.
if ([fontName isEqualToString:MMDefaultFontName]
|| [NSFont fontWithName:fontName size:size])
return [[NSString alloc] initWithFormat:@"%@:%d", fontName, size];
}
#ifdef FEAT_MBYTE
CONVERT_TO_UTF8_FREE(name);
#endif
return font;
return NOFONT;
}
// -- Scrollbars ------------------------------------------------------------
@@ -1172,14 +1236,14 @@ gui_mch_stop_blink(void)
void
gui_mch_getmouse(int *x, int *y)
{
//NSLog(@"gui_mch_getmouse()");
ASLogInfo(@"Not implemented!");
}
void
gui_mch_setmouse(int x, int y)
{
//NSLog(@"gui_mch_setmouse(x=%d, y=%d)", x, y);
ASLogInfo(@"Not implemented!");
}
@@ -1204,28 +1268,32 @@ im_set_position(int row, int col)
}
void
im_set_control(int enable)
{
// Tell frontend whether it should notify us when the input method changes
// or not (called when 'imd' is toggled).
int msgid = enable ? EnableImControlMsgID : DisableImControlMsgID;
[[MMBackend sharedInstance] queueMessage:msgid properties:nil];
}
void
im_set_active(int active)
{
// Set roman or the system script if 'active' is TRUE or FALSE,
// respectively.
SInt32 systemScript = GetScriptManagerVariable(smSysScript);
if (!p_imdisable && smRoman != systemScript)
KeyScript(active ? smKeySysScript : smKeyRoman);
// Tell frontend to enable/disable IM (called e.g. when the mode changes).
if (!p_imdisable) {
int msgid = active ? ActivateKeyScriptMsgID : DeactivateKeyScriptMsgID;
[[MMBackend sharedInstance] setImState:active];
[[MMBackend sharedInstance] queueMessage:msgid properties:nil];
}
}
int
im_get_status(void)
{
// IM is active whenever the current script is the system script and the
// system script isn't roman. (Hence IM can only be active when using
// non-roman scripts.)
SInt32 currentScript = GetScriptManagerVariable(smKeyScript);
SInt32 systemScript = GetScriptManagerVariable(smSysScript);
return currentScript != smRoman && currentScript == systemScript;
return [[MMBackend sharedInstance] imState];
}
#endif // defined(USE_IM_CONTROL)
@@ -1353,8 +1421,8 @@ gui_mch_browse(
char_u *initdir,
char_u *filter)
{
//NSLog(@"gui_mch_browse(saving=%d, title=%s, dflt=%s, ext=%s, initdir=%s,"
// " filter=%s", saving, title, dflt, ext, initdir, filter);
ASLogDebug(@"saving=%d title='%s' dflt='%s' ext='%s' initdir='%s' "
"filter='%s'", saving, title, dflt, ext, initdir, filter);
// Ensure no data is on the output queue before presenting the dialog.
gui_macvim_force_flush();
@@ -1383,9 +1451,9 @@ gui_mch_dialog(
int dfltbutton,
char_u *textfield)
{
//NSLog(@"gui_mch_dialog(type=%d title=%s message=%s buttons=%s "
// "dfltbutton=%d textfield=%s)", type, title, message, buttons,
// dfltbutton, textfield);
ASLogDebug(@"type=%d title='%s' message='%s' buttons='%s' dfltbutton=%d "
"textfield='%s'", type, title, message, buttons, dfltbutton,
textfield);
// Ensure no data is on the output queue before presenting the dialog.
gui_macvim_force_flush();
@@ -1498,7 +1566,7 @@ gui_mch_get_rgb(guicolor_T pixel)
void
gui_mch_get_screen_dimensions(int *screen_w, int *screen_h)
{
//NSLog(@"gui_mch_get_screen_dimensions()");
ASLogDebug(@"Columns=%d Rows=%d", Columns, Rows);
*screen_w = Columns;
*screen_h = Rows;
}
@@ -1571,10 +1639,9 @@ gui_mch_set_shellsize(
int base_height,
int direction)
{
//NSLog(@"gui_mch_set_shellsize(width=%d, height=%d, min_width=%d,"
// " min_height=%d, base_width=%d, base_height=%d, direction=%d)",
// width, height, min_width, min_height, base_width, base_height,
// direction);
ASLogDebug(@"width=%d height=%d min_width=%d min_height=%d base_width=%d "
"base_height=%d direction=%d", width, height, min_width,
min_height, base_width, base_height, direction);
[[MMBackend sharedInstance] setRows:height columns:width];
}
@@ -1602,7 +1669,7 @@ gui_mch_set_winpos(int x, int y)
void
gui_mch_settitle(char_u *title, char_u *icon)
{
//NSLog(@"gui_mch_settitle(title=%s, icon=%s)", title, icon);
ASLogDebug(@"title='%s' icon='%s'", title, icon);
#ifdef FEAT_MBYTE
title = CONVERT_TO_UTF8(title);
@@ -1646,6 +1713,9 @@ gui_mch_leave_fullscreen()
void
gui_mch_fuopt_update()
{
if (!gui.in_use)
return;
guicolor_T fg, bg;
if (fuoptions_flags & FUOPT_BGCOLOR_HLGROUP) {
syn_id2colors(fuoptions_bgcolor, &fg, &bg);
@@ -2119,3 +2189,18 @@ static int vimModMaskToEventModifierFlags(int mods)
return flags;
}
// -- NetBeans Support ------------------------------------------------------
#ifdef FEAT_NETBEANS_INTG
/* Set NetBeans socket to CFRunLoop */
void
gui_macvim_set_netbeans_socket(int socket)
{
[[MMBackend sharedInstance] setNetbeansSocket:socket];
}
#endif // FEAT_NETBEANS_INTG
+11 -5
View File
@@ -1,7 +1,7 @@
" System gvimrc file for MacVim
"
" Maintainer: Bjorn Winckler <bjorn.winckler@gmail.com>
" Last Change: Sun Oct 04 2008
" Last Change: Sun Mar 15 2009
"
" This is a work in progress. If you feel so inclined, please help me improve
" this file.
@@ -26,6 +26,9 @@ if !exists("colors_name")
colorscheme macvim
endif
" To make tabs more readable, the label only contains the tail of the file
" name and the buffer modified flag.
set guitablabel=%M%t
" Send print jobs to Preview.app. This does not delete the temporary ps file
@@ -94,8 +97,8 @@ an <silent> 9900.311 Window.Zoom\ All <Nop>
an <silent> 9900.320 Window.Toggle\ Full\ Screen\ Mode :set invfullscreen<CR>
an 9900.330 Window.-SEP1- <Nop>
" TODO! Grey out if no tabs are visible.
an <silent> 9900.340 Window.Previous\ Tab :tabprevious<CR>
an <silent> 9900.350 Window.Next\ Tab :tabnext<CR>
an <silent> 9900.340 Window.Select\ Next\ Tab :tabnext<CR>
an <silent> 9900.350 Window.Select\ Previous\ Tab :tabprevious<CR>
an 9900.360 Window.-SEP2- <Nop>
an <silent> 9900.370 Window.Bring\ All\ To\ Front <Nop>
@@ -161,6 +164,9 @@ if !exists("macvim_skip_cmd_opt_movement")
ino <D-Down> <C-End>
map <M-Down> }
imap <M-Down> <C-o>}
imap <M-BS> <C-w>
imap <D-BS> <C-u>
endif " !exists("macvim_skip_cmd_opt_movement")
@@ -251,8 +257,8 @@ macm Window.Minimize\ All key=<D-M-m> action=miniaturizeAll: alt=YES
macm Window.Zoom key=<D-C-z> action=performZoom:
macm Window.Zoom\ All key=<D-M-C-z> action=zoomAll: alt=YES
macm Window.Toggle\ Full\ Screen\ Mode key=<D-F>
macm Window.Previous\ Tab key=<D-{>
macm Window.Next\ Tab key=<D-}>
macm Window.Select\ Next\ Tab key=<D-}>
macm Window.Select\ Previous\ Tab key=<D-{>
macm Window.Bring\ All\ To\ Front action=arrangeInFront:
macm Help.MacVim\ Help key=<D-?>
+26
View File
@@ -0,0 +1,26 @@
.PHONY: clean
OUTDIR ?= .
$(OUTDIR)/MacVim-generic.icns: make_icons.py vim-noshadow-512.png loadfont.so Envy\ Code\ R\ Bold.ttf
$(MAKE) -C makeicns
/usr/bin/python make_icons.py $(OUTDIR)
loadfont.so: loadfont.c
/usr/bin/python setup.py install --install-lib .
Envy\ Code\ R\ Bold.ttf: EnvyCodeR.zip
unzip -jo EnvyCodeR.zip
# unzip uses the file date from the zip file. Change the file date to
# "now", so that the zip is not unzipped in every `make` run.`
touch Envy\ Code\ R\ Bold.ttf
ENVYCODE_URL=http://download.damieng.com/latest/EnvyCodeR
EnvyCodeR.zip:
curl ${ENVYCODE_URL} --location -o EnvyCodeR.zip
clean:
$(MAKE) -C makeicns clean
rm -f $(OUTDIR)/MacVim-*.icns loadfont.so *.pyc \
EnvyCodeR.zip *.ttf *.reg *.txt
rm -rf *.egginfo build # Created by setup.py
+605
View File
@@ -0,0 +1,605 @@
from Foundation import *
from AppKit import *
import itertools
import math
import operator
import os
from optparse import OptionParser
# Resources
DEFAULT_BACKGROUND = '/System/Library/CoreServices/CoreTypes.bundle/' + \
'Contents/Resources/GenericDocumentIcon.icns' # might require leopard?
# Cache both images and background renderers globally
imageCache = {}
bgCache = {}
# Make us not crash
# http://www.cocoabuilder.com/archive/message/cocoa/2008/8/6/214964
NSApplicationLoad()
class Surface(object):
"""Represents a simple bitmapped image."""
def __init__(self, *p, **kw):
if not 'premultiplyAlpha' in kw:
kw['premultiplyAlpha'] = True
if len(p) == 1 and isinstance(p[0], NSBitmapImageRep):
self.bitmapRep = p[0]
elif len(p) == 2 and isinstance(p[0], int) and isinstance(p[1], int):
format = NSAlphaFirstBitmapFormat
if not kw['premultiplyAlpha']:
format += NSAlphaNonpremultipliedBitmapFormat
self.bitmapRep = NSBitmapImageRep.alloc().initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bitmapFormat_bytesPerRow_bitsPerPixel_(
None, p[0], p[1], 8, 4, True, False, NSDeviceRGBColorSpace,
format, 0, 0)
if not hasattr(self, 'bitmapRep') or not self.bitmapRep:
raise Exception('Failed to create surface: ' + str(p))
def size(self):
return map(int, self.bitmapRep.size()) # cocoa returns floats. cocoa ftw
def data(self):
"""Returns data in ARGB order (on intel, at least)."""
r = self.bitmapRep
if r.bitmapFormat() != (NSAlphaNonpremultipliedBitmapFormat |
NSAlphaFirstBitmapFormat) or \
r.bitsPerPixel() != 32 or \
r.isPlanar() or \
r.samplesPerPixel() != 4:
raise Exception("Unsupported image format")
return self.bitmapRep.bitmapData()
def save(self, filename):
"""Saves image as png file."""
self.bitmapRep.representationUsingType_properties_(NSPNGFileType, None) \
.writeToFile_atomically_(filename, True)
def draw(self):
self.bitmapRep.draw()
def context(self):
# Note: Cocoa only supports contexts with premultiplied alpha
return NSGraphicsContext.graphicsContextWithBitmapImageRep_(self.bitmapRep)
def copy(self):
return Surface(self.bitmapRep.copy())
class Image(object):
"""Represents an image that can consist of several Surfaces."""
def __init__(self, param):
if isinstance(param, str):
self.image = NSImage.alloc().initWithContentsOfFile_(param)
elif isinstance(param, Surface):
self.image = NSImage.alloc().initWithSize_( param.size() )
self.image.addRepresentation_(param.bitmapRep)
if not self.image:
raise Exception('Failed to load image: ' + str(param))
def surfaceOfSize(self, w, h):
"""Returns an ARGB, non-premultiplied surface of size w*h or throws."""
r = None
for rep in self.image.representations():
# Cocoa reports fraction widths for pngs (wtf?!), so use round()
if map(lambda x: int(round(x)), rep.size()) == [w, h]:
r = rep
break
# XXX: Resample in this case? That'd make the program easier to use, but
# can silently create blurry backgrounds. Since this happens with
# the app icon anyways, this might not be a huge deal?
if not r:
raise Exception('Unsupported size %dx%d', w, h)
return Surface(r)
def blend(self):
self.compositeInRect( ((0, 0), self.image.size()) )
def compositeInRect(self, r, mode=NSCompositeSourceOver):
self.image.drawInRect_fromRect_operation_fraction_(r, NSZeroRect,
mode, 1.0)
def sizes(self):
s = set()
for rep in self.image.representations():
s.add(tuple(map(lambda x: int(round(x)), rep.size())))
return s
class Context(object):
# Tiger has only Python2.3, so we can't use __enter__ / __exit__ for this :-(
def __init__(self, surface):
NSGraphicsContext.saveGraphicsState()
c = surface.context()
c.setShouldAntialias_(True);
c.setImageInterpolation_(NSImageInterpolationHigh);
NSGraphicsContext.setCurrentContext_(c)
def done(self):
NSGraphicsContext.restoreGraphicsState()
class SplittableBackground(object):
def __init__(self, unsplitted, shouldSplit=True):
self.unsplitted = unsplitted
self.shouldSplit = shouldSplit
self.ground = {}
self.shadow = {}
def rawGroundAtSize(self, s):
return self.unsplitted.surfaceOfSize(s, s)
def groundAtSize(self, s):
if not self.shouldSplit:
return self.rawGroundAtSize(s)
self._performSplit(s)
return self.ground[s]
def shadowAtSize(self, s):
if not self.shouldSplit:
return None
self._performSplit(s)
return self.shadow[s]
def _performSplit(self, s):
if s in self.ground:
assert s in self.shadow
return
assert s not in self.shadow
ground, shadow = splitGenericDocumentIcon(self.unsplitted, s)
self.ground[s] = ground
self.shadow[s] = shadow
class BackgroundRenderer(object):
def __init__(self, bg, icon=None, r={}):
self.bgRenderer = bg
self.icon = icon
self.cache = {}
self.rect = r
def drawIcon(self, s):
if not self.icon:
return
assert s in [16, 32, 128, 256, 512]
a = list(self.rect[s])
# convert from `flow` coords to cocoa
a[2] = -a[2] # mirror y
w, h = s*a[1], s*a[3]
self.icon.compositeInRect( (((s-w)/2 + a[0], (s-h)/2 + a[2]), (w, h)) )
def drawAtSize(self, s):
if not self.icon:
# No need to split the background if no icons is interleaved -- take
# the faster code path in that case.
self.bgRenderer.rawGroundAtSize(s).draw()
return
self.bgRenderer.groundAtSize(s).draw()
self.drawIcon(s)
if self.bgRenderer.shouldSplit:
# shadow needs to be composited, so it needs to be in an image
Image(self.bgRenderer.shadowAtSize(s)).blend()
def backgroundAtSize(self, s):
if not s in self.cache:
result = Surface(s, s)
context = Context(result)
self.drawAtSize(s)
context.done()
self.cache[s] = result
return self.cache[s]
def splitGenericDocumentIcon(img, s):
"""Takes the generic document icon and splits it into a background and a
shadow layer. For the 32x32 and 16x16 variants, the white pixels of the page
curl are hardcoded into the otherwise transparent shadow layer."""
w, h = s, s
r = img.surfaceOfSize(w, h)
bps = 4*w
data = r.data()
ground = Surface(w, h, premultiplyAlpha=False)
shadow = Surface(w, h, premultiplyAlpha=False)
grounddata = ground.data()
shadowdata = shadow.data()
for y in xrange(h):
for x in xrange(w):
idx = y*bps + 4*x
ia, ir, ig, ib = data[idx:idx + 4]
if ia != chr(255):
# buffer objects don't support slice assignment :-(
grounddata[idx] = ia
grounddata[idx + 1] = ir
grounddata[idx + 2] = ig
grounddata[idx + 3] = ib
shadowdata[idx] = chr(0)
shadowdata[idx + 1] = chr(0)
shadowdata[idx + 2] = chr(0)
shadowdata[idx + 3] = chr(0)
continue
assert ir == ig == ib
grounddata[idx] = chr(255)
grounddata[idx + 1] = chr(255)
grounddata[idx + 2] = chr(255)
grounddata[idx + 3] = chr(255)
shadowdata[idx] = chr(255 - ord(ir))
shadowdata[idx + 1] = chr(0)
shadowdata[idx + 2] = chr(0)
shadowdata[idx + 3] = chr(0)
# Special-case 16x16 and 32x32 cases: Make some pixels on the fold white.
# Ideally, I could make the fold whiteish in all variants, but I can't.
whitePix = { 16: [(10, 2), (10, 3), (11, 3), (10, 4), (11, 4), (12, 4)],
32: [(21, 4), (21, 5), (22, 5), (21, 6), (22, 6), (23, 6)]}
if (w, h) in [(16, 16), (32, 32)]:
for x, y in whitePix[w]:
idx = y*bps + 4*x
shadowdata[idx] = chr(255)
shadowdata[idx + 1] = chr(255)
shadowdata[idx + 2] = chr(255)
shadowdata[idx + 3] = chr(255)
return ground, shadow
class TextRenderer(object):
def __init__(self):
self.cache = {}
def attribsAtSize(self, s):
if s not in self.cache:
self.cache[s] = self._attribsAtSize(s)
return self.cache[s]
def centeredStyle(self):
style = NSMutableParagraphStyle.new()
style.setParagraphStyle_(NSParagraphStyle.defaultParagraphStyle())
style.setAlignment_(NSCenterTextAlignment)
return style
def _attribsAtSize(self, s):
# This looks not exactly like the font on Preview.app's document icons,
# but I believe that's because Preview's icons are drawn by Photoshop,
# and Adobe's font rendering is different from Apple's.
fontname = 'LucidaGrande-Bold'
# Prepare text format
fontsizes = { 512: 72.0, 256: 36.0, 128: 18.0, 32: 7.0, 16: 3.0 }
# http://developer.apple.com/documentation/Cocoa/Conceptual/AttributedStrings/Articles/standardAttributes.html#//apple_ref/doc/uid/TP40004903
attribs = {
NSParagraphStyleAttributeName: self.centeredStyle(),
NSForegroundColorAttributeName: NSColor.colorWithDeviceWhite_alpha_(
0.34, 1),
NSFontAttributeName: NSFont.fontWithName_size_(fontname, fontsizes[s])
}
# tighten font a bit for some sizes
if s in [256, 512]:
attribs[NSKernAttributeName] = -1.0
elif s == 32:
attribs[NSKernAttributeName] = -0.25
if not attribs[NSFontAttributeName]:
raise Exception('Failed to load font %s' % fontname)
return attribs
def drawTextAtSize(self, text, s):
"""Draws text `s` into the current context of size `s`."""
textRects = {
512: ((0, 7), (512, 119)),
128: ((0, 6), (128, 26.5)),
256: ((0, 7), (256, 57)),
16: ((1, 1), (15, 5)),
#32: ((1, 1), (31, 9))
}
attribs = self.attribsAtSize(s)
text = NSString.stringWithString_(text)
if s in [16, 128, 256, 512]:
text.drawInRect_withAttributes_(textRects[s], attribs)
elif s == 32:
# Try to align text on pixel boundary:
attribs = attribs.copy()
attribs[NSParagraphStyleAttributeName] = \
NSParagraphStyle.defaultParagraphStyle()
ts = text.sizeWithAttributes_(attribs)
text.drawAtPoint_withAttributes_( (math.floor((32.0-ts[0])/2) + 0.5, 1.5),
attribs)
class OfficeTextRenderer(TextRenderer):
"""Uses Office's LucidaSans font for 32x32.
This font looks much better for certain strings (e.g. "PDF") but much worse
for most others (e.g. "VIM", "JAVA") -- and office fonts are usually not
installed. Hence, this class is better not used.
"""
def _attribsAtSize(self, s):
self.useOfficeFont = False
attribs = TextRenderer._attribsAtSize(self, s)
if s == 32:
font = NSFont.fontWithName_size_('LucidaSans-Demi', 7.0)
if font:
attribs[NSFontAttributeName] = font
attribs[NSKernAttributeName] = 0
self.useOfficeFont = True
return attribs
def drawTextAtSize(self, text, s):
attribs = self.attribsAtSize(s)
if not self.useOfficeFont or s != 32:
TextRenderer.drawTextAtSize(self, text, s)
return
text = NSString.stringWithString_(text)
text.drawInRect_withAttributes_( ((0, 1), (31, 11)), attribs)
def createIcon(s, bg, textRenderer, text):
# Fill in background
output = bg.backgroundAtSize(s).copy()
# Draw text on top of shadow
context = Context(output)
if s in text and text[s]:
textRenderer.drawTextAtSize(text[s], s)
context.done()
return output
def textDictFromTextList(l):
assert 1 <= len(l) <= 3
if len(l) == 1:
return dict.fromkeys([16, 32, 128, 256, 512], l[0])
elif len(l) == 2:
return dict(zip([16, 32], 2*[l[1]]) + zip((128, 256, 512), 3*[l[0]]))
elif len(l) == 3:
return dict([(16, l[2]), (32, l[1])] + zip((128, 256, 512), 3*[l[0]]))
def saveIcns(icons, icnsName, makeIcns='./makeicns'):
"""Creates an icns file with several variants.
Params:
icons: A dict that contains icon size as key and Surface as value.
Valid keys are 512, 256, 128, 32, 16
icnsname: Name of the output file
"""
# If IconFamily was less buggy, we could wrap it into a python module and
# call it directly, which is about a lot faster. However, IconFamily does not
# work with NSAlphaNonpremultipliedBitmapFormat correctly, so this has to
# wait.
#import IconFamily
#typeDict = {
#16: IconFamily.kSmall32BitData,
#32: IconFamily.kLarge32BitData,
#128: IconFamily.kThumbnail32BitData,
#256: IconFamily.kIconServices256PixelDataARGB,
#512: IconFamily.IconServices512PixelDataARGB,
#}
#maskDict = {
#16: IconFamily.kSmall8BitMask,
#32: IconFamily.kLarge8BitMask,
#128: IconFamily.kThumbnail8BitMask,
#}
#output = IconFamily.IconFamily.iconFamily()
#for s, icon in icons.items():
#output.setIconFamilyElement_fromBitmapImageRep_(typeDict[s], icon.bitmapRep)
#if s in maskDict:
#output.setIconFamilyElement_fromBitmapImageRep_(
#maskDict[s], icon.bitmapRep)
#output.writeToFile_(icnsName)
TMPFILE = 'docerator_tmp_%d.png'
try:
args = []
for s, icon in icons.items():
assert s in [512, 256, 128, 32, 16]
assert icon.size() == [s, s]
icon.save(TMPFILE % s)
args.append('-%d %s' % (s, TMPFILE % s))
return \
os.system('%s %s -out %s' % (makeIcns, ' '.join(args), icnsName)) == 0
finally:
for s in icons:
if os.access(TMPFILE % s, os.F_OK):
os.remove(TMPFILE % s)
def getOutname(options):
def saneBasename(p):
""" '/my/path/to/file.txt' -> 'file' """
return os.path.splitext(os.path.basename(p))[0]
textPart = 'Generic'
if options.text:
textPart = options.text.split(',')[0]
if options.appicon:
base = saneBasename(options.appicon)
else:
base = saneBasename(getBgName(options))
return '%s-%s.icns' % (base, textPart)
def cachedImage(filename):
absPath = os.path.abspath(filename)
if not absPath in imageCache:
imageCache[absPath] = Image(absPath)
return imageCache[absPath]
def cachedBackground(img, split):
key = (img, split)
if not key in bgCache:
bgCache[key] = SplittableBackground(img, shouldSplit=split)
return bgCache[key]
# taken from running flow on preview
defaultRects = {
16: (-0.30890000000000001, 0.4919, -1.2968, 0.4743),
32: (-0.27810000000000001,
0.58930000000000005,
-2.2292999999999998,
0.57140000000000002),
128: (1.1774, 0.56820000000000004, -0.8246, 0.56799999999999995),
256: (0.5917, 0.56489999999999996, -1.8994, 0.56499999999999995),
512: (0.68700000000000006,
0.56530000000000002,
-4.2813999999999997,
0.56540000000000001)
}
def getBgName(options):
if not hasattr(options, 'background') \
or options.background in ['default-split', 'default-unsplit']:
return DEFAULT_BACKGROUND
else:
return options.background
class IconGenerator(object):
def __init__(self, options):
if hasattr(options, 'textrenderer') and options.textrenderer:
self.textRenderer = options.textrenderer()
else:
self.textRenderer = TextRenderer()
# Prepare input images
splitBackground = options.background == 'default-split'
self.bgIcon = cachedImage(getBgName(options))
self.testIcon = None
if options.appicon:
self.testIcon = cachedImage(options.appicon)
rects = defaultRects.copy()
rects[16] = [ 0.0000, 0.5000, -1.0000, 0.5000] # manually, better
if hasattr(options, 'rects'):
rects.update(options.rects)
bg = cachedBackground(self.bgIcon, splitBackground)
if hasattr(options, 'backgroundrenderer') and options.backgroundrenderer:
self.bgRenderer = options.backgroundrenderer(bg, self.testIcon, rects)
else:
self.bgRenderer = BackgroundRenderer(bg, self.testIcon, rects)
self.testtext = textDictFromTextList(options.text.split(','))
def createIconAtSize(self, s):
return createIcon(s, self.bgRenderer, self.textRenderer, self.testtext)
def iconGenerator(**kwargs):
return IconGenerator(optsFromDict(**kwargs))
def makedocicon_opts(options):
renderer = IconGenerator(options)
if hasattr(options, 'sizes') and options.sizes:
if isinstance(options.sizes, list):
sizes = options.sizes
else:
sizes = map(int, options.sizes.split(','))
else:
sizes = renderer.bgIcon.sizes()
if renderer.testIcon:
sizes = sizes.intersection(renderer.testIcon.sizes())
sizes = sorted(map(operator.itemgetter(0), sizes))
icons = dict([(s, renderer.createIconAtSize(s)) for s in sizes])
if options.debug:
for s, icon in icons.iteritems():
icon.save(options.debug % s)
if hasattr(options, 'outname') and options.outname:
outname = options.outname
else:
outname = getOutname(options)
if saveIcns(icons, outname, options.makeicns):
print 'Wrote', outname
else:
print 'Failed to write %s. Make sure makeicns is in your path.' % outname
def optsFromDict(**kwargs):
options, _ = getopts().parse_args([]) # get default options
for k in kwargs:
setattr(options, k, kwargs[k])
return options
def makedocicon(**kwargs):
makedocicon_opts(optsFromDict(**kwargs))
def makedocicons_opts(options):
if not hasattr(options, 'text') or not options.text:
options.text = ['']
texts = options.text
for text in texts:
options.text = text
makedocicon_opts(options)
def makedocicons(**kwargs):
makedocicons_opts(optsFromDict(**kwargs))
def getopts():
parser = OptionParser(usage='%prog [options]', version='%prog 1.01')
parser.add_option('--background', '--bg', default='default-split',
help='Used as background (special values: "default-split" (default), ' \
'"default-unsplit").')
parser.add_option('--appicon', help='App icon, defaults to no icon.')
parser.add_option('--text', help='Text on icon. Defaults to empty. '
'More than one text is supported, multiple docicons are generated in '
'that case.', action='append')
parser.add_option('--sizes', help='Sizes of icons. ' \
'Defaults to all sizes available in input appicon. Example: "512,128,16"')
# XXX(Nico): This has to go
parser.add_option('--debug', help='If set, write out pngs for all variants.' \
' This needs to look like "debug%d.png".')
# XXX(Nico): This has to go once IconFamily is less buggy and can be used
# directly
parser.add_option('--makeicns', help='Path to makeicns binary',
default='./makeicns')
return parser
def main():
options, args = getopts().parse_args()
makedocicons_opts(options)
if __name__ == '__main__':
main()
+65
View File
@@ -0,0 +1,65 @@
import docerator
import unittest
class TextDictFromTextListTest(unittest.TestCase):
def testBasic(self):
self.assertEquals({16: 'a', 32: 'a', 128: 'a', 256: 'a', 512: 'a'},
docerator.textDictFromTextList(['a']))
self.assertEquals({16: 'b', 32: 'b', 128: 'a', 256: 'a', 512: 'a'},
docerator.textDictFromTextList(['a', 'b']))
self.assertEquals({16: 'c', 32: 'b', 128: 'a', 256: 'a', 512: 'a'},
docerator.textDictFromTextList(['a', 'b', 'c']))
class OutnameTest(unittest.TestCase):
class FakeOptions(object):
def __init__(self, **kwargs):
for k in kwargs:
self.__setattr__(k, kwargs[k])
def testBasic(self):
options = OutnameTest.FakeOptions(
appicon = '/Applications/iTunes.app/Contents/Resources/iTunes.icns',
text='MP3')
self.assertEquals('iTunes-MP3.icns', docerator.getOutname(options))
def testTextList(self):
options = OutnameTest.FakeOptions(
appicon = '/Applications/iTunes.app/Contents/Resources/iTunes.icns',
text='PYTHON,PY')
self.assertEquals('iTunes-PYTHON.icns',
docerator.getOutname(options))
def testEmptyText(self):
options = OutnameTest.FakeOptions(
appicon = '/Applications/iTunes.app/Contents/Resources/iTunes.icns',
text='')
self.assertEquals('iTunes-Generic.icns', docerator.getOutname(options))
options = OutnameTest.FakeOptions(
appicon = '/Applications/iTunes.app/Contents/Resources/iTunes.icns',
text=None)
self.assertEquals('iTunes-Generic.icns',
docerator.getOutname(options))
def testEmptyIcon(self):
options = OutnameTest.FakeOptions(appicon=None, text='MP3')
self.assertEquals('GenericDocumentIcon-MP3.icns',
docerator.getOutname(options))
options = OutnameTest.FakeOptions(appicon=None, text='')
self.assertEquals('GenericDocumentIcon-Generic.icns',
docerator.getOutname(options))
options = OutnameTest.FakeOptions(appicon=None, text='',
background='/Applications/Bla/bgicon.icns')
self.assertEquals('bgicon-Generic.icns',
docerator.getOutname(options))
# XXX(Nico): Look at the doctest module.
if __name__ == '__main__':
unittest.main()
+56
View File
@@ -0,0 +1,56 @@
// A small python module that registers a font with ATS, given the name of
// the font.
#include <Python/Python.h>
#include <CoreFoundation/CoreFoundation.h>
#include <Carbon/Carbon.h>
static PyObject* loadfont(PyObject* self, PyObject* args) {
PyObject* result = Py_False;
const char* path = NULL;
int ok = PyArg_ParseTuple(args, "s", &path);
if (ok) {
CFStringRef componentPath = CFStringCreateWithCString(kCFAllocatorDefault,
path, kCFStringEncodingUTF8);
CFURLRef componentURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,
componentPath, kCFURLPOSIXPathStyle, false);
FSRef fsref;
if (CFURLGetFSRef(componentURL, &fsref)) {
OSStatus err = noErr;
ATSFontContainerRef fontContainerRef; // we don't deactivate the font
#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4)
err = ATSFontActivateFromFileReference(&fsref,
kATSFontContextLocal, kATSFontFormatUnspecified, NULL,
kATSOptionFlagsDefault, &fontContainerRef);
#else
FSSpec fsSpec;
FSRef fsRef;
if ((err = FSGetCatalogInfo(
&fsRef, kFSCatInfoNone, NULL, NULL, &fsSpec, NULL)) == noErr) {
err = ATSFontActivateFromFileSpecification(&fsSpec,
kATSFontContextLocal, kATSFontFormatUnspecified, NULL,
kATSOptionFlagsDefault, &fontContainerRef);
}
#endif
if (err == noErr) {
result = Py_True;
}
}
CFRelease(componentURL);
CFRelease(componentPath);
}
return result;
}
static PyMethodDef LoadfontMethods[] = {
{ "loadfont", loadfont, METH_VARARGS, "Locally activates font from file." },
{ NULL, NULL, 0, NULL }
};
PyMODINIT_FUNC initloadfont(void) {
Py_InitModule("loadfont", LoadfontMethods);
}
+197
View File
@@ -0,0 +1,197 @@
# Creates all of MacVim document icons.
# http://www.macresearch.org/cocoa-scientists-part-xx-python-scriptersmeet-cocoa
try:
# Make us independent of sysprefs->appearance->antialias fonts smaller than...
# Needs to happen before docerator is imported.
from AppKit import NSUserDefaults
prefs = NSUserDefaults.standardUserDefaults()
prefs.setInteger_forKey_(4, 'AppleAntiAliasingThreshold')
import docerator
# Load Envy Code R from a file and register it under its postscript name
# Thanks to DamienG for this font (redistributed with permission):
# http://damieng.com/blog/2008/05/26/envy-code-r-preview-7-coding-font-released
import loadfont
loadfont.loadfont('Envy Code R Bold.ttf')
from Foundation import NSString
from AppKit import *
dont_create = False
except:
dont_create = True # most likely because we're on tiger
import os
import sys
# icon types
LARGE = 0 # 512, 128, 32, 16; about 96kB
SMALL = 1 # 128, 32, 16; about 36kB
LINK = 2 # Create link to generic icon; 4kB (== smallest block size on HFS+)
iconsizes = {
SMALL: [128, 32, 16],
LARGE: [512, 128, 32, 16],
}
# Resources
MAKEICNS = 'makeicns/makeicns'
APPICON = 'vim-noshadow-512.png'
DEFAULT_BACKGROUND = '/System/Library/CoreServices/CoreTypes.bundle/' + \
'Contents/Resources/GenericDocumentIcon.icns'
# List of icons to create
GENERIC_ICON_NAME = 'MacVim-generic'
vimIcons = {
GENERIC_ICON_NAME: [u'', LARGE],
'MacVim-vim': [u'VIM', LARGE],
'MacVim-txt': [u'TXT', SMALL],
'MacVim-tex': [u'TEX', SMALL],
'MacVim-h': [u'H', SMALL],
'MacVim-c': [u'C', SMALL],
'MacVim-m': [u'M', SMALL],
'MacVim-mm': [u'MM', SMALL],
'MacVim-cpp': [u'C\uff0b\uff0b,C++,C++', SMALL], # fullwidth plusses
'MacVim-java': [u'JAVA', SMALL],
'MacVim-f': [u'FTRAN', SMALL],
'MacVim-html': [u'HTML', SMALL],
'MacVim-xml': [u'XML', SMALL],
'MacVim-js': [u'JS', SMALL],
'MacVim-perl': [u'PERL,PL', SMALL],
'MacVim-py': [u'PYTHON,PY', SMALL],
'MacVim-php': [u'PHP', SMALL],
'MacVim-rb': [u'RUBY,RB', SMALL],
'MacVim-bash': [u'SH', SMALL],
'MacVim-patch': [u'DIFF', SMALL],
'MacVim-applescript': [u'\uf8ffSCPT,\uf8ffS', SMALL], # apple sign
'MacVim-as': [u'FLASH', LINK],
'MacVim-asp': [u'ASP', LINK],
'MacVim-bib': [u'BIB', LINK],
'MacVim-cs': [u'C#', LINK],
'MacVim-csfg': [u'CFDG', LINK],
'MacVim-csv': [u'CSV', LINK],
'MacVim-tsv': [u'TSV', LINK],
'MacVim-cgi': [u'CGI', LINK],
'MacVim-cfg': [u'CFG', LINK],
'MacVim-css': [u'CSS', SMALL],
'MacVim-dtd': [u'DTD', LINK],
'MacVim-dylan': [u'DYLAN', LINK],
'MacVim-erl': [u'ERLANG,ERL', SMALL],
'MacVim-fscript': [u'FSCPT,FSCR,FS', SMALL],
'MacVim-hs': [u'HS', SMALL],
'MacVim-inc': [u'INC', LINK],
'MacVim-ics': [u'ICS', SMALL],
'MacVim-ini': [u'INI', LINK],
'MacVim-io': [u'IO', LINK],
'MacVim-bsh': [u'BSH', LINK],
'MacVim-properties': [u'PROP', LINK],
'MacVim-jsp': [u'JSP', SMALL],
'MacVim-lisp': [u'LISP,LISP,LSP', SMALL],
'MacVim-log': [u'LOG', SMALL],
'MacVim-wiki': [u'WIKI', SMALL],
'MacVim-ps': [u'PS', LINK],
#'MacVim-plist': [u'PLIST', SMALL],
'MacVim-sch': [u'SCHEME,SCM', SMALL],
'MacVim-sql': [u'SQL', SMALL],
'MacVim-tcl': [u'TCL', SMALL],
'MacVim-xsl': [u'XSL', LINK],
'MacVim-vcf': [u'VCARD,VCF', SMALL],
'MacVim-vb': [u'VBASIC,VB', LINK],
'MacVim-yaml': [u'YAML,YAML,YML', SMALL],
'MacVim-gtd': [u'GTD', LINK],
'MacVim-markdown': [u'MARK\u2193,M\u2193', LINK], # down arrow
'MacVim-rst': [u'RST', LINK],
}
def createLinks(icons, target):
assert len(icons) > 0
for name in icons:
icnsName = '%s.icns' % name
if os.access(icnsName, os.F_OK):
os.remove(icnsName)
os.symlink(target, icnsName)
if not dont_create:
# define a few classes to render custom 16x16 icons
class NoTextRenderer(docerator.TextRenderer):
def drawTextAtSize(self, text, s):
if s == 16: return # No text at 16x16
docerator.TextRenderer.drawTextAtSize(self, text, s)
class NoIconRenderer(docerator.BackgroundRenderer):
def drawIcon(self, s):
if s == 16: return # no "MacVim" icon on the sheet at 16x16
docerator.BackgroundRenderer.drawIcon(self, s)
class SmallTextRenderer(docerator.TextRenderer):
def _attribsAtSize(self, s):
attribs = docerator.TextRenderer._attribsAtSize(self, s)
if s == 16:
font = NSFont.fontWithName_size_('EnvyCodeR-Bold', 7.0)
assert font
attribs[NSFontAttributeName] = font
attribs[NSForegroundColorAttributeName] = \
NSColor.colorWithDeviceRed_green_blue_alpha_(
0/255.0, 82/255.0, 0/255.0, 1)
return attribs
def drawTextAtSize(self, text, s):
if s != 16:
docerator.TextRenderer.drawTextAtSize(self, text, s)
return
text = NSString.stringWithString_(text.lower()[0:3]) # at most 3 chars
attribs = self.attribsAtSize(s)
if len(text) <= 2:
attribs[NSKernAttributeName] = 0 # we have some space
else:
attribs[NSKernAttributeName] = -1 # we need all the room we can get
text.drawInRect_withAttributes_( ((1, 2), (15, 11)), attribs)
def main():
if dont_create:
print "PyObjC not found, only using a stock icon for document icons."
# Can't use the constants from docerator in this case
import shutil
shutil.copyfile(DEFAULT_BACKGROUND, '%s.icns' % GENERIC_ICON_NAME)
createLinks([name for name in vimIcons if name != GENERIC_ICON_NAME],
'%s.icns' % GENERIC_ICON_NAME)
return
srcdir = os.getcwd()
if len(sys.argv) > 1:
os.chdir(sys.argv[1])
appIcon = os.path.join(srcdir, APPICON)
makeIcns = os.path.join(srcdir, MAKEICNS)
# create LARGE and SMALL icons first...
for name, t in vimIcons.iteritems():
text, size = t
if size == LINK: continue
print name
if name == GENERIC_ICON_NAME:
# The generic icon has no text; make the appicon a bit larger
docerator.makedocicon(outname='%s.icns' % name, appicon=appIcon,
text=text, sizes=iconsizes[size], makeicns=makeIcns,
textrenderer=NoTextRenderer, rects={16:(0.0, 0.5533, 0.0, 0.5533)})
else:
# For the other icons, leave out appicon and render text in Envy Code R
docerator.makedocicon(outname='%s.icns' % name, appicon=appIcon,
text=text, sizes=iconsizes[size], makeicns=makeIcns,
textrenderer=SmallTextRenderer, backgroundrenderer=NoIconRenderer)
# ...create links later (to make sure the link targets exist)
createLinks([name for (name, t) in vimIcons.items() if t[1] == LINK],
'%s.icns' % GENERIC_ICON_NAME)
if __name__ == '__main__':
main()
+186
View File
@@ -0,0 +1,186 @@
// IconFamily.h
// IconFamily class interface
// by Troy Stephens, Thomas Schnitzer, David Remahl, Nathan Day, Ben Haller, Sven Janssen, Peter Hosey, Conor Dearden, Elliot Glaysher, and Dave MacLachlan
// version 0.9.3
//
// Project Home Page:
// http://iconfamily.sourceforge.net/
//
// Problems, shortcomings, and uncertainties that I'm aware of are flagged with "NOTE:". Please address bug reports, bug fixes, suggestions, etc. to the project Forums and bug tracker at https://sourceforge.net/projects/iconfamily/
/*
Copyright (c) 2001-2006 Troy N. Stephens
Portions Copyright (c) 2007 Google Inc.
Use and distribution of this source code is governed by the MIT License, whose terms are as follows.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#import <Cocoa/Cocoa.h>
#import <Carbon/Carbon.h>
// This class is a Cocoa/Objective-C wrapper for the Mac OS X Carbon API's
// "icon family" data type. Its main purpose is to enable Cocoa applications
// to easily create custom file icons from NSImage instances, and thus take
// advantage of Mac OS X's new larger RGBA "thumbnail" icon format to provide
// richly detailed thumbnail previews of the files' contents.
//
// Using IconFamily, this becomes as simple as:
//
// id iconFamily = [IconFamily iconFamilyWithThumbnailsOfImage:anImage];
// [iconFamily setAsCustomIconForFile:anExistingFile];
//
// You can also write an icon family to an .icns file using the -writeToFile:
// method.
@interface IconFamily : NSObject
{
IconFamilyHandle hIconFamily;
}
// Convenience methods. These use the corresponding -init... methods to return
// an autoreleased IconFamily instance.
+ (IconFamily*) iconFamily;
+ (IconFamily*) iconFamilyWithContentsOfFile:(NSString*)path;
+ (IconFamily*) iconFamilyWithIconOfFile:(NSString*)path;
+ (IconFamily*) iconFamilyWithIconFamilyHandle:(IconFamilyHandle)hNewIconFamily;
+ (IconFamily*) iconFamilyWithSystemIcon:(int)fourByteCode;
+ (IconFamily*) iconFamilyWithThumbnailsOfImage:(NSImage*)image;
+ (IconFamily*) iconFamilyWithThumbnailsOfImage:(NSImage*)image usingImageInterpolation:(NSImageInterpolation)imageInterpolation;
// Initializes as a new, empty IconFamily. This is IconFamily's designated
// initializer method.
- init;
// Initializes an IconFamily by loading the contents of an .icns file.
- initWithContentsOfFile:(NSString*)path;
// Initializes an IconFamily from an existing Carbon IconFamilyHandle.
- initWithIconFamilyHandle:(IconFamilyHandle)hNewIconFamily;
// Initializes an IconFamily by loading the Finder icon that's assigned to a
// file.
- initWithIconOfFile:(NSString*)path;
// Initializes an IconFamily by referencing a standard system icon.
- initWithSystemIcon:(int)fourByteCode;
// Initializes an IconFamily by creating its elements from a resampled
// NSImage. The second form of this method allows you to specify the degree
// of antialiasing to be used in resampling the image, by passing in one of
// the NSImageInterpolation... constants that are defined in
// NSGraphicsContext.h. The first form of this initializer simply calls the
// second form with imageInterpolation set to NSImageInterpolationHigh, which
// produces highly smoothed thumbnails.
- initWithThumbnailsOfImage:(NSImage*)image;
- initWithThumbnailsOfImage:(NSImage*)image usingImageInterpolation:(NSImageInterpolation)imageInterpolation;
// Writes the icon family to an .icns file.
- (BOOL) writeToFile:(NSString*)path;
// Sets the image data for one of the icon family's elements from an
// NSBitmapImageRep. The "elementType" parameter must be one of the icon
// family element types listed below, and the format of the "bitmapImageRep"
// must match the corresponding requirements specified below. Regardless of
// the elementType, the bitmapImageRep must also be non-planar and have 8 bits
// per sample.
//
// elementType dimensions format
// ------------------- ---------- ---------------------------------------
// kIconServices512PixelDataARGB 512 x 512 32-bit RGBA, 32-bit RGB, or 24-bit RGB
// kIconServices256PixelDataARGB 256 x 256 32-bit RGBA, 32-bit RGB, or 24-bit RGB
// kThumbnail32BitData 128 x 128 32-bit RGBA, 32-bit RGB, or 24-bit RGB
// kThumbnail8BitMask 128 x 128 32-bit RGBA or 8-bit intensity
// kLarge32BitData 32 x 32 32-bit RGBA, 32-bit RGB, or 24-bit RGB
// kLarge8BitMask 32 x 32 32-bit RGBA or 8-bit intensity
// kLarge1BitMask 32 x 32 32-bit RGBA, 8-bit intensity, or 1-bit
// kSmall32BitData 16 x 16 32-bit RGBA, 32-bit RGB, or 24-bit RGB
// kSmall8BitMask 16 x 16 32-bit RGBA or 8-bit intensity
// kSmall1BitMask 16 x 16 32-bit RGBA, 8-bit intensity, or 1-bit
//
// When an RGBA image is supplied to set a "Mask" element, the mask data is
// taken from the image's alpha channel.
//
// NOTE: Setting an IconFamily's kLarge1BitMask seems to damage the IconFamily
// for some as yet unknown reason. (If you then assign the icon family
// as a file's custom icon using -setAsCustomIconForFile:, the custom
// icon doesn't appear for the file in the Finder.) However, both
// custom icon display and mouse-click hit-testing in the Finder seem to
// work fine when we only set the other four elements (thus keeping the
// existing kLarge1BitMask from the valid icon family from which we
// initialized the IconFamily via -initWithContentsOfFile:, since
// IconFamily's -init method is currently broken...), so it seems safe
// to just leave the kLarge1BitMask alone.
- (BOOL) setIconFamilyElement:(OSType)elementType
fromBitmapImageRep:(NSBitmapImageRep*)bitmapImageRep;
// Gets the image data for one of the icon family's elements as a new, 32-bit
// RGBA NSBitmapImageRep. The specified elementType should be one of
// kIconServices512PixelDataARGB, kIconServices256PixelDataARGB,
// kThumbnail32BitData, kLarge32BitData, or kSmall32BitData.
//
// The returned NSBitmapImageRep will have the corresponding 8-bit mask data
// in its alpha channel, or a fully opaque alpha channel if the icon family
// has no 8-bit mask data for the specified alpha channel.
//
// Returns nil if the requested element cannot be retrieved (e.g. if the
// icon family has no such 32BitData element).
- (NSBitmapImageRep*) bitmapImageRepWithAlphaForIconFamilyElement:(OSType)elementType;
// Creates and returns an NSImage that contains the icon family's various
// elements as its NSImageReps.
- (NSImage*) imageWithAllReps;
// NOTE: Planned method -- not yet implemented.
//
// Gets the image data for one of the icon family's elements as a new
// NSBitmapImageRep. The specified elementType should be one of
// kThumbnail32BitData, kThumbnail8BitMask, kLarge32BitData, kLarge8BitMask,
// kLarge1BitMask, kSmall32BitData, kSmall8BitMask, or kSmall1BitMask.
// - (NSBitmapImageRep*) bitmapImageRepForIconFamilyElement:(OSType)elementType;
// Writes the icon family to the resource fork of the specified file as its
// kCustomIconResource, and sets the necessary Finder bits so the icon will
// be displayed for the file in Finder views.
- (BOOL) setAsCustomIconForFile:(NSString*)path;
- (BOOL) setAsCustomIconForFile:(NSString*)path withCompatibility:(BOOL)compat;
// Same as the -setAsCustomIconForFile:... methods, but for folders (directories).
- (BOOL) setAsCustomIconForDirectory:(NSString*)path;
- (BOOL) setAsCustomIconForDirectory:(NSString*)path withCompatibility:(BOOL)compat;
// Removes the custom icon (if any) from the specified file's resource fork,
// and clears the necessary Finder bits for the file. (Note that this is a
// class method, so you don't need an instance of IconFamily to invoke it.)
+ (BOOL) removeCustomIconFromFile:(NSString*)path;
@end
// Methods for interfacing with the Carbon Scrap Manager (analogous to and
// interoperable with the Cocoa Pasteboard).
@interface IconFamily (ScrapAdditions)
+ (BOOL) canInitWithScrap;
+ (IconFamily*) iconFamilyWithScrap;
- initWithScrap;
- (BOOL) putOnScrap;
@end
File diff suppressed because it is too large Load Diff
+16
View File
@@ -0,0 +1,16 @@
CFLAGS = -fpascal-strings -O2
.PHONY: clean dist
makeicns: makeicns.o IconFamily.o NSString+CarbonFSRefCreation.o
g++ -o makeicns $^ -O2 \
-framework Foundation -framework AppKit -framework Carbon
clean:
rm -rf makeicns.o IconFamily.o NSString+CarbonFSRefCreation.o
dist: makeicns
rm -rf makeicns-1.0.zip
zip makeicns-1.0.zip Makefile makeicns.m IconFamily.m IconFamily.h \
NSString+CarbonFSRefCreation.m NSString+CarbonFSRefCreation.h \
makeicns
@@ -0,0 +1,25 @@
/*
Copyright (c) 2001-2006 Troy N. Stephens
Use and distribution of this source code is governed by the MIT License, whose terms are as follows.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#import <Foundation/Foundation.h>
#import <Carbon/Carbon.h>
@interface NSString (CarbonFSRefCreation)
// Fills in the given FSRef struct so it specifies the file whose path is in this string.
// If the file doesn't exist, and "createFile" is YES, this method will attempt to create
// an empty file with the specified path. (The caller should insure that the directory
// the file is to be placed in already exists.)
- (BOOL) getFSRef:(FSRef*)fsRef createFileIfNecessary:(BOOL)createFile;
@end
@@ -0,0 +1,58 @@
/*
Copyright (c) 2001-2006 Troy N. Stephens
Use and distribution of this source code is governed by the MIT License, whose terms are as follows.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#import "NSString+CarbonFSRefCreation.h"
@implementation NSString (CarbonFSRefCreation)
- (BOOL) getFSRef:(FSRef*)fsRef createFileIfNecessary:(BOOL)createFile
{
NSFileManager* fileManager = [NSFileManager defaultManager];
CFURLRef urlRef;
Boolean gotFSRef;
// Check whether the file exists already. If not, create an empty file if requested.
if (![fileManager fileExistsAtPath:self]) {
if (createFile) {
if (![@"" writeToFile:self atomically:YES]) {
return NO;
}
} else {
return NO;
}
}
// Create a CFURL with the specified POSIX path.
urlRef = CFURLCreateWithFileSystemPath( kCFAllocatorDefault,
(CFStringRef) self,
kCFURLPOSIXPathStyle,
FALSE /* isDirectory */ );
if (urlRef == NULL) {
// printf( "** Couldn't make a CFURLRef for the file.\n" );
return NO;
}
// Try to create an FSRef from the URL. (If the specified file doesn't exist, this
// function will return false, but if we've reached this code we've already insured
// that the file exists.)
gotFSRef = CFURLGetFSRef( urlRef, fsRef );
CFRelease( urlRef );
if (!gotFSRef) {
// printf( "** Couldn't get an FSRef for the file.\n" );
return NO;
}
return YES;
}
@end
+173
View File
@@ -0,0 +1,173 @@
// makeicns
// Converts images to Apple's icns format.
// Written by nicolasweber@gmx.de, released under MIT license.
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
#import <Cocoa/Cocoa.h>
#include "IconFamily.h"
#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4
// This is defined in 10.5 and beyond in IconStorage.h
enum {
kIconServices512PixelDataARGB = 'ic09' /* non-premultiplied 512x512 ARGB bitmap*/
};
#endif
#define VERSION "1.0 (20081122)"
void usage() {
fprintf(stderr,
"makeicns v%s\n\n", VERSION);
fprintf(stderr,
"Usage: makeicns [k1=v1] [k2=v2] ...\n\n");
fprintf(stderr,
"Keys and values include:\n");
fprintf(stderr,
" 512: Name of input image for 512x512 variant of icon\n");
fprintf(stderr,
" 256: Name of input image for 256x256 variant of icon\n");
fprintf(stderr,
" 128: Name of input image for 128x128 variant of icon\n");
fprintf(stderr,
" 32: Name of input image for 32x32 variant of icon\n");
fprintf(stderr,
" 16: Name of input image for 16x16 variant of icon\n");
fprintf(stderr,
" in: Name of input image for all variants not having an explicit name\n");
fprintf(stderr,
" out: Name of output file, defaults to first nonempty input name,\n"
" but with icns extension\n\n");
fprintf(stderr,
"Examples:\n\n"
" icns -512 image.png -32 image.png\n"
" Creates image.icns with only a 512x512 and a 32x32 variant.\n\n"
" icns -in myfile.jpg -32 otherfile.png -out outfile.icns\n"
" Creates outfile.icns with sizes 512, 256, 128, and 16 containing data\n"
" from myfile.jpg and with size 32 containing data from otherfile.png.\n");
exit(1);
}
NSBitmapImageRep* getBitmapImageRepOfSize(NSImage* img, int size) {
// Don't resample if it's not necessary
#if 0
// IconFamily does not work correctly with
// NSAlphaNonpremultipliedBitmapFormat images, so this has to stay disabled
// until IconFamily is fixed (if ever).
NSEnumerator* e = [[img representations] objectEnumerator];
NSImageRep* ir;
while ((ir = [e nextObject])) {
if (![ir isKindOfClass:[NSBitmapImageRep class]]) continue;
NSBitmapImageRep* br = (NSBitmapImageRep*)ir;
//NSLog(@"%@", br);
if ([br pixelsWide] == size && [br pixelsHigh] == size
&& ([[br colorSpaceName] isEqualToString:NSDeviceRGBColorSpace]
|| [[br colorSpaceName] isEqualToString:NSCalibratedRGBColorSpace])
&& ([br bitsPerPixel] == 24 || [br bitsPerPixel] == 32)
)
return br;
}
#endif
NSLog(@"Resampling for size %d", size);
NSBitmapImageRep* r = [[NSBitmapImageRep alloc]
initWithBitmapDataPlanes:NULL
pixelsWide:size
pixelsHigh:size
bitsPerSample:8
samplesPerPixel:4
hasAlpha:YES
isPlanar:NO
colorSpaceName:NSDeviceRGBColorSpace
bitmapFormat:0
bytesPerRow:0
bitsPerPixel:0];
[NSGraphicsContext saveGraphicsState];
NSGraphicsContext* context = [NSGraphicsContext
graphicsContextWithBitmapImageRep:r];
[context setShouldAntialias:YES];
[context setImageInterpolation:NSImageInterpolationHigh];
[NSGraphicsContext setCurrentContext:context];
[img drawInRect:NSMakeRect(0, 0, size, size)
fromRect:NSZeroRect
operation:NSCompositeCopy
fraction:1.0];
[NSGraphicsContext restoreGraphicsState];
return r;
}
int main(int argc, char* argv[]) {
int i;
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSApplicationLoad();
struct {
NSString* paramName;
OSType type, mask;
int size;
NSString* inputName;
} inputs[] = {
{ @"512", kIconServices512PixelDataARGB, 0, 512, nil },
{ @"256", kIconServices256PixelDataARGB, 0, 256, nil },
{ @"128", kThumbnail32BitData, kThumbnail8BitMask, 128, nil },
{ @"32", kLarge32BitData, kLarge8BitMask, 32, nil },
{ @"16", kSmall32BitData, kSmall8BitMask, 16, nil },
};
const int N = sizeof(inputs)/sizeof(inputs[0]);
// Process arguments -- Thanks Greg!
//http://unixjunkie.blogspot.com/2006/07/command-line-processing-in-cocoa.html
NSUserDefaults* args = [NSUserDefaults standardUserDefaults];
BOOL foundInputParam = NO;
NSString* outputName = [args stringForKey:@"out"];
NSString* defaultIn = [args stringForKey:@"in"];
for (i = 0; i < N; ++i) {
inputs[i].inputName = [args stringForKey:inputs[i].paramName];
if (inputs[i].inputName == nil)
inputs[i].inputName = defaultIn;
foundInputParam = foundInputParam || inputs[i].inputName != nil;
// Create default output name if necessary
if (outputName == nil && inputs[i].inputName != nil)
outputName = [[inputs[i].inputName stringByDeletingPathExtension]
stringByAppendingPathExtension:@"icns"];
}
if (!foundInputParam)
usage();
// Create output
IconFamily* output = [IconFamily iconFamily];
for (i = 0; i < N; ++i) {
if (inputs[i].inputName == nil) continue;
NSImage* img = [[[NSImage alloc] initWithContentsOfFile:inputs[i].inputName]
autorelease];
NSBitmapImageRep* rep = getBitmapImageRepOfSize(img, inputs[i].size);
[output setIconFamilyElement:inputs[i].type fromBitmapImageRep:rep];
if (inputs[i].mask != 0)
[output setIconFamilyElement:inputs[i].mask fromBitmapImageRep:rep];
}
// Write output
if ([output writeToFile:outputName])
NSLog(@"Wrote output file \"%@\"", outputName);
else
NSLog(@"Failed to write \"%@\"", outputName);
[pool drain];
return 0;
}
+5
View File
@@ -0,0 +1,5 @@
from distutils.core import setup, Extension
setup(name="loadfont", version="1.0",
ext_modules = [Extension("loadfont", ["loadfont.c"])])
Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

+176 -20
View File
@@ -41,37 +41,193 @@
-->
<item>
<title>Snapshot 38 released</title>
<title>Snapshot 46 released</title>
<description><![CDATA[
<h1>MacVim snapshot 38 released</h1>
<h1>MacVim snapshot 46 released</h1>
<p> Snapshot 37 had a problem with the "Login shell" option, so I've built a new snapshot containing a fix (by Ben Schmidt).</p>
<p> Changes since snapshot 37:
<p> Changes since snapshot 45:
<ul>
<li> Dropping multiple files on a window no longer results in an error </li>
<li> Fix "Login shell" problems (Ben Schmidt) </li>
<li> Exit Vim process if connection becomes invalid -- this should avoid the system log filling up with error messages, but please let me know when it happens (and send me the output from Console.app) </li>
<li> Markdown (Nico Weber) and reStructuredText (Travis Jeffery) are supported file types </li>
<li> The forever bouncing Dock icon bug should now really really be fixed (Kazuki Sakamoto) </li>
<li> Fixed bug when file name contained decomposed UTF8 characters </li>
<li> Quick Look should work for most/all supported filetypes now (although the preview is simple text and is not syntax highlighted) </li>
<li> Update the help file </li>
<li> 'guifontwide' is updated on Cmd-+/Cmd-- </li>
<li> The titles of the next/previous tab menu items now match other apps </li>
<li> Add NetBeans support (Kazuki Sakamoto) </li>
<li> Add simple logging facility </li>
<li> Update to latest Vim patches and runtime files </li>
</ul>
</p>
]]></description>
<pubDate>Sat, 21 Nov 2008 16:26 CET</pubDate>
<pubDate>Fri, 10 Jul 2009 23:50 CET</pubDate>
<enclosure type="application/octet-stream"
url="http://newmacvim.muskokamug.org/mirror/files/MacVim-snapshot-38.tbz"
length="8007082"
sparkle:version="38"
url="http://newmacvim.muskokamug.org/mirror/files/MacVim-snapshot-46.tbz"
length="8198862"
sparkle:version="46"
sparkle:shortVersionString="7.2"
/>
</item>
<item>
<title>Snapshot 37 released</title>
<title>Snapshot 45 released</title>
<description><![CDATA[
<h1>MacVim snapshot 37 released</h1>
<h1>MacVim snapshot 45 released</h1>
<p> Changes since snapshot 36:
<p> Changes since snapshot 44:
<ul>
<li> The toolbar is not hidden by default again (if you prefer having the toolbar hidden, then add the line "set go-=T" to your ~/.gvimrc file) </li>
<li> The ATSUI renderer honors the 'guisp' highlighting color </li>
<li> Fix the forever bouncing Dock icon bug (Kazuki Sakamoto) </li>
<li> Add the "Show Hidden Files" checkbox button to the Save dialog whenever the file browser is expanded </li>
<li> Frontend refactoring </li>
</ul>
</p>
]]></description>
<pubDate>Mon, 13 Apr 2009 19:19 CET</pubDate>
<enclosure type="application/octet-stream"
url="http://newmacvim.muskokamug.org/mirror/files/MacVim-snapshot-45.tbz"
length="8135831"
sparkle:version="45"
sparkle:shortVersionString="7.2"
/>
</item>
<item>
<title>Snapshot 44 released</title>
<description><![CDATA[
<h1>MacVim snapshot 44 released</h1>
<p> Changes since snapshot 43:
<ul>
<li> The color table had many erroneous entries which have been corrected (Zvezdan Petkovic) </li>
<li> Ctrl+tab works again </li>
<li> Tab labels only show file tail by default to make them more legible (reset to default by adding "set guitablabel&" to .gvimrc) </li>
<li> The number of columns does not change on ":set go+=rT" </li>
<li> Fixed problems with view not maximizing when entering full-screen and the Dock was visible </li>
<li> Fix various problems related to having windows on a screen that got unplugged (fixes Issue 162) </li>
<li> Latest source code version and runtime files (e.g. the Python syntax file is fixed, fixes Issue 160) </li>
</ul>
</p>
]]></description>
<pubDate>Sun, 29 Mar 2009 16:56 CET</pubDate>
<enclosure type="application/octet-stream"
url="http://newmacvim.muskokamug.org/mirror/files/MacVim-snapshot-44.tbz"
length="8139075"
sparkle:version="44"
sparkle:shortVersionString="7.2"
/>
</item>
<item>
<title>Snapshot 43 released</title>
<description><![CDATA[
<h1>MacVim snapshot 43 released</h1>
<p><b>The automatic updating feature is broken in snapshots 39 and 40. If the automatic updating never finishes extracting then you are affected by this bug and will have to upgrade manually. To do so, simply go to the <a href="http://code.google.com/p/macvim/wiki/Snapshot">Snapshot page</a> to download the latest version.</b></p>
<p> Changes since snapshot 42:
<ul>
<li> Do inclusive search when opening files (Jonathon Mah) </li>
<li> Respect layout prefs when double-clicking an already open file </li>
<li> Fix two minor memory leaks </li>
<li> Ctrl-] works on German keyboard layout </li>
<li> The .viminfo file is written on Cmd-q </li>
<li> New 16x16 icons (Nico Weber) </li>
<li> Untitled window again opens on reopen event if requested in prefs </li>
<li> Fork earlier; fixes bug with 'autochdir', faster startup, "f" no longer supported in 'guioptions' </li>
<li> Some other minor bug fixes </li>
<li> Use latest runtime files and Vim patches </li>
</ul>
</p>
]]></description>
<pubDate>Fri, 20 Feb 2009 13:49 CET</pubDate>
<enclosure type="application/octet-stream"
url="http://newmacvim.muskokamug.org/mirror/files/MacVim-snapshot-43.tbz"
length="8136440"
sparkle:version="43"
sparkle:shortVersionString="7.2"
/>
</item>
<item>
<title>Snapshot 42 released</title>
<description><![CDATA[
<h1>MacVim snapshot 42 released</h1>
<p><b>The automatic updating feature is broken in snapshots 39 and 40. If the automatic updating never finishes extracting then you are affected by this bug and will have to upgrade manually. To do so, simply go to the <a href="http://code.google.com/p/macvim/wiki/Snapshot">Snapshot page</a> to download the latest version.</b></p>
<p> Changes since snapshot 40:
<ul>
<li> The menu bar behaves better when using full-screen and switching Spaces (Nico Weber) </li>
<li> Don't switch Spaces when using "mvim" on one Space and a MacVim window is open on another Space </li>
<li> Add user default to toggle the "add tab" button on the tabline (to disable, enter "defaults org.vim.MacVim MMShowAddTabButton 0" in Terminal) </li>
<li> Avoid the "Press ENTER..." prompt when dragging and dropping </li>
<li> Faster startup (and shutdown, but you're not likely to notice that unless you are me ;-) </li>
<li> Automatic updating works again </li>
<li> Possible to interrupt external commands (e.g. you can Ctrl-C during a lenghty :grep now) </li>
<li> The output from external commands is displayed "interactively" (i.e. you don't have to wait for the command to finish before any output is drawn; try ":!ls -l /usr/lib" and compare with snap 40 to see what I mean) </li>
<li> Cmd-. sends SIGINT (so that if a Vim process is stuck you should always be able to interrupt it with Cmd-. even if Ctrl-C doesn't work) </li>
<li> Fix crashing bug: e.g. with snap 40 if you go to the src/ folder of Vim and type ":grep a *.c" MacVim would crash </li>
<li> Toggle loading of default font with user default MMLoadDefaultFont </li>
</ul>
</p>
]]></description>
<pubDate>Sat, 12 Jan 2009 16:12 CET</pubDate>
<enclosure type="application/octet-stream"
url="http://newmacvim.muskokamug.org/mirror/files/MacVim-snapshot-42.tbz"
length="8131516"
sparkle:version="42"
sparkle:shortVersionString="7.2"
/>
</item>
<item>
<title>Snapshot 40 released</title>
<description><![CDATA[
<h1>MacVim snapshot 40 released</h1>
<p> Changes since snapshot 39:
<ul>
<li> Fix problems with Quickstart "leaking" Vim processes </li>
<li> 'imdisable' now on by default (i.e. IM is disabled by default) </li>
<li> Clipboard support in non-GUI mode (Kent Sibilev) </li>
<li> New document icons, more filetype associations (Nico Weber) </li>
<li> Add support for 'guitabtooltip' (hint: add the line "set gtl=%t gtt=%F" to your .gvimrc to make tabs display the name of the file and have the tooltip display the full path) (Jonathon Mah) </li>
<li> Look for toolbar icons in runtime path (plugins such as TVO now display toolbar icons properly) </li>
<li> Show dialog when clicking to close tab with modified buffers </li>
<li> Update documentation </li>
<li> Latest runtime files, and Vim patches </li>
</ul>
</p>
]]></description>
<pubDate>Sun, 28 Dec 2008 17:26 CET</pubDate>
<enclosure type="application/octet-stream"
url="http://newmacvim.muskokamug.org/mirror/files/MacVim-snapshot-40.tbz"
length="8138981"
sparkle:version="40"
sparkle:shortVersionString="7.2"
/>
</item>
<item>
<title>Snapshot 39 released</title>
<description><![CDATA[
<h1>MacVim snapshot 39 released</h1>
<p> Changes since snapshot 36 (snapshots 37 and 38 were skipped):
<ul>
<li> Avoid "Stray process..." warning messages (Ben Schmidt) </li>
<li> Add Cmd-BackSpace and Alt-BackSpace insert mode mappings (Nico Weber) </li>
<li> Dropping multiple files on a window no longer results in an error </li>
<li> Fix "Login shell" problems (Ben Schmidt) </li>
<li> Exit Vim process if connection becomes invalid -- this should avoid the system log filling up with error messages, but please let me know when it happens (and send me the output from Console.app) </li>
<li> Fix bug where Vim would crash when resizing a window with double-width characters </li>
<li> Add option 'macmeta' to use "alt/option" as meta key to allow bindings to &lt;M-..&gt; (see ":h 'macmeta') </li>
<li> Add basic support for AppleScript (Jason Foreman). E.g. to zoom a window:
@@ -91,15 +247,15 @@ end tell
<li> Tentative support for receiving input from system services (Try this: insert "2+3", select the text, then hit Cmd-*. Result: "2+3" is replaced with "5". Sometimes it seems you have to choose "MacVim-&gt;Services-&gt;Script Editor-&gt;Get Result of AppleScript" instead of pressing Cmd-* for this to work.) </li>
<li> No more Vim zombie processes </li>
<li> Add "Reload"/"Ignore All" buttons to the file changed dialog </li>
<li> (Almost) Latest runtime files, and Vim patches </li>
<li> Latest runtime files, and Vim patches </li>
</ul>
</p>
]]></description>
<pubDate>Sat, 15 Nov 2008 13:04 CET</pubDate>
<pubDate>Sun, 23 Nov 2008 18:09 CET</pubDate>
<enclosure type="application/octet-stream"
url="http://newmacvim.muskokamug.org/mirror/files/MacVim-snapshot-37.tbz"
length="8007921"
sparkle:version="37"
url="http://newmacvim.muskokamug.org/mirror/files/MacVim-snapshot-39.tbz"
length="8012682"
sparkle:version="39"
sparkle:shortVersionString="7.2"
/>
</item>
+26
View File
@@ -115,8 +115,21 @@ ifndef MZSCHEME_VER
MZSCHEME_VER=205_000
endif
ifndef MZSCHEME_PRECISE_GC
MZSCHEME_PRECISE_GC=no
endif
# for version 4.x we need to generate byte-code for Scheme base
ifndef MZSCHEME_GENERATE_BASE
MZSCHEME_GENERATE_BASE=no
endif
ifeq (no,$(DYNAMIC_MZSCHEME))
ifeq (yes,$(MZSCHEME_PRECISE_GC))
MZSCHEME_LIB=-lmzsch$(MZSCHEME_VER)
else
MZSCHEME_LIB = -lmzsch$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER)
endif
# the modern MinGW can dynamically link to dlls directly.
# point MZSCHEME_DLLS to where you put libmzschXXXXXXX.dll and libgcXXXXXXX.dll
ifndef MZSCHEME_DLLS
@@ -410,6 +423,13 @@ endif
ifdef MZSCHEME
OBJ += $(OUTDIR)/if_mzsch.o
MZSCHEME_INCL = if_mzsch.h
ifeq (yes,$(MZSCHEME_GENERATE_BASE))
CFLAGS += -DINCLUDE_MZSCHEME_BASE
MZ_EXTRA_DEP += mzscheme_base.c
endif
ifeq (yes,$(MZSCHEME_PRECISE_GC))
CFLAGS += -DMZ_PRECISE_GC
endif
endif
ifdef PYTHON
OBJ += $(OUTDIR)/if_python.o
@@ -588,6 +608,12 @@ if_perl.c: if_perl.xs typemap
$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_INCL) $(NBDEBUG_SRC)
$(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o
$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) if_mzsch.h $(MZ_EXTRA_DEP)
$(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o
mzscheme_base.c:
$(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base
pathdef.c: $(INCL)
ifneq (sh.exe, $(SHELL))
@echo creating pathdef.c
+40 -9
View File
@@ -1,18 +1,18 @@
# Makefile for Vim on Win32 (Windows NT/2000/XP/2003 and Windows 95/98/Me)
# and Win64, using the Microsoft Visual C++ compilers. Known to work with
# VC5, VC6 (VS98), VC7.0 (VS2002), VC7.1 (VS2003), VC8 (VS2005),
# and VC9 (VS2008).
# VC9 (VS2008), and VC10 (VS2010).
#
# To build using other Windows compilers, see INSTALLpc.txt
#
# This makefile can build the console, GUI, OLE-enable, Perl-enabled and
# Python-enabled versions of vim for Win32 platforms.
# Python-enabled versions of Vim for Win32 platforms.
#
# The basic command line to build vim is:
# The basic command line to build Vim is:
#
# nmake -f Make_mvc.mak
#
# This will build the console version of vim with no additional interfaces.
# This will build the console version of Vim with no additional interfaces.
# To add features, define any of the following:
#
# !!!! After changing features do "nmake clean" first !!!!
@@ -34,6 +34,7 @@
# MZSCHEME=[Path to MzScheme directory]
# DYNAMIC_MZSCHEME=yes (to load the MzScheme DLLs dynamically)
# MZSCHEME_VER=[version, 205_000, ...]
# MZSCHEME_DEBUG=no
#
# Perl interface:
# PERL=[Path to Perl directory]
@@ -354,6 +355,12 @@ MSVCVER = 9.0
!if "$(_NMAKE_VER)" == "9.00.21022.08"
MSVCVER = 9.0
!endif
!if "$(_NMAKE_VER)" == "9.00.30729.01"
MSVCVER = 9.0
!endif
!if "$(_NMAKE_VER)" == "10.00.20506.01"
MSVCVER = 10.0
!endif
!endif
# Abort bulding VIM if version of VC is unrecognised.
@@ -368,7 +375,7 @@ MSVCVER = 9.0
!endif
# Convert processor ID to MVC-compatible number
!if ("$(MSVCVER)" != "8.0") && ("$(MSVCVER)" != "9.0")
!if ("$(MSVCVER)" != "8.0") && ("$(MSVCVER)" != "9.0") && ("$(MSVCVER)" != "10.0")
!if "$(CPUNR)" == "i386"
CPUARG = /G3
!elseif "$(CPUNR)" == "i486"
@@ -401,7 +408,7 @@ OPTFLAG = /O2
!else # MAXSPEED
OPTFLAG = /Ox
!endif
!if ("$(MSVCVER)" == "8.0") || ("$(MSVCVER)" == "9.0")
!if ("$(MSVCVER)" == "8.0") || ("$(MSVCVER)" == "9.0") || ("$(MSVCVER)" == "10.0")
# Use link time code generation if not worried about size
!if "$(OPTIMIZE)" != "SPACE"
OPTFLAG = $(OPTFLAG) /GL
@@ -618,15 +625,37 @@ PYTHON_LIB = $(PYTHON)\libs\python$(PYTHON_VER).lib
MZSCHEME_VER = 205_000
!endif
CFLAGS = $(CFLAGS) -DFEAT_MZSCHEME -I $(MZSCHEME)\include
!if EXIST("$(MZSCHEME)\collects\scheme\base.ss")
# for MzScheme 4.x we need to include byte code for basic Scheme stuff
MZSCHEME_EXTRA_DEP = mzscheme_base.c
CFLAGS = $(CFLAGS) -DINCLUDE_MZSCHEME_BASE
!endif
!if EXIST("$(MZSCHEME)\lib\msvc\libmzsch$(MZSCHEME_VER).lib") \
&& !EXIST("$(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib")
!message Building with Precise GC
MZSCHEME_PRECISE_GC = yes
CFLAGS = $(CFLAGS) -DMZ_PRECISE_GC
!endif
!if "$(DYNAMIC_MZSCHEME)" == "yes"
!if "$(MZSCHEME_PRECISE_GC)" == "yes"
!error MzScheme with Precise GC cannot be loaded dynamically
!endif
!message MzScheme DLLs will be loaded dynamically
CFLAGS = $(CFLAGS) -DDYNAMIC_MZSCHEME \
-DDYNAMIC_MZSCH_DLL=\"libmzsch$(MZSCHEME_VER).dll\" \
-DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
!else
!if "$(MZSCHEME_DEBUG)" == "yes"
CFLAGS = $(CFLAGS) -DMZSCHEME_FORCE_GC
!endif
!if "$(MZSCHEME_PRECISE_GC)" == "yes"
# Precise GC does not use separate dll
MZSCHEME_LIB = $(MZSCHEME)\lib\msvc\libmzsch$(MZSCHEME_VER).lib
!else
MZSCHEME_LIB = $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib \
$(MZSCHEME)\lib\msvc\libmzsch$(MZSCHEME_VER).lib
!endif
!endif
MZSCHEME_OBJ = $(OUTDIR)\if_mzsch.obj
!endif
@@ -767,7 +796,7 @@ LINKARGS2 = $(CON_LIB) $(GUI_LIB) $(LIBC) $(OLE_LIB) user32.lib $(SNIFF_LIB) \
# Report link time code generation progress if used.
!ifdef NODEBUG
!if ("$(MSVCVER)" == "8.0") || ("$(MSVCVER)" == "9.0")
!if ("$(MSVCVER)" == "8.0") || ("$(MSVCVER)" == "9.0") || ("$(MSVCVER)" == "10.0")
!if "$(OPTIMIZE)" != "SPACE"
LINKARGS1 = $(LINKARGS1) /LTCG:STATUS
!endif
@@ -927,9 +956,11 @@ $(OUTDIR)/if_perl.obj: $(OUTDIR) if_perl.c $(INCL)
$(OUTDIR)/if_perlsfio.obj: $(OUTDIR) if_perlsfio.c $(INCL)
$(CC) $(CFLAGS) $(PERL_INC) if_perlsfio.c
$(OUTDIR)/if_mzsch.obj: $(OUTDIR) if_mzsch.c $(INCL)
$(OUTDIR)/if_mzsch.obj: $(OUTDIR) if_mzsch.c $(INCL) $(MZSCHEME_EXTRA_DEP)
$(CC) $(CFLAGS) if_mzsch.c \
-DMZSCHEME_COLLECTS=\"$(MZSCHEME:\=\\)\\collects\"
mzscheme_base.c:
$(MZSCHEME)\mzc --c-mods mzscheme_base.c ++lib scheme/base
$(OUTDIR)/if_python.obj: $(OUTDIR) if_python.c $(INCL)
$(CC) $(CFLAGS) $(PYTHON_INC) if_python.c
@@ -1009,7 +1040,7 @@ $(OUTDIR)/window.obj: $(OUTDIR) window.c $(INCL)
$(OUTDIR)/xpm_w32.obj: $(OUTDIR) xpm_w32.c
$(CC) $(CFLAGS) $(XPM_INC) xpm_w32.c
$(OUTDIR)/vim.res: $(OUTDIR) vim.rc version.h tools.bmp tearoff.bmp \
$(OUTDIR)/vim.res: $(OUTDIR) vim.rc gvim.exe.mnf version.h tools.bmp tearoff.bmp \
vim.ico vim_error.ico vim_alert.ico vim_info.ico vim_quest.ico
$(RC) /l 0x409 /Fo$(OUTDIR)/vim.res $(RCFLAGS) vim.rc
+31 -14
View File
@@ -105,8 +105,8 @@
# 4. "make test" {{{1
# This is optional. This will run Vim scripts on a number of test
# files, and compare the produced output with the expected output.
# If all is well, you will get the "ALL DONE" message in the end. See
# below (search for "/^test").
# If all is well, you will get the "ALL DONE" message in the end. If a
# test fails you get "TEST FAILURE". See below (search for "/^test").
#
# 5. "make install" {{{1
# If the new Vim seems to be working OK you can install it and the
@@ -533,6 +533,11 @@ CClink = $(CC)
#CFLAGS = -g -DDEBUG -Wall -Wshadow -Wmissing-prototypes
#CFLAGS = -g -O2 '-DSTARTUPTIME="vimstartup"' -fno-strength-reduce -Wall -Wmissing-prototypes
# Use this with GCC to check for mistakes, unused arguments, etc.
#CFLAGS = -g -Wall -Wextra -Wmissing-prototypes -Wunreachable-code
#PYTHON_CFLAGS_EXTRA = -Wno-missing-field-initializers
#MZSCHEME_CFLAGS_EXTRA = -Wno-unreachable-code -Wno-unused-parameter
# EFENCE - Electric-Fence malloc debugging: catches memory accesses beyond
# allocated memory (and makes every malloc()/free() very slow).
# Electric Fence is free (search ftp sites).
@@ -551,7 +556,13 @@ CClink = $(CC)
# }}}
# LINT - for running lint
# For standard Unix lint
LINT = lint
LINT_OPTIONS = -beprxzF
# For splint
# It doesn't work well, crashes on include files and non-ascii characters.
#LINT = splint
#LINT_OPTIONS = +unixlib -weak -macrovarprefixexclude -showfunc -linelen 9999
# PROFILING - Uncomment the next two lines to do profiling with gcc and gprof.
# Might not work with GUI or Perl.
@@ -1275,16 +1286,16 @@ CPP_DEPEND = $(CC) -I$(srcdir) -M$(CPP_MM) \
# This is for cproto 3 patchlevel 8 or below
# __inline, __attribute__ and __extension__ are not recognized by cproto
# G_IMPLEMENT_INLINES is to avoid functions defined in glib/gutils.h.
NO_ATTR = -D__inline= -D__inline__= -DG_IMPLEMENT_INLINES \
-D"__attribute__\\(x\\)=" -D"__asm__\\(x\\)=" \
-D__extension__= -D__restrict="" \
-D__gnuc_va_list=char -D__builtin_va_list=char
#NO_ATTR = -D__inline= -D__inline__= -DG_IMPLEMENT_INLINES \
# -D"__attribute__\\(x\\)=" -D"__asm__\\(x\\)=" \
# -D__extension__= -D__restrict="" \
# -D__gnuc_va_list=char -D__builtin_va_list=char
#
# This is for cproto 3 patchlevel 9 or above (currently 4.6)
# This is for cproto 3 patchlevel 9 or above (currently 4.6, 4.7g)
# __inline and __attribute__ are now recognized by cproto
# -D"foo()=" is not supported by all compilers so do not use it
# NO_ATTR=
NO_ATTR=
#
# maybe the "/usr/bin/cc -E" has to be adjusted for some systems
# This is for cproto 3.5 patchlevel 3:
@@ -1448,6 +1459,7 @@ LINT_SRC = $(BASIC_SRC) $(GUI_SRC) $(HANGULIN_SRC) $(PYTHON_SRC) $(TCL_SRC) \
$(SNIFF_SRC) $(WORKSHOP_SRC) $(WSDEBUG_SRC) $(NETBEANS_SRC)
#LINT_SRC = $(SRC)
#LINT_SRC = $(ALL_SRC)
#LINT_SRC = $(BASIC_SRC)
OBJ = \
objects/buffer.o \
@@ -1753,7 +1765,8 @@ types.vim: $(TAGS_SRC) $(TAGS_INCL)
# messages. Don't worry about that.
# If there is a real error, there will be a difference between "test.out" and
# a "test99.ok" file.
# If everything is alright, the final message will be "ALL DONE".
# If everything is alright, the final message will be "ALL DONE". If not you
# get "TEST FAILURE".
#
test check:
$(MAKE) -f Makefile $(VIMTARGET)
@@ -2203,6 +2216,7 @@ clean celan: testclean
-rm -f $(TOOLS) auto/osdef.h auto/pathdef.c auto/if_perl.c
-rm -f conftest* *~ auto/link.sed
-rm -rf $(APPDIR)
-rm -rf mzscheme_base.c
if test -d $(PODIR); then \
cd $(PODIR); $(MAKE) prefix=$(DESTDIR)$(prefix) clean; \
fi
@@ -2288,12 +2302,12 @@ depend:
# Run lint. Clean up the *.ln files that are sometimes left behind.
lint:
lint $(LINT_OPTIONS) $(LINT_CFLAGS) $(LINT_EXTRA) $(LINT_SRC)
$(LINT) $(LINT_OPTIONS) $(LINT_CFLAGS) $(LINT_EXTRA) $(LINT_SRC)
-rm -f *.ln
# Check dosinst.c with lint.
lintinstall:
lint $(LINT_OPTIONS) -DWIN32 -DUNIX_LINT dosinst.c
$(LINT) $(LINT_OPTIONS) -DWIN32 -DUNIX_LINT dosinst.c
-rm -f dosinst.ln
###########################################################################
@@ -2445,8 +2459,11 @@ objects/if_cscope.o: if_cscope.c
objects/if_xcmdsrv.o: if_xcmdsrv.c
$(CCC) -o $@ if_xcmdsrv.c
objects/if_mzsch.o: if_mzsch.c
$(CCC) -o $@ if_mzsch.c
objects/if_mzsch.o: if_mzsch.c $(MZSCHEME_EXTRA)
$(CCC) -o $@ $(MZSCHEME_CFLAGS_EXTRA) if_mzsch.c
mzscheme_base.c:
$(MZSCHEME_MZC) --c-mods mzscheme_base.c ++lib scheme/base
objects/if_perl.o: auto/if_perl.c
$(CCC) -o $@ auto/if_perl.c
@@ -2455,7 +2472,7 @@ objects/if_perlsfio.o: if_perlsfio.c
$(CCC) -o $@ if_perlsfio.c
objects/if_python.o: if_python.c
$(CCC) -o $@ if_python.c
$(CCC) -o $@ $(PYTHON_CFLAGS_EXTRA) if_python.c
objects/if_ruby.o: if_ruby.c
$(CCC) -o $@ if_ruby.c
+171 -154
View File
@@ -20,20 +20,21 @@ static char THIS_FILE[] = __FILE__;
static BOOL g_bEnableVim = TRUE; // Vim enabled
static BOOL g_bDevStudioEditor = FALSE; // Open file in Dev Studio editor simultaneously
static BOOL g_bNewTabs = FALSE;
static int g_ChangeDir = CD_NONE; // CD after file open?
static void VimSetEnableState (BOOL bEnableState);
static BOOL VimOpenFile (BSTR& FileName, long LineNr);
static DISPID VimGetDispatchId (COleAutomationControl& VimOle, char* Method);
static void VimErrDiag (COleAutomationControl& VimOle);
static void VimChangeDir (COleAutomationControl& VimOle, DISPID DispatchId, BSTR& FileName);
static void DebugMsg (char* Msg, char* Arg = NULL);
static void VimSetEnableState(BOOL bEnableState);
static BOOL VimOpenFile(BSTR& FileName, long LineNr);
static DISPID VimGetDispatchId(COleAutomationControl& VimOle, char* Method);
static void VimErrDiag(COleAutomationControl& VimOle);
static void VimChangeDir(COleAutomationControl& VimOle, DISPID DispatchId, BSTR& FileName);
static void DebugMsg(char* Msg, char* Arg = NULL);
/////////////////////////////////////////////////////////////////////////////
// CCommands
CCommands::CCommands ()
CCommands::CCommands()
{
// m_pApplication == NULL; M$ Code generation bug!!!
m_pApplication = NULL;
@@ -41,17 +42,17 @@ CCommands::CCommands ()
m_pDebuggerEventsObj = NULL;
}
CCommands::~CCommands ()
CCommands::~CCommands()
{
ASSERT (m_pApplication != NULL);
ASSERT(m_pApplication != NULL);
if (m_pApplication)
{
m_pApplication->Release ();
m_pApplication->Release();
m_pApplication = NULL;
}
}
void CCommands::SetApplicationObject (IApplication * pApplication)
void CCommands::SetApplicationObject(IApplication * pApplication)
{
// This function assumes pApplication has already been AddRef'd
// for us, which CDSAddIn did in it's QueryInterface call
@@ -61,55 +62,57 @@ void CCommands::SetApplicationObject (IApplication * pApplication)
return;
// Create Application event handlers
XApplicationEventsObj::CreateInstance (&m_pApplicationEventsObj);
XApplicationEventsObj::CreateInstance(&m_pApplicationEventsObj);
if (! m_pApplicationEventsObj)
{
ReportInternalError ("XApplicationEventsObj::CreateInstance");
ReportInternalError("XApplicationEventsObj::CreateInstance");
return;
}
m_pApplicationEventsObj->AddRef ();
m_pApplicationEventsObj->Connect (m_pApplication);
m_pApplicationEventsObj->AddRef();
m_pApplicationEventsObj->Connect(m_pApplication);
m_pApplicationEventsObj->m_pCommands = this;
#ifdef NEVER
// Create Debugger event handler
CComPtr < IDispatch > pDebugger;
if (SUCCEEDED (m_pApplication->get_Debugger (&pDebugger))
if (SUCCEEDED(m_pApplication->get_Debugger(&pDebugger))
&& pDebugger != NULL)
{
XDebuggerEventsObj::CreateInstance (&m_pDebuggerEventsObj);
m_pDebuggerEventsObj->AddRef ();
m_pDebuggerEventsObj->Connect (pDebugger);
XDebuggerEventsObj::CreateInstance(&m_pDebuggerEventsObj);
m_pDebuggerEventsObj->AddRef();
m_pDebuggerEventsObj->Connect(pDebugger);
m_pDebuggerEventsObj->m_pCommands = this;
}
#endif
// Get settings from registry HKEY_CURRENT_USER\Software\Vim\VisVim
HKEY hAppKey = GetAppKey ("Vim");
HKEY hAppKey = GetAppKey("Vim");
if (hAppKey)
{
HKEY hSectionKey = GetSectionKey (hAppKey, "VisVim");
HKEY hSectionKey = GetSectionKey(hAppKey, "VisVim");
if (hSectionKey)
{
g_bEnableVim = GetRegistryInt (hSectionKey, "EnableVim",
g_bEnableVim = GetRegistryInt(hSectionKey, "EnableVim",
g_bEnableVim);
g_bDevStudioEditor = GetRegistryInt(hSectionKey,"DevStudioEditor",
g_bDevStudioEditor);
g_ChangeDir = GetRegistryInt (hSectionKey, "ChangeDir",
g_bDevStudioEditor = GetRegistryInt(hSectionKey,
"DevStudioEditor", g_bDevStudioEditor);
g_bNewTabs = GetRegistryInt(hSectionKey, "NewTabs",
g_bNewTabs);
g_ChangeDir = GetRegistryInt(hSectionKey, "ChangeDir",
g_ChangeDir);
RegCloseKey (hSectionKey);
RegCloseKey(hSectionKey);
}
RegCloseKey (hAppKey);
RegCloseKey(hAppKey);
}
}
void CCommands::UnadviseFromEvents ()
void CCommands::UnadviseFromEvents()
{
ASSERT (m_pApplicationEventsObj != NULL);
ASSERT(m_pApplicationEventsObj != NULL);
if (m_pApplicationEventsObj)
{
m_pApplicationEventsObj->Disconnect (m_pApplication);
m_pApplicationEventsObj->Release ();
m_pApplicationEventsObj->Disconnect(m_pApplication);
m_pApplicationEventsObj->Release();
m_pApplicationEventsObj = NULL;
}
@@ -121,10 +124,10 @@ void CCommands::UnadviseFromEvents ()
// unadvise from its events (thus the VERIFY_OK below--see
// stdafx.h).
CComPtr < IDispatch > pDebugger;
VERIFY_OK (m_pApplication->get_Debugger (&pDebugger));
ASSERT (pDebugger != NULL);
m_pDebuggerEventsObj->Disconnect (pDebugger);
m_pDebuggerEventsObj->Release ();
VERIFY_OK(m_pApplication->get_Debugger(&pDebugger));
ASSERT(pDebugger != NULL);
m_pDebuggerEventsObj->Disconnect(pDebugger);
m_pDebuggerEventsObj->Release();
m_pDebuggerEventsObj = NULL;
}
#endif
@@ -136,21 +139,21 @@ void CCommands::UnadviseFromEvents ()
// Application events
HRESULT CCommands::XApplicationEvents::BeforeBuildStart ()
HRESULT CCommands::XApplicationEvents::BeforeBuildStart()
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return S_OK;
}
HRESULT CCommands::XApplicationEvents::BuildFinish (long nNumErrors, long nNumWarnings)
HRESULT CCommands::XApplicationEvents::BuildFinish(long nNumErrors, long nNumWarnings)
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return S_OK;
}
HRESULT CCommands::XApplicationEvents::BeforeApplicationShutDown ()
HRESULT CCommands::XApplicationEvents::BeforeApplicationShutDown()
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return S_OK;
}
@@ -158,9 +161,9 @@ HRESULT CCommands::XApplicationEvents::BeforeApplicationShutDown ()
// is done.
// Vim gets called from here.
//
HRESULT CCommands::XApplicationEvents::DocumentOpen (IDispatch * theDocument)
HRESULT CCommands::XApplicationEvents::DocumentOpen(IDispatch * theDocument)
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
if (! g_bEnableVim)
// Vim not enabled or empty command line entered
@@ -169,7 +172,7 @@ HRESULT CCommands::XApplicationEvents::DocumentOpen (IDispatch * theDocument)
// First get the current file name and line number
// Get the document object
CComQIPtr < ITextDocument, &IID_ITextDocument > pDoc (theDocument);
CComQIPtr < ITextDocument, &IID_ITextDocument > pDoc(theDocument);
if (! pDoc)
return S_OK;
@@ -177,26 +180,26 @@ HRESULT CCommands::XApplicationEvents::DocumentOpen (IDispatch * theDocument)
long LineNr = -1;
// Get the document name
if (FAILED (pDoc->get_FullName (&FileName)))
if (FAILED(pDoc->get_FullName(&FileName)))
return S_OK;
LPDISPATCH pDispSel;
// Get a selection object dispatch pointer
if (SUCCEEDED (pDoc->get_Selection (&pDispSel)))
if (SUCCEEDED(pDoc->get_Selection(&pDispSel)))
{
// Get the selection object
CComQIPtr < ITextSelection, &IID_ITextSelection > pSel (pDispSel);
CComQIPtr < ITextSelection, &IID_ITextSelection > pSel(pDispSel);
if (pSel)
// Get the selection line number
pSel->get_CurrentLine (&LineNr);
pSel->get_CurrentLine(&LineNr);
pDispSel->Release ();
pDispSel->Release();
}
// Open the file in Vim and position to the current line
if (VimOpenFile (FileName, LineNr))
if (VimOpenFile(FileName, LineNr))
{
if (! g_bDevStudioEditor)
{
@@ -204,30 +207,30 @@ HRESULT CCommands::XApplicationEvents::DocumentOpen (IDispatch * theDocument)
CComVariant vSaveChanges = dsSaveChangesPrompt;
DsSaveStatus Saved;
pDoc->Close (vSaveChanges, &Saved);
pDoc->Close(vSaveChanges, &Saved);
}
}
// We're done here
SysFreeString (FileName);
SysFreeString(FileName);
return S_OK;
}
HRESULT CCommands::XApplicationEvents::BeforeDocumentClose (IDispatch * theDocument)
HRESULT CCommands::XApplicationEvents::BeforeDocumentClose(IDispatch * theDocument)
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return S_OK;
}
HRESULT CCommands::XApplicationEvents::DocumentSave (IDispatch * theDocument)
HRESULT CCommands::XApplicationEvents::DocumentSave(IDispatch * theDocument)
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return S_OK;
}
HRESULT CCommands::XApplicationEvents::NewDocument (IDispatch * theDocument)
HRESULT CCommands::XApplicationEvents::NewDocument(IDispatch * theDocument)
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
if (! g_bEnableVim)
// Vim not enabled or empty command line entered
@@ -235,19 +238,19 @@ HRESULT CCommands::XApplicationEvents::NewDocument (IDispatch * theDocument)
// First get the current file name and line number
CComQIPtr < ITextDocument, &IID_ITextDocument > pDoc (theDocument);
CComQIPtr < ITextDocument, &IID_ITextDocument > pDoc(theDocument);
if (! pDoc)
return S_OK;
BSTR FileName;
HRESULT hr;
hr = pDoc->get_FullName (&FileName);
if (FAILED (hr))
hr = pDoc->get_FullName(&FileName);
if (FAILED(hr))
return S_OK;
// Open the file in Vim and position to the current line
if (VimOpenFile (FileName, 0))
if (VimOpenFile(FileName, 0))
{
if (! g_bDevStudioEditor)
{
@@ -255,49 +258,49 @@ HRESULT CCommands::XApplicationEvents::NewDocument (IDispatch * theDocument)
CComVariant vSaveChanges = dsSaveChangesPrompt;
DsSaveStatus Saved;
pDoc->Close (vSaveChanges, &Saved);
pDoc->Close(vSaveChanges, &Saved);
}
}
SysFreeString (FileName);
SysFreeString(FileName);
return S_OK;
}
HRESULT CCommands::XApplicationEvents::WindowActivate (IDispatch * theWindow)
HRESULT CCommands::XApplicationEvents::WindowActivate(IDispatch * theWindow)
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return S_OK;
}
HRESULT CCommands::XApplicationEvents::WindowDeactivate (IDispatch * theWindow)
HRESULT CCommands::XApplicationEvents::WindowDeactivate(IDispatch * theWindow)
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return S_OK;
}
HRESULT CCommands::XApplicationEvents::WorkspaceOpen ()
HRESULT CCommands::XApplicationEvents::WorkspaceOpen()
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return S_OK;
}
HRESULT CCommands::XApplicationEvents::WorkspaceClose ()
HRESULT CCommands::XApplicationEvents::WorkspaceClose()
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return S_OK;
}
HRESULT CCommands::XApplicationEvents::NewWorkspace ()
HRESULT CCommands::XApplicationEvents::NewWorkspace()
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return S_OK;
}
// Debugger event
HRESULT CCommands::XDebuggerEvents::BreakpointHit (IDispatch * pBreakpoint)
HRESULT CCommands::XDebuggerEvents::BreakpointHit(IDispatch * pBreakpoint)
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return S_OK;
}
@@ -308,17 +311,18 @@ HRESULT CCommands::XDebuggerEvents::BreakpointHit (IDispatch * pBreakpoint)
class CMainDialog : public CDialog
{
public:
CMainDialog (CWnd * pParent = NULL); // Standard constructor
CMainDialog(CWnd * pParent = NULL); // Standard constructor
//{{AFX_DATA(CMainDialog)
enum { IDD = IDD_ADDINMAIN };
int m_ChangeDir;
BOOL m_bDevStudioEditor;
BOOL m_bNewTabs;
//}}AFX_DATA
//{{AFX_VIRTUAL(CMainDialog)
protected:
virtual void DoDataExchange (CDataExchange * pDX); // DDX/DDV support
virtual void DoDataExchange(CDataExchange * pDX); // DDX/DDV support
//}}AFX_VIRTUAL
protected:
@@ -326,100 +330,106 @@ class CMainDialog : public CDialog
afx_msg void OnEnable();
afx_msg void OnDisable();
//}}AFX_MSG
DECLARE_MESSAGE_MAP ()
DECLARE_MESSAGE_MAP()
};
CMainDialog::CMainDialog (CWnd * pParent /* =NULL */ )
: CDialog (CMainDialog::IDD, pParent)
CMainDialog::CMainDialog(CWnd * pParent /* =NULL */ )
: CDialog(CMainDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CMainDialog)
m_ChangeDir = -1;
m_bDevStudioEditor = FALSE;
m_bNewTabs = FALSE;
//}}AFX_DATA_INIT
}
void CMainDialog::DoDataExchange (CDataExchange * pDX)
void CMainDialog::DoDataExchange(CDataExchange * pDX)
{
CDialog::DoDataExchange (pDX);
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMainDialog)
DDX_Radio(pDX, IDC_CD_SOURCE_PATH, m_ChangeDir);
DDX_Check (pDX, IDC_DEVSTUDIO_EDITOR, m_bDevStudioEditor);
DDX_Check(pDX, IDC_DEVSTUDIO_EDITOR, m_bDevStudioEditor);
DDX_Check(pDX, IDC_NEW_TABS, m_bNewTabs);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP (CMainDialog, CDialog)
BEGIN_MESSAGE_MAP(CMainDialog, CDialog)
//{{AFX_MSG_MAP(CMainDialog)
//}}AFX_MSG_MAP
END_MESSAGE_MAP ()
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCommands methods
STDMETHODIMP CCommands::VisVimDialog ()
STDMETHODIMP CCommands::VisVimDialog()
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
// Use m_pApplication to access the Developer Studio Application
// object,
// and VERIFY_OK to see error strings in DEBUG builds of your add-in
// (see stdafx.h)
VERIFY_OK (m_pApplication->EnableModeless (VARIANT_FALSE));
VERIFY_OK(m_pApplication->EnableModeless(VARIANT_FALSE));
CMainDialog Dlg;
Dlg.m_bDevStudioEditor = g_bDevStudioEditor;
Dlg.m_bNewTabs = g_bNewTabs;
Dlg.m_ChangeDir = g_ChangeDir;
if (Dlg.DoModal () == IDOK)
if (Dlg.DoModal() == IDOK)
{
g_bDevStudioEditor = Dlg.m_bDevStudioEditor;
g_bNewTabs = Dlg.m_bNewTabs;
g_ChangeDir = Dlg.m_ChangeDir;
// Save settings to registry HKEY_CURRENT_USER\Software\Vim\VisVim
HKEY hAppKey = GetAppKey ("Vim");
HKEY hAppKey = GetAppKey("Vim");
if (hAppKey)
{
HKEY hSectionKey = GetSectionKey (hAppKey, "VisVim");
HKEY hSectionKey = GetSectionKey(hAppKey, "VisVim");
if (hSectionKey)
{
WriteRegistryInt (hSectionKey, "DevStudioEditor",
WriteRegistryInt(hSectionKey, "DevStudioEditor",
g_bDevStudioEditor);
WriteRegistryInt (hSectionKey, "ChangeDir", g_ChangeDir);
RegCloseKey (hSectionKey);
WriteRegistryInt(hSectionKey, "NewTabs",
g_bNewTabs);
WriteRegistryInt(hSectionKey, "ChangeDir", g_ChangeDir);
RegCloseKey(hSectionKey);
}
RegCloseKey (hAppKey);
RegCloseKey(hAppKey);
}
}
VERIFY_OK (m_pApplication->EnableModeless (VARIANT_TRUE));
VERIFY_OK(m_pApplication->EnableModeless(VARIANT_TRUE));
return S_OK;
}
STDMETHODIMP CCommands::VisVimEnable ()
STDMETHODIMP CCommands::VisVimEnable()
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
VimSetEnableState (true);
AFX_MANAGE_STATE(AfxGetStaticModuleState());
VimSetEnableState(true);
return S_OK;
}
STDMETHODIMP CCommands::VisVimDisable ()
STDMETHODIMP CCommands::VisVimDisable()
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
VimSetEnableState (false);
AFX_MANAGE_STATE(AfxGetStaticModuleState());
VimSetEnableState(false);
return S_OK;
}
STDMETHODIMP CCommands::VisVimToggle ()
STDMETHODIMP CCommands::VisVimToggle()
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
VimSetEnableState (! g_bEnableVim);
AFX_MANAGE_STATE(AfxGetStaticModuleState());
VimSetEnableState(! g_bEnableVim);
return S_OK;
}
STDMETHODIMP CCommands::VisVimLoad ()
STDMETHODIMP CCommands::VisVimLoad()
{
AFX_MANAGE_STATE (AfxGetStaticModuleState ());
AFX_MANAGE_STATE(AfxGetStaticModuleState());
// Use m_pApplication to access the Developer Studio Application object,
// and VERIFY_OK to see error strings in DEBUG builds of your add-in
@@ -430,7 +440,7 @@ STDMETHODIMP CCommands::VisVimLoad ()
CComPtr < IDispatch > pDispDoc, pDispSel;
// Get a document object dispatch pointer
VERIFY_OK (m_pApplication->get_ActiveDocument (&pDispDoc));
VERIFY_OK(m_pApplication->get_ActiveDocument(&pDispDoc));
if (! pDispDoc)
return S_OK;
@@ -438,30 +448,30 @@ STDMETHODIMP CCommands::VisVimLoad ()
long LineNr = -1;
// Get the document object
CComQIPtr < ITextDocument, &IID_ITextDocument > pDoc (pDispDoc);
CComQIPtr < ITextDocument, &IID_ITextDocument > pDoc(pDispDoc);
if (! pDoc)
return S_OK;
// Get the document name
if (FAILED (pDoc->get_FullName (&FileName)))
if (FAILED(pDoc->get_FullName(&FileName)))
return S_OK;
// Get a selection object dispatch pointer
if (SUCCEEDED (pDoc->get_Selection (&pDispSel)))
if (SUCCEEDED(pDoc->get_Selection(&pDispSel)))
{
// Get the selection object
CComQIPtr < ITextSelection, &IID_ITextSelection > pSel (pDispSel);
CComQIPtr < ITextSelection, &IID_ITextSelection > pSel(pDispSel);
if (pSel)
// Get the selection line number
pSel->get_CurrentLine (&LineNr);
pSel->get_CurrentLine(&LineNr);
}
// Open the file in Vim
VimOpenFile (FileName, LineNr);
VimOpenFile(FileName, LineNr);
SysFreeString (FileName);
SysFreeString(FileName);
return S_OK;
}
@@ -472,16 +482,16 @@ STDMETHODIMP CCommands::VisVimLoad ()
// Set the enable state and save to registry
//
static void VimSetEnableState (BOOL bEnableState)
static void VimSetEnableState(BOOL bEnableState)
{
g_bEnableVim = bEnableState;
HKEY hAppKey = GetAppKey ("Vim");
HKEY hAppKey = GetAppKey("Vim");
if (hAppKey)
{
HKEY hSectionKey = GetSectionKey (hAppKey, "VisVim");
HKEY hSectionKey = GetSectionKey(hAppKey, "VisVim");
if (hSectionKey)
WriteRegistryInt (hSectionKey, "EnableVim", g_bEnableVim);
RegCloseKey (hAppKey);
WriteRegistryInt(hSectionKey, "EnableVim", g_bEnableVim);
RegCloseKey(hAppKey);
}
}
@@ -490,7 +500,7 @@ static void VimSetEnableState (BOOL bEnableState)
// letter.
// 'LineNr' must contain a valid line number or 0, e. g. for a new file
//
static BOOL VimOpenFile (BSTR& FileName, long LineNr)
static BOOL VimOpenFile(BSTR& FileName, long LineNr)
{
// OLE automation object for com. with Vim
@@ -507,7 +517,7 @@ static BOOL VimOpenFile (BSTR& FileName, long LineNr)
// Get a dispatch id for the SendKeys method of Vim;
// enables connection to Vim if necessary
DISPID DispatchId;
DispatchId = VimGetDispatchId (VimOle, "SendKeys");
DispatchId = VimGetDispatchId(VimOle, "SendKeys");
if (! DispatchId)
// OLE error, can't obtain dispatch id
goto OleError;
@@ -525,20 +535,28 @@ static BOOL VimOpenFile (BSTR& FileName, long LineNr)
#ifdef SINGLE_WINDOW
// Update the current file in Vim if it has been modified.
// Disabled, because it could write the file when you don't want to.
sprintf (VimCmd + 2, ":up\n");
sprintf(VimCmd + 2, ":up\n");
#endif
if (! VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf)))
if (! VimOle.Method(DispatchId, "s", TO_OLE_STR_BUF(VimCmd, Buf)))
goto OleError;
// Change Vim working directory to where the file is if desired
if (g_ChangeDir != CD_NONE)
VimChangeDir (VimOle, DispatchId, FileName);
VimChangeDir(VimOle, DispatchId, FileName);
// Make Vim open the file.
// In the filename convert all \ to /, put a \ before a space.
sprintf(VimCmd, ":drop ");
if (g_bNewTabs)
{
sprintf(VimCmd, ":tab drop ");
s = VimCmd + 11;
}
else
{
sprintf(VimCmd, ":drop ");
s = VimCmd + 6;
}
sprintf(FileNameTmp, "%S", (char *)FileName);
s = VimCmd + 6;
for (p = FileNameTmp; *p != '\0' && s < FileNameTmp + MAX_OLE_STR - 4;
++p)
if (*p == '\\')
@@ -552,20 +570,20 @@ static BOOL VimOpenFile (BSTR& FileName, long LineNr)
*s++ = '\n';
*s = '\0';
if (! VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf)))
if (! VimOle.Method(DispatchId, "s", TO_OLE_STR_BUF(VimCmd, Buf)))
goto OleError;
if (LineNr > 0)
{
// Goto line
sprintf (VimCmd, ":%d\n", LineNr);
if (! VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf)))
sprintf(VimCmd, ":%d\n", LineNr);
if (! VimOle.Method(DispatchId, "s", TO_OLE_STR_BUF(VimCmd, Buf)))
goto OleError;
}
// Make Vim come to the foreground
if (! VimOle.Method ("SetForeground"))
VimOle.ErrDiag ();
if (! VimOle.Method("SetForeground"))
VimOle.ErrDiag();
// We're done
return true;
@@ -573,7 +591,7 @@ static BOOL VimOpenFile (BSTR& FileName, long LineNr)
OleError:
// There was an OLE error
// Check if it's the "unknown class string" error
VimErrDiag (VimOle);
VimErrDiag(VimOle);
return false;
}
@@ -581,18 +599,18 @@ static BOOL VimOpenFile (BSTR& FileName, long LineNr)
// Create the Vim OLE object if necessary
// Returns a valid dispatch id or null on error
//
static DISPID VimGetDispatchId (COleAutomationControl& VimOle, char* Method)
static DISPID VimGetDispatchId(COleAutomationControl& VimOle, char* Method)
{
// Initialize Vim OLE connection if not already done
if (! VimOle.IsCreated ())
if (! VimOle.IsCreated())
{
if (! VimOle.CreateObject ("Vim.Application"))
if (! VimOle.CreateObject("Vim.Application"))
return NULL;
}
// Get the dispatch id for the SendKeys method.
// By doing this, we are checking if Vim is still there...
DISPID DispatchId = VimOle.GetDispatchId ("SendKeys");
DISPID DispatchId = VimOle.GetDispatchId("SendKeys");
if (! DispatchId)
{
// We can't get a dispatch id.
@@ -604,12 +622,12 @@ static DISPID VimGetDispatchId (COleAutomationControl& VimOle, char* Method)
// should not be kept long enough to allow the user to terminate Vim
// to avoid memory corruption (why the heck is there no system garbage
// collection for those damned OLE memory chunks???).
VimOle.DeleteObject ();
if (! VimOle.CreateObject ("Vim.Application"))
VimOle.DeleteObject();
if (! VimOle.CreateObject("Vim.Application"))
// If this create fails, it's time for an error msg
return NULL;
if (! (DispatchId = VimOle.GetDispatchId ("SendKeys")))
if (! (DispatchId = VimOle.GetDispatchId("SendKeys")))
// There is something wrong...
return NULL;
}
@@ -620,20 +638,20 @@ static DISPID VimGetDispatchId (COleAutomationControl& VimOle, char* Method)
// Output an error message for an OLE error
// Check on the classstring error, which probably means Vim wasn't registered.
//
static void VimErrDiag (COleAutomationControl& VimOle)
static void VimErrDiag(COleAutomationControl& VimOle)
{
SCODE sc = GetScode (VimOle.GetResult ());
SCODE sc = GetScode(VimOle.GetResult());
if (sc == CO_E_CLASSSTRING)
{
char Buf[256];
sprintf (Buf, "There is no registered OLE automation server named "
sprintf(Buf, "There is no registered OLE automation server named "
"\"Vim.Application\".\n"
"Use the OLE-enabled version of Vim with VisVim and "
"make sure to register Vim by running \"vim -register\".");
MessageBox (NULL, Buf, "OLE Error", MB_OK);
MessageBox(NULL, Buf, "OLE Error", MB_OK);
}
else
VimOle.ErrDiag ();
VimOle.ErrDiag();
}
// Change directory to the directory the file 'FileName' is in or it's parent
@@ -644,7 +662,7 @@ static void VimErrDiag (COleAutomationControl& VimOle)
// CD_SOURCE_PATH
// CD_SOURCE_PARENT
//
static void VimChangeDir (COleAutomationControl& VimOle, DISPID DispatchId, BSTR& FileName)
static void VimChangeDir(COleAutomationControl& VimOle, DISPID DispatchId, BSTR& FileName)
{
// Do a :cd first
@@ -655,7 +673,7 @@ static void VimChangeDir (COleAutomationControl& VimOle, DISPID DispatchId, BSTR
char DirUnix[_MAX_DIR * 2];
char *s, *t;
_splitpath (StrFileName, Drive, Dir, NULL, NULL);
_splitpath(StrFileName, Drive, Dir, NULL, NULL);
// Convert to Unix path name format, escape spaces.
t = DirUnix;
@@ -676,19 +694,18 @@ static void VimChangeDir (COleAutomationControl& VimOle, DISPID DispatchId, BSTR
OLECHAR Buf[MAX_OLE_STR];
char VimCmd[MAX_OLE_STR];
sprintf (VimCmd, ":cd %s%s%s\n", Drive, DirUnix,
sprintf(VimCmd, ":cd %s%s%s\n", Drive, DirUnix,
g_ChangeDir == CD_SOURCE_PARENT && DirUnix[1] ? ".." : "");
VimOle.Method (DispatchId, "s", TO_OLE_STR_BUF (VimCmd, Buf));
VimOle.Method(DispatchId, "s", TO_OLE_STR_BUF(VimCmd, Buf));
}
#ifdef _DEBUG
// Print out a debug message
//
static void DebugMsg (char* Msg, char* Arg)
static void DebugMsg(char* Msg, char* Arg)
{
char Buf[400];
sprintf (Buf, Msg, Arg);
AfxMessageBox (Buf);
sprintf(Buf, Msg, Arg);
AfxMessageBox(Buf);
}
#endif
+1
View File
@@ -16,6 +16,7 @@
#define IDC_CD_SOURCE_PATH 1001
#define IDC_CD_SOURCE_PARENT 1002
#define IDC_CD_NONE 1003
#define IDC_NEW_TABS 1004
// Next default values for new objects
//
+3
View File
@@ -122,6 +122,9 @@ BEGIN
CONTROL "&Open file in DevStudio editor simultaneously",
IDC_DEVSTUDIO_EDITOR,"Button",BS_AUTOCHECKBOX | WS_GROUP |
WS_TABSTOP,7,7,153,10
CONTROL "Open files in new tabs",
IDC_NEW_TABS,"Button",BS_AUTOCHECKBOX | WS_GROUP |
WS_TABSTOP,7,21,153,10
GROUPBOX "Current directory",IDC_STATIC,7,35,164,58,WS_GROUP
CONTROL "Set to &source file path",IDC_CD_SOURCE_PATH,"Button",
BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,17,49,85,10
+590 -274
View File
File diff suppressed because it is too large Load Diff
+142 -89
View File
@@ -33,7 +33,7 @@ static char_u *buflist_match __ARGS((regprog_T *prog, buf_T *buf));
static char_u *fname_match __ARGS((regprog_T *prog, char_u *name));
#endif
static void buflist_setfpos __ARGS((buf_T *buf, win_T *win, linenr_T lnum, colnr_T col, int copy_options));
static wininfo_T *find_wininfo __ARGS((buf_T *buf));
static wininfo_T *find_wininfo __ARGS((buf_T *buf, int skip_diff_buffer));
#ifdef UNIX
static buf_T *buflist_findname_stat __ARGS((char_u *ffname, struct stat *st));
static int otherfile_buf __ARGS((buf_T *buf, char_u *ffname, struct stat *stp));
@@ -44,6 +44,7 @@ static int otherfile_buf __ARGS((buf_T *buf, char_u *ffname));
#ifdef FEAT_TITLE
static int ti_change __ARGS((char_u *str, char_u **last));
#endif
static int append_arg_number __ARGS((win_T *wp, char_u *buf, int buflen, int add_file));
static void free_buffer __ARGS((buf_T *));
static void free_buffer_stuff __ARGS((buf_T *buf, int free_options));
static void clear_wininfo __ARGS((buf_T *buf));
@@ -437,10 +438,6 @@ close_buffer(win, buf, action)
return;
#endif
#ifdef FEAT_NETBEANS_INTG
if (usingNetbeans)
netbeans_file_closed(buf);
#endif
#ifdef FEAT_ODB_EDITOR
odb_buffer_close(buf);
#endif
@@ -519,12 +516,11 @@ buf_clear_file(buf)
* buf_freeall() - free all things allocated for a buffer that are related to
* the file.
*/
/*ARGSUSED*/
void
buf_freeall(buf, del_buf, wipe_buf)
buf_T *buf;
int del_buf; /* buffer is going to be deleted */
int wipe_buf; /* buffer is going to be wiped out */
int del_buf UNUSED; /* buffer is going to be deleted */
int wipe_buf UNUSED; /* buffer is going to be wiped out */
{
#ifdef FEAT_AUTOCMD
int is_curbuf = (buf == curbuf);
@@ -643,6 +639,10 @@ free_buffer_stuff(buf, free_options)
#ifdef FEAT_SIGNS
buf_delete_signs(buf); /* delete any signs */
#endif
#ifdef FEAT_NETBEANS_INTG
if (usingNetbeans)
netbeans_file_killed(buf);
#endif
#ifdef FEAT_LOCALMAP
map_clear_int(buf, MAP_ALL_MODES, TRUE, FALSE); /* clear local mappings */
map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE); /* clear local abbrevs */
@@ -651,6 +651,9 @@ free_buffer_stuff(buf, free_options)
vim_free(buf->b_start_fenc);
buf->b_start_fenc = NULL;
#endif
#ifdef FEAT_SPELL
ga_clear(&buf->b_langp);
#endif
}
/*
@@ -816,9 +819,6 @@ do_bufdel(command, arg, addr_count, start_bnr, end_bnr, forceit)
int bnr; /* buffer number */
char_u *p;
#ifdef FEAT_NETBEANS_INTG
netbeansCloseFile = 1;
#endif
if (addr_count == 0)
{
(void)do_buffer(command, DOBUF_CURRENT, FORWARD, 0, forceit);
@@ -913,9 +913,6 @@ do_bufdel(command, arg, addr_count, start_bnr, end_bnr, forceit)
}
}
#ifdef FEAT_NETBEANS_INTG
netbeansCloseFile = 0;
#endif
return errormsg;
}
@@ -1094,7 +1091,7 @@ do_buffer(action, start, dir, count, forceit)
#endif
setpcmark();
retval = do_ecmd(0, NULL, NULL, NULL, ECMD_ONE,
forceit ? ECMD_FORCEIT : 0);
forceit ? ECMD_FORCEIT : 0, curwin);
/*
* do_ecmd() may create a new buffer, then we have to delete
@@ -1241,7 +1238,7 @@ do_buffer(action, start, dir, count, forceit)
* "buf" if one exists */
if ((swb_flags & SWB_USEOPEN) && buf_jump_open_win(buf))
return OK;
/* If 'switchbuf' contians "usetab": jump to first window in any tab
/* If 'switchbuf' contains "usetab": jump to first window in any tab
* page containing "buf" if one exists */
if ((swb_flags & SWB_USETAB) && buf_jump_open_tab(buf))
return OK;
@@ -1317,7 +1314,7 @@ set_curbuf(buf, action)
setpcmark();
if (!cmdmod.keepalt)
curwin->w_alt_fnum = curbuf->b_fnum; /* remember alternate file */
buflist_altfpos(); /* remember curpos */
buflist_altfpos(curwin); /* remember curpos */
#ifdef FEAT_VISUAL
/* Don't restart Select mode after switching to another buffer. */
@@ -1402,6 +1399,9 @@ enter_buffer(buf)
curwin->w_cursor.coladd = 0;
#endif
curwin->w_set_curswant = TRUE;
#ifdef FEAT_AUTOCMD
curwin->w_topline_was_set = FALSE;
#endif
/* Make sure the buffer is loaded. */
if (curbuf->b_ml.ml_mfp == NULL) /* need to load the file */
@@ -1441,7 +1441,8 @@ enter_buffer(buf)
maketitle();
#endif
#ifdef FEAT_AUTOCMD
if (curwin->w_topline == 1) /* when autocmds didn't change it */
/* when autocmds didn't change it */
if (curwin->w_topline == 1 && !curwin->w_topline_was_set)
#endif
scroll_cursor_halfway(FALSE); /* redisplay at correct position */
@@ -1456,13 +1457,13 @@ enter_buffer(buf)
#ifdef FEAT_KEYMAP
if (curbuf->b_kmap_state & KEYMAP_INIT)
keymap_init();
(void)keymap_init();
#endif
#ifdef FEAT_SPELL
/* May need to set the spell language. Can only do this after the buffer
* has been properly setup. */
if (!curbuf->b_help && curwin->w_p_spell && *curbuf->b_p_spl != NUL)
did_set_spelllang(curbuf);
(void)did_set_spelllang(curbuf);
#endif
redraw_later(NOT_VALID);
@@ -1680,9 +1681,10 @@ buflist_new(ffname, sfname, lnum, flags)
buf->b_fname = buf->b_sfname;
#ifdef UNIX
if (st.st_dev == (dev_T)-1)
buf->b_dev = -1;
buf->b_dev_valid = FALSE;
else
{
buf->b_dev_valid = TRUE;
buf->b_dev = st.st_dev;
buf->b_ino = st.st_ino;
}
@@ -2027,13 +2029,12 @@ buflist_findname_stat(ffname, stp)
* Return fnum of the found buffer.
* Return < 0 for error.
*/
/*ARGSUSED*/
int
buflist_findpat(pattern, pattern_end, unlisted, diffmode)
char_u *pattern;
char_u *pattern_end; /* pointer to first char after pattern */
int unlisted; /* find unlisted buffers */
int diffmode; /* find diff-mode buffers only */
int diffmode UNUSED; /* find diff-mode buffers only */
{
buf_T *buf;
regprog_T *prog;
@@ -2405,22 +2406,69 @@ buflist_setfpos(buf, win, lnum, col, copy_options)
return;
}
#ifdef FEAT_DIFF
static int wininfo_other_tab_diff __ARGS((wininfo_T *wip));
/*
* Return TRUE when "wip" has 'diff' set and the diff is only for another tab
* page. That's because a diff is local to a tab page.
*/
static int
wininfo_other_tab_diff(wip)
wininfo_T *wip;
{
win_T *wp;
if (wip->wi_opt.wo_diff)
{
for (wp = firstwin; wp != NULL; wp = wp->w_next)
/* return FALSE when it's a window in the current tab page, thus
* the buffer was in diff mode here */
if (wip->wi_win == wp)
return FALSE;
return TRUE;
}
return FALSE;
}
#endif
/*
* Find info for the current window in buffer "buf".
* If not found, return the info for the most recently used window.
* When "skip_diff_buffer" is TRUE avoid windows with 'diff' set that is in
* another tab page.
* Returns NULL when there isn't any info.
*/
static wininfo_T *
find_wininfo(buf)
find_wininfo(buf, skip_diff_buffer)
buf_T *buf;
int skip_diff_buffer UNUSED;
{
wininfo_T *wip;
for (wip = buf->b_wininfo; wip != NULL; wip = wip->wi_next)
if (wip->wi_win == curwin)
if (wip->wi_win == curwin
#ifdef FEAT_DIFF
&& (!skip_diff_buffer || !wininfo_other_tab_diff(wip))
#endif
)
break;
if (wip == NULL) /* if no fpos for curwin, use the first in the list */
wip = buf->b_wininfo;
/* If no wininfo for curwin, use the first in the list (that doesn't have
* 'diff' set and is in another tab page). */
if (wip == NULL)
{
#ifdef FEAT_DIFF
if (skip_diff_buffer)
{
for (wip = buf->b_wininfo; wip != NULL; wip = wip->wi_next)
if (!wininfo_other_tab_diff(wip))
break;
}
else
#endif
wip = buf->b_wininfo;
}
return wip;
}
@@ -2441,7 +2489,7 @@ get_winopts(buf)
clearFolding(curwin);
#endif
wip = find_wininfo(buf);
wip = find_wininfo(buf, TRUE);
if (wip != NULL && wip->wi_optset)
{
copy_winopt(&wip->wi_opt, &curwin->w_onebuf_opt);
@@ -2471,9 +2519,9 @@ buflist_findfpos(buf)
buf_T *buf;
{
wininfo_T *wip;
static pos_T no_position = {1, 0};
static pos_T no_position = INIT_POS_T(1, 0, 0);
wip = find_wininfo(buf);
wip = find_wininfo(buf, FALSE);
if (wip != NULL)
return &(wip->wi_fpos);
else
@@ -2494,7 +2542,6 @@ buflist_findlnum(buf)
/*
* List all know file names (for :files and :buffers command).
*/
/*ARGSUSED*/
void
buflist_list(eap)
exarg_T *eap;
@@ -2532,8 +2579,8 @@ buflist_list(eap)
{
IObuff[len++] = ' ';
} while (--i > 0 && len < IOSIZE - 18);
vim_snprintf((char *)IObuff + len, IOSIZE - len, _("line %ld"),
buf == curbuf ? curwin->w_cursor.lnum
vim_snprintf((char *)IObuff + len, (size_t)(IOSIZE - len),
_("line %ld"), buf == curbuf ? curwin->w_cursor.lnum
: (long)buflist_findlnum(buf));
msg_outtrans(IObuff);
out_flush(); /* output one line at a time */
@@ -2647,9 +2694,10 @@ setfname(buf, ffname, sfname, message)
buf->b_fname = buf->b_sfname;
#ifdef UNIX
if (st.st_dev == (dev_T)-1)
buf->b_dev = -1;
buf->b_dev_valid = FALSE;
else
{
buf->b_dev_valid = TRUE;
buf->b_dev = st.st_dev;
buf->b_ino = st.st_ino;
}
@@ -2794,14 +2842,14 @@ buflist_slash_adjust()
#endif
/*
* Set alternate cursor position for current window.
* Set alternate cursor position for the current buffer and window "win".
* Also save the local window option values.
*/
void
buflist_altfpos()
buflist_altfpos(win)
win_T *win;
{
buflist_setfpos(curbuf, curwin, curwin->w_cursor.lnum,
curwin->w_cursor.col, TRUE);
buflist_setfpos(curbuf, win, win->w_cursor.lnum, win->w_cursor.col, TRUE);
}
/*
@@ -2843,7 +2891,7 @@ otherfile_buf(buf, ffname
/* If no struct stat given, get it now */
if (stp == NULL)
{
if (buf->b_dev < 0 || mch_stat((char *)ffname, &st) < 0)
if (!buf->b_dev_valid || mch_stat((char *)ffname, &st) < 0)
st.st_dev = (dev_T)-1;
stp = &st;
}
@@ -2880,11 +2928,12 @@ buf_setino(buf)
if (buf->b_fname != NULL && mch_stat((char *)buf->b_fname, &st) >= 0)
{
buf->b_dev_valid = TRUE;
buf->b_dev = st.st_dev;
buf->b_ino = st.st_ino;
}
else
buf->b_dev = -1;
buf->b_dev_valid = FALSE;
}
/*
@@ -2895,7 +2944,7 @@ buf_same_ino(buf, stp)
buf_T *buf;
struct stat *stp;
{
return (buf->b_dev >= 0
return (buf->b_dev_valid
&& stp->st_dev == buf->b_dev
&& stp->st_ino == buf->b_ino);
}
@@ -2922,7 +2971,7 @@ fileinfo(fullname, shorthelp, dont_truncate)
if (fullname > 1) /* 2 CTRL-G: include buffer number */
{
sprintf((char *)buffer, "buf %d: ", curbuf->b_fnum);
vim_snprintf((char *)buffer, IOSIZE, "buf %d: ", curbuf->b_fnum);
p = buffer + STRLEN(buffer);
}
else
@@ -2996,11 +3045,12 @@ fileinfo(fullname, shorthelp, dont_truncate)
(long)curbuf->b_ml.ml_line_count,
n);
validate_virtcol();
col_print(buffer + STRLEN(buffer),
len = STRLEN(buffer);
col_print(buffer + len, IOSIZE - len,
(int)curwin->w_cursor.col + 1, (int)curwin->w_virtcol + 1);
}
(void)append_arg_number(curwin, buffer, !shortmess(SHM_FILE), IOSIZE);
(void)append_arg_number(curwin, buffer, IOSIZE, !shortmess(SHM_FILE));
if (dont_truncate)
{
@@ -3028,15 +3078,16 @@ fileinfo(fullname, shorthelp, dont_truncate)
}
void
col_print(buf, col, vcol)
col_print(buf, buflen, col, vcol)
char_u *buf;
size_t buflen;
int col;
int vcol;
{
if (col == vcol)
sprintf((char *)buf, "%d", col);
vim_snprintf((char *)buf, buflen, "%d", col);
else
sprintf((char *)buf, "%d-%d", col, vcol);
vim_snprintf((char *)buf, buflen, "%d-%d", col, vcol);
}
#if defined(FEAT_TITLE) || defined(PROTO)
@@ -3153,20 +3204,18 @@ maketitle()
if (p == buf + off)
/* must be a help buffer */
vim_strncpy(buf + off, (char_u *)_("help"),
IOSIZE - off - 1);
(size_t)(IOSIZE - off - 1));
else
*p = NUL;
/* translate unprintable chars */
p = transstr(buf + off);
vim_strncpy(buf + off, p, IOSIZE - off - 1);
vim_strncpy(buf + off, p, (size_t)(IOSIZE - off - 1));
vim_free(p);
STRCAT(buf, ")");
}
#ifndef FEAT_GUI_MACVIM
append_arg_number(curwin, buf, FALSE, IOSIZE);
#endif
append_arg_number(curwin, buf, IOSIZE, FALSE);
#if defined(FEAT_CLIENTSERVER)
if (serverName != NULL)
@@ -3303,14 +3352,13 @@ free_titles()
* If maxwidth is not zero, the string will be filled at any middle marker
* or truncated if too long, fillchar is used for all whitespace.
*/
/*ARGSUSED*/
int
build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, tabtab)
win_T *wp;
char_u *out; /* buffer to write into != NameBuff */
size_t outlen; /* length of out[] */
char_u *fmt;
int use_sandbox; /* "fmt" was set insecurely, use sandbox */
int use_sandbox UNUSED; /* "fmt" was set insecurely, use sandbox */
int fillchar;
int maxwidth;
struct stl_hlrec *hltab; /* return: HL attributes (can be NULL) */
@@ -3481,7 +3529,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
n = (long)(p - t) - item[groupitem[groupdepth]].maxwid + 1;
*t = '<';
mch_memmove(t + 1, t + n, p - (t + n));
mch_memmove(t + 1, t + n, (size_t)(p - (t + n)));
p = p - n + 1;
#ifdef FEAT_MBYTE
/* Fill up space left over by half a double-wide char. */
@@ -3511,7 +3559,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
else
{
/* fill by inserting characters */
mch_memmove(t + n - l, t, p - t);
mch_memmove(t + n - l, t, (size_t)(p - t));
l = n - l;
if (p + l >= out + outlen)
l = (long)((out + outlen) - p - 1);
@@ -3647,7 +3695,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
p = t;
#ifdef FEAT_EVAL
sprintf((char *)tmp, "%d", curbuf->b_fnum);
vim_snprintf((char *)tmp, sizeof(tmp), "%d", curbuf->b_fnum);
set_internal_string_var((char_u *)"actual_curbuf", tmp);
o_curbuf = curbuf;
@@ -3714,13 +3762,13 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
case STL_ALTPERCENT:
str = tmp;
get_rel_pos(wp, str);
get_rel_pos(wp, str, TMPLEN);
break;
case STL_ARGLISTSTAT:
fillable = FALSE;
tmp[0] = 0;
if (append_arg_number(wp, tmp, FALSE, (int)sizeof(tmp)))
if (append_arg_number(wp, tmp, (int)sizeof(tmp), FALSE))
str = tmp;
break;
@@ -3755,7 +3803,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
case STL_BYTEVAL_X:
base = 'X';
case STL_BYTEVAL:
if (wp->w_cursor.col > STRLEN(linecont))
if (wp->w_cursor.col > (colnr_T)STRLEN(linecont))
num = 0;
else
{
@@ -3928,7 +3976,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
if (zeropad)
*t++ = '0';
*t++ = '*';
*t++ = nbase == 16 ? base : (nbase == 8 ? 'o' : 'd');
*t++ = nbase == 16 ? base : (char_u)(nbase == 8 ? 'o' : 'd');
*t = 0;
for (n = num, l = 1; n >= nbase; n /= nbase)
@@ -3974,7 +4022,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
width = vim_strsize(out);
if (maxwidth > 0 && width > maxwidth)
{
/* Result is too long, must trunctate somewhere. */
/* Result is too long, must truncate somewhere. */
l = 0;
if (itemcnt == 0)
s = out;
@@ -4121,13 +4169,14 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
#if defined(FEAT_STL_OPT) || defined(FEAT_CMDL_INFO) \
|| defined(FEAT_GUI_TABLINE) || defined(PROTO)
/*
* Get relative cursor position in window into "str[]", in the form 99%, using
* "Top", "Bot" or "All" when appropriate.
* Get relative cursor position in window into "buf[buflen]", in the form 99%,
* using "Top", "Bot" or "All" when appropriate.
*/
void
get_rel_pos(wp, str)
get_rel_pos(wp, buf, buflen)
win_T *wp;
char_u *str;
char_u *buf;
int buflen;
{
long above; /* number of lines above window */
long below; /* number of lines below window */
@@ -4138,34 +4187,35 @@ get_rel_pos(wp, str)
#endif
below = wp->w_buffer->b_ml.ml_line_count - wp->w_botline + 1;
if (below <= 0)
STRCPY(str, above == 0 ? _("All") : _("Bot"));
vim_strncpy(buf, (char_u *)(above == 0 ? _("All") : _("Bot")),
(size_t)(buflen - 1));
else if (above <= 0)
STRCPY(str, _("Top"));
vim_strncpy(buf, (char_u *)_("Top"), (size_t)(buflen - 1));
else
sprintf((char *)str, "%2d%%", above > 1000000L
vim_snprintf((char *)buf, (size_t)buflen, "%2d%%", above > 1000000L
? (int)(above / ((above + below) / 100L))
: (int)(above * 100L / (above + below)));
}
#endif
/*
* Append (file 2 of 8) to 'buf', if editing more than one file.
* Append (file 2 of 8) to "buf[buflen]", if editing more than one file.
* Return TRUE if it was appended.
*/
int
append_arg_number(wp, buf, add_file, maxlen)
static int
append_arg_number(wp, buf, buflen, add_file)
win_T *wp;
char_u *buf;
int buflen;
int add_file; /* Add "file" before the arg number */
int maxlen; /* maximum nr of chars in buf or zero*/
{
char_u *p;
if (ARGCOUNT <= 1) /* nothing to do */
return FALSE;
p = buf + STRLEN(buf); /* go to the end of the buffer */
if (maxlen && p - buf + 35 >= maxlen) /* getting too long */
p = buf + STRLEN(buf); /* go to the end of the buffer */
if (p - buf + 35 >= buflen) /* getting too long */
return FALSE;
*p++ = ' ';
*p++ = '(';
@@ -4174,7 +4224,8 @@ append_arg_number(wp, buf, add_file, maxlen)
STRCPY(p, "file ");
p += 5;
}
sprintf((char *)p, wp->w_arg_idx_invalid ? "(%d) of %d)"
vim_snprintf((char *)p, (size_t)(buflen - (p - buf)),
wp->w_arg_idx_invalid ? "(%d) of %d)"
: "%d of %d)", wp->w_arg_idx + 1, ARGCOUNT);
return TRUE;
}
@@ -4230,10 +4281,9 @@ fix_fname(fname)
* Make "ffname" a full file name, set "sfname" to "ffname" if not NULL.
* "ffname" becomes a pointer to allocated memory (or NULL).
*/
/*ARGSUSED*/
void
fname_expand(buf, ffname, sfname)
buf_T *buf;
buf_T *buf UNUSED;
char_u **ffname;
char_u **sfname;
{
@@ -4499,7 +4549,7 @@ do_arg_all(count, forceit, keep_tabs)
ECMD_ONE,
((P_HID(curwin->w_buffer)
|| bufIsChanged(curwin->w_buffer)) ? ECMD_HIDE : 0)
+ ECMD_OLDBUF);
+ ECMD_OLDBUF, curwin);
#ifdef FEAT_AUTOCMD
if (use_firstwin)
++autocmd_no_leave;
@@ -4957,7 +5007,7 @@ read_viminfo_bufferlist(virp, writing)
if (tab != NULL)
{
*tab++ = '\0';
col = atoi((char *)tab);
col = (colnr_T)atoi((char *)tab);
tab = vim_strrchr(xline, '\t');
if (tab != NULL)
{
@@ -4995,6 +5045,7 @@ write_viminfo_bufferlist(fp)
#endif
char_u *line;
int max_buffers;
size_t len;
if (find_viminfo_parameter('%') == NULL)
return;
@@ -5003,7 +5054,8 @@ write_viminfo_bufferlist(fp)
max_buffers = get_viminfo_parameter('%');
/* Allocate room for the file name, lnum and col. */
line = alloc(MAXPATHL + 40);
#define LINE_BUF_LEN (MAXPATHL + 40)
line = alloc(LINE_BUF_LEN);
if (line == NULL)
return;
@@ -5029,7 +5081,8 @@ write_viminfo_bufferlist(fp)
break;
putc('%', fp);
home_replace(NULL, buf->b_ffname, line, MAXPATHL, TRUE);
sprintf((char *)line + STRLEN(line), "\t%ld\t%d",
len = STRLEN(line);
vim_snprintf((char *)line + len, len - LINE_BUF_LEN, "\t%ld\t%d",
(long)buf->b_last_cursor.lnum,
buf->b_last_cursor.col);
viminfo_writestring(fp, line);
@@ -5059,7 +5112,8 @@ buf_spname(buf)
*/
FOR_ALL_TAB_WINDOWS(tp, win)
if (win->w_buffer == buf)
break;
goto win_found;
win_found:
if (win != NULL && win->w_llist_ref != NULL)
return _("[Location List]");
else
@@ -5073,7 +5127,7 @@ buf_spname(buf)
{
if (buf->b_sfname != NULL)
return (char *)buf->b_sfname;
return "[Scratch]";
return _("[Scratch]");
}
#endif
if (buf->b_fname == NULL)
@@ -5186,7 +5240,7 @@ buf_addsign(buf, id, lnum, typenr)
return;
}
int
linenr_T
buf_change_sign_type(buf, markId, typenr)
buf_T *buf; /* buffer to store sign in */
int markId; /* sign ID */
@@ -5203,10 +5257,10 @@ buf_change_sign_type(buf, markId, typenr)
}
}
return 0;
return (linenr_T)0;
}
int_u
int
buf_getsigntype(buf, lnum, type)
buf_T *buf;
linenr_T lnum;
@@ -5525,11 +5579,10 @@ buf_contents_changed(buf)
* this buffer. Call this to wipe out a temp buffer that does not contain any
* marks.
*/
/*ARGSUSED*/
void
wipe_buffer(buf, aucmd)
buf_T *buf;
int aucmd; /* When TRUE trigger autocommands. */
int aucmd UNUSED; /* When TRUE trigger autocommands. */
{
if (buf->b_fnum == top_file_num - 1)
--top_file_num;
+13 -14
View File
@@ -17,7 +17,7 @@ static int win_chartabsize __ARGS((win_T *wp, char_u *p, colnr_T col));
static int win_nolbr_chartabsize __ARGS((win_T *wp, char_u *s, colnr_T col, int *headp));
#endif
static int nr2hex __ARGS((int c));
static unsigned nr2hex __ARGS((unsigned c));
static int chartab_initialized = FALSE;
@@ -664,7 +664,7 @@ transchar_hex(buf, c)
}
#endif
buf[++i] = nr2hex((unsigned)c >> 4);
buf[++i] = nr2hex(c);
buf[++i] = nr2hex((unsigned)c);
buf[++i] = '>';
buf[++i] = NUL;
}
@@ -674,9 +674,9 @@ transchar_hex(buf, c)
* Lower case letters are used to avoid the confusion of <F1> being 0xf1 or
* function key 1.
*/
static int
static unsigned
nr2hex(c)
int c;
unsigned c;
{
if ((c & 0xf) <= 9)
return (c & 0xf) + '0';
@@ -884,7 +884,7 @@ vim_iswordc(c)
if (c >= 0x100)
{
if (enc_dbcs != 0)
return dbcs_class((unsigned)c >> 8, c & 0xff) >= 2;
return dbcs_class((unsigned)c >> 8, (unsigned)(c & 0xff)) >= 2;
if (enc_utf8)
return utf_class(c) >= 2;
}
@@ -1026,13 +1026,12 @@ lbr_chartabsize_adv(s, col)
* string at start of line. Warning: *headp is only set if it's a non-zero
* value, init to 0 before calling.
*/
/*ARGSUSED*/
int
win_lbr_chartabsize(wp, s, col, headp)
win_T *wp;
char_u *s;
colnr_T col;
int *headp;
int *headp UNUSED;
{
#ifdef FEAT_LINEBREAK
int c;
@@ -1090,7 +1089,7 @@ win_lbr_chartabsize(wp, s, col, headp)
*/
numberextra = win_col_off(wp);
col2 = col;
colmax = W_WIDTH(wp) - numberextra;
colmax = (colnr_T)(W_WIDTH(wp) - numberextra);
if (col >= colmax)
{
n = colmax + win_col_off2(wp);
@@ -1201,17 +1200,17 @@ in_win_border(wp, vcol)
win_T *wp;
colnr_T vcol;
{
colnr_T width1; /* width of first line (after line number) */
colnr_T width2; /* width of further lines */
int width1; /* width of first line (after line number) */
int width2; /* width of further lines */
#ifdef FEAT_VERTSPLIT
if (wp->w_width == 0) /* there is no border */
return FALSE;
#endif
width1 = W_WIDTH(wp) - win_col_off(wp);
if (vcol < width1 - 1)
if ((int)vcol < width1 - 1)
return FALSE;
if (vcol == width1 - 1)
if ((int)vcol == width1 - 1)
return TRUE;
width2 = width1 + win_col_off2(wp);
return ((vcol - width1) % width2 == width2 - 1);
@@ -1396,13 +1395,13 @@ getvvcol(wp, pos, start, cursor, end)
# ifdef FEAT_MBYTE
/* Cannot put the cursor on part of a wide character. */
ptr = ml_get_buf(wp->w_buffer, pos->lnum, FALSE);
if (pos->col < STRLEN(ptr))
if (pos->col < (colnr_T)STRLEN(ptr))
{
int c = (*mb_ptr2char)(ptr + pos->col);
if (c != TAB && vim_isprintc(c))
{
endadd = char2cells(c) - 1;
endadd = (colnr_T)(char2cells(c) - 1);
if (coladd > endadd) /* past end of line */
endadd = 0;
else
+9
View File
@@ -30,12 +30,18 @@
/* Define when __DATE__ " " __TIME__ can be used */
#undef HAVE_DATE_TIME
/* Define when __attribute__((unused)) can be used */
#undef HAVE_ATTRIBUTE_UNUSED
/* defined always when using configure */
#undef UNIX
/* Defined to the size of an int */
#undef SIZEOF_INT
/* Define when wchar_t is only 2 bytes. */
#undef SMALL_WCHAR_T
/*
* If we cannot trust one of the following from the libraries, we use our
* own safe but probably slower vim_memmove().
@@ -50,6 +56,9 @@
/* Define to empty if the keyword does not work. */
#undef const
/* Define to empty if the keyword does not work. */
#undef volatile
/* Define to `int' if <sys/types.h> doesn't define. */
#undef mode_t
+2
View File
@@ -41,6 +41,8 @@ MZSCHEME_SRC = @MZSCHEME_SRC@
MZSCHEME_OBJ = @MZSCHEME_OBJ@
MZSCHEME_CFLAGS = @MZSCHEME_CFLAGS@
MZSCHEME_PRO = @MZSCHEME_PRO@
MZSCHEME_EXTRA = @MZSCHEME_EXTRA@
MZSCHEME_MZC = @MZSCHEME_MZC@
PERL = @vi_cv_path_perl@
PERLLIB = @vi_cv_perllib@
+96 -28
View File
@@ -423,7 +423,7 @@ if test "$enable_mzschemeinterp" = "yes"; then
AC_MSG_RESULT("$PLTHOME")
vi_cv_path_mzscheme_pfx="$PLTHOME"
else
AC_MSG_RESULT("not set")
AC_MSG_RESULT(not set)
dnl -- try to find MzScheme executable
AC_PATH_PROG(vi_cv_path_mzscheme, mzscheme)
@@ -439,14 +439,16 @@ if test "$enable_mzschemeinterp" = "yes"; then
if test "X$vi_cv_path_mzscheme" != "X"; then
dnl -- find where MzScheme thinks it was installed
AC_CACHE_CHECK(MzScheme install prefix,vi_cv_path_mzscheme_pfx,
[ vi_cv_path_mzscheme_pfx=`
${vi_cv_path_mzscheme} -evm \
"(display (simplify-path \
dnl different versions of MzScheme differ in command line processing
dnl use universal approach
echo "(display (simplify-path \
(build-path (call-with-values \
(lambda () (split-path (find-system-path (quote exec-file)))) \
(lambda (base name must-be-dir?) base)) (quote up))))"` ])
dnl Remove a trailing slash.
vi_cv_path_mzscheme_pfx=`echo "$vi_cv_path_mzscheme_pfx" | sed 's+/$++'`
(lambda (base name must-be-dir?) base)) (quote up))))" > mzdirs.scm
dnl Remove a trailing slash
[ vi_cv_path_mzscheme_pfx=`${vi_cv_path_mzscheme} -r mzdirs.scm | \
sed -e 's+/$++'` ])
rm -f mzdirs.scm
fi
fi
fi
@@ -455,16 +457,24 @@ if test "$enable_mzschemeinterp" = "yes"; then
if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include)
if test -f $vi_cv_path_mzscheme_pfx/include/scheme.h; then
AC_MSG_RESULT("yes")
SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT("no")
AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/plt/include)
AC_MSG_RESULT(no)
AC_MSG_CHECKING(if scheme.h can be found in $vi_cv_path_mzscheme_pfx/include/plt)
if test -f $vi_cv_path_mzscheme_pfx/include/plt/scheme.h; then
AC_MSG_RESULT("yes")
SCHEME_INC=/plt
AC_MSG_RESULT(yes)
SCHEME_INC=${vi_cv_path_mzscheme_pfx}/include/plt
else
AC_MSG_RESULT("no")
vi_cv_path_mzscheme_pfx=
AC_MSG_RESULT(no)
AC_MSG_CHECKING(if scheme.h can be found in /usr/include/plt/)
if test -f /usr/include/plt/scheme.h; then
AC_MSG_RESULT(yes)
SCHEME_INC=/usr/include/plt
else
AC_MSG_RESULT(no)
vi_cv_path_mzscheme_pfx=
fi
fi
fi
fi
@@ -472,23 +482,38 @@ if test "$enable_mzschemeinterp" = "yes"; then
if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
if test "x$MACOSX" = "xyes"; then
MZSCHEME_LIBS="-framework PLT_MzScheme"
elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"; then
MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.a"
MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"; then
MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme.a ${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"
else
MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme -lmzgc"
dnl Using shared objects
if test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzscheme3m.so"; then
MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme3m"
MZSCHEME_CFLAGS="-DMZ_PRECISE_GC"
else
MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme -lmzgc"
fi
if test "$GCC" = yes; then
dnl Make Vim remember the path to the library. For when it's not in
dnl $LD_LIBRARY_PATH.
MZSCHEME_LIBS="$MZSCHEME_LIBS -Wl,-rpath -Wl,${vi_cv_path_mzscheme_pfx}/lib"
MZSCHEME_LIBS="${MZSCHEME_LIBS} -Wl,-rpath -Wl,${vi_cv_path_mzscheme_pfx}/lib"
elif test "`(uname) 2>/dev/null`" = SunOS &&
uname -r | grep '^5' >/dev/null; then
MZSCHEME_LIBS="$MZSCHEME_LIBS -R ${vi_cv_path_mzscheme_pfx}/lib"
MZSCHEME_LIBS="${MZSCHEME_LIBS} -R ${vi_cv_path_mzscheme_pfx}/lib"
fi
fi
if test -d $vi_cv_path_mzscheme_pfx/lib/plt/collects; then
SCHEME_COLLECTS=lib/plt/
fi
MZSCHEME_CFLAGS="-I${vi_cv_path_mzscheme_pfx}/include${SCHEME_INC} \
if test -f "${vi_cv_path_mzscheme_pfx}/${SCHEME_COLLECTS}collects/scheme/base.ss" ; then
dnl need to generate bytecode for MzScheme base
MZSCHEME_EXTRA="mzscheme_base.c"
MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -DINCLUDE_MZSCHEME_BASE"
MZSCHEME_MZC="${vi_cv_path_mzscheme_pfx}/bin/mzc"
fi
MZSCHEME_CFLAGS="${MZSCHEME_CFLAGS} -I${SCHEME_INC} \
-DMZSCHEME_COLLECTS='\"${vi_cv_path_mzscheme_pfx}/${SCHEME_COLLECTS}collects\"'"
MZSCHEME_SRC="if_mzsch.c"
MZSCHEME_OBJ="objects/if_mzsch.o"
@@ -500,6 +525,8 @@ if test "$enable_mzschemeinterp" = "yes"; then
AC_SUBST(MZSCHEME_PRO)
AC_SUBST(MZSCHEME_LIBS)
AC_SUBST(MZSCHEME_CFLAGS)
AC_SUBST(MZSCHEME_EXTRA)
AC_SUBST(MZSCHEME_MZC)
fi
@@ -1202,6 +1229,28 @@ else
LDFLAGS="$ac_save_LDFLAGS"
AC_MSG_CHECKING(size of wchar_t is 2 bytes)
AC_CACHE_VAL(ac_cv_small_wchar_t,
[AC_TRY_RUN([
#include <X11/Xlib.h>
#if STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
#endif
main()
{
if (sizeof(wchar_t) <= 2)
exit(1);
exit(0);
}],
ac_cv_small_wchar_t="no",
ac_cv_small_wchar_t="yes",
AC_MSG_ERROR(failed to compile test program))])
AC_MSG_RESULT($ac_cv_small_wchar_t)
if test "x$ac_cv_small_wchar_t" = "xyes" ; then
AC_DEFINE(SMALL_WCHAR_T)
fi
fi
fi
@@ -2103,6 +2152,11 @@ AC_TRY_COMPILE([#include <stdio.h>], [printf("(" __DATE__ " " __TIME__ ")");],
AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DATE_TIME),
AC_MSG_RESULT(no))
AC_MSG_CHECKING(whether __attribute__((unused)) is allowed)
AC_TRY_COMPILE([#include <stdio.h>], [int x __attribute__((unused));],
AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ATTRIBUTE_UNUSED),
AC_MSG_RESULT(no))
dnl Checks for header files.
AC_CHECK_HEADER(elf.h, HAS_ELF=1)
dnl AC_CHECK_HEADER(dwarf.h, SVR4=1)
@@ -2131,7 +2185,7 @@ AC_CHECK_HEADERS(stdarg.h stdlib.h string.h sys/select.h sys/utsname.h \
sys/stream.h termios.h libc.h sys/statfs.h \
poll.h sys/poll.h pwd.h utime.h sys/param.h libintl.h \
libgen.h util/debug.h util/msg18n.h frame.h \
sys/acl.h sys/access.h sys/sysctl.h sys/sysinfo.h wchar.h wctype.h)
sys/acl.h sys/access.h sys/sysinfo.h wchar.h wctype.h)
dnl sys/ptem.h depends on sys/stream.h on Solaris
AC_CHECK_HEADERS(sys/ptem.h, [], [],
@@ -2139,6 +2193,12 @@ AC_CHECK_HEADERS(sys/ptem.h, [], [],
# include <sys/stream.h>
#endif])
dnl sys/sysctl.h depends on sys/param.h on OpenBSD
AC_CHECK_HEADERS(sys/sysctl.h, [], [],
[#if defined HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif])
dnl pthread_np.h may exist but can only be used after including pthread.h
AC_MSG_CHECKING([for pthread_np.h])
@@ -2184,6 +2244,7 @@ fi
dnl Checks for typedefs, structures, and compiler characteristics.
AC_PROG_GCC_TRADITIONAL
AC_C_CONST
AC_C_VOLATILE
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
@@ -2905,7 +2966,6 @@ main()
AC_MSG_RESULT($ac_cv_sizeof_int)
AC_DEFINE_UNQUOTED(SIZEOF_INT, $ac_cv_sizeof_int)
dnl Check for memmove() before bcopy(), makes memmove() be used when both are
dnl present, fixes problem with incompatibility between Solaris 2.4 and 2.5.
@@ -2987,7 +3047,7 @@ dnl Check if X_LOCALE should be defined.
if test "$enable_multibyte" = "yes"; then
cflags_save=$CFLAGS
ldflags_save=$LDFLAGS
if test -n "$x_includes" ; then
if test "x$x_includes" != "xNONE" ; then
CFLAGS="$CFLAGS -I$x_includes"
LDFLAGS="$X_LIBS $LDFLAGS -lX11"
AC_MSG_CHECKING(whether X_LOCALE needed)
@@ -3003,7 +3063,7 @@ fi
dnl Link with xpg4, it is said to make Korean locale working
AC_CHECK_LIB(xpg4, _xpg4_setrunelocale, [LIBS="$LIBS -lxpg4"],,)
dnl Check how we can run ctags
dnl Check how we can run ctags. Default to "ctags" when nothing works.
dnl --version for Exuberant ctags (preferred)
dnl Add --fields=+S to get function signatures for omni completion.
dnl -t for typedefs (many ctags have this)
@@ -3015,6 +3075,7 @@ test -f tags && mv tags tags.save
if (eval ctags --version /dev/null | grep Exuberant) < /dev/null 1>&AC_FD_CC 2>&1; then
TAGPRG="ctags -I INIT+ --fields=+S"
else
TAGPRG="ctags"
(eval etags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags"
(eval etags -c /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="etags -c"
(eval ctags /dev/null) < /dev/null 1>&AC_FD_CC 2>&1 && TAGPRG="ctags"
@@ -3188,18 +3249,25 @@ 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".
dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
dnl the number before the version number.
AC_MSG_CHECKING(for GCC 3 or later)
DEPEND_CFLAGS_FILTER=
if test "$GCC" = yes; then
AC_MSG_CHECKING(for GCC 3 or later)
gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'`
if test "$gccmajor" -gt "2"; then
DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is
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"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
fi
if test "$DEPEND_CFLAGS_FILTER" = ""; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
fi
AC_SUBST(DEPEND_CFLAGS_FILTER)
+42 -22
View File
@@ -8,7 +8,7 @@
*/
/*
* diff.c: code for diff'ing two or three buffers.
* diff.c: code for diff'ing two, three or four buffers.
*/
#include "vim.h"
@@ -73,6 +73,8 @@ diff_buf_delete(buf)
{
tp->tp_diffbuf[i] = NULL;
tp->tp_diff_invalid = TRUE;
if (tp == curtab)
diff_redraw(TRUE);
}
}
}
@@ -102,6 +104,7 @@ diff_buf_adjust(win)
{
curtab->tp_diffbuf[i] = NULL;
curtab->tp_diff_invalid = TRUE;
diff_redraw(TRUE);
}
}
}
@@ -113,7 +116,7 @@ diff_buf_adjust(win)
* Add a buffer to make diffs for.
* Call this when a new buffer is being edited in the current window where
* 'diff' is set.
* Marks the current buffer as being part of the diff and requireing updating.
* Marks the current buffer as being part of the diff and requiring updating.
* This must be done before any autocmd, because a command may use info
* about the screen contents.
*/
@@ -131,6 +134,7 @@ diff_buf_add(buf)
{
curtab->tp_diffbuf[i] = buf;
curtab->tp_diff_invalid = TRUE;
diff_redraw(TRUE);
return;
}
@@ -648,10 +652,9 @@ diff_write(buf, fname)
* The buffers are written to a file, also for unmodified buffers (the file
* could have been produced by autocommands, e.g. the netrw plugin).
*/
/*ARGSUSED*/
void
ex_diffupdate(eap)
exarg_T *eap; /* can be NULL, it's not used */
exarg_T *eap UNUSED; /* can be NULL */
{
buf_T *buf;
int idx_orig;
@@ -661,6 +664,7 @@ ex_diffupdate(eap)
char_u *tmp_diff;
FILE *fd;
int ok;
int io_error = FALSE;
/* Delete all diffblocks. */
diff_clear(curtab);
@@ -697,18 +701,26 @@ ex_diffupdate(eap)
{
ok = FALSE;
fd = mch_fopen((char *)tmp_orig, "w");
if (fd != NULL)
if (fd == NULL)
io_error = TRUE;
else
{
fwrite("line1\n", (size_t)6, (size_t)1, fd);
if (fwrite("line1\n", (size_t)6, (size_t)1, fd) != 1)
io_error = TRUE;
fclose(fd);
fd = mch_fopen((char *)tmp_new, "w");
if (fd != NULL)
if (fd == NULL)
io_error = TRUE;
else
{
fwrite("line2\n", (size_t)6, (size_t)1, fd);
if (fwrite("line2\n", (size_t)6, (size_t)1, fd) != 1)
io_error = TRUE;
fclose(fd);
diff_file(tmp_orig, tmp_new, tmp_diff);
fd = mch_fopen((char *)tmp_diff, "r");
if (fd != NULL)
if (fd == NULL)
io_error = TRUE;
else
{
char_u linebuf[LBUFLEN];
@@ -761,6 +773,8 @@ ex_diffupdate(eap)
}
if (!ok)
{
if (io_error)
EMSG(_("E810: Cannot read or write temp files"));
EMSG(_("E97: Cannot create diffs"));
diff_a_works = MAYBE;
#if defined(MSWIN) || defined(MSDOS)
@@ -812,6 +826,7 @@ diff_file(tmp_orig, tmp_new, tmp_diff)
char_u *tmp_diff;
{
char_u *cmd;
size_t len;
#ifdef FEAT_EVAL
if (*p_dex != NUL)
@@ -820,8 +835,9 @@ diff_file(tmp_orig, tmp_new, tmp_diff)
else
#endif
{
cmd = alloc((unsigned)(STRLEN(tmp_orig) + STRLEN(tmp_new)
+ STRLEN(tmp_diff) + STRLEN(p_srr) + 27));
len = STRLEN(tmp_orig) + STRLEN(tmp_new)
+ STRLEN(tmp_diff) + STRLEN(p_srr) + 27;
cmd = alloc((unsigned)len);
if (cmd != NULL)
{
/* We don't want $DIFF_OPTIONS to get in the way. */
@@ -831,7 +847,7 @@ diff_file(tmp_orig, tmp_new, tmp_diff)
/* Build the diff command and execute it. Always use -a, binary
* differences are of no use. Ignore errors, diff returns
* non-zero when differences have been found. */
sprintf((char *)cmd, "diff %s%s%s%s%s %s",
vim_snprintf((char *)cmd, len, "diff %s%s%s%s%s %s",
diff_a_works == FALSE ? "" : "-a ",
#if defined(MSWIN) || defined(MSDOS)
diff_bin_works == TRUE ? "--binary " : "",
@@ -841,7 +857,7 @@ diff_file(tmp_orig, tmp_new, tmp_diff)
(diff_flags & DIFF_IWHITE) ? "-b " : "",
(diff_flags & DIFF_ICASE) ? "-i " : "",
tmp_orig, tmp_new);
append_redir(cmd, p_srr, tmp_diff);
append_redir(cmd, (int)len, p_srr, tmp_diff);
#ifdef FEAT_AUTOCMD
block_autocmds(); /* Avoid ShellCmdPost stuff */
#endif
@@ -866,6 +882,7 @@ ex_diffpatch(eap)
char_u *tmp_orig; /* name of original temp file */
char_u *tmp_new; /* name of patched temp file */
char_u *buf = NULL;
size_t buflen;
win_T *old_curwin = curwin;
char_u *newname = NULL; /* name of patched file buffer */
#ifdef UNIX
@@ -905,16 +922,17 @@ ex_diffpatch(eap)
/* Get the absolute path of the patchfile, changing directory below. */
fullname = FullName_save(eap->arg, FALSE);
#endif
buf = alloc((unsigned)(STRLEN(tmp_orig) + (
buflen = STRLEN(tmp_orig) + (
# ifdef UNIX
fullname != NULL ? STRLEN(fullname) :
# endif
STRLEN(eap->arg)) + STRLEN(tmp_new) + 16));
STRLEN(eap->arg)) + STRLEN(tmp_new) + 16;
buf = alloc((unsigned)buflen);
if (buf == NULL)
goto theend;
#ifdef UNIX
/* Temporaraly chdir to /tmp, to avoid patching files in the current
/* Temporarily chdir to /tmp, to avoid patching files in the current
* directory when the patch file contains more than one patch. When we
* have our own temp dir use that instead, it will be cleaned up when we
* exit (any .rej files created). Don't change directory if we can't
@@ -925,10 +943,10 @@ ex_diffpatch(eap)
{
# ifdef TEMPDIRNAMES
if (vim_tempdir != NULL)
mch_chdir((char *)vim_tempdir);
ignored = mch_chdir((char *)vim_tempdir);
else
# endif
mch_chdir("/tmp");
ignored = mch_chdir("/tmp");
shorten_fnames(TRUE);
}
#endif
@@ -946,7 +964,8 @@ ex_diffpatch(eap)
{
/* Build the patch command and execute it. Ignore errors. Switch to
* cooked mode to allow the user to respond to prompts. */
sprintf((char *)buf, "patch -o %s %s < \"%s\"", tmp_new, tmp_orig,
vim_snprintf((char *)buf, buflen, "patch -o %s %s < \"%s\"",
tmp_new, tmp_orig,
# ifdef UNIX
fullname != NULL ? fullname :
# endif
@@ -1074,10 +1093,9 @@ ex_diffsplit(eap)
/*
* Set options to show difs for the current window.
*/
/*ARGSUSED*/
void
ex_diffthis(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
/* Set 'diff', 'scrollbind' on and 'wrap' off. */
diff_win_options(curwin, TRUE);
@@ -1138,7 +1156,7 @@ ex_diffoff(eap)
for (wp = firstwin; wp != NULL; wp = wp->w_next)
{
if (wp == curwin || eap->forceit)
if (wp == curwin || (eap->forceit && wp->w_p_diff))
{
/* Set 'diff', 'scrollbind' off and 'wrap' on. */
wp->w_p_diff = FALSE;
@@ -2114,6 +2132,8 @@ ex_diffgetput(eap)
EMSG2(_("E102: Can't find buffer \"%s\""), eap->arg);
return;
}
if (buf == curbuf)
return; /* nothing to do */
idx_other = diff_buf_idx(buf);
if (idx_other == DB_COUNT)
{
+16 -9
View File
@@ -32,7 +32,7 @@ static int getexactdigraph __ARGS((int, int, int));
static void printdigraph __ARGS((digr_T *));
/* digraphs added by the user */
static garray_T user_digraphs = {0, 0, sizeof(digr_T), 10, NULL};
static garray_T user_digraphs = {0, 0, (int)sizeof(digr_T), 10, NULL};
/*
* Note: Characters marked with XX are not included literally, because some
@@ -2371,10 +2371,10 @@ printdigraph(dp)
}
else
#endif
*p++ = dp->result;
*p++ = (char_u)dp->result;
if (char2cells(dp->result) == 1)
*p++ = ' ';
sprintf((char *)p, " %3d", dp->result);
vim_snprintf((char *)p, sizeof(buf) - (p - buf), " %3d", dp->result);
msg_outtrans(buf);
}
}
@@ -2395,7 +2395,10 @@ typedef struct
static void keymap_unload __ARGS((void));
/*
* Set up key mapping tables for the 'keymap' option
* Set up key mapping tables for the 'keymap' option.
* Returns NULL if OK, an error message for failure. This only needs to be
* used when setting the option, not later when the value has already been
* checked.
*/
char_u *
keymap_init()
@@ -2412,25 +2415,29 @@ keymap_init()
else
{
char_u *buf;
size_t buflen;
/* Source the keymap file. It will contain a ":loadkeymap" command
* which will call ex_loadkeymap() below. */
buf = alloc((unsigned)(STRLEN(curbuf->b_p_keymap)
buflen = STRLEN(curbuf->b_p_keymap)
# ifdef FEAT_MBYTE
+ STRLEN(p_enc)
+ STRLEN(p_enc)
# endif
+ 14));
+ 14;
buf = alloc((unsigned)buflen);
if (buf == NULL)
return e_outofmem;
# ifdef FEAT_MBYTE
/* try finding "keymap/'keymap'_'encoding'.vim" in 'runtimepath' */
sprintf((char *)buf, "keymap/%s_%s.vim", curbuf->b_p_keymap, p_enc);
vim_snprintf((char *)buf, buflen, "keymap/%s_%s.vim",
curbuf->b_p_keymap, p_enc);
if (source_runtime(buf, FALSE) == FAIL)
# endif
{
/* try finding "keymap/'keymap'.vim" in 'runtimepath' */
sprintf((char *)buf, "keymap/%s.vim", curbuf->b_p_keymap);
vim_snprintf((char *)buf, buflen, "keymap/%s.vim",
curbuf->b_p_keymap);
if (source_runtime(buf, FALSE) == FAIL)
{
vim_free(buf);
+141 -74
View File
@@ -57,7 +57,7 @@ static char *ctrl_x_msgs[] =
N_(" Keyword Local completion (^N^P)"),
};
static char_u e_hitend[] = N_("Hit end of paragraph");
static char e_hitend[] = N_("Hit end of paragraph");
/*
* Structure used to store one match for insert completion.
@@ -114,6 +114,10 @@ static int compl_restarting = FALSE; /* don't insert match */
* FALSE the word to be completed must be located. */
static int compl_started = FALSE;
/* Set when doing something for completion that may call edit() recursively,
* which is not allowed. */
static int compl_busy = FALSE;
static int compl_matches = 0;
static char_u *compl_pattern = NULL;
static int compl_direction = FORWARD;
@@ -147,6 +151,7 @@ static void ins_compl_clear __ARGS((void));
static int ins_compl_bs __ARGS((void));
static void ins_compl_new_leader __ARGS((void));
static void ins_compl_addleader __ARGS((int c));
static int ins_compl_len __ARGS((void));
static void ins_compl_restart __ARGS((void));
static void ins_compl_set_original_text __ARGS((char_u *str));
static void ins_compl_addfrommatch __ARGS((void));
@@ -164,7 +169,7 @@ static int ins_compl_pum_key __ARGS((int c));
static int ins_compl_key2count __ARGS((int c));
static int ins_compl_use_match __ARGS((int c));
static int ins_complete __ARGS((int c));
static int quote_meta __ARGS((char_u *dest, char_u *str, int len));
static unsigned quote_meta __ARGS((char_u *dest, char_u *str, int len));
#endif /* FEAT_INS_EXPAND */
#define BACKSPACE_CHAR 1
@@ -197,7 +202,8 @@ static void replace_pop_ins __ARGS((void));
static void mb_replace_pop_ins __ARGS((int cc));
#endif
static void replace_flush __ARGS((void));
static void replace_do_bs __ARGS((void));
static void replace_do_bs __ARGS((int limit_col));
static int del_char_after_col __ARGS((int limit_col));
#ifdef FEAT_CINDENT
static int cindent_on __ARGS((void));
#endif
@@ -304,7 +310,7 @@ edit(cmdchar, startln, count)
int c = 0;
char_u *ptr;
int lastc;
colnr_T mincol;
int mincol;
static linenr_T o_lnum = 0;
int i;
int did_backspace = TRUE; /* previous char was backspace */
@@ -344,7 +350,7 @@ edit(cmdchar, startln, count)
#ifdef FEAT_INS_EXPAND
/* Don't allow recursive insert mode when busy with completion. */
if (compl_started || pum_visible())
if (compl_started || compl_busy || pum_visible())
{
EMSG(_(e_secure));
return FALSE;
@@ -385,7 +391,7 @@ edit(cmdchar, startln, count)
if (startln)
Insstart.col = 0;
}
Insstart_textlen = linetabsize(ml_get_curline());
Insstart_textlen = (colnr_T)linetabsize(ml_get_curline());
Insstart_blank_vcol = MAXCOL;
if (!did_ai)
ai_col = 0;
@@ -651,7 +657,7 @@ edit(cmdchar, startln, count)
mincol = curwin->w_wcol;
validate_cursor_col();
if ((int)curwin->w_wcol < (int)mincol - curbuf->b_p_ts
if ((int)curwin->w_wcol < mincol - curbuf->b_p_ts
&& curwin->w_wrow == W_WINROW(curwin)
+ curwin->w_height - 1 - p_so
&& (curwin->w_cursor.lnum != curwin->w_topline
@@ -751,7 +757,7 @@ edit(cmdchar, startln, count)
* there is nothing to add, CTRL-L works like CTRL-P then. */
if (c == Ctrl_L
&& (ctrl_x_mode != CTRL_X_WHOLE_LINE
|| STRLEN(compl_shown_match->cp_str)
|| (int)STRLEN(compl_shown_match->cp_str)
> curwin->w_cursor.col - compl_col))
{
ins_compl_addfrommatch();
@@ -1338,8 +1344,10 @@ doESCkey:
goto normalchar;
docomplete:
compl_busy = TRUE;
if (ins_complete(c) == FAIL)
compl_cont_status = 0;
compl_busy = FALSE;
break;
#endif /* FEAT_INS_EXPAND */
@@ -1441,10 +1449,9 @@ force_cindent:
* Only redraw when there are no characters available. This speeds up
* inserting sequences of characters (e.g., for CTRL-R).
*/
/*ARGSUSED*/
static void
ins_redraw(ready)
int ready; /* not busy with something */
int ready UNUSED; /* not busy with something */
{
if (!char_avail())
{
@@ -1771,7 +1778,7 @@ change_indent(type, amount, round, replaced, call_changed_bytes)
* Compute the screen column where the cursor should be.
*/
vcol = get_indent() - vcol;
curwin->w_virtcol = (vcol < 0) ? 0 : vcol;
curwin->w_virtcol = (colnr_T)((vcol < 0) ? 0 : vcol);
/*
* Advance the cursor until we reach the right screen column.
@@ -1798,9 +1805,9 @@ change_indent(type, amount, round, replaced, call_changed_bytes)
*/
if (vcol != (int)curwin->w_virtcol)
{
curwin->w_cursor.col = new_cursor_col;
curwin->w_cursor.col = (colnr_T)new_cursor_col;
i = (int)curwin->w_virtcol - vcol;
ptr = alloc(i + 1);
ptr = alloc((unsigned)(i + 1));
if (ptr != NULL)
{
new_cursor_col += i;
@@ -1824,7 +1831,7 @@ change_indent(type, amount, round, replaced, call_changed_bytes)
if (new_cursor_col <= 0)
curwin->w_cursor.col = 0;
else
curwin->w_cursor.col = new_cursor_col;
curwin->w_cursor.col = (colnr_T)new_cursor_col;
curwin->w_set_curswant = TRUE;
changed_cline_bef_curs();
@@ -1933,6 +1940,8 @@ truncate_spaces(line)
/*
* Backspace the cursor until the given column. Handles REPLACE and VREPLACE
* modes correctly. May also be used when not in insert mode at all.
* Will attempt not to go before "col" even when there is a composing
* character.
*/
void
backspace_until_column(col)
@@ -1942,13 +1951,49 @@ backspace_until_column(col)
{
curwin->w_cursor.col--;
if (State & REPLACE_FLAG)
replace_do_bs();
else
(void)del_char(FALSE);
replace_do_bs(col);
else if (!del_char_after_col(col))
break;
}
}
#endif
/*
* Like del_char(), but make sure not to go before column "limit_col".
* Only matters when there are composing characters.
* Return TRUE when something was deleted.
*/
static int
del_char_after_col(limit_col)
int limit_col UNUSED;
{
#ifdef FEAT_MBYTE
if (enc_utf8 && limit_col >= 0)
{
colnr_T ecol = curwin->w_cursor.col + 1;
/* Make sure the cursor is at the start of a character, but
* skip forward again when going too far back because of a
* composing character. */
mb_adjust_cursor();
while (curwin->w_cursor.col < (colnr_T)limit_col)
{
int l = utf_ptr2len(ml_get_cursor());
if (l == 0) /* end of line */
break;
curwin->w_cursor.col += l;
}
if (*ml_get_cursor() == NUL || curwin->w_cursor.col == ecol)
return FALSE;
del_bytes((long)((int)ecol - curwin->w_cursor.col), FALSE, TRUE);
}
else
#endif
(void)del_char(FALSE);
return TRUE;
}
#if defined(FEAT_INS_EXPAND) || defined(PROTO)
/*
* CTRL-X pressed in Insert mode.
@@ -2160,7 +2205,7 @@ ins_compl_add_infercase(str, len, icase, fname, dir, flags)
actual_compl_length = compl_length;
/* Allocate wide character array for the completion and fill it. */
wca = (int *)alloc(actual_len * sizeof(int));
wca = (int *)alloc((unsigned)(actual_len * sizeof(int)));
if (wca != NULL)
{
p = str;
@@ -2418,7 +2463,7 @@ ins_compl_longest_match(match)
{
had_match = (curwin->w_cursor.col > compl_col);
ins_compl_delete();
ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
ins_bytes(compl_leader + ins_compl_len());
ins_redraw(FALSE);
/* When the match isn't there (to avoid matching itself) remove it
@@ -2470,7 +2515,7 @@ ins_compl_longest_match(match)
*p = NUL;
had_match = (curwin->w_cursor.col > compl_col);
ins_compl_delete();
ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
ins_bytes(compl_leader + ins_compl_len());
ins_redraw(FALSE);
/* When the match isn't there (to avoid matching itself) remove it
@@ -2539,7 +2584,7 @@ ins_compl_make_cyclic()
*/
void
set_completion(startcol, list)
int startcol;
colnr_T startcol;
list_T *list;
{
/* If already doing completions stop it. */
@@ -2550,10 +2595,10 @@ set_completion(startcol, list)
if (stop_arrow() == FAIL)
return;
if (startcol > (int)curwin->w_cursor.col)
if (startcol > curwin->w_cursor.col)
startcol = curwin->w_cursor.col;
compl_col = startcol;
compl_length = curwin->w_cursor.col - startcol;
compl_length = (int)curwin->w_cursor.col - (int)startcol;
/* compl_pattern doesn't need to be set */
compl_orig_text = vim_strnsave(ml_get_curline() + compl_col, compl_length);
if (compl_orig_text == NULL || ins_compl_add(compl_orig_text,
@@ -2819,7 +2864,6 @@ ins_compl_dictionaries(dict_start, pat, flags, thesaurus)
regmatch_T regmatch;
char_u **files;
int count;
int i;
int save_p_scs;
int dir = compl_direction;
@@ -2851,17 +2895,18 @@ ins_compl_dictionaries(dict_start, pat, flags, thesaurus)
if (ctrl_x_mode == CTRL_X_WHOLE_LINE)
{
char_u *pat_esc = vim_strsave_escaped(pat, (char_u *)"\\");
size_t len;
if (pat_esc == NULL)
goto theend;
i = (int)STRLEN(pat_esc) + 10;
ptr = alloc(i);
len = STRLEN(pat_esc) + 10;
ptr = alloc((unsigned)len);
if (ptr == NULL)
{
vim_free(pat_esc);
goto theend;
}
vim_snprintf((char *)ptr, i, "^\\s*\\zs\\V%s", pat_esc);
vim_snprintf((char *)ptr, len, "^\\s*\\zs\\V%s", pat_esc);
regmatch.regprog = vim_regcomp(ptr, RE_MAGIC);
vim_free(pat_esc);
vim_free(ptr);
@@ -2952,7 +2997,7 @@ ins_compl_files(count, files, thesaurus, flags, regmatch, buf, dir)
{
vim_snprintf((char *)IObuff, IOSIZE,
_("Scanning dictionary: %s"), (char *)files[i]);
msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R));
(void)msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R));
}
if (fp != NULL)
@@ -3133,6 +3178,7 @@ ins_compl_free()
vim_free(match);
} while (compl_curr_match != NULL && compl_curr_match != compl_first_match);
compl_first_match = compl_curr_match = NULL;
compl_shown_match = NULL;
}
static void
@@ -3209,7 +3255,7 @@ ins_compl_new_leader()
{
ins_compl_del_pum();
ins_compl_delete();
ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
ins_bytes(compl_leader + ins_compl_len());
compl_used_match = FALSE;
if (compl_started)
@@ -3263,6 +3309,20 @@ ins_compl_new_leader()
compl_enter_selects = FALSE;
}
/*
* Return the length of the completion, from the completion start column to
* the cursor column. Making sure it never goes below zero.
*/
static int
ins_compl_len()
{
int off = (int)curwin->w_cursor.col - (int)compl_col;
if (off < 0)
return 0;
return off;
}
/*
* Append one character to the match leader. May reduce the number of
* matches.
@@ -3292,7 +3352,7 @@ ins_compl_addleader(c)
vim_free(compl_leader);
compl_leader = vim_strnsave(ml_get_curline() + compl_col,
curwin->w_cursor.col - compl_col);
(int)(curwin->w_cursor.col - compl_col));
if (compl_leader != NULL)
ins_compl_new_leader();
}
@@ -3340,7 +3400,7 @@ ins_compl_set_original_text(str)
ins_compl_addfrommatch()
{
char_u *p;
int len = curwin->w_cursor.col - compl_col;
int len = (int)curwin->w_cursor.col - (int)compl_col;
int c;
compl_T *cp;
@@ -3621,10 +3681,9 @@ ins_compl_prep(c)
{
ins_compl_delete();
if (compl_leader != NULL)
ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
ins_bytes(compl_leader + ins_compl_len());
else if (compl_first_match != NULL)
ins_bytes(compl_orig_text
+ curwin->w_cursor.col - compl_col);
ins_bytes(compl_orig_text + ins_compl_len());
retval = TRUE;
}
@@ -3907,7 +3966,7 @@ ins_compl_get_exp(ini)
: ins_buf->b_sfname == NULL
? (char *)ins_buf->b_fname
: (char *)ins_buf->b_sfname);
msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R));
(void)msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R));
}
else if (*e_cpt == NUL)
break;
@@ -3936,8 +3995,8 @@ ins_compl_get_exp(ini)
else if (*e_cpt == ']' || *e_cpt == 't')
{
type = CTRL_X_TAGS;
sprintf((char*)IObuff, _("Scanning tags."));
msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R));
vim_snprintf((char *)IObuff, IOSIZE, _("Scanning tags."));
(void)msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R));
}
else
type = -1;
@@ -4035,7 +4094,7 @@ ins_compl_get_exp(ini)
case CTRL_X_SPELL:
#ifdef FEAT_SPELL
num_matches = expand_spelling(first_match_pos.lnum,
first_match_pos.col, compl_pattern, &matches);
compl_pattern, &matches);
if (num_matches > 0)
ins_compl_add_matches(num_matches, matches, p_ic);
#endif
@@ -4187,7 +4246,7 @@ ins_compl_get_exp(ini)
}
/* check if compl_curr_match has changed, (e.g. other type of
* expansion added somenthing) */
* expansion added something) */
if (type != 0 && compl_curr_match != old_match)
found_new_match = OK;
@@ -4256,7 +4315,7 @@ ins_compl_delete()
static void
ins_compl_insert()
{
ins_bytes(compl_shown_match->cp_str + curwin->w_cursor.col - compl_col);
ins_bytes(compl_shown_match->cp_str + ins_compl_len());
if (compl_shown_match->cp_flags & ORIGINAL_TEXT)
compl_used_match = FALSE;
else
@@ -4425,7 +4484,7 @@ ins_compl_next(allow_get_expansion, count, insert_match)
if (!compl_get_longest || compl_used_match)
ins_compl_insert();
else
ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
ins_bytes(compl_leader + ins_compl_len());
}
else
compl_used_match = FALSE;
@@ -4688,7 +4747,7 @@ ins_complete(c)
}
compl_length = curwin->w_cursor.col - (int)compl_col;
/* IObuff is used to add a "word from the next line" would we
* have enough space? just being paranoic */
* have enough space? just being paranoid */
#define MIN_SPACE 75
if (compl_length > (IOSIZE - MIN_SPACE))
{
@@ -4745,10 +4804,9 @@ ins_complete(c)
{
char_u *prefix = (char_u *)"\\<";
/* we need 3 extra chars, 1 for the NUL and
* 2 >= strlen(prefix) -- Acevedo */
/* we need up to 2 extra chars for the prefix */
compl_pattern = alloc(quote_meta(NULL, line + compl_col,
compl_length) + 3);
compl_length) + 2);
if (compl_pattern == NULL)
return FAIL;
if (!vim_iswordp(line + compl_col)
@@ -4823,7 +4881,7 @@ ins_complete(c)
else
{
compl_pattern = alloc(quote_meta(NULL, line + compl_col,
compl_length) + 3);
compl_length) + 2);
if (compl_pattern == NULL)
return FAIL;
STRCPY((char *)compl_pattern, "\\<");
@@ -4905,7 +4963,7 @@ ins_complete(c)
if (col < 0)
col = curs_col;
compl_col = col;
if ((colnr_T)compl_col > curs_col)
if (compl_col > curs_col)
compl_col = curs_col;
/* Setup variables for completion. Need to obtain "line" again,
@@ -5178,15 +5236,15 @@ ins_complete(c)
* a backslash) the metachars, and dest would be NUL terminated.
* Returns the length (needed) of dest
*/
static int
static unsigned
quote_meta(dest, src, len)
char_u *dest;
char_u *src;
int len;
{
int m;
unsigned m = (unsigned)len + 1; /* one extra for the NUL */
for (m = len; --len >= 0; src++)
for ( ; --len >= 0; src++)
{
switch (*src)
{
@@ -6015,7 +6073,7 @@ auto_format(trailblank, prev_line)
* in 'formatoptions' and there is a single character before the cursor.
* Otherwise the line would be broken and when typing another non-white
* next they are not joined back together. */
wasatend = (pos.col == STRLEN(old));
wasatend = (pos.col == (colnr_T)STRLEN(old));
if (*old != NUL && !trailblank && wasatend)
{
dec_cursor();
@@ -6192,7 +6250,7 @@ redo_literal(c)
* three digits. */
if (VIM_ISDIGIT(c))
{
sprintf((char *)buf, "%03d", c);
vim_snprintf((char *)buf, sizeof(buf), "%03d", c);
AppendToRedobuff(buf);
}
else
@@ -6266,7 +6324,7 @@ stop_arrow()
ins_need_undo = FALSE;
}
Insstart = curwin->w_cursor; /* new insertion starts here */
Insstart_textlen = linetabsize(ml_get_curline());
Insstart_textlen = (colnr_T)linetabsize(ml_get_curline());
ai_col = 0;
#ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)
@@ -6369,13 +6427,17 @@ stop_insert(end_insert_pos, esc)
/* If we just did an auto-indent, remove the white space from the end
* of the line, and put the cursor back.
* Do this when ESC was used or moving the cursor up/down. */
* Do this when ESC was used or moving the cursor up/down.
* Check for the old position still being valid, just in case the text
* got changed unexpectedly. */
if (did_ai && (esc || (vim_strchr(p_cpo, CPO_INDENT) == NULL
&& curwin->w_cursor.lnum != end_insert_pos->lnum)))
&& curwin->w_cursor.lnum != end_insert_pos->lnum))
&& end_insert_pos->lnum <= curbuf->b_ml.ml_line_count)
{
pos_T tpos = curwin->w_cursor;
curwin->w_cursor = *end_insert_pos;
check_cursor_col(); /* make sure it is not past the line */
for (;;)
{
if (gchar_cursor() == NUL && curwin->w_cursor.col > 0)
@@ -6383,7 +6445,8 @@ stop_insert(end_insert_pos, esc)
cc = gchar_cursor();
if (!vim_iswhite(cc))
break;
(void)del_char(TRUE);
if (del_char(TRUE) == FAIL)
break; /* should not happen */
}
if (curwin->w_cursor.lnum != tpos.lnum)
curwin->w_cursor = tpos;
@@ -6395,10 +6458,11 @@ stop_insert(end_insert_pos, esc)
* deleted characters. */
if (VIsual_active && VIsual.lnum == curwin->w_cursor.lnum)
{
cc = (int)STRLEN(ml_get_curline());
if (VIsual.col > (colnr_T)cc)
int len = (int)STRLEN(ml_get_curline());
if (VIsual.col > len)
{
VIsual.col = cc;
VIsual.col = len;
# ifdef FEAT_VIRTUALEDIT
VIsual.coladd = 0;
# endif
@@ -7123,9 +7187,12 @@ replace_flush()
* cc == 0: character was inserted, delete it
* cc > 0: character was replaced, put cc (first byte of original char) back
* and check for more characters to be put back
* When "limit_col" is >= 0, don't delete before this column. Matters when
* using composing characters, use del_char_after_col() instead of del_char().
*/
static void
replace_do_bs()
replace_do_bs(limit_col)
int limit_col;
{
int cc;
#ifdef FEAT_VREPLACE
@@ -7153,7 +7220,7 @@ replace_do_bs()
#ifdef FEAT_MBYTE
if (has_mbyte)
{
del_char(FALSE);
(void)del_char_after_col(limit_col);
# ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)
orig_len = (int)STRLEN(ml_get_cursor());
@@ -7203,7 +7270,7 @@ replace_do_bs()
changed_bytes(curwin->w_cursor.lnum, curwin->w_cursor.col);
}
else if (cc == 0)
(void)del_char(FALSE);
(void)del_char_after_col(limit_col);
}
#ifdef FEAT_CINDENT
@@ -7646,9 +7713,7 @@ ins_reg()
*/
++no_mapping;
regname = plain_vgetc();
#ifdef FEAT_LANGMAP
LANGMAP_ADJUST(regname, TRUE);
#endif
if (regname == Ctrl_R || regname == Ctrl_O || regname == Ctrl_P)
{
/* Get a third key for literal register insertion */
@@ -7657,9 +7722,7 @@ ins_reg()
add_to_showcmd_c(literally);
#endif
regname = plain_vgetc();
#ifdef FEAT_LANGMAP
LANGMAP_ADJUST(regname, TRUE);
#endif
}
--no_mapping;
@@ -8150,7 +8213,7 @@ ins_ctrl_o()
/*
* If the cursor is on an indent, ^T/^D insert/delete one
* shiftwidth. Otherwise ^T/^D behave like a "<<" or ">>".
* Always round the indent to 'shiftwith', this is compatible
* Always round the indent to 'shiftwidth', this is compatible
* with vi. But vi only supports ^T and ^D after an
* autoindent, we support it everywhere.
*/
@@ -8239,7 +8302,7 @@ ins_bs_one(vcolp)
* Replace mode */
if (curwin->w_cursor.lnum != Insstart.lnum
|| curwin->w_cursor.col >= Insstart.col)
replace_do_bs();
replace_do_bs(-1);
}
else
(void)del_char(FALSE);
@@ -8258,6 +8321,7 @@ ins_bs(c, mode, inserted_space_p)
linenr_T lnum;
int cc;
int temp = 0; /* init for GCC */
colnr_T save_col;
colnr_T mincol;
int did_backspace = FALSE;
int in_indent;
@@ -8415,13 +8479,13 @@ ins_bs(c, mode, inserted_space_p)
*/
while (cc > 0)
{
temp = curwin->w_cursor.col;
save_col = curwin->w_cursor.col;
#ifdef FEAT_MBYTE
mb_replace_pop_ins(cc);
#else
ins_char(cc);
#endif
curwin->w_cursor.col = temp;
curwin->w_cursor.col = save_col;
cc = replace_pop();
}
/* restore the characters that NL replaced */
@@ -8453,11 +8517,11 @@ ins_bs(c, mode, inserted_space_p)
#endif
)
{
temp = curwin->w_cursor.col;
save_col = curwin->w_cursor.col;
beginline(BL_WHITE);
if (curwin->w_cursor.col < (colnr_T)temp)
mincol = curwin->w_cursor.col;
curwin->w_cursor.col = temp;
curwin->w_cursor.col = save_col;
}
/*
@@ -8556,7 +8620,7 @@ ins_bs(c, mode, inserted_space_p)
break;
}
if (State & REPLACE_FLAG)
replace_do_bs();
replace_do_bs(-1);
else
{
#ifdef FEAT_MBYTE
@@ -8931,7 +8995,10 @@ ins_right()
foldOpenCursor();
#endif
undisplay_dollar();
if (gchar_cursor() != NUL || virtual_active()
if (gchar_cursor() != NUL
#ifdef FEAT_VIRTUALEDIT
|| virtual_active()
#endif
)
{
start_arrow(&curwin->w_cursor);
+386 -348
View File
File diff suppressed because it is too large Load Diff
+343 -96
View File
@@ -43,12 +43,12 @@ static int
/*
* ":ascii" and "ga".
*/
/*ARGSUSED*/
void
do_ascii(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
int c;
int cval;
char buf1[20];
char buf2[20];
char_u buf3[7];
@@ -75,6 +75,10 @@ do_ascii(eap)
{
if (c == NL) /* NUL is stored as NL */
c = NUL;
if (c == CAR && get_fileformat(curbuf) == EOL_MAC)
cval = NL; /* NL is stored as CR */
else
cval = c;
if (vim_isprintc_strict(c) && (c < ' '
#ifndef EBCDIC
|| c > '~'
@@ -82,19 +86,20 @@ do_ascii(eap)
))
{
transchar_nonprint(buf3, c);
sprintf(buf1, " <%s>", (char *)buf3);
vim_snprintf(buf1, sizeof(buf1), " <%s>", (char *)buf3);
}
else
buf1[0] = NUL;
#ifndef EBCDIC
if (c >= 0x80)
sprintf(buf2, " <M-%s>", transchar(c & 0x7f));
vim_snprintf(buf2, sizeof(buf2), " <M-%s>",
(char *)transchar(c & 0x7f));
else
#endif
buf2[0] = NUL;
vim_snprintf((char *)IObuff, IOSIZE,
_("<%s>%s%s %d, Hex %02x, Octal %03o"),
transchar(c), buf1, buf2, c, c, c);
transchar(c), buf1, buf2, cval, cval, cval);
#ifdef FEAT_MBYTE
if (enc_utf8)
c = cc[ci++];
@@ -353,7 +358,7 @@ ex_sort(eap)
linenr_T lnum;
long maxlen = 0;
sorti_T *nrs;
size_t count = eap->line2 - eap->line1 + 1;
size_t count = (size_t)(eap->line2 - eap->line1 + 1);
size_t i;
char_u *p;
char_u *s;
@@ -952,7 +957,7 @@ do_bang(addr_count, eap, forceit, do_in, do_out)
}
len += (int)STRLEN(prevcmd);
}
if ((t = alloc(len)) == NULL)
if ((t = alloc((unsigned)len)) == NULL)
{
vim_free(newcmd);
return;
@@ -1543,7 +1548,7 @@ make_filter_cmd(cmd, itmp, otmp)
* redirecting input and/or output.
*/
if (itmp != NULL || otmp != NULL)
sprintf((char *)buf, "(%s)", (char *)cmd);
vim_snprintf((char *)buf, len, "(%s)", (char *)cmd);
else
STRCPY(buf, cmd);
if (itmp != NULL)
@@ -1592,37 +1597,41 @@ make_filter_cmd(cmd, itmp, otmp)
}
#endif
if (otmp != NULL)
append_redir(buf, p_srr, otmp);
append_redir(buf, (int)len, p_srr, otmp);
return buf;
}
/*
* Append output redirection for file "fname" to the end of string buffer "buf"
* Append output redirection for file "fname" to the end of string buffer
* "buf[buflen]"
* Works with the 'shellredir' and 'shellpipe' options.
* The caller should make sure that there is enough room:
* STRLEN(opt) + STRLEN(fname) + 3
*/
void
append_redir(buf, opt, fname)
append_redir(buf, buflen, opt, fname)
char_u *buf;
int buflen;
char_u *opt;
char_u *fname;
{
char_u *p;
char_u *end;
buf += STRLEN(buf);
end = buf + STRLEN(buf);
/* find "%s", skipping "%%" */
for (p = opt; (p = vim_strchr(p, '%')) != NULL; ++p)
if (p[1] == 's')
break;
if (p != NULL)
{
*buf = ' '; /* not really needed? Not with sh, ksh or bash */
sprintf((char *)buf + 1, (char *)opt, (char *)fname);
*end = ' '; /* not really needed? Not with sh, ksh or bash */
vim_snprintf((char *)end + 1, (size_t)(buflen - (end + 1 - buf)),
(char *)opt, (char *)fname);
}
else
sprintf((char *)buf,
vim_snprintf((char *)end, (size_t)(buflen - (end - buf)),
#ifdef FEAT_QUICKFIX
# ifndef RISCOS
opt != p_sp ? " %s%s" :
@@ -1784,7 +1793,7 @@ write_viminfo(file, forceit)
* overwrite a user's viminfo file after a "su root", with a
* viminfo file that the user can't read.
*/
st_old.st_dev = 0;
st_old.st_dev = (dev_t)0;
st_old.st_ino = 0;
st_old.st_mode = 0600;
if (mch_stat((char *)fname, &st_old) == 0
@@ -1941,7 +1950,7 @@ write_viminfo(file, forceit)
* root.
*/
if (fp_out != NULL)
(void)fchown(fileno(fp_out), st_old.st_uid, st_old.st_gid);
ignored = fchown(fileno(fp_out), st_old.st_uid, st_old.st_gid);
#endif
}
}
@@ -2246,12 +2255,11 @@ viminfo_readline(virp)
*
* Return the string in allocated memory (NULL when out of memory).
*/
/*ARGSUSED*/
char_u *
viminfo_readstring(virp, off, convert)
vir_T *virp;
int off; /* offset for virp->vir_line */
int convert; /* convert the string */
int convert UNUSED; /* convert the string */
{
char_u *retval;
char_u *s, *d;
@@ -2363,10 +2371,9 @@ viminfo_writestring(fd, p)
* ^? ^H
* not ^? ^?
*/
/*ARGSUSED*/
void
do_fixdel(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
char_u *p;
@@ -2385,7 +2392,8 @@ print_line_no_prefix(lnum, use_number, list)
if (curwin->w_p_nu || use_number)
{
sprintf((char *)numbuf, "%*ld ", number_width(curwin), (long)lnum);
vim_snprintf((char *)numbuf, sizeof(numbuf),
"%*ld ", number_width(curwin), (long)lnum);
msg_puts_attr(numbuf, hl_attr(HLF_N)); /* Highlight line nrs */
}
msg_prt_line(ml_get(lnum), list);
@@ -2412,8 +2420,8 @@ print_line(lnum, use_number, list)
cursor_on(); /* msg_start() switches it off */
out_flush();
silent_mode = save_silent;
info_message = FALSE;
}
info_message = FALSE;
}
/*
@@ -2702,7 +2710,12 @@ do_write(eap)
if (eap->cmdidx == CMD_saveas)
{
if (retval == OK)
{
curbuf->b_p_ro = FALSE;
#ifdef FEAT_WINDOWS
redraw_tabline = TRUE;
#endif
}
/* Change directories when the 'acd' option is set. */
DO_AUTOCHDIR
}
@@ -2722,7 +2735,6 @@ theend:
* May set eap->forceit if a dialog says it's OK to overwrite.
* Return OK if it's OK, FAIL if it is not.
*/
/*ARGSUSED*/
static int
check_overwrite(eap, buf, fname, ffname, other)
exarg_T *eap;
@@ -3052,7 +3064,8 @@ getfile(fnum, ffname, sfname, setpm, lnum, forceit)
retval = 0; /* it's in the same file */
}
else if (do_ecmd(fnum, ffname, sfname, NULL, lnum,
(P_HID(curbuf) ? ECMD_HIDE : 0) + (forceit ? ECMD_FORCEIT : 0)) == OK)
(P_HID(curbuf) ? ECMD_HIDE : 0) + (forceit ? ECMD_FORCEIT : 0),
curwin) == OK)
retval = -1; /* opened another file */
else
retval = 1; /* error encountered */
@@ -3085,17 +3098,21 @@ theend:
* ECMD_OLDBUF: use existing buffer if it exists
* ECMD_FORCEIT: ! used for Ex command
* ECMD_ADDBUF: don't edit, just add to buffer list
* oldwin: Should be "curwin" when editing a new buffer in the current
* window, NULL when splitting the window first. When not NULL info
* of the previous buffer for "oldwin" is stored.
*
* return FAIL for failure, OK otherwise
*/
int
do_ecmd(fnum, ffname, sfname, eap, newlnum, flags)
do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin)
int fnum;
char_u *ffname;
char_u *sfname;
exarg_T *eap; /* can be NULL! */
linenr_T newlnum;
int flags;
win_T *oldwin;
{
int other_file; /* TRUE if editing another file */
int oldbuf; /* TRUE if using existing buffer */
@@ -3267,7 +3284,8 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags)
{
if (!cmdmod.keepalt)
curwin->w_alt_fnum = curbuf->b_fnum;
buflist_altfpos();
if (oldwin != NULL)
buflist_altfpos(oldwin);
}
if (fnum)
@@ -3371,7 +3389,7 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags)
/* close the link to the current buffer */
u_sync(FALSE);
close_buffer(curwin, curbuf,
close_buffer(oldwin, curbuf,
(flags & ECMD_HIDE) ? 0 : DOBUF_UNLOAD);
#ifdef FEAT_AUTOCMD
@@ -3699,7 +3717,7 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags)
/* If the window options were changed may need to set the spell language.
* Can only do this after the buffer has been properly setup. */
if (did_get_winopts && curwin->w_p_spell && *curbuf->b_p_spl != NUL)
did_set_spelllang(curbuf);
(void)did_set_spelllang(curbuf);
#endif
if (command == NULL)
@@ -3772,7 +3790,7 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags)
#ifdef FEAT_KEYMAP
if (curbuf->b_kmap_state & KEYMAP_INIT)
keymap_init();
(void)keymap_init();
#endif
--RedrawingDisabled;
@@ -3995,6 +4013,9 @@ ex_change(eap)
break;
ml_delete(eap->line1, FALSE);
}
/* make sure the cursor is not beyond the end of the file now */
check_cursor_lnum();
deleted_lines_mark(eap->line1, (long)(eap->line2 - lnum));
/* ":append" on the line above the deleted lines. */
@@ -4020,8 +4041,10 @@ ex_z(eap)
bigness = curwin->w_height;
else if (firstwin == lastwin)
bigness = curwin->w_p_scr * 2;
#ifdef FEAT_WINDOWS
else
bigness = curwin->w_height - 3;
#endif
if (bigness < 1)
bigness = 1;
@@ -4470,7 +4493,7 @@ do_sub(eap)
char_u *p1;
int did_sub = FALSE;
int lastone;
unsigned len, needed_len;
int len, copy_len, needed_len;
long nmatch_tl = 0; /* nr of lines matched below lnum */
int do_again; /* do it again after joining lines */
int skip_match = FALSE;
@@ -4615,6 +4638,8 @@ do_sub(eap)
if (do_ask)
{
int typed = 0;
/* change State to CONFIRM, so that the mouse works
* properly */
save_State = State;
@@ -4653,7 +4678,7 @@ do_sub(eap)
resp = getexmodeline('?', NULL, 0);
if (resp != NULL)
{
i = *resp;
typed = *resp;
vim_free(resp);
}
}
@@ -4705,7 +4730,7 @@ do_sub(eap)
#endif
++no_mapping; /* don't map this key */
++allow_keys; /* allow special keys */
i = plain_vgetc();
typed = plain_vgetc();
--allow_keys;
--no_mapping;
@@ -4716,35 +4741,35 @@ do_sub(eap)
}
need_wait_return = FALSE; /* no hit-return prompt */
if (i == 'q' || i == ESC || i == Ctrl_C
if (typed == 'q' || typed == ESC || typed == Ctrl_C
#ifdef UNIX
|| i == intr_char
|| typed == intr_char
#endif
)
{
got_quit = TRUE;
break;
}
if (i == 'n')
if (typed == 'n')
break;
if (i == 'y')
if (typed == 'y')
break;
if (i == 'l')
if (typed == 'l')
{
/* last: replace and then stop */
do_all = FALSE;
line2 = lnum;
break;
}
if (i == 'a')
if (typed == 'a')
{
do_ask = FALSE;
break;
}
#ifdef FEAT_INS_EXPAND
if (i == Ctrl_E)
if (typed == Ctrl_E)
scrollup_clamp();
else if (i == Ctrl_Y)
else if (typed == Ctrl_Y)
scrolldown_clamp();
#endif
}
@@ -4755,7 +4780,7 @@ do_sub(eap)
if (vim_strchr(p_cpo, CPO_UNDO) != NULL)
--no_u_sync;
if (i == 'n')
if (typed == 'n')
{
/* For a multi-line match, put matchcol at the NUL at
* the end of the line and set nmatch to one, so that
@@ -4806,9 +4831,9 @@ do_sub(eap)
p1 = ml_get(sub_firstlnum + nmatch - 1);
nmatch_tl += nmatch - 1;
}
i = regmatch.startpos[0].col - copycol;
needed_len = i + ((unsigned)STRLEN(p1) - regmatch.endpos[0].col)
+ sublen + 1;
copy_len = regmatch.startpos[0].col - copycol;
needed_len = copy_len + ((unsigned)STRLEN(p1)
- regmatch.endpos[0].col) + sublen + 1;
if (new_start == NULL)
{
/*
@@ -4831,7 +4856,7 @@ do_sub(eap)
*/
len = (unsigned)STRLEN(new_start);
needed_len += len;
if (needed_len > new_start_len)
if (needed_len > (int)new_start_len)
{
new_start_len = needed_len + 50;
if ((p1 = alloc_check(new_start_len)) == NULL)
@@ -4849,8 +4874,8 @@ do_sub(eap)
/*
* copy the text up to the part that matched
*/
mch_memmove(new_end, sub_firstline + copycol, (size_t)i);
new_end += i;
mch_memmove(new_end, sub_firstline + copycol, (size_t)copy_len);
new_end += copy_len;
(void)vim_regsub_multi(&regmatch,
sub_firstlnum - regmatch.startpos[0].lnum,
@@ -5609,7 +5634,13 @@ ex_help(eap)
*/
alt_fnum = curbuf->b_fnum;
(void)do_ecmd(0, NULL, NULL, NULL, ECMD_LASTL,
ECMD_HIDE + ECMD_SET_HELP);
ECMD_HIDE + ECMD_SET_HELP,
#ifdef FEAT_WINDOWS
NULL /* buffer is still open, don't store info */
#else
curwin
#endif
);
if (!cmdmod.keepalt)
curwin->w_alt_fnum = alt_fnum;
empty_fnum = curbuf->b_fnum;
@@ -5768,7 +5799,7 @@ find_help_tags(arg, num_matches, matches, keep_lang)
* Recognize a few exceptions to the rule. Some strings that contain '*'
* with "star". Otherwise '*' is recognized as a wildcard.
*/
for (i = sizeof(mtable) / sizeof(char *); --i >= 0; )
for (i = (int)(sizeof(mtable) / sizeof(char *)); --i >= 0; )
if (STRCMP(arg, mtable[i]) == 0)
{
STRCPY(d, rtable[i]);
@@ -6092,10 +6123,9 @@ fix_help_buffer()
/*
* ":exusage"
*/
/*ARGSUSED*/
void
ex_exusage(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
do_cmdline_cmd((char_u *)"help ex-cmd-index");
}
@@ -6103,10 +6133,9 @@ ex_exusage(eap)
/*
* ":viusage"
*/
/*ARGSUSED*/
void
ex_viusage(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
do_cmdline_cmd((char_u *)"help normal-index");
}
@@ -6518,7 +6547,46 @@ struct sign
static sign_T *first_sign = NULL;
static int last_sign_typenr = MAX_TYPENR; /* is decremented */
static int sign_cmd_idx __ARGS((char_u *begin_cmd, char_u *end_cmd));
static void sign_list_defined __ARGS((sign_T *sp));
static void sign_undefine __ARGS((sign_T *sp, sign_T *sp_prev));
static char *cmds[] = {
"define",
#define SIGNCMD_DEFINE 0
"undefine",
#define SIGNCMD_UNDEFINE 1
"list",
#define SIGNCMD_LIST 2
"place",
#define SIGNCMD_PLACE 3
"unplace",
#define SIGNCMD_UNPLACE 4
"jump",
#define SIGNCMD_JUMP 5
NULL
#define SIGNCMD_LAST 6
};
/*
* Find index of a ":sign" subcmd from its name.
* "*end_cmd" must be writable.
*/
static int
sign_cmd_idx(begin_cmd, end_cmd)
char_u *begin_cmd; /* begin of sign subcmd */
char_u *end_cmd; /* just after sign subcmd */
{
int idx;
char save = *end_cmd;
*end_cmd = NUL;
for (idx = 0; ; ++idx)
if (cmds[idx] == NULL || STRCMP(begin_cmd, cmds[idx]) == 0)
break;
*end_cmd = save;
return idx;
}
/*
* ":sign" command
@@ -6533,35 +6601,14 @@ ex_sign(eap)
sign_T *sp;
sign_T *sp_prev;
buf_T *buf;
static char *cmds[] = {
"define",
#define SIGNCMD_DEFINE 0
"undefine",
#define SIGNCMD_UNDEFINE 1
"list",
#define SIGNCMD_LIST 2
"place",
#define SIGNCMD_PLACE 3
"unplace",
#define SIGNCMD_UNPLACE 4
"jump",
#define SIGNCMD_JUMP 5
#define SIGNCMD_LAST 6
};
/* Parse the subcommand. */
p = skiptowhite(arg);
if (*p != NUL)
*p++ = NUL;
for (idx = 0; ; ++idx)
idx = sign_cmd_idx(arg, p);
if (idx == SIGNCMD_LAST)
{
if (idx == SIGNCMD_LAST)
{
EMSG2(_("E160: Unknown sign command: %s"), arg);
return;
}
if (STRCMP(arg, cmds[idx]) == 0)
break;
EMSG2(_("E160: Unknown sign command: %s"), arg);
return;
}
arg = skipwhite(p);
@@ -6727,24 +6774,8 @@ ex_sign(eap)
/* ":sign list {name}" */
sign_list_defined(sp);
else
{
/* ":sign undefine {name}" */
vim_free(sp->sn_name);
vim_free(sp->sn_icon);
#ifdef FEAT_SIGN_ICONS
if (sp->sn_image != NULL)
{
out_flush();
gui_mch_destroy_sign(sp->sn_image);
}
#endif
vim_free(sp->sn_text);
if (sp_prev == NULL)
first_sign = sp->sn_next;
else
sp_prev->sn_next = sp->sn_next;
vim_free(sp);
}
sign_undefine(sp, sp_prev);
}
}
else
@@ -6992,6 +7023,31 @@ sign_list_defined(sp)
}
}
/*
* Undefine a sign and free its memory.
*/
static void
sign_undefine(sp, sp_prev)
sign_T *sp;
sign_T *sp_prev;
{
vim_free(sp->sn_name);
vim_free(sp->sn_icon);
#ifdef FEAT_SIGN_ICONS
if (sp->sn_image != NULL)
{
out_flush();
gui_mch_destroy_sign(sp->sn_image);
}
#endif
vim_free(sp->sn_text);
if (sp_prev == NULL)
first_sign = sp->sn_next;
else
sp_prev->sn_next = sp->sn_next;
vim_free(sp);
}
/*
* Get highlighting attribute for sign "typenr".
* If "line" is TRUE: line highl, if FALSE: text highl.
@@ -7066,6 +7122,197 @@ sign_typenr2name(typenr)
return (char_u *)_("[Deleted]");
}
#if defined(EXITFREE) || defined(PROTO)
/*
* Undefine/free all signs.
*/
void
free_signs()
{
while (first_sign != NULL)
sign_undefine(first_sign, NULL);
}
#endif
#if defined(FEAT_CMDL_COMPL) || defined(PROTO)
static enum
{
EXP_SUBCMD, /* expand :sign sub-commands */
EXP_DEFINE, /* expand :sign define {name} args */
EXP_PLACE, /* expand :sign place {id} args */
EXP_UNPLACE, /* expand :sign unplace" */
EXP_SIGN_NAMES /* expand with name of placed signs */
} expand_what;
/*
* Function given to ExpandGeneric() to obtain the sign command
* expansion.
*/
char_u *
get_sign_name(xp, idx)
expand_T *xp UNUSED;
int idx;
{
sign_T *sp;
int current_idx;
switch (expand_what)
{
case EXP_SUBCMD:
return (char_u *)cmds[idx];
case EXP_DEFINE:
{
char *define_arg[] =
{
"icon=", "linehl=", "text=", "texthl=", NULL
};
return (char_u *)define_arg[idx];
}
case EXP_PLACE:
{
char *place_arg[] =
{
"line=", "name=", "file=", "buffer=", NULL
};
return (char_u *)place_arg[idx];
}
case EXP_UNPLACE:
{
char *unplace_arg[] = { "file=", "buffer=", NULL };
return (char_u *)unplace_arg[idx];
}
case EXP_SIGN_NAMES:
/* Complete with name of signs already defined */
current_idx = 0;
for (sp = first_sign; sp != NULL; sp = sp->sn_next)
if (current_idx++ == idx)
return sp->sn_name;
return NULL;
default:
return NULL;
}
}
/*
* Handle command line completion for :sign command.
*/
void
set_context_in_sign_cmd(xp, arg)
expand_T *xp;
char_u *arg;
{
char_u *p;
char_u *end_subcmd;
char_u *last;
int cmd_idx;
char_u *begin_subcmd_args;
/* Default: expand subcommands. */
xp->xp_context = EXPAND_SIGN;
expand_what = EXP_SUBCMD;
xp->xp_pattern = arg;
end_subcmd = skiptowhite(arg);
if (*end_subcmd == NUL)
/* expand subcmd name
* :sign {subcmd}<CTRL-D>*/
return;
cmd_idx = sign_cmd_idx(arg, end_subcmd);
/* :sign {subcmd} {subcmd_args}
* |
* begin_subcmd_args */
begin_subcmd_args = skipwhite(end_subcmd);
p = skiptowhite(begin_subcmd_args);
if (*p == NUL)
{
/*
* Expand first argument of subcmd when possible.
* For ":jump {id}" and ":unplace {id}", we could
* possibly expand the ids of all signs already placed.
*/
xp->xp_pattern = begin_subcmd_args;
switch (cmd_idx)
{
case SIGNCMD_LIST:
case SIGNCMD_UNDEFINE:
/* :sign list <CTRL-D>
* :sign undefine <CTRL-D> */
expand_what = EXP_SIGN_NAMES;
break;
default:
xp->xp_context = EXPAND_NOTHING;
}
return;
}
/* expand last argument of subcmd */
/* :sign define {name} {args}...
* |
* p */
/* Loop until reaching last argument. */
do
{
p = skipwhite(p);
last = p;
p = skiptowhite(p);
} while (*p != NUL);
p = vim_strchr(last, '=');
/* :sign define {name} {args}... {last}=
* | |
* last p */
if (p == NUL)
{
/* Expand last argument name (before equal sign). */
xp->xp_pattern = last;
switch (cmd_idx)
{
case SIGNCMD_DEFINE:
expand_what = EXP_DEFINE;
break;
case SIGNCMD_PLACE:
expand_what = EXP_PLACE;
break;
case SIGNCMD_JUMP:
case SIGNCMD_UNPLACE:
expand_what = EXP_UNPLACE;
break;
default:
xp->xp_context = EXPAND_NOTHING;
}
}
else
{
/* Expand last argument value (after equal sign). */
xp->xp_pattern = p + 1;
switch (cmd_idx)
{
case SIGNCMD_DEFINE:
if (STRNCMP(last, "texthl", p - last) == 0 ||
STRNCMP(last, "linehl", p - last) == 0)
xp->xp_context = EXPAND_HIGHLIGHT;
else if (STRNCMP(last, "icon", p - last) == 0)
xp->xp_context = EXPAND_FILES;
else
xp->xp_context = EXPAND_NOTHING;
break;
case SIGNCMD_PLACE:
if (STRNCMP(last, "name", p - last) == 0)
expand_what = EXP_SIGN_NAMES;
else
xp->xp_context = EXPAND_NOTHING;
break;
default:
xp->xp_context = EXPAND_NOTHING;
}
}
}
#endif
#endif
#if defined(FEAT_GUI) || defined(FEAT_CLIENTSERVER) || defined(PROTO)
+2
View File
@@ -995,6 +995,8 @@ EX(CMD_unmap, "unmap", ex_unmap,
BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
EX(CMD_unmenu, "unmenu", ex_menu,
BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
EX(CMD_unsilent, "unsilent", ex_wrongmodifier,
NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN),
EX(CMD_update, "update", ex_update,
RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR),
EX(CMD_vglobal, "vglobal", ex_global,
+43 -45
View File
@@ -28,7 +28,8 @@ typedef struct scriptitem_S
{
char_u *sn_name;
# ifdef UNIX
int sn_dev;
int sn_dev_valid;
dev_t sn_dev;
ino_t sn_ino;
# endif
# ifdef FEAT_PROFILE
@@ -680,10 +681,9 @@ ex_breakdel(eap)
/*
* ":breaklist".
*/
/*ARGSUSED*/
void
ex_breaklist(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
struct debuggy *bp;
int i;
@@ -1342,14 +1342,13 @@ autowrite_all()
/*
* return TRUE if buffer was changed and cannot be abandoned.
*/
/*ARGSUSED*/
int
check_changed(buf, checkaw, mult_win, forceit, allbuf)
buf_T *buf;
int checkaw; /* do autowrite if buffer was changed */
int mult_win; /* check also when several wins for the buf */
int forceit;
int allbuf; /* may write all buffers */
int allbuf UNUSED; /* may write all buffers */
{
if ( !forceit
&& bufIsChanged(buf)
@@ -1832,12 +1831,11 @@ set_arglist(str)
*
* Return FAIL for failure, OK otherwise.
*/
/*ARGSUSED*/
static int
do_arglist(str, what, after)
char_u *str;
int what;
int after; /* 0 means before first one */
int what UNUSED;
int after UNUSED; /* 0 means before first one */
{
garray_T new_ga;
int exp_count;
@@ -2205,8 +2203,8 @@ do_argfile(eap, argn)
* argument index. */
if (do_ecmd(0, alist_name(&ARGLIST[curwin->w_arg_idx]), NULL,
eap, ECMD_LAST,
(P_HID(curwin->w_buffer) ? ECMD_HIDE : 0) +
(eap->forceit ? ECMD_FORCEIT : 0)) == FAIL)
(P_HID(curwin->w_buffer) ? ECMD_HIDE : 0)
+ (eap->forceit ? ECMD_FORCEIT : 0), curwin) == FAIL)
curwin->w_arg_idx = old_arg_idx;
/* like Vi: set the mark where the cursor is in the file. */
else if (eap->cmdidx != CMD_argdo)
@@ -2622,11 +2620,10 @@ ex_runtime(eap)
static void source_callback __ARGS((char_u *fname, void *cookie));
/*ARGSUSED*/
static void
source_callback(fname, cookie)
char_u *fname;
void *cookie;
void *cookie UNUSED;
{
(void)do_source(fname, FALSE, DOSO_NONE);
}
@@ -2753,10 +2750,9 @@ do_in_runtimepath(name, all, callback, cookie)
/*
* ":options"
*/
/*ARGSUSED*/
void
ex_options(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
cmd_source((char_u *)SYS_OPTWIN_FILE, NULL);
}
@@ -2915,6 +2911,7 @@ do_source(fname, check_other, is_vimrc)
linenr_T save_sourcing_lnum;
char_u *p;
char_u *fname_exp;
char_u *firstline = NULL;
int retval = FAIL;
#ifdef FEAT_EVAL
scid_T save_current_SID;
@@ -3065,23 +3062,6 @@ do_source(fname, check_other, is_vimrc)
cookie.level = ex_nesting_level;
#endif
#ifdef FEAT_MBYTE
cookie.conv.vc_type = CONV_NONE; /* no conversion */
/* Try reading the first few bytes to check for a UTF-8 BOM. */
{
char_u buf[3];
if (fread((char *)buf, sizeof(char_u), (size_t)3, cookie.fp)
== (size_t)3
&& buf[0] == 0xef && buf[1] == 0xbb && buf[2] == 0xbf)
/* Found BOM, setup conversion and skip over it. */
convert_setup(&cookie.conv, (char_u *)"utf-8", p_enc);
else
/* No BOM found, rewind. */
fseek(cookie.fp, 0L, SEEK_SET);
}
#endif
/*
* Keep the sourcing name/lnum, for recursive calls.
@@ -3091,6 +3071,27 @@ do_source(fname, check_other, is_vimrc)
save_sourcing_lnum = sourcing_lnum;
sourcing_lnum = 0;
#ifdef FEAT_MBYTE
cookie.conv.vc_type = CONV_NONE; /* no conversion */
/* Read the first line so we can check for a UTF-8 BOM. */
firstline = getsourceline(0, (void *)&cookie, 0);
if (firstline != NULL && STRLEN(firstline) >= 3 && firstline[0] == 0xef
&& firstline[1] == 0xbb && firstline[2] == 0xbf)
{
/* Found BOM; setup conversion, skip over BOM and recode the line. */
convert_setup(&cookie.conv, (char_u *)"utf-8", p_enc);
p = string_convert(&cookie.conv, firstline + 3, NULL);
if (p == NULL)
p = vim_strsave(firstline + 3);
if (p != NULL)
{
vim_free(firstline);
firstline = p;
}
}
#endif
#ifdef STARTUPTIME
time_push(&tv_rel, &tv_start);
#endif
@@ -3122,7 +3123,7 @@ do_source(fname, check_other, is_vimrc)
/* Compare dev/ino when possible, it catches symbolic
* links. Also compare file names, the inode may change
* when the file was edited. */
((stat_ok && si->sn_dev != -1)
((stat_ok && si->sn_dev_valid)
&& (si->sn_dev == st.st_dev
&& si->sn_ino == st.st_ino)) ||
# endif
@@ -3149,11 +3150,12 @@ do_source(fname, check_other, is_vimrc)
# ifdef UNIX
if (stat_ok)
{
si->sn_dev_valid = TRUE;
si->sn_dev = st.st_dev;
si->sn_ino = st.st_ino;
}
else
si->sn_dev = -1;
si->sn_dev_valid = FALSE;
# endif
/* Allocate the local script variables to use for this script. */
@@ -3184,9 +3186,8 @@ do_source(fname, check_other, is_vimrc)
/*
* Call do_cmdline, which will call getsourceline() to get the lines.
*/
do_cmdline(NULL, getsourceline, (void *)&cookie,
do_cmdline(firstline, getsourceline, (void *)&cookie,
DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_REPEAT);
retval = OK;
#ifdef FEAT_PROFILE
@@ -3244,6 +3245,7 @@ almosttheend:
#endif
fclose(cookie.fp);
vim_free(cookie.nextline);
vim_free(firstline);
#ifdef FEAT_MBYTE
convert_setup(&cookie.conv, NULL, NULL);
#endif
@@ -3258,10 +3260,9 @@ theend:
/*
* ":scriptnames"
*/
/*ARGSUSED*/
void
ex_scriptnames(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
int i;
@@ -3385,12 +3386,11 @@ fgets_cr(s, n, stream)
* Return a pointer to the line in allocated memory.
* Return NULL for end-of-file or some error.
*/
/* ARGSUSED */
char_u *
getsourceline(c, cookie, indent)
int c; /* not used */
int c UNUSED;
void *cookie;
int indent; /* not used */
int indent UNUSED;
{
struct source_cookie *sp = (struct source_cookie *)cookie;
char_u *line;
@@ -3441,7 +3441,7 @@ getsourceline(c, cookie, indent)
p = skipwhite(sp->nextline);
if (*p != '\\')
break;
s = alloc((int)(STRLEN(line) + STRLEN(p)));
s = alloc((unsigned)(STRLEN(line) + STRLEN(p)));
if (s == NULL) /* out of memory */
break;
STRCPY(s, line);
@@ -3717,10 +3717,9 @@ script_line_end()
* ":scriptencoding": Set encoding conversion for a sourced script.
* Without the multi-byte feature it's simply ignored.
*/
/*ARGSUSED*/
void
ex_scriptencoding(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
#ifdef FEAT_MBYTE
struct source_cookie *sp;
@@ -4169,10 +4168,9 @@ ex_language(eap)
* Function given to ExpandGeneric() to obtain the possible arguments of the
* ":language" command.
*/
/*ARGSUSED*/
char_u *
get_lang_arg(xp, idx)
expand_T *xp;
expand_T *xp UNUSED;
int idx;
{
if (idx == 0)
+140 -81
View File
@@ -1585,11 +1585,10 @@ free_cmdlines(gap)
* If "fgetline" is get_loop_line(), return TRUE if the getline it uses equals
* "func". * Otherwise return TRUE when "fgetline" equals "func".
*/
/*ARGSUSED*/
int
getline_equal(fgetline, cookie, func)
char_u *(*fgetline) __ARGS((int, void *, int));
void *cookie; /* argument for fgetline() */
void *cookie UNUSED; /* argument for fgetline() */
char_u *(*func) __ARGS((int, void *, int));
{
#ifdef FEAT_EVAL
@@ -1617,10 +1616,9 @@ getline_equal(fgetline, cookie, func)
* If "fgetline" is get_loop_line(), return the cookie used by the original
* getline function. Otherwise return "cookie".
*/
/*ARGSUSED*/
void *
getline_cookie(fgetline, cookie)
char_u *(*fgetline) __ARGS((int, void *, int));
char_u *(*fgetline) __ARGS((int, void *, int)) UNUSED;
void *cookie; /* argument for fgetline() */
{
# ifdef FEAT_EVAL
@@ -1686,8 +1684,8 @@ do_one_cmd(cmdlinep, sourcing,
char_u *errormsg = NULL; /* error message */
exarg_T ea; /* Ex command arguments */
long verbose_save = -1;
int save_msg_scroll = 0;
int did_silent = 0;
int save_msg_scroll = msg_scroll;
int save_msg_silent = -1;
int did_esilent = 0;
#ifdef HAVE_SANDBOX
int did_sandbox = FALSE;
@@ -1865,9 +1863,9 @@ do_one_cmd(cmdlinep, sourcing,
}
if (!checkforcmd(&ea.cmd, "silent", 3))
break;
++did_silent;
if (save_msg_silent == -1)
save_msg_silent = msg_silent;
++msg_silent;
save_msg_scroll = msg_scroll;
if (*ea.cmd == '!' && !vim_iswhite(ea.cmd[-1]))
{
/* ":silent!", but not "silent !cmd" */
@@ -1895,6 +1893,13 @@ do_one_cmd(cmdlinep, sourcing,
#endif
continue;
case 'u': if (!checkforcmd(&ea.cmd, "unsilent", 3))
break;
if (save_msg_silent == -1)
save_msg_silent = msg_silent;
msg_silent = 0;
continue;
case 'v': if (checkforcmd(&ea.cmd, "vertical", 4))
{
#ifdef FEAT_VERTSPLIT
@@ -2693,19 +2698,23 @@ doend:
cmdmod = save_cmdmod;
if (did_silent > 0)
if (save_msg_silent != -1)
{
/* messages could be enabled for a serious error, need to check if the
* counters don't become negative */
msg_silent -= did_silent;
if (msg_silent < 0)
msg_silent = 0;
if (!did_emsg)
msg_silent = save_msg_silent;
emsg_silent -= did_esilent;
if (emsg_silent < 0)
emsg_silent = 0;
/* Restore msg_scroll, it's set by file I/O commands, even when no
* message is actually displayed. */
msg_scroll = save_msg_scroll;
/* "silent reg" or "silent echo x" inside "redir" leaves msg_col
* somewhere in the line. Put it back in the first column. */
if (redirecting())
msg_col = 0;
}
#ifdef HAVE_SANDBOX
@@ -2739,7 +2748,7 @@ checkforcmd(pp, cmd, len)
int i;
for (i = 0; cmd[i] != NUL; ++i)
if (cmd[i] != (*pp)[i])
if (((char_u *)cmd)[i] != (*pp)[i])
break;
if (i >= len && !isalpha((*pp)[i]))
{
@@ -2756,11 +2765,10 @@ checkforcmd(pp, cmd, len)
* "full" is set to TRUE if the whole command name matched.
* Returns NULL for an ambiguous user command.
*/
/*ARGSUSED*/
static char_u *
find_command(eap, full)
exarg_T *eap;
int *full;
int *full UNUSED;
{
int len;
char_u *p;
@@ -2805,7 +2813,7 @@ find_command(eap, full)
/* Check for ":dl", ":dell", etc. to ":deletel": that's
* :delete with the 'l' flag. Same for 'p'. */
for (i = 0; i < len; ++i)
if (eap->cmd[i] != "delete"[i])
if (eap->cmd[i] != ((char_u *)"delete")[i])
break;
if (i == len - 1)
{
@@ -2992,6 +3000,7 @@ static struct cmdmod
{"silent", 3, FALSE},
{"tab", 3, TRUE},
{"topleft", 2, FALSE},
{"unsilent", 3, FALSE},
{"verbose", 4, TRUE},
{"vertical", 4, FALSE},
};
@@ -3009,7 +3018,7 @@ modifier_len(cmd)
if (VIM_ISDIGIT(*cmd))
p = skipwhite(skipdigits(cmd));
for (i = 0; i < sizeof(cmdmods) / sizeof(struct cmdmod); ++i)
for (i = 0; i < (int)(sizeof(cmdmods) / sizeof(struct cmdmod)); ++i)
{
for (j = 0; p[j] != NUL; ++j)
if (p[j] != cmdmods[i].name[j])
@@ -3037,7 +3046,7 @@ cmd_exists(name)
char_u *p;
/* Check command modifiers. */
for (i = 0; i < sizeof(cmdmods) / sizeof(struct cmdmod); ++i)
for (i = 0; i < (int)(sizeof(cmdmods) / sizeof(struct cmdmod)); ++i)
{
for (j = 0; name[j] != NUL; ++j)
if (name[j] != cmdmods[i].name[j])
@@ -3690,6 +3699,18 @@ set_one_cmd_context(xp, buff)
case CMD_highlight:
set_context_in_highlight_cmd(xp, arg);
break;
#ifdef FEAT_CSCOPE
case CMD_cscope:
case CMD_lcscope:
case CMD_scscope:
set_context_in_cscope_cmd(xp, arg, ea.cmdidx);
break;
#endif
#ifdef FEAT_SIGNS
case CMD_sign:
set_context_in_sign_cmd(xp, arg);
break;
#endif
#ifdef FEAT_LISTCMDS
case CMD_bdelete:
case CMD_bwipeout:
@@ -3824,7 +3845,7 @@ skip_range(cmd, ctx)
char_u *cmd;
int *ctx; /* pointer to xp_context or NULL */
{
int delim;
unsigned delim;
while (vim_strchr((char_u *)" \t0123456789.$%'/?-+,;", *cmd) != NULL)
{
@@ -5054,10 +5075,9 @@ check_more(message, forceit)
/*
* Function given to ExpandGeneric() to obtain the list of command names.
*/
/*ARGSUSED*/
char_u *
get_command_name(xp, idx)
expand_T *xp;
expand_T *xp UNUSED;
int idx;
{
if (idx >= (int)CMD_SIZE)
@@ -5142,7 +5162,11 @@ uc_add_command(name, name_len, rep, argt, def, flags, compl, compl_arg, force)
}
vim_free(cmd->uc_rep);
cmd->uc_rep = 0;
cmd->uc_rep = NULL;
#if defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL)
vim_free(cmd->uc_compl_arg);
cmd->uc_compl_arg = NULL;
#endif
break;
}
@@ -5201,6 +5225,9 @@ static struct
{EXPAND_AUGROUP, "augroup"},
{EXPAND_BUFFERS, "buffer"},
{EXPAND_COMMANDS, "command"},
#if defined(FEAT_CSCOPE)
{EXPAND_CSCOPE, "cscope"},
#endif
#if defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL)
{EXPAND_USER_DEFINED, "custom"},
{EXPAND_USER_LIST, "customlist"},
@@ -5217,6 +5244,9 @@ static struct
{EXPAND_MENUS, "menu"},
{EXPAND_SETTINGS, "option"},
{EXPAND_SHELLCMD, "shellcmd"},
#if defined(FEAT_SIGNS)
{EXPAND_SIGN, "sign"},
#endif
{EXPAND_TAGS, "tag"},
{EXPAND_TAGS_LISTFILES, "tag_listfiles"},
{EXPAND_USER_VARS, "var"},
@@ -5500,6 +5530,9 @@ invalid_count:
return OK;
}
/*
* ":command ..."
*/
static void
ex_command(eap)
exarg_T *eap;
@@ -5561,10 +5594,9 @@ ex_command(eap)
* ":comclear"
* Clear all user commands, global and for current buffer.
*/
/*ARGSUSED*/
void
ex_comclear(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
uc_clear(&ucmds);
uc_clear(&curbuf->b_ucmds);
@@ -5931,7 +5963,8 @@ do_ucmd(eap)
char_u *q;
char_u *start;
char_u *end;
char_u *end = NULL;
char_u *ksp;
size_t len, totlen;
size_t split_len = 0;
@@ -5948,16 +5981,51 @@ do_ucmd(eap)
/*
* Replace <> in the command by the arguments.
* First round: "buf" is NULL, compute length, allocate "buf".
* Second round: copy result into "buf".
*/
buf = NULL;
for (;;)
{
p = cmd->uc_rep;
q = buf;
p = cmd->uc_rep; /* source */
q = buf; /* destination */
totlen = 0;
while ((start = vim_strchr(p, '<')) != NULL
&& (end = vim_strchr(start + 1, '>')) != NULL)
for (;;)
{
start = vim_strchr(p, '<');
if (start != NULL)
end = vim_strchr(start + 1, '>');
if (buf != NULL)
{
ksp = vim_strchr(p, K_SPECIAL);
if (ksp != NULL && (start == NULL || ksp < start || end == NULL)
&& ((ksp[1] == KS_SPECIAL && ksp[2] == KE_FILLER)
# ifdef FEAT_GUI
|| (ksp[1] == KS_EXTRA && ksp[2] == (int)KE_CSI)
# endif
))
{
/* K_SPECIAL han been put in the buffer as K_SPECIAL
* KS_SPECIAL KE_FILLER, like for mappings, but
* do_cmdline() doesn't handle that, so convert it back.
* Also change K_SPECIAL KS_EXTRA KE_CSI into CSI. */
len = ksp - p;
if (len > 0)
{
mch_memmove(q, p, len);
q += len;
}
*q++ = ksp[1] == KS_SPECIAL ? K_SPECIAL : CSI;
p = ksp + 3;
continue;
}
}
/* break if there no <item> is found */
if (start == NULL || end == NULL)
break;
/* Include the '>' */
++end;
@@ -6024,10 +6092,9 @@ get_user_command_name(idx)
/*
* Function given to ExpandGeneric() to obtain the list of user command names.
*/
/*ARGSUSED*/
char_u *
get_user_commands(xp, idx)
expand_T *xp;
expand_T *xp UNUSED;
int idx;
{
if (idx < curbuf->b_ucmds.ga_len)
@@ -6042,17 +6109,16 @@ get_user_commands(xp, idx)
* Function given to ExpandGeneric() to obtain the list of user command
* attributes.
*/
/*ARGSUSED*/
char_u *
get_user_cmd_flags(xp, idx)
expand_T *xp;
expand_T *xp UNUSED;
int idx;
{
static char *user_cmd_flags[] =
{"bang", "bar", "buffer", "complete", "count",
"nargs", "range", "register"};
if (idx >= sizeof(user_cmd_flags) / sizeof(user_cmd_flags[0]))
if (idx >= (int)(sizeof(user_cmd_flags) / sizeof(user_cmd_flags[0])))
return NULL;
return (char_u *)user_cmd_flags[idx];
}
@@ -6060,15 +6126,14 @@ get_user_cmd_flags(xp, idx)
/*
* Function given to ExpandGeneric() to obtain the list of values for -nargs.
*/
/*ARGSUSED*/
char_u *
get_user_cmd_nargs(xp, idx)
expand_T *xp;
expand_T *xp UNUSED;
int idx;
{
static char *user_cmd_nargs[] = {"0", "1", "*", "?", "+"};
if (idx >= sizeof(user_cmd_nargs) / sizeof(user_cmd_nargs[0]))
if (idx >= (int)(sizeof(user_cmd_nargs) / sizeof(user_cmd_nargs[0])))
return NULL;
return (char_u *)user_cmd_nargs[idx];
}
@@ -6076,10 +6141,9 @@ get_user_cmd_nargs(xp, idx)
/*
* Function given to ExpandGeneric() to obtain the list of values for -complete.
*/
/*ARGSUSED*/
char_u *
get_user_cmd_complete(xp, idx)
expand_T *xp;
expand_T *xp UNUSED;
int idx;
{
return (char_u *)command_complete[idx].name;
@@ -6257,10 +6321,9 @@ ex_quit(eap)
/*
* ":cquit".
*/
/*ARGSUSED*/
static void
ex_cquit(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
getout(1); /* this does not always pass on the exit code to the Manx
compiler. why? */
@@ -6702,10 +6765,9 @@ ex_goto(eap)
/*
* ":shell".
*/
/*ARGSUSED*/
static void
ex_shell(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
do_shell(NULL, 0);
}
@@ -7010,10 +7072,9 @@ alist_slash_adjust()
/*
* ":preserve".
*/
/*ARGSUSED*/
static void
ex_preserve(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
curbuf->b_flags |= BF_PRESERVED;
ml_preserve(curbuf, TRUE);
@@ -7245,10 +7306,9 @@ ex_tabmove(eap)
/*
* :tabs command: List tabs and their contents.
*/
/*ARGSUSED*/
static void
ex_tabs(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
tabpage_T *tp;
win_T *wp;
@@ -7435,7 +7495,6 @@ ex_edit(eap)
/*
* ":edit <file>" command and alikes.
*/
/*ARGSUSED*/
void
do_exedit(eap, old_curwin)
exarg_T *eap;
@@ -7507,7 +7566,8 @@ do_exedit(eap, old_curwin)
/* ":new" or ":tabnew" without argument: edit an new empty buffer */
setpcmark();
(void)do_ecmd(0, NULL, NULL, eap, ECMD_ONE,
ECMD_HIDE + (eap->forceit ? ECMD_FORCEIT : 0));
ECMD_HIDE + (eap->forceit ? ECMD_FORCEIT : 0),
old_curwin == NULL ? curwin : NULL);
}
else if ((eap->cmdidx != CMD_split
#ifdef FEAT_VERTSPLIT
@@ -7544,7 +7604,7 @@ do_exedit(eap, old_curwin)
#ifdef FEAT_LISTCMDS
+ (eap->cmdidx == CMD_badd ? ECMD_ADDBUF : 0 )
#endif
) == FAIL)
, old_curwin == NULL ? curwin : NULL) == FAIL)
{
/* Editing the file failed. If the window was split, close it. */
#ifdef FEAT_WINDOWS
@@ -7647,10 +7707,9 @@ ex_popup(eap)
}
#endif
/*ARGSUSED*/
static void
ex_swapname(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
if (curbuf->b_ml.ml_mfp == NULL || curbuf->b_ml.ml_mfp->mf_fname == NULL)
MSG(_("No swap file"));
@@ -7663,10 +7722,9 @@ ex_swapname(eap)
* offset.
* (1998-11-02 16:21:01 R. Edward Ralston <eralston@computer.org>)
*/
/*ARGSUSED*/
static void
ex_syncbind(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
#ifdef FEAT_SCROLLBIND
win_T *wp;
@@ -7807,10 +7865,10 @@ ex_read(eap)
if (*ml_get(lnum) == NUL && u_savedel(lnum, 1L) == OK)
{
ml_delete(lnum, FALSE);
deleted_lines_mark(lnum, 1L);
if (curwin->w_cursor.lnum > 1
&& curwin->w_cursor.lnum >= lnum)
--curwin->w_cursor.lnum;
deleted_lines_mark(lnum, 1L);
}
}
redraw_curbuf_later(VALID);
@@ -7826,6 +7884,9 @@ free_cd_dir()
{
vim_free(prev_dir);
prev_dir = NULL;
vim_free(globaldir);
globaldir = NULL;
}
#endif
@@ -7848,6 +7909,10 @@ ex_cd(eap)
else
#endif
{
#ifdef FEAT_AUTOCMD
if (allbuf_locked())
return;
#endif
if (vim_strchr(p_cpo, CPO_CHDIR) != NULL && curbufIsChanged()
&& !eap->forceit)
{
@@ -7919,7 +7984,7 @@ ex_cd(eap)
shorten_fnames(TRUE);
/* Echo the new current directory if the command was typed. */
if (KeyTyped)
if (KeyTyped || p_verbose >= 5)
ex_pwd(eap);
}
vim_free(tofree);
@@ -7929,10 +7994,9 @@ ex_cd(eap)
/*
* ":pwd".
*/
/*ARGSUSED*/
static void
ex_pwd(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
if (mch_dirname(NameBuff, MAXPATHL) == OK)
{
@@ -8363,10 +8427,9 @@ ex_bang(eap)
/*
* ":undo".
*/
/*ARGSUSED*/
static void
ex_undo(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
if (eap->addr_count == 1) /* :undo 123 */
undo_time(eap->line2, FALSE, TRUE);
@@ -8377,10 +8440,9 @@ ex_undo(eap)
/*
* ":redo".
*/
/*ARGSUSED*/
static void
ex_redo(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
u_redo(1);
}
@@ -8388,7 +8450,6 @@ ex_redo(eap)
/*
* ":earlier" and ":later".
*/
/*ARGSUSED*/
static void
ex_later(eap)
exarg_T *eap;
@@ -8573,10 +8634,9 @@ ex_redraw(eap)
/*
* ":redrawstatus": force redraw of status line(s)
*/
/*ARGSUSED*/
static void
ex_redrawstatus(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
#if defined(FEAT_WINDOWS)
int r = RedrawingDisabled;
@@ -8653,6 +8713,8 @@ ex_mkrc(eap)
}
#ifdef FEAT_SESSION
/* Use the short file name until ":lcd" is used. We also don't use the
* short file name when 'acd' is set, that is checked later. */
did_lcd = FALSE;
/* ":mkview" or ":mkview 9": generate file name with 'viewdir' */
@@ -8772,8 +8834,8 @@ ex_mkrc(eap)
else if (*dirnow != NUL
&& (ssop_flags & SSOP_CURDIR) && globaldir != NULL)
{
(void)mch_chdir((char *)globaldir);
shorten_fnames(TRUE);
if (mch_chdir((char *)globaldir) == 0)
shorten_fnames(TRUE);
}
failed |= (makeopens(fd, dirnow) == FAIL);
@@ -8837,11 +8899,10 @@ theend:
#if ((defined(FEAT_SESSION) || defined(FEAT_EVAL)) && defined(vim_mkdir)) \
|| defined(PROTO)
/*ARGSUSED*/
int
vim_mkdir_emsg(name, prot)
char_u *name;
int prot;
int prot UNUSED;
{
if (vim_mkdir(name, prot) != 0)
{
@@ -9112,10 +9173,9 @@ ex_startinsert(eap)
/*
* ":stopinsert"
*/
/*ARGSUSED*/
static void
ex_stopinsert(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
restart_edit = 0;
stop_insert_mode = TRUE;
@@ -9389,9 +9449,8 @@ find_cmdline_var(src, usedlen)
# define SPEC_CLIENT 9
#endif
};
#define SPEC_COUNT (sizeof(spec_str) / sizeof(char *))
for (i = 0; i < SPEC_COUNT; ++i)
for (i = 0; i < (int)(sizeof(spec_str) / sizeof(char *)); ++i)
{
len = (int)STRLEN(spec_str[i]);
if (STRNCMP(src, spec_str[i], len) == 0)
@@ -9742,7 +9801,7 @@ arg_all()
}
/* allocate memory */
retval = alloc(len + 1);
retval = alloc((unsigned)len + 1);
if (retval == NULL)
break;
}
@@ -10133,7 +10192,7 @@ makeopens(fd, dirnow)
*/
if (put_line(fd, "let s:sx = expand(\"<sfile>:p:r\").\"x.vim\"") == FAIL
|| put_line(fd, "if file_readable(s:sx)") == FAIL
|| put_line(fd, " exe \"source \" . s:sx") == FAIL
|| put_line(fd, " exe \"source \" . fnameescape(s:sx)") == FAIL
|| put_line(fd, "endif") == FAIL)
return FAIL;
@@ -10551,6 +10610,9 @@ ses_fname(fd, buf, flagp)
if (buf->b_sfname != NULL
&& flagp == &ssop_flags
&& (ssop_flags & (SSOP_CURDIR | SSOP_SESDIR))
#ifdef FEAT_AUTOCHDIR
&& !p_acd
#endif
&& !did_lcd)
name = buf->b_sfname;
else
@@ -10917,10 +10979,9 @@ ex_setfiletype(eap)
}
#endif
/*ARGSUSED*/
static void
ex_digraphs(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
#ifdef FEAT_DIGRAPHS
if (*eap->arg != NUL)
@@ -10954,10 +11015,9 @@ ex_set(eap)
/*
* ":nohlsearch"
*/
/*ARGSUSED*/
static void
ex_nohlsearch(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
no_hlsearch = TRUE;
redraw_all_later(SOME_VALID);
@@ -11036,10 +11096,9 @@ ex_match(eap)
/*
* ":X": Get crypt key
*/
/*ARGSUSED*/
static void
ex_X(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
(void)get_crypt_key(TRUE, TRUE);
}
+7 -2
View File
@@ -60,7 +60,9 @@ static char_u *get_end_emsg __ARGS((struct condstack *cstack));
#else
/* Values used for the Vim release. */
# define THROW_ON_ERROR TRUE
# define THROW_ON_ERROR_TRUE
# define THROW_ON_INTERRUPT TRUE
# define THROW_ON_INTERRUPT_TRUE
#endif
static void catch_exception __ARGS((except_T *excp));
@@ -1320,16 +1322,20 @@ do_throw(cstack)
* and reset the did_emsg or got_int flag, so this won't happen again at
* the next surrounding try conditional.
*/
#ifndef THROW_ON_ERROR_TRUE
if (did_emsg && !THROW_ON_ERROR)
{
inactivate_try = TRUE;
did_emsg = FALSE;
}
#endif
#ifndef THROW_ON_INTERRUPT_TRUE
if (got_int && !THROW_ON_INTERRUPT)
{
inactivate_try = TRUE;
got_int = FALSE;
}
#endif
idx = cleanup_conditionals(cstack, 0, inactivate_try);
if (idx >= 0)
{
@@ -2254,10 +2260,9 @@ rewind_conditionals(cstack, idx, cond_type, cond_level)
/*
* ":endfunction" when not after a ":function"
*/
/*ARGSUSED*/
void
ex_endfunction(eap)
exarg_T *eap;
exarg_T *eap UNUSED;
{
EMSG(_("E193: :endfunction not inside a function"));
}
+48 -29
View File
@@ -140,11 +140,10 @@ static int ex_window __ARGS((void));
* Return pointer to allocated string if there is a commandline, NULL
* otherwise.
*/
/*ARGSUSED*/
char_u *
getcmdline(firstc, count, indent)
int firstc;
long count; /* only used for incremental search */
long count UNUSED; /* only used for incremental search */
int indent; /* indent for inside conditionals */
{
int c;
@@ -325,7 +324,7 @@ getcmdline(firstc, count, indent)
#endif
#ifdef FEAT_DIGRAPHS
do_digraph(-1); /* init digraph typahead */
do_digraph(-1); /* init digraph typeahead */
#endif
/*
@@ -2000,8 +1999,8 @@ text_locked_msg()
#if defined(FEAT_AUTOCMD) || defined(PROTO)
/*
* Check if "curbuf_lock" is set and return TRUE when it is and give an error
* message.
* Check if "curbuf_lock" or "allbuf_lock" is set and return TRUE when it is
* and give an error message.
*/
int
curbuf_locked()
@@ -2011,6 +2010,21 @@ curbuf_locked()
EMSG(_("E788: Not allowed to edit another buffer now"));
return TRUE;
}
return allbuf_locked();
}
/*
* Check if "allbuf_lock" is set and return TRUE when it is and give an error
* message.
*/
int
allbuf_locked()
{
if (allbuf_lock > 0)
{
EMSG(_("E811: Not allowed to change buffer information now"));
return TRUE;
}
return FALSE;
}
#endif
@@ -2098,11 +2112,10 @@ correct_cmdspos(idx, cells)
/*
* Get an Ex command line for the ":" command.
*/
/* ARGSUSED */
char_u *
getexline(c, dummy, indent)
getexline(c, cookie, indent)
int c; /* normally ':', NUL for ":append" */
void *dummy; /* cookie not used */
void *cookie UNUSED;
int indent; /* indent for inside conditionals */
{
/* When executing a register, remove ':' that's in front of each line. */
@@ -2117,12 +2130,11 @@ getexline(c, dummy, indent)
* mappings or abbreviations.
* Returns a string in allocated memory or NULL.
*/
/* ARGSUSED */
char_u *
getexmodeline(promptc, dummy, indent)
getexmodeline(promptc, cookie, indent)
int promptc; /* normally ':', NUL for ":append" and '?' for
:s prompt */
void *dummy; /* cookie not used */
void *cookie UNUSED;
int indent; /* indent for inside conditionals */
{
garray_T line_ga;
@@ -2524,7 +2536,7 @@ realloc_cmdbuff(len)
&& ccline.xpc->xp_context != EXPAND_NOTHING
&& ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL)
{
int i = ccline.xpc->xp_pattern - p;
int i = (int)(ccline.xpc->xp_pattern - p);
/* If xp_pattern points inside the old cmdbuff it needs to be adjusted
* to point into the newly allocated memory. */
@@ -3817,11 +3829,10 @@ tilde_replace(orig_pat, num_files, files)
* Returns EXPAND_NOTHING when the character that triggered expansion should
* be inserted like a normal character.
*/
/*ARGSUSED*/
static int
showmatches(xp, wildmenu)
expand_T *xp;
int wildmenu;
int wildmenu UNUSED;
{
#define L_SHOWFILE(m) (showtail ? sm_gettail(files_found[m]) : files_found[m])
int num_files;
@@ -4503,6 +4514,12 @@ ExpandFromContext(xp, pat, num_file, file, options)
{EXPAND_EVENTS, get_event_name, TRUE},
{EXPAND_AUGROUP, get_augroup_name, TRUE},
#endif
#ifdef FEAT_CSCOPE
{EXPAND_CSCOPE, get_cscope_name, TRUE},
#endif
#ifdef FEAT_SIGNS
{EXPAND_SIGN, get_sign_name, TRUE},
#endif
#if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
&& (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE))
{EXPAND_LANGUAGE, get_lang_arg, TRUE},
@@ -4519,7 +4536,7 @@ ExpandFromContext(xp, pat, num_file, file, options)
* right function to do the expansion.
*/
ret = FAIL;
for (i = 0; i < sizeof(tab) / sizeof(struct expgen); ++i)
for (i = 0; i < (int)(sizeof(tab) / sizeof(struct expgen)); ++i)
if (xp->xp_context == tab[i].context)
{
if (tab[i].ic)
@@ -4860,14 +4877,14 @@ ExpandUserList(xp, num_file, file)
/* Loop over the items in the list. */
for (li = retlist->lv_first; li != NULL; li = li->li_next)
{
if (li->li_tv.v_type != VAR_STRING)
continue; /* Skip non-string items */
if (li->li_tv.v_type != VAR_STRING || li->li_tv.vval.v_string == NULL)
continue; /* Skip non-string items and empty strings */
if (ga_grow(&ga, 1) == FAIL)
break;
((char_u **)ga.ga_data)[ga.ga_len] =
vim_strsave(li->li_tv.vval.v_string);
vim_strsave(li->li_tv.vval.v_string);
++ga.ga_len;
}
list_unref(retlist);
@@ -4900,7 +4917,7 @@ ExpandRTDir(pat, num_file, file, dirname)
if (s == NULL)
return FAIL;
sprintf((char *)s, "%s/%s*.vim", dirname, pat);
all = globpath(p_rtp, s);
all = globpath(p_rtp, s, 0);
vim_free(s);
if (all == NULL)
return FAIL;
@@ -4941,9 +4958,10 @@ ExpandRTDir(pat, num_file, file, dirname)
* newlines. Returns NULL for an error or no matches.
*/
char_u *
globpath(path, file)
globpath(path, file, expand_options)
char_u *path;
char_u *file;
int expand_options;
{
expand_T xpc;
char_u *buf;
@@ -4972,10 +4990,10 @@ globpath(path, file)
{
add_pathsep(buf);
STRCAT(buf, file);
if (ExpandFromContext(&xpc, buf, &num_p, &p, WILD_SILENT) != FAIL
&& num_p > 0)
if (ExpandFromContext(&xpc, buf, &num_p, &p,
WILD_SILENT|expand_options) != FAIL && num_p > 0)
{
ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT);
ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT|expand_options);
for (len = 0, i = 0; i < num_p; ++i)
len += (int)STRLEN(p[i]) + 1;
@@ -5670,7 +5688,7 @@ ex_history(eap)
histype1 = get_histtype(arg);
if (histype1 == -1)
{
if (STRICMP(arg, "all") == 0)
if (STRNICMP(arg, "all", STRLEN(arg)) == 0)
{
histype1 = 0;
histype2 = HIST_COUNT-1;
@@ -6049,16 +6067,17 @@ ex_window()
# endif
return K_IGNORE;
}
cmdwin_type = ccline.cmdfirstc;
if (cmdwin_type == NUL)
cmdwin_type = '-';
cmdwin_type = get_cmdline_type();
/* Create the command-line buffer empty. */
(void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE);
(void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, NULL);
(void)setfname(curbuf, (char_u *)"[Command Line]", NULL, TRUE);
set_option_value((char_u *)"bt", 0L, (char_u *)"nofile", OPT_LOCAL);
set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
curbuf->b_p_ma = TRUE;
#ifdef FEAT_FOLDING
curwin->w_p_fen = FALSE;
#endif
# ifdef FEAT_RIGHTLEFT
curwin->w_p_rl = cmdmsg_rl;
cmdmsg_rl = FALSE;
@@ -6075,7 +6094,7 @@ ex_window()
/* Showing the prompt may have set need_wait_return, reset it. */
need_wait_return = FALSE;
histtype = hist_char2type(ccline.cmdfirstc);
histtype = hist_char2type(cmdwin_type);
if (histtype == HIST_CMD || histtype == HIST_DEBUG)
{
if (p_wc == TAB)
+8 -7
View File
@@ -103,7 +103,8 @@ toF_Xor_X_(c)
case F_HE:
tempc = _HE;
if (p_ri && (curwin->w_cursor.col+1 < STRLEN(ml_get_curline())))
if (p_ri && (curwin->w_cursor.col + 1
< (colnr_T)STRLEN(ml_get_curline())))
{
inc_cursor();
@@ -344,7 +345,7 @@ put_curr_and_l_to_X(c)
if (curwin->w_p_rl && p_ri)
return;
if ( (curwin->w_cursor.col < STRLEN(ml_get_curline())))
if ((curwin->w_cursor.col < (colnr_T)STRLEN(ml_get_curline())))
{
if ((p_ri && curwin->w_cursor.col) || !p_ri)
{
@@ -565,7 +566,7 @@ chg_c_to_X_or_X ()
tempc = gchar_cursor();
if (curwin->w_cursor.col+1 < STRLEN(ml_get_curline()))
if (curwin->w_cursor.col + 1 < (colnr_T)STRLEN(ml_get_curline()))
{
inc_cursor();
@@ -594,8 +595,8 @@ chg_l_to_X_orX_ ()
{
int tempc;
if (!curwin->w_cursor.col &&
(curwin->w_cursor.col+1 == STRLEN(ml_get_curline())))
if (curwin->w_cursor.col != 0 &&
(curwin->w_cursor.col + 1 == (colnr_T)STRLEN(ml_get_curline())))
return;
if (!curwin->w_cursor.col && p_ri)
@@ -663,8 +664,8 @@ chg_l_toXor_X ()
{
int tempc;
if (!curwin->w_cursor.col &&
(curwin->w_cursor.col+1 == STRLEN(ml_get_curline())))
if (curwin->w_cursor.col != 0 &&
(curwin->w_cursor.col + 1 == (colnr_T)STRLEN(ml_get_curline())))
return;
if (!curwin->w_cursor.col && p_ri)

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