Compare commits

...

61 Commits

Author SHA1 Message Date
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
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
Nico Weber 1eb73428b0 Icon generation works on Tiger again 2008-12-30 23:36:50 -08: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
87 changed files with 4835 additions and 826 deletions
+2
View File
@@ -3,6 +3,8 @@
src/MacVim/MacVim.xcodeproj/*.mode1
src/MacVim/MacVim.xcodeproj/*.mode1v3
src/MacVim/MacVim.xcodeproj/*.pbxuser
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
+22 -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|
@@ -3286,14 +3287,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 +3310,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
@@ -5343,10 +5348,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 +5843,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|.
+14 -5
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 Jan 08
VIM REFERENCE MANUAL by Bjorn Winckler
@@ -119,7 +119,12 @@ strings like "((3) of 2)" to appear in the window title.
*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 +260,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]
@@ -556,9 +563,11 @@ 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.
*Cmd-`* *<D-`>*
Cmd-` Cycle to the next window. On an American keyboard the
+6 -4
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
@@ -3867,14 +3867,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'*
@@ -7595,7 +7595,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|
+628 -33
View File
@@ -5,6 +5,7 @@
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDocumentTypes</key>
<!-- See http://developer.apple.com/documentation/Carbon/Conceptual/understanding_utis/utilist/chapter_4_section_1.html#//apple_ref/doc/uid/TP40001319-CH205-CHDIJFGJ for a list of UTIs -->
<array>
<dict>
<key>CFBundleTypeExtensions</key>
@@ -12,7 +13,7 @@
<string>vim</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc-bm</string>
<string>MacVim-vim</string>
<key>CFBundleTypeName</key>
<string>Vim Script File</string>
<key>CFBundleTypeRole</key>
@@ -25,9 +26,10 @@
<array>
<string>txt</string>
<string>text</string>
<string>utf8</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc-bm-txt</string>
<string>MacVim-txt</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>text/plain</string>
@@ -43,9 +45,14 @@
<key>CFBundleTypeExtensions</key>
<array>
<string>tex</string>
<string>sty</string>
<string>cls</string>
<string>ltx</string>
<string>ins</string>
<string>dtx</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc-bm-tex</string>
<string>MacVim-tex</string>
<key>CFBundleTypeName</key>
<string>TeX File</string>
<key>CFBundleTypeRole</key>
@@ -59,7 +66,7 @@
<string>h</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc-bm-h</string>
<string>MacVim-h</string>
<key>CFBundleTypeName</key>
<string>C Header Source File</string>
<key>CFBundleTypeRole</key>
@@ -76,6 +83,8 @@
<array>
<string>pch</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-h</string>
<key>CFBundleTypeName</key>
<string>C Precompiled Header Source File</string>
<key>CFBundleTypeRole</key>
@@ -96,6 +105,8 @@
<string>hxx</string>
<string>h++</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-h</string>
<key>CFBundleTypeName</key>
<string>C++ Header Source File</string>
<key>CFBundleTypeRole</key>
@@ -108,6 +119,8 @@
<array>
<string>pch++</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-h</string>
<key>CFBundleTypeName</key>
<string>C++ Precompiled Header Source File</string>
<key>CFBundleTypeRole</key>
@@ -125,7 +138,7 @@
<string>c</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc-bm-c</string>
<string>MacVim-c</string>
<key>CFBundleTypeName</key>
<string>C Source File</string>
<key>CFBundleTypeRole</key>
@@ -142,6 +155,8 @@
<array>
<string>m</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-m</string>
<key>CFBundleTypeName</key>
<string>Objective-C Source File</string>
<key>CFBundleTypeRole</key>
@@ -158,6 +173,8 @@
<array>
<string>mm</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-mm</string>
<key>CFBundleTypeName</key>
<string>Objective-C++ Source File</string>
<key>CFBundleTypeRole</key>
@@ -178,6 +195,8 @@
<string>cxx</string>
<string>c++</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-cpp</string>
<key>CFBundleTypeName</key>
<string>C++ Source File</string>
<key>CFBundleTypeRole</key>
@@ -229,7 +248,7 @@
<string>jav</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc-bm-java</string>
<string>MacVim-java</string>
<key>CFBundleTypeName</key>
<string>Java Source File</string>
<key>CFBundleTypeRole</key>
@@ -314,9 +333,13 @@
<array>
<string>f</string>
<string>for</string>
<string>fpp</string>
<string>f77</string>
<string>f90</string>
<string>f95</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-f</string>
<key>CFBundleTypeName</key>
<string>Fortran Source File</string>
<key>CFBundleTypeRole</key>
@@ -366,10 +389,19 @@
<key>CFBundleTypeExtensions</key>
<array>
<string>html</string>
<string>phtml</string>
<string>shtml</string>
<string>xhtml</string>
<string>htm</string>
<string>pht</string>
<string>sht</string>
<string>xht</string>
<string>phtm</string>
<string>shtm</string>
<string>xhtm</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc-bm-html</string>
<string>MacVim-html</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>text/html</string>
@@ -389,9 +421,14 @@
<key>CFBundleTypeExtensions</key>
<array>
<string>xml</string>
<string>rss</string>
<string>tld</string>
<string>pt</string>
<string>cpt</string>
<string>dtml</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc-bm-xml</string>
<string>MacVim-xml</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>text/xml</string>
@@ -411,9 +448,12 @@
<key>CFBundleTypeExtensions</key>
<array>
<string>js</string>
<string>htc</string>
<string>jscript</string>
<string>javascript</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-js</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>text/javascript</string>
@@ -430,42 +470,123 @@
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Perl source</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>sh</string>
<string>command</string>
<string>csh</string>
<string>pl</string>
<string>pm</string>
<string>py</string>
<string>rb</string>
<string>rbw</string>
<string>php</string>
<string>php3</string>
<string>php4</string>
<string>ph3</string>
<string>ph4</string>
<string>phtml</string>
<string>applescript</string>
<string>pod</string>
<string>perl</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc-bm-sh</string>
<string>MacVim-perl</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>text/x-perl-script</string>
<string>text/x-python-script</string>
<string>text/ruby-script</string>
<string>text/php</string>
</array>
<key>CFBundleTypeName</key>
<string>Script File</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSIsAppleDefaultForType</key>
<true/>
<key>LSItemContentTypes</key>
<array>
<string>public.script</string>
<string>public.perl-script</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Python source</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>py</string>
<string>rpy</string>
<string>cpy</string>
<string>python</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-py</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>text/x-python-script</string>
</array>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSItemContentTypes</key>
<array>
<string>public.python-script</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>PHP source</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>php</string>
<string>php3</string>
<string>php4</string>
<string>php5</string>
<string>ph3</string>
<string>ph4</string>
<string>phtml</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-php</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>text/php</string>
</array>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSItemContentTypes</key>
<array>
<string>public.php-script</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Ruby source</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>rb</string>
<string>rbw</string>
<string>rbx</string>
<string>rjs</string>
<string>rxml</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-rb</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>text/ruby-script</string>
</array>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSItemContentTypes</key>
<array>
<string>public.ruby-script</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Shell script</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>sh</string>
<string>csh</string>
<string>command</string>
<string>ss</string>
<string>bashrc</string>
<string>bash_profile</string>
<string>bash_login</string>
<string>profile</string>
<string>bash_logout</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-bash</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSItemContentTypes</key>
<array>
<string>public.shell-script</string>
</array>
</dict>
<dict>
@@ -491,7 +612,7 @@
<string>diff</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>doc-bm</string>
<string>MacVim-patch</string>
<key>CFBundleTypeName</key>
<string>Patch File</string>
<key>CFBundleTypeRole</key>
@@ -527,11 +648,485 @@
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>AppleScript source</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>applescript</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-applescript</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSItemContentTypes</key>
<array>
<string>com.apple.applescript.text</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>ActionScript source</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>as</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-as</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>ASP document</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>asp</string>
<string>asa</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-asp</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>ASP.NET document</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>aspx</string>
<string>ascx</string>
<string>asmx</string>
<string>ashx</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-asp</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>BibTeX bibliography</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>bib</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-bib</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>C# source</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>cs</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-cs</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Context Free Design Grammar</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>cfdg</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-csfg</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Comma separated values</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>csv</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-csv</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Tab separated values</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>tsv</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-tsv</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>CGI script</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>cgi</string>
<string>fcgi</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-cgi</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Configuration file</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>cfg</string>
<string>conf</string>
<string>config</string>
<string>htaccess</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-cfg</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Cascading style sheet</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>css</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-css</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Document Type Definition</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>dtd</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-dtd</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Dylan source</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>dylan</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-dylan</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Erlang source</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>erl</string>
<string>hrl</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-erl</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>F-Script source</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>fscript</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-fscript</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Haskell source</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>hs</string>
<string>lhs</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-hs</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Include file</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>inc</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-inc</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>iCalendar schedule</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>ics</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-ics</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>MS Windows initialization file</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>ini</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-ini</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Io source</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>io</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-io</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>BeanShell script</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>bsh</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-bsh</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Java properties file</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>properties</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-properties</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Java Server Page</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>jsp</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-jsp</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>LISP source</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>lisp</string>
<string>cl</string>
<string>l</string>
<string>lsp</string>
<string>mud</string>
<string>el</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-lisp</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Log file</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>log</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-log</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Mediawiki document</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>wiki</string>
<string>wikipedia</string>
<string>mediawiki</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-wiki</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>PostScript source</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>ps</string>
<string>eps</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-ps</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<!--<dict>
<key>CFBundleTypeName</key>
<string>Property list</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>dict</string>
<string>plist</string>
<string>scriptSuite</string>
<string>scriptTerminology</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-plist</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>-->
<dict>
<key>CFBundleTypeName</key>
<string>Scheme source</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>scm</string>
<string>sch</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-sch</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>SQL source</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>sql</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-sql</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Tcl source</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>tcl</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-tcl</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>XSL stylesheet</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>xsl</string>
<string>xslt</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-xsl</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Electronic business card</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>vcf</string>
<string>vcard</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-vcf</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Visual Basic source</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>vb</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-vb</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>YAML document</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>yaml</string>
<string>yml</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-yaml</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>GTD document</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>gtd</string>
<string>gtdlog</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>MacVim-gtd</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>vim_gloss</string>
<string>MacVim</string>
<key>CFBundleIdentifier</key>
<string>org.vim.MacVim</string>
<key>CFBundleInfoDictionaryVersion</key>
@@ -558,7 +1153,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>39</string>
<string>41</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
+1
View File
@@ -28,6 +28,7 @@
NSMutableArray *cachedVimControllers;
int preloadPid;
BOOL shouldActivateWhenNextWindowOpens;
int numChildProcesses;
#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4)
FSEventStreamRef fsEventStream;
+152 -54
View File
@@ -61,10 +61,6 @@ static NSTimeInterval MMReplyTimeout = 5;
static NSString *MMWebsiteString = @"http://code.google.com/p/macvim/";
// When terminating, notify Vim processes then sleep for these many
// microseconds.
static useconds_t MMTerminationSleepPeriod = 10000;
#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4)
// Latency (in s) between FS event occuring and being reported to MacVim.
// Should be small so that MacVim is notified of changes to the ~/.vim
@@ -86,8 +82,6 @@ typedef struct
#pragma options align=reset
static int executeInLoginShell(NSString *path, NSArray *args);
@interface MMAppController (MMServices)
- (void)openSelection:(NSPasteboard *)pboard userData:(NSString *)userData
@@ -128,6 +122,9 @@ static int executeInLoginShell(NSString *path, NSArray *args);
- (void)startWatchingVimDir;
- (void)stopWatchingVimDir;
- (void)handleFSEvent;
- (void)loadDefaultFont;
- (int)executeInLoginShell:(NSString *)path arguments:(NSArray *)args;
- (void)reapChildProcesses:(id)sender;
#ifdef MM_ENABLE_PLUGINS
- (void)removePlugInMenu;
@@ -154,14 +151,12 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
+ (void)initialize
{
// Avoid zombies (we fork Vim processes which we don't want to wait for).
signal(SIGCHLD, SIG_IGN);
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:NO], MMNoWindowKey,
[NSNumber numberWithInt:64], MMTabMinWidthKey,
[NSNumber numberWithInt:6*64], MMTabMaxWidthKey,
[NSNumber numberWithInt:132], MMTabOptimumWidthKey,
[NSNumber numberWithBool:YES], MMShowAddTabButtonKey,
[NSNumber numberWithInt:2], MMTextInsetLeftKey,
[NSNumber numberWithInt:1], MMTextInsetRightKey,
[NSNumber numberWithInt:1], MMTextInsetTopKey,
@@ -188,6 +183,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
[NSNumber numberWithBool:NO], MMVerticalSplitKey,
[NSNumber numberWithInt:0], MMPreloadCacheSizeKey,
[NSNumber numberWithInt:0], MMLastWindowClosedBehaviorKey,
[NSNumber numberWithBool:YES], MMLoadDefaultFontKey,
nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:dict];
@@ -206,7 +202,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
{
if (!(self = [super init])) return nil;
fontContainerRef = loadFonts();
[self loadDefaultFont];
vimControllers = [NSMutableArray new];
cachedVimControllers = [NSMutableArray new];
@@ -457,14 +453,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
// Count the number of open tabs
e = [vimControllers objectEnumerator];
id vc;
while ((vc = [e nextObject])) {
NSString *eval = [vc evaluateVimExpression:@"tabpagenr('$')"];
if (eval) {
int count = [eval intValue];
if (count > 0 && count < INT_MAX)
numTabs += count;
}
}
while ((vc = [e nextObject]))
numTabs += [[vc objectForVimStateKey:@"numTabs"] intValue];
if (numWindows > 1 || numTabs > 1) {
NSAlert *alert = [[NSAlert alloc] init];
@@ -515,17 +505,34 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
if (NSTerminateNow == reply) {
e = [vimControllers objectEnumerator];
id vc;
while ((vc = [e nextObject]))
while ((vc = [e nextObject])) {
//NSLog(@"Terminate pid=%d", [vc pid]);
[vc sendMessage:TerminateNowMsgID data:nil];
}
e = [cachedVimControllers objectEnumerator];
while ((vc = [e nextObject]))
while ((vc = [e nextObject])) {
//NSLog(@"Terminate pid=%d (cached)", [vc pid]);
[vc sendMessage:TerminateNowMsgID data:nil];
}
// Give Vim processes a chance to terminate before MacVim. If they
// haven't terminated by the time applicationWillTerminate: is sent,
// they may be forced to quit (see below).
usleep(MMTerminationSleepPeriod);
// If a Vim process is being preloaded as we quit we have to forcibly
// kill it since we have not established a connection yet.
if (preloadPid > 0) {
//NSLog(@"INCOMPLETE preloaded process: preloadPid=%d", preloadPid);
kill(preloadPid, SIGKILL);
}
// If a Vim process was loading as we quit we also have to kill it.
e = [[pidArguments allKeys] objectEnumerator];
NSNumber *pidKey;
while ((pidKey = [e nextObject])) {
//NSLog(@"INCOMPLETE process: pid=%d", [pidKey intValue]);
kill([pidKey intValue], SIGKILL);
}
// Sleep a little to allow all the Vim processes to exit.
usleep(10000);
}
return reply;
@@ -549,23 +556,41 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
// connection).
[connection invalidate];
// Send a SIGINT to all running Vim processes, so that they are sure to
// receive the connectionDidDie: notification (a process has to be checking
// the run-loop for this to happen).
unsigned i, count = [vimControllers count];
for (i = 0; i < count; ++i) {
MMVimController *controller = [vimControllers objectAtIndex:i];
int pid = [controller pid];
if (-1 != pid)
kill(pid, SIGINT);
}
// Deactivate the font we loaded from the app bundle.
// NOTE: This can take quite a while (~500 ms), so termination will be
// noticeably faster if loading of the default font is disabled.
if (fontContainerRef) {
ATSFontDeactivate(fontContainerRef, NULL, kATSOptionFlagsDefault);
fontContainerRef = 0;
}
[NSApp setDelegate:nil];
// Try to wait for all child processes to avoid leaving zombies behind (but
// don't wait around for too long).
NSDate *timeOutDate = [NSDate dateWithTimeIntervalSinceNow:2];
while ([timeOutDate timeIntervalSinceNow] > 0) {
[self reapChildProcesses:nil];
if (numChildProcesses <= 0)
break;
//NSLog(@"%d processes still left, sleep a bit...", numChildProcesses);
// Run in NSConnectionReplyMode while waiting instead of calling e.g.
// usleep(). Otherwise incoming messages may clog up the DO queues and
// the outgoing TerminateNowMsgID sent earlier never reaches the Vim
// process.
// This has at least one side-effect, namely we may receive the
// annoying "dropping incoming DO message". (E.g. this may happen if
// you quickly hit Cmd-n several times in a row and then immediately
// press Cmd-q, Enter.)
while (CFRunLoopRunInMode((CFStringRef)NSConnectionReplyMode,
0.05, true) == kCFRunLoopRunHandledSource)
; // do nothing
}
if (numChildProcesses > 0)
NSLog(@"%d ZOMBIES left behind", numChildProcesses);
}
+ (MMAppController *)sharedInstance
@@ -607,6 +632,14 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
if (hide)
[NSApp hide:self];
}
// There is a small delay before the Vim process actually exits so wait a
// little before trying to reap the child process. If the process still
// hasn't exited after this wait it won't be reaped until the next time
// reapChildProcesses: is called (but this should be harmless).
[self performSelector:@selector(reapChildProcesses:)
withObject:nil
afterDelay:0.1];
}
- (void)windowControllerWillOpen:(MMWindowController *)windowController
@@ -807,7 +840,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
NSString *input = [NSString stringWithFormat:@"<C-\\><C-N>"
":let oldswb=&swb|let &swb=\"useopen,usetab\"|"
"tab sb %@|let &swb=oldswb|unl oldswb|"
"cal foreground()|redr|f<CR>", firstFile];
"cal foreground()<CR>", firstFile];
[firstController addVimInput:input];
@@ -935,7 +968,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
boolForKey:MMDialogsTrackPwdKey];
if (trackPwd) {
MMVimController *vc = [self keyVimController];
if (vc) dir = [[vc vimState] objectForKey:@"pwd"];
if (vc) dir = [vc objectForVimStateKey:@"pwd"];
}
NSOpenPanel *panel = [NSOpenPanel openPanel];
@@ -1077,7 +1110,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
// MacVim would steal the focus if another app was activated while the
// untitled window was loading.
if (!args || args != [NSNull null])
[NSApp activateIgnoringOtherApps:YES];
[self activateWhenNextWindowOpens];
if (args)
[pidArguments removeObjectForKey:pidKey];
@@ -1212,7 +1245,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
if (!dirIndicator)
path = [path stringByDeletingLastPathComponent];
path = [path stringByReplacingOccurrencesOfString:@" " withString:@"\\ "];
path = [path stringByEscapingSpecialFilenameCharacters];
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
BOOL openInCurrentWindow = [ud boolForKey:MMOpenInCurrentWindowKey];
@@ -1272,7 +1305,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
if (useLoginShell) {
// Run process with a login shell, roughly:
// echo "exec Vim -g -f args" | ARGV0=-`basename $SHELL` $SHELL [-l]
pid = executeInLoginShell(path, taskArgs);
pid = [self executeInLoginShell:path arguments:taskArgs];
} else {
// Run process directly:
// Vim -g -f args
@@ -1282,12 +1315,10 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
}
if (-1 != pid) {
// NOTE: If the process has no arguments, then add a null argument to
// the pidArguments dictionary. This is later used to detect that a
// process without arguments is being launched.
if (!args)
[pidArguments setObject:[NSNull null]
forKey:[NSNumber numberWithInt:pid]];
// Add a null argument to the pidArguments dictionary. This is later
// used to detect that a process without arguments is being launched.
[pidArguments setObject:[NSNull null]
forKey:[NSNumber numberWithInt:pid]];
} else {
NSLog(@"WARNING: %s%@ failed (useLoginShell=%d)", _cmd, args,
useLoginShell);
@@ -1523,7 +1554,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
NSEnumerator *e = [vimControllers objectEnumerator];
id vc;
while ((vc = [e nextObject])) {
if ([[[vc vimState] objectForKey:@"unusedEditor"] boolValue])
if ([[vc objectForVimStateKey:@"unusedEditor"] boolValue])
return vc;
}
@@ -1738,6 +1769,14 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
n = count;
while (n-- > 0 && [cachedVimControllers count] > 0)
[cachedVimControllers removeObjectAtIndex:0];
// There is a small delay before the Vim process actually exits so wait a
// little before trying to reap the child process. If the process still
// hasn't exited after this wait it won't be reaped until the next time
// reapChildProcesses: is called (but this should be harmless).
[self performSelector:@selector(reapChildProcesses:)
withObject:nil
afterDelay:0.1];
}
- (void)rebuildPreloadCache
@@ -1877,13 +1916,53 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
[self scheduleVimControllerPreloadAfterDelay:0.5];
}
@end // MMAppController (Private)
- (void)loadDefaultFont
{
// It is possible to set a user default to avoid loading the default font
// (this cuts down on startup time).
if (![[NSUserDefaults standardUserDefaults] boolForKey:MMLoadDefaultFontKey]
|| fontContainerRef)
return;
// Load all fonts in the Resouces folder of the app bundle.
NSString *fontsFolder = [[NSBundle mainBundle] resourcePath];
if (fontsFolder) {
NSURL *fontsURL = [NSURL fileURLWithPath:fontsFolder];
if (fontsURL) {
FSRef fsRef;
CFURLGetFSRef((CFURLRef)fontsURL, &fsRef);
#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4)
// This is the font activation API for OS X 10.5. Only compile
// this code if we're building on OS X 10.5 or later.
if (NULL != ATSFontActivateFromFileReference) { // Weakly linked
ATSFontActivateFromFileReference(&fsRef, kATSFontContextLocal,
kATSFontFormatUnspecified,
NULL, kATSOptionFlagsDefault,
&fontContainerRef);
}
#endif
#if (MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4)
// The following font activation API was deprecated in OS X 10.5.
// Don't compile this code unless we're targeting OS X 10.4.
FSSpec fsSpec;
if (fontContainerRef == 0 &&
FSGetCatalogInfo(&fsRef, kFSCatInfoNone, NULL, NULL,
&fsSpec, NULL) == noErr) {
ATSFontActivateFromFileSpecification(&fsSpec,
kATSFontContextLocal, kATSFontFormatUnspecified, NULL,
kATSOptionFlagsDefault, &fontContainerRef);
}
#endif
}
}
if (!fontContainerRef)
NSLog(@"WARNING: Failed to activate the default font (the app bundle "
"may be incomplete)");
}
static int
executeInLoginShell(NSString *path, NSArray *args)
- (int)executeInLoginShell:(NSString *)path arguments:(NSArray *)args
{
// Start a login shell and execute the command 'path' with arguments 'args'
// in the shell. This ensures that user environment variables are set even
@@ -1955,10 +2034,6 @@ executeInLoginShell(NSString *path, NSArray *args)
} else if (pid == 0) {
// Child process
// We need to undo our zombie avoidance as Vim waits for and needs
// the exit statuses of processes it spawns.
signal(SIGCHLD, SIG_DFL);
if (close(ds[1]) == -1) exit(255);
if (dup2(ds[0], 0) == -1) exit(255);
@@ -1982,7 +2057,30 @@ executeInLoginShell(NSString *path, NSArray *args)
if (write(ds[1], [input UTF8String], bytes) != bytes) return -1;
if (close(ds[1]) == -1) return -1;
++numChildProcesses;
//NSLog(@"new process pid=%d (count=%d)", pid, numChildProcesses);
}
return pid;
}
- (void)reapChildProcesses:(id)sender
{
// NOTE: numChildProcesses (currently) only counts the number of Vim
// processes that have been started with executeInLoginShell::. If other
// processes are spawned this code may need to be adjusted (or
// numChildProcesses needs to be incremented when such a process is
// started).
while (numChildProcesses > 0) {
int status = 0;
int pid = waitpid(-1, &status, WNOHANG);
if (pid <= 0)
break;
//NSLog(@"WAIT for pid=%d complete", pid);
--numChildProcesses;
}
}
@end // MMAppController (Private)
+9
View File
@@ -892,10 +892,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
{
+4 -4
View File
@@ -41,12 +41,13 @@
NSMutableDictionary *clientProxyDict;
NSMutableDictionary *serverReplyDict;
NSString *alternateServerName;
ATSFontContainerRef fontContainerRef;
NSFont *oldWideFont;
GuiFont oldWideFont;
BOOL isTerminating;
BOOL waitForAck;
int initialWindowLayout;
BOOL flushDisabled;
unsigned numWholeLineChanges;
unsigned offsetForDrawDataPrune;
}
+ (MMBackend *)sharedInstance;
@@ -95,8 +96,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;
+169 -119
View File
@@ -51,13 +51,6 @@ static int eventModifierFlagsToVimModMask(int modifierFlags);
static int eventModifierFlagsToVimMouseModMask(int modifierFlags);
static int eventButtonNumberToVimMouseButton(int buttonNumber);
// Before exiting process, sleep for this many microseconds. This is to allow
// any distributed object messages in transit to be received by MacVim before
// the process dies (otherwise an error message is logged by Cocoa). Note that
// this delay is only necessary if an NSConnection to MacVim has been
// established.
static useconds_t MMExitProcessDelay = 300000;
// In gui_macvim.m
vimmenu_T *menu_for_descriptor(NSArray *desc);
@@ -77,6 +70,9 @@ static NSString *MMSymlinkWarningString =
"\ta symlink, then your MacVim.app bundle is incomplete.\n\n";
extern GuiFont gui_mch_retain_font(GuiFont font);
@interface NSString (MMServerNameCompare)
- (NSComparisonResult)serverNameCompare:(NSString *)string;
@@ -86,6 +82,8 @@ static NSString *MMSymlinkWarningString =
@interface MMBackend (Private)
- (void)clearDrawData;
- (void)didChangeWholeLine;
- (void)waitForDialogReturn;
- (void)insertVimStateMessage;
- (void)processInputQueue;
@@ -138,8 +136,6 @@ static NSString *MMSymlinkWarningString =
self = [super init];
if (!self) return nil;
fontContainerRef = loadFonts();
outputQueue = [[NSMutableArray alloc] init];
inputQueue = [[NSMutableArray alloc] init];
drawData = [[NSMutableData alloc] initWithCapacity:1024];
@@ -173,7 +169,7 @@ static NSString *MMSymlinkWarningString =
//NSLog(@"%@ %s", [self className], _cmd);
[[NSNotificationCenter defaultCenter] removeObserver:self];
[oldWideFont release]; oldWideFont = nil;
gui_mch_free_font(oldWideFont); oldWideFont = NOFONT;
[blinkTimer release]; blinkTimer = nil;
[alternateServerName release]; alternateServerName = nil;
[serverReplyDict release]; serverReplyDict = nil;
@@ -370,7 +366,7 @@ static NSString *MMSymlinkWarningString =
// Any draw commands in queue are effectively obsolete since this clearAll
// will negate any effect they have, therefore we may as well clear the
// draw queue.
[drawData setLength:0];
[self clearDrawData];
[drawData appendBytes:&type length:sizeof(int)];
}
@@ -402,6 +398,9 @@ static NSString *MMSymlinkWarningString =
[drawData appendBytes:&bottom length:sizeof(int)];
[drawData appendBytes:&left length:sizeof(int)];
[drawData appendBytes:&right length:sizeof(int)];
if (left == 0 && right == gui.num_cols-1)
[self didChangeWholeLine];
}
- (void)drawString:(char*)s length:(int)len row:(int)row column:(int)col
@@ -437,6 +436,9 @@ static NSString *MMSymlinkWarningString =
[drawData appendBytes:&bottom length:sizeof(int)];
[drawData appendBytes:&left length:sizeof(int)];
[drawData appendBytes:&right length:sizeof(int)];
if (left == 0 && right == gui.num_cols-1)
[self didChangeWholeLine];
}
- (void)drawCursorAtRow:(int)row column:(int)col shape:(int)shape
@@ -472,7 +474,7 @@ static NSString *MMSymlinkWarningString =
// Keep running the run-loop until there is no more input to process.
while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, true)
== kCFRunLoopRunHandledSource)
;
; // do nothing
}
- (void)flushQueue:(BOOL)force
@@ -485,10 +487,10 @@ static NSString *MMSymlinkWarningString =
if ([drawData length] > 0) {
// HACK! Detect changes to 'guifontwide'.
if (gui.wide_font != (GuiFont)oldWideFont) {
[oldWideFont release];
oldWideFont = [(NSFont*)gui.wide_font retain];
[self setWideFont:oldWideFont];
if (gui.wide_font != oldWideFont) {
gui_mch_free_font(oldWideFont);
oldWideFont = gui_mch_retain_font(gui.wide_font);
[self setFont:oldWideFont wide:YES];
}
int type = SetCursorPosDrawType;
@@ -497,7 +499,7 @@ static NSString *MMSymlinkWarningString =
[drawData appendBytes:&gui.col length:sizeof(gui.col)];
[self queueMessage:BatchDrawMsgID data:[drawData copy]];
[drawData setLength:0];
[self clearDrawData];
}
if ([outputQueue count] > 0) {
@@ -512,8 +514,7 @@ static NSString *MMSymlinkWarningString =
outputQueue);
if (![connection isValid]) {
NSLog(@"WARNING! Connection is invalid, exit now!");
NSLog(@"waitForAck=%d got_int=%d isTerminating=%d",
waitForAck, got_int, isTerminating);
NSLog(@"waitForAck=%d got_int=%d", waitForAck, got_int);
mch_exit(-1);
}
}
@@ -559,21 +560,17 @@ static NSString *MMSymlinkWarningString =
{
// NOTE: This is called if mch_exit() is called. Since we assume here that
// the process has started properly, be sure to use exit() instead of
// mch_exit() to prematurely terminate a process.
// To notify MacVim that this Vim process is exiting we could simply
// invalidate the connection and it would automatically receive a
// connectionDidDie: notification. However, this notification seems to
// take up to 300 ms to arrive which is quite a noticeable delay. Instead
// we immediately send a message to MacVim asking it to close the window
// belonging to this process, and then we invalidate the connection (in
// case the message got lost).
// mch_exit() to prematurely terminate a process (or set 'isTerminating'
// first).
// Make sure no connectionDidDie: notification is received now that we are
// already exiting.
[[NSNotificationCenter defaultCenter] removeObserver:self];
if ([connection isValid]) {
// The 'isTerminating' flag indicates that the frontend is also exiting so
// there is no need to flush any more output since the frontend won't look
// at it anyway.
if (!isTerminating && [connection isValid]) {
@try {
// Flush the entire queue in case a VimLeave autocommand added
// something to the queue.
@@ -584,7 +581,15 @@ static NSString *MMSymlinkWarningString =
NSLog(@"Exception caught when sending CloseWindowMsgID: \"%@\"", e);
}
[connection invalidate];
// NOTE: If Cmd-w was pressed to close the window the menu is briefly
// highlighted and during this pause the frontend won't receive any DO
// messages. If the Vim process exits before this highlighting has
// finished Cocoa will emit the following error message:
// *** -[NSMachPort handlePortMessage:]: dropping incoming DO message
// because the connection or ports are invalid
// To avoid this warning we delay here. If the warning still appears
// this delay may need to be increased.
usleep(150000);
}
#ifdef MAC_CLIENTSERVER
@@ -592,13 +597,6 @@ static NSString *MMSymlinkWarningString =
[[NSConnection defaultConnection] setRootObject:nil];
[[NSConnection defaultConnection] invalidate];
#endif
if (fontContainerRef) {
ATSFontDeactivate(fontContainerRef, NULL, kATSOptionFlagsDefault);
fontContainerRef = 0;
}
usleep(MMExitProcessDelay);
}
- (void)selectTab:(int)index
@@ -621,28 +619,26 @@ static NSString *MMSymlinkWarningString =
tabpage_T *tp;
for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) {
// This function puts the label of the tab in the global 'NameBuff'.
get_tabline_label(tp, FALSE);
char_u *s = NameBuff;
int len = STRLEN(s);
if (len <= 0) continue;
#ifdef FEAT_MBYTE
s = CONVERT_TO_UTF8(s);
#endif
// Count the number of windows in the tabpage.
//win_T *wp = tp->tp_firstwin;
//int wincount;
//for (wincount = 0; wp != NULL; wp = wp->w_next, ++wincount);
//[data appendBytes:&wincount length:sizeof(int)];
[data appendBytes:&len length:sizeof(int)];
[data appendBytes:s length:len];
#ifdef FEAT_MBYTE
CONVERT_TO_UTF8_FREE(s);
#endif
int tabProp = MMTabInfoCount;
[data appendBytes:&tabProp length:sizeof(int)];
for (tabProp = MMTabLabel; tabProp < MMTabInfoCount; ++tabProp) {
// This function puts the label of the tab in the global 'NameBuff'.
get_tabline_label(tp, (tabProp == MMTabToolTip));
NSString *s = [NSString stringWithVimString:NameBuff];
int len = [s lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
if (len < 0)
len = 0;
[data appendBytes:&len length:sizeof(int)];
if (len > 0)
[data appendBytes:[s UTF8String] length:len];
}
}
[self queueMessage:UpdateTabBarMsgID data:data];
@@ -836,35 +832,27 @@ static NSString *MMSymlinkWarningString =
[self queueMessage:SetScrollbarThumbMsgID data:data];
}
- (void)setFont:(NSFont *)font
- (void)setFont:(GuiFont)font wide:(BOOL)wide
{
NSString *fontName = [font displayName];
float size = [font pointSize];
int len = [fontName lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
if (len > 0) {
NSMutableData *data = [NSMutableData data];
[data appendBytes:&size length:sizeof(float)];
[data appendBytes:&len length:sizeof(int)];
[data appendBytes:[fontName UTF8String] length:len];
[self queueMessage:SetFontMsgID data:data];
NSString *fontName = (NSString *)font;
float size = 0;
NSArray *components = [fontName componentsSeparatedByString:@":"];
if ([components count] == 2) {
size = [[components lastObject] floatValue];
fontName = [components objectAtIndex:0];
}
}
- (void)setWideFont:(NSFont *)font
{
NSString *fontName = [font displayName];
float size = [font pointSize];
int len = [fontName lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
NSMutableData *data = [NSMutableData data];
[data appendBytes:&size length:sizeof(float)];
[data appendBytes:&len length:sizeof(int)];
if (len > 0)
[data appendBytes:[fontName UTF8String] length:len];
else if (!wide)
return; // Only the wide font can be set to nothing
[self queueMessage:SetWideFontMsgID data:data];
[self queueMessage:(wide ? SetWideFontMsgID : SetFontMsgID) data:data];
}
- (void)executeActionWithName:(NSString *)name
@@ -1053,25 +1041,28 @@ static NSString *MMSymlinkWarningString =
// Look for Cmd-. and Ctrl-C immediately instead of waiting until the input
// queue is processed since that only happens in waitForInput: (and Vim
// regularly checks for Ctrl-C in between waiting for input).
// Similarly, TerminateNowMsgID must be checked immediately otherwise code
// which waits on the run loop will fail to detect this message (e.g. in
// waitForConnectionAcknowledgement).
BOOL interrupt = NO;
if (msgid == InterruptMsgID) {
interrupt = YES;
} else if (InsertTextMsgID == msgid && data != nil) {
if (InsertTextMsgID == msgid && data != nil) {
const void *bytes = [data bytes];
bytes += sizeof(int);
int len = *((int*)bytes); bytes += sizeof(int);
if (1 == len) {
char_u *str = (char_u*)bytes;
if ((str[0] == Ctrl_C && ctrl_c_interrupts) ||
(str[0] == intr_char && intr_char != Ctrl_C))
interrupt = YES;
(str[0] == intr_char && intr_char != Ctrl_C)) {
got_int = TRUE;
[inputQueue removeAllObjects];
return;
}
}
}
if (interrupt) {
got_int = TRUE;
[inputQueue removeAllObjects];
} else if (TerminateNowMsgID == msgid) {
// Terminate immediately (the frontend is about to quit or this process
// was aborted).
isTerminating = YES;
mch_exit(0);
return;
}
@@ -1230,11 +1221,18 @@ static NSString *MMSymlinkWarningString =
}
- (void)addInput:(in bycopy NSString *)input
client:(in byref id <MMVimClientProtocol>)client
client:(in byref id <MMVimClientProtocol>)client
{
//NSLog(@"addInput:%@ client:%@", input, (id)client);
[self addInput:input];
// NOTE: We don't call addInput: here because it differs from
// server_to_input_buf() in that it always sets the 'silent' flag and we
// don't want the MacVim client/server code to behave differently from
// other platforms.
char_u *s = [input vimStringSave];
server_to_input_buf(s);
vim_free(s);
[self addClient:(id)client];
}
@@ -1443,11 +1441,11 @@ static NSString *MMSymlinkWarningString =
{
if (!waitForAck) return;
while (waitForAck && !got_int && [connection isValid] && !isTerminating) {
while (waitForAck && !got_int && [connection isValid]) {
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
beforeDate:[NSDate distantFuture]];
//NSLog(@" waitForAck=%d got_int=%d isTerminating=%d isValid=%d",
// waitForAck, got_int, isTerminating, [connection isValid]);
//NSLog(@" waitForAck=%d got_int=%d isValid=%d",
// waitForAck, got_int, [connection isValid]);
}
if (waitForAck) {
@@ -1458,7 +1456,6 @@ static NSString *MMSymlinkWarningString =
// NOTE: We intentionally do not call mch_exit() since this in turn
// will lead to -[MMBackend exit] getting called which we want to
// avoid.
usleep(MMExitProcessDelay);
exit(0);
}
@@ -1477,6 +1474,40 @@ static NSString *MMSymlinkWarningString =
@implementation MMBackend (Private)
- (void)clearDrawData
{
[drawData setLength:0];
numWholeLineChanges = offsetForDrawDataPrune = 0;
}
- (void)didChangeWholeLine
{
// It may happen that draw queue is filled up with lots of changes that
// affect a whole row. If the number of such changes equals twice the
// number of visible rows then we can prune some commands off the queue.
//
// NOTE: If we don't perform this pruning the draw queue may grow
// indefinitely if Vim were to repeatedly send draw commands without ever
// waiting for new input (that's when the draw queue is flushed). The one
// instance I know where this can happen is when a command is executed in
// the shell (think ":grep" with thousands of matches).
++numWholeLineChanges;
if (numWholeLineChanges == gui.num_rows) {
// Remember the offset to prune up to.
offsetForDrawDataPrune = [drawData length];
} else if (numWholeLineChanges == 2*gui.num_rows) {
// Delete all the unnecessary draw commands.
NSMutableData *d = [[NSMutableData alloc]
initWithBytes:[drawData bytes] + offsetForDrawDataPrune
length:[drawData length] - offsetForDrawDataPrune];
offsetForDrawDataPrune = [d length];
numWholeLineChanges -= gui.num_rows;
[drawData release];
drawData = d;
}
}
- (void)waitForDialogReturn
{
// Keep processing the run loop until a dialog returns. To avoid getting
@@ -1487,8 +1518,7 @@ static NSString *MMSymlinkWarningString =
// items while a sheet is being displayed, so we can't just wait for the
// first message to arrive and assume that is the setDialogReturn: call.
while (nil == dialogReturn && !got_int && [connection isValid]
&& !isTerminating)
while (nil == dialogReturn && !got_int && [connection isValid])
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
beforeDate:[NSDate distantFuture]];
@@ -1530,12 +1560,16 @@ static NSString *MMSymlinkWarningString =
// to make synchronous calls from MacVim to Vim in order to get state.
BOOL mmta = curbuf ? curbuf->b_p_mmta : NO;
int numTabs = tabpage_index(NULL) - 1;
if (numTabs < 0)
numTabs = 0;
NSDictionary *vimState = [NSDictionary dictionaryWithObjectsAndKeys:
[[NSFileManager defaultManager] currentDirectoryPath], @"pwd",
[NSNumber numberWithInt:p_mh], @"p_mh",
[NSNumber numberWithBool:[self unusedEditor]], @"unusedEditor",
[NSNumber numberWithBool:mmta], @"p_mmta",
[NSNumber numberWithInt:numTabs], @"numTabs",
nil];
// Put the state before all other messages.
@@ -1664,8 +1698,6 @@ static NSString *MMSymlinkWarningString =
[self addInput:string];
[string release];
}
} else if (TerminateNowMsgID == msgid) {
isTerminating = YES;
} else if (SelectTabMsgID == msgid) {
if (!data) return;
const void *bytes = [data bytes];
@@ -1978,19 +2010,15 @@ static NSString *MMSymlinkWarningString =
- (void)connectionDidDie:(NSNotification *)notification
{
// If the main connection to MacVim is lost this means that MacVim was
// either quit (by the user chosing Quit on the MacVim menu), or it has
// crashed. In the former case the flag 'isTerminating' is set and we then
// quit cleanly; in the latter case we make sure the swap files are left
// for recovery.
// If the main connection to MacVim is lost this means that either MacVim
// has crashed or this process did not receive its termination message
// properly (e.g. if the TerminateNowMsgID was dropped).
//
// NOTE: This is not called if a Vim controller invalidates its connection.
//NSLog(@"%s isTerminating=%d", _cmd, isTerminating);
if (isTerminating)
getout(0);
else
getout_preserve_modified(1);
NSLog(@"WARNING[%s]: Main connection was lost before process had a chance "
"to terminate; preserving swap files.", _cmd);
getout_preserve_modified(1);
}
- (void)blinkTimerFired:(NSTimer *)timer
@@ -2128,7 +2156,7 @@ static NSString *MMSymlinkWarningString =
bytes += sizeof(unsigned); // len not used
NSMutableString *name = [NSMutableString stringWithUTF8String:bytes];
[name appendString:[NSString stringWithFormat:@":h%.2f", pointSize]];
[name appendString:[NSString stringWithFormat:@":h%d", (int)pointSize]];
char_u *s = (char_u*)[name UTF8String];
#ifdef FEAT_MBYTE
@@ -2409,10 +2437,7 @@ static NSString *MMSymlinkWarningString =
[self addInput:@"|vert sall"];
// Restore the old value of 'suffixes'.
[self addInput:@"|let &su=mvim_oldsu|unlet mvim_oldsu"];
// Adding "|redr|f" ensures a "Hit ENTER" prompt is not shown.
[self addInput:@"|redr|f<CR>"];
[self addInput:@"|let &su=mvim_oldsu|unlet mvim_oldsu<CR>"];
} else {
// When opening one file we try to reuse the current window,
// but not if its buffer is modified or has a filename.
@@ -2443,9 +2468,7 @@ static NSString *MMSymlinkWarningString =
}
[self addInput:cmd];
// Adding "|redr|f" ensures a "Hit ENTER" prompt is not shown.
[self addInput:@"|redr|f<CR>"];
[self addInput:@"<CR>"];
}
// Force screen redraw (does it have to be this complicated?).
@@ -2520,17 +2543,44 @@ static NSString *MMSymlinkWarningString =
- (void)addInput:(NSString *)input
{
char_u *s = (char_u*)[input UTF8String];
// NOTE: This code is essentially identical to server_to_input_buf(),
// except the 'silent' flag is TRUE in the call to ins_typebuf() below.
char_u *string = [input vimStringSave];
if (!string) return;
#ifdef FEAT_MBYTE
s = CONVERT_FROM_UTF8(s);
#endif
/* Set 'cpoptions' the way we want it.
* B set - backslashes are *not* treated specially
* k set - keycodes are *not* reverse-engineered
* < unset - <Key> sequences *are* interpreted
* The last but one parameter of replace_termcodes() is TRUE so that the
* <lt> sequence is recognised - needed for a real backslash.
*/
char_u *ptr = NULL;
char_u *cpo_save = p_cpo;
p_cpo = (char_u *)"Bk";
char_u *str = replace_termcodes((char_u *)string, &ptr, FALSE, TRUE, FALSE);
p_cpo = cpo_save;
server_to_input_buf(s);
if (*ptr != NUL) /* trailing CTRL-V results in nothing */
{
/*
* Add the string to the input stream.
* Can't use add_to_input_buf() here, we now have K_SPECIAL bytes.
*
* First clear typed characters from the typeahead buffer, there could
* be half a mapping there. Then append to the existing string, so
* that multiple commands from a client are concatenated.
*/
if (typebuf.tb_maplen < typebuf.tb_len)
del_typebuf(typebuf.tb_len - typebuf.tb_maplen, typebuf.tb_maplen);
(void)ins_typebuf(str, REMAP_NONE, typebuf.tb_len, TRUE, TRUE);
#ifdef FEAT_MBYTE
CONVERT_FROM_UTF8_FREE(s);
#endif
/* Let input_available() know we inserted text in the typeahead
* buffer. */
typebuf_was_filled = TRUE;
}
vim_free(ptr);
vim_free(string);
}
- (BOOL)unusedEditor
+25 -26
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,6 +77,18 @@ 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;
}
@@ -86,6 +96,8 @@ static int numFullscreenWindows = 0;
{
LOG_DEALLOC
[[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;
@@ -277,8 +287,6 @@ static int numFullscreenWindows = 0;
CGReleaseDisplayFadeReservation(token);
}
[self revealDockIfAppropriate];
[self autorelease]; // Balance the above retain
}
@@ -347,38 +355,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);
}
}
+6 -3
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 =
+6 -2
View File
@@ -264,10 +264,14 @@ 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;
}
+1
View File
@@ -49,6 +49,7 @@
- (NSString *)serverName;
- (MMWindowController *)windowController;
- (NSDictionary *)vimState;
- (id)objectForVimStateKey:(NSString *)key;
- (NSMenu *)mainMenu;
- (BOOL)isPreloading;
- (void)setIsPreloading:(BOOL)yn;
+12 -3
View File
@@ -200,6 +200,11 @@ static BOOL isUnsafeMessage(int msgid);
return vimState;
}
- (id)objectForVimStateKey:(NSString *)key
{
return [vimState objectForKey:key];
}
- (NSMenu *)mainMenu
{
return mainMenu;
@@ -859,10 +864,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];
+34 -17
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];
@@ -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:
NSLog(@"WARNING: 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
+7 -6
View File
@@ -174,7 +174,6 @@ enum {
SetDocumentFilenameMsgID,
OpenWithArgumentsMsgID,
CloseWindowMsgID,
InterruptMsgID,
SetFullscreenColorMsgID,
ShowFindReplaceDialogMsgID,
FindReplaceMsgID,
@@ -209,6 +208,13 @@ enum {
ToolbarSizeRegularFlag = 4
};
enum {
MMTabLabel = 0,
MMTabToolTip,
MMTabInfoCount
};
// 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;
@@ -218,11 +224,6 @@ 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;
-34
View File
@@ -81,7 +81,6 @@ char *MessageStrings[] =
"SetDocumentFilenameMsgID",
"OpenWithArgumentsMsgID",
"CloseWindowMsgID",
"InterruptMsgID",
"SetFullscreenColorMsgID",
"ShowFindReplaceDialogMsgID",
"FindReplaceMsgID",
@@ -100,39 +99,6 @@ NSString *VimPBoardType = @"VimPBoardType";
ATSFontContainerRef
loadFonts()
{
// 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);
}
}
}
return fontContainerRef;
}
@implementation NSString (MMExtras)
- (NSString *)stringByEscapingSpecialFilenameCharacters
+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 = 39;
CURRENT_PROJECT_VERSION = 41;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
@@ -807,7 +778,7 @@
buildSettings = {
ARCHS = "$(NATIVE_ARCH)";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 39;
CURRENT_PROJECT_VERSION = 41;
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 = 39;
CURRENT_PROJECT_VERSION = 41;
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;
+2
View File
@@ -26,6 +26,7 @@
extern NSString *MMTabMinWidthKey;
extern NSString *MMTabMaxWidthKey;
extern NSString *MMTabOptimumWidthKey;
extern NSString *MMShowAddTabButtonKey;
extern NSString *MMTextInsetLeftKey;
extern NSString *MMTextInsetRightKey;
extern NSString *MMTextInsetTopKey;
@@ -53,6 +54,7 @@ extern NSString *MMOpenLayoutKey;
extern NSString *MMVerticalSplitKey;
extern NSString *MMPreloadCacheSizeKey;
extern NSString *MMLastWindowClosedBehaviorKey;
extern NSString *MMLoadDefaultFontKey;
// Enum for MMUntitledWindowKey
+2
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";
@@ -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];
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.
+145 -73
View File
@@ -22,13 +22,13 @@
// 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 int MMDefaultFontSize = 12;
static int MMMinFontSize = 6;
static int MMMaxFontSize = 100;
static BOOL gui_mch_init_has_finished = NO;
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);
@@ -189,7 +189,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 +211,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 out output.
// When one page has scrolled by we increase the delay before the next
// flush.
if (++scrolls > gui.num_rows) {
delay <<= 1;
if (delay > 0x10000)
delay = 0x10000;
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
@@ -695,6 +738,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 +779,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;
}
@@ -868,11 +940,18 @@ gui_mch_free_font(font)
{
if (font != NOFONT) {
//NSLog(@"gui_mch_free_font(font=0x%x)", font);
[(NSFont*)font release];
[(id)font release];
}
}
GuiFont
gui_mch_retain_font(GuiFont font)
{
return (GuiFont)[(id)font retain];
}
/*
* Get a font structure for highlighting.
*/
@@ -882,9 +961,9 @@ gui_mch_get_font(char_u *name, int giveErrorIfMissing)
//NSLog(@"gui_mch_get_font(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 +975,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
@@ -923,24 +1000,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 +1031,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 ------------------------------------------------------------
+11
View File
@@ -0,0 +1,11 @@
.PHONY: clean
OUTDIR ?= .
$(OUTDIR)/MacVim-generic.icns: make_icons.py vim-noshadow-512.png
$(MAKE) -C makeicns
/usr/bin/python make_icons.py $(OUTDIR)
clean:
$(MAKE) -C makeicns clean
rm -f $(OUTDIR)/MacVim-*.icns
+549
View File
@@ -0,0 +1,549 @@
# Creates a document icon from an app icon and an optional text.
# The font is not quite right, use this script to create a document icon
# for 'PDF' and compare the D with the D in Preview's pdf.icns
# http://www.macresearch.org/cocoa-scientists-part-xx-python-scriptersmeet-cocoa
try:
from Foundation import *
from AppKit import *
dont_create = False
except:
dont_create = True # most likely because we're on tiger
NSCompositeSourceOver = 2
import math
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+)
# path to makeicns binary
MAKEICNS = 'makeicns/makeicns'
# List of icons to create
# XXX: 32x32 variants only support 3-4 letters of text
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', 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', SMALL],
'MacVim-py': [u'PYTHON', SMALL],
'MacVim-php': [u'PHP', SMALL],
'MacVim-rb': [u'RUBY', SMALL],
'MacVim-bash': [u'SH', SMALL],
'MacVim-patch': [u'DIFF', SMALL],
'MacVim-applescript': [u'\uf8ffSCPT', 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', SMALL],
'MacVim-fscript': [u'FSCPT', 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', 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', SMALL],
'MacVim-sql': [u'SQL', SMALL],
'MacVim-tcl': [u'TCL', SMALL],
'MacVim-xsl': [u'XSL', LINK],
'MacVim-vcf': [u'VCARD', SMALL],
'MacVim-vb': [u'VBASIC', LINK],
'MacVim-yaml': [u'YAML', SMALL],
'MacVim-gtd': [u'GTD', LINK],
}
shorttext = {
u'MacVim-py': u'PY',
u'MacVim-rb': u'RB',
u'MacVim-perl': u'PL',
u'MacVim-applescript': u'\uf8ffS',
u'MacVim-erl': u'ERL',
u'MacVim-fscript': u'FSCR',
u'MacVim-sch': u'SCM',
u'MacVim-vcf': u'VCF',
u'MacVim-vb': u'VB',
}
# Resources
BACKGROUND = '/System/Library/CoreServices/CoreTypes.bundle/' + \
'Contents/Resources/GenericDocumentIcon.icns' # might require leopard?
APPICON = 'vim-noshadow-512.png'
#APPICON = 'vim-noshadow-no-v-512.png'
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(filename))
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():
if map(int, rep.size()) == [w, h]:
r = rep
break
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)
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):
self.bgRenderer = bg
self.icon = icon
self.cache = {}
def drawIcon(self, s):
if not self.icon:
return
# found by flow program, better than anything i came up with manually before
# (except for the 16x16 variant :-( )
transforms = {
512: [ 0.7049, 0.5653, -4.2432, 0.5656],
256: [ 0.5690, 0.5658, -1.9331, 0.5656],
128: [ 1.1461, 0.5684, -0.8482, 0.5681],
32: [-0.2682, 0.5895, -2.2130, 0.5701], # intensity
#32: [-0.2731, 0.5898, -2.2262, 0.5729], # rgb (no rmse difference)
#16: [-0.3033, 0.4909, -1.3235, 0.4790], # program, intensity
#16: [-0.3087, 0.4920, -1.2990, 0.4750], # program, rgb mode
16: [ 0.0000, 0.5000, -1.0000, 0.5000], # manually, better
}
assert s in [16, 32, 128, 256, 512]
a = transforms[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):
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, shorttext=None):
# Fill in background
output = bg.backgroundAtSize(s).copy()
# Draw text on top of shadow
context = Context(output)
if s in [16, 32] and shorttext:
text = shorttext
textRenderer.drawTextAtSize(text, s)
context.done()
return output
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)
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
"""
# XXX: Figure out how to call ObjC directly from Python, then this doesn't
# need to call a different process and do lots of i/o.
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))
os.system('%s %s -out %s' % (makeIcns, ' '.join(args), icnsName))
TMPFILE = 'make_icons_tmp_%d.png'
sizes = [512, 128, 32, 16]
def main():
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)
if dont_create:
print "PyObjC not found, only using a stock icon for document icons."
import shutil
shutil.copyfile(BACKGROUND, '%s.icns' % GENERIC_ICON_NAME)
createLinks([name for name in vimIcons if name != GENERIC_ICON_NAME],
'%s.icns' % GENERIC_ICON_NAME)
return
# Make us not crash
# http://www.cocoabuilder.com/archive/message/cocoa/2008/8/6/214964
NSApplicationLoad()
textRenderer = TextRenderer()
#textRenderer = OfficeTextRenderer()
# Prepare input images
bgIcon = Image(BACKGROUND)
#bg = SplittableBackground(bgIcon, shouldSplit=False)
bg = SplittableBackground(bgIcon, shouldSplit=True)
icon = Image(appIcon)
bgRenderer = BackgroundRenderer(bg, icon)
if not os.access(makeIcns, os.X_OK):
print 'Cannot find makeicns at %s', makeIcns
return
# create LARGE and SMALL icons first...
for name, t in vimIcons.iteritems():
text, size = t
if size == LINK: continue
print name
icnsName = '%s.icns' % name
if size == SMALL:
currSizes = [128, 32, 16]
elif size == LARGE:
currSizes = [512, 128, 32, 16]
st = shorttext.get(name)
icons = [(s, createIcon(s, bgRenderer, textRenderer, text, shorttext=st))
for s in currSizes]
icons = dict(icons)
saveIcns(icons, '%s.icns' % name, makeIcns)
del text, size, name, t
# ...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__':
try:
main()
finally:
for s in sizes:
if os.access(TMPFILE % s, os.F_OK):
os.remove(TMPFILE % s)
+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
+172
View File
@@ -0,0 +1,172 @@
// 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
// XXX: Seems as if this creates problems in some situations, disable this
// for now.
#if 0
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;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

+29
View File
@@ -40,6 +40,35 @@
Sparkle supports updates in zip, tar, tbz, tgz, or dmg format.
-->
<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[
+1 -1
View File
@@ -5128,7 +5128,7 @@ buf_spname(buf)
{
if (buf->b_sfname != NULL)
return (char *)buf->b_sfname;
return "[Scratch]";
return _("[Scratch]");
}
#endif
if (buf->b_fname == NULL)
+22 -7
View File
@@ -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);
}
}
}
@@ -131,6 +134,7 @@ diff_buf_add(buf)
{
curtab->tp_diffbuf[i] = buf;
curtab->tp_diff_invalid = TRUE;
diff_redraw(TRUE);
return;
}
@@ -661,6 +665,7 @@ ex_diffupdate(eap)
char_u *tmp_diff;
FILE *fd;
int ok;
int io_error = FALSE;
/* Delete all diffblocks. */
diff_clear(curtab);
@@ -697,18 +702,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 +774,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)
@@ -925,10 +940,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
+186 -62
View File
@@ -32,6 +32,9 @@
#define DICT_MAXNEST 100 /* maximum nesting of lists and dicts */
#define DO_NOT_FREE_CNT 99999 /* refcount for dict or list that should not
be freed. */
/*
* In a hashtab item "hi_key" points to "di_key" in a dictitem.
* This avoids adding a pointer to the hashtab item.
@@ -789,6 +792,8 @@ static void func_free __ARGS((ufunc_T *fp));
static void func_unref __ARGS((char_u *name));
static void func_ref __ARGS((char_u *name));
static void call_user_func __ARGS((ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rettv, linenr_T firstline, linenr_T lastline, dict_T *selfdict));
static int can_free_funccal __ARGS((funccall_T *fc, int copyID)) ;
static void free_funccal __ARGS((funccall_T *fc, int free_val));
static void add_nr_var __ARGS((dict_T *dp, dictitem_T *v, char *name, varnumber_T nr));
static win_T *find_win_by_nr __ARGS((typval_T *vp, tabpage_T *tp));
static void getwinvar __ARGS((typval_T *argvars, typval_T *rettv, int off));
@@ -923,6 +928,10 @@ func_level(cookie)
/* pointer to funccal for currently active function */
funccall_T *current_funccal = NULL;
/* pointer to list of previously used funccal, still around because some
* item in it is still being used. */
funccall_T *previous_funccal = NULL;
/*
* Return TRUE when a function was ended by a ":return" command.
*/
@@ -6490,7 +6499,7 @@ garbage_collect()
buf_T *buf;
win_T *wp;
int i;
funccall_T *fc;
funccall_T *fc, **pfc;
int did_free = FALSE;
#ifdef FEAT_WINDOWS
tabpage_T *tp;
@@ -6574,6 +6583,20 @@ garbage_collect()
else
ll = ll->lv_used_next;
/* check if any funccal can be freed now */
for (pfc = &previous_funccal; *pfc != NULL; )
{
if (can_free_funccal(*pfc, copyID))
{
fc = *pfc;
*pfc = fc->caller;
free_funccal(fc, TRUE);
did_free = TRUE;
}
else
pfc = &(*pfc)->caller;
}
return did_free;
}
@@ -7564,8 +7587,8 @@ static struct fst
{"getwinposx", 0, 0, f_getwinposx},
{"getwinposy", 0, 0, f_getwinposy},
{"getwinvar", 2, 2, f_getwinvar},
{"glob", 1, 1, f_glob},
{"globpath", 2, 2, f_globpath},
{"glob", 1, 2, f_glob},
{"globpath", 2, 3, f_globpath},
{"has", 1, 1, f_has},
{"has_key", 2, 2, f_has_key},
{"haslocaldir", 0, 0, f_haslocaldir},
@@ -9557,7 +9580,7 @@ f_expand(argvars, rettv)
else
{
/* When the optional second argument is non-zero, don't remove matches
* for 'suffixes' and 'wildignore' */
* for 'wildignore' and don't put matches for 'suffixes' at the end. */
if (argvars[1].v_type != VAR_UNKNOWN
&& get_tv_number_chk(&argvars[1], &error))
flags |= WILD_KEEP_ALL;
@@ -10339,7 +10362,8 @@ f_function(argvars, rettv)
s = get_tv_string(&argvars[0]);
if (s == NULL || *s == NUL || VIM_ISDIGIT(*s))
EMSG2(_(e_invarg2), s);
else if (!function_exists(s))
/* Don't check an autoload name for existence here. */
else if (vim_strchr(s, AUTOLOAD_CHAR) == NULL && !function_exists(s))
EMSG2(_("E700: Unknown function: %s"), s);
else
{
@@ -10641,7 +10665,7 @@ f_getchar(argvars, rettv)
# ifdef FEAT_WINDOWS
win_T *wp;
# endif
int n = 1;
int winnr = 1;
if (row >= 0 && col >= 0)
{
@@ -10651,9 +10675,9 @@ f_getchar(argvars, rettv)
(void)mouse_comp_pos(win, &row, &col, &lnum);
# ifdef FEAT_WINDOWS
for (wp = firstwin; wp != win; wp = wp->w_next)
++n;
++winnr;
# endif
vimvars[VV_MOUSE_WIN].vv_nr = n;
vimvars[VV_MOUSE_WIN].vv_nr = winnr;
vimvars[VV_MOUSE_LNUM].vv_nr = lnum;
vimvars[VV_MOUSE_COL].vv_nr = col + 1;
}
@@ -11323,13 +11347,25 @@ f_glob(argvars, rettv)
typval_T *argvars;
typval_T *rettv;
{
int flags = WILD_SILENT|WILD_USE_NL;
expand_T xpc;
int error = FALSE;
ExpandInit(&xpc);
xpc.xp_context = EXPAND_FILES;
/* When the optional second argument is non-zero, don't remove matches
* for 'wildignore' and don't put matches for 'suffixes' at the end. */
if (argvars[1].v_type != VAR_UNKNOWN
&& get_tv_number_chk(&argvars[1], &error))
flags |= WILD_KEEP_ALL;
rettv->v_type = VAR_STRING;
rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]),
NULL, WILD_USE_NL|WILD_SILENT, WILD_ALL);
if (!error)
{
ExpandInit(&xpc);
xpc.xp_context = EXPAND_FILES;
rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]),
NULL, flags, WILD_ALL);
}
else
rettv->vval.v_string = NULL;
}
/*
@@ -11340,14 +11376,22 @@ f_globpath(argvars, rettv)
typval_T *argvars;
typval_T *rettv;
{
int flags = 0;
char_u buf1[NUMBUFLEN];
char_u *file = get_tv_string_buf_chk(&argvars[1], buf1);
int error = FALSE;
/* When the optional second argument is non-zero, don't remove matches
* for 'wildignore' and don't put matches for 'suffixes' at the end. */
if (argvars[2].v_type != VAR_UNKNOWN
&& get_tv_number_chk(&argvars[2], &error))
flags |= WILD_KEEP_ALL;
rettv->v_type = VAR_STRING;
if (file == NULL)
if (file == NULL || error)
rettv->vval.v_string = NULL;
else
rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file);
rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file,
flags);
}
/*
@@ -11833,6 +11877,10 @@ f_has(argvars, rettv)
n = has_patch(atoi((char *)name + 5));
else if (STRICMP(name, "vim_starting") == 0)
n = (starting != 0);
#ifdef FEAT_MBYTE
else if (STRICMP(name, "multi_byte_encoding") == 0)
n = has_mbyte;
#endif
#if defined(FEAT_BEVAL) && defined(FEAT_GUI_W32)
else if (STRICMP(name, "balloon_multiline") == 0)
n = multiline_balloon_available();
@@ -16648,8 +16696,11 @@ f_synIDattr(argvars, rettv)
p = highlight_has_attr(id, HL_INVERSE, modec);
break;
case 's': /* standout */
p = highlight_has_attr(id, HL_STANDOUT, modec);
case 's':
if (TOLOWER_ASC(what[1]) == 'p') /* sp[#] */
p = highlight_color(id, what, modec);
else /* standout */
p = highlight_has_attr(id, HL_STANDOUT, modec);
break;
case 'u':
@@ -18954,7 +19005,7 @@ init_var_dict(dict, dict_var)
dictitem_T *dict_var;
{
hash_init(&dict->dv_hashtab);
dict->dv_refcount = 99999;
dict->dv_refcount = DO_NOT_FREE_CNT;
dict_var->di_tv.vval.v_dict = dict;
dict_var->di_tv.v_type = VAR_DICT;
dict_var->di_tv.v_lock = VAR_FIXED;
@@ -19291,6 +19342,8 @@ tv_check_lock(lock, name)
* Copy the values from typval_T "from" to typval_T "to".
* When needed allocates string or increases reference count.
* Does not make a copy of a list or dict but copies the reference!
* It is OK for "from" and "to" to point to the same item. This is used to
* make a copy later.
*/
static void
copy_tv(from, to)
@@ -21103,7 +21156,7 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
char_u *save_sourcing_name;
linenr_T save_sourcing_lnum;
scid_T save_current_SID;
funccall_T fc;
funccall_T *fc;
int save_did_emsg;
static int depth = 0;
dictitem_T *v;
@@ -21129,36 +21182,37 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
line_breakcheck(); /* check for CTRL-C hit */
fc.caller = current_funccal;
current_funccal = &fc;
fc.func = fp;
fc.rettv = rettv;
fc = (funccall_T *)alloc(sizeof(funccall_T));
fc->caller = current_funccal;
current_funccal = fc;
fc->func = fp;
fc->rettv = rettv;
rettv->vval.v_number = 0;
fc.linenr = 0;
fc.returned = FALSE;
fc.level = ex_nesting_level;
fc->linenr = 0;
fc->returned = FALSE;
fc->level = ex_nesting_level;
/* Check if this function has a breakpoint. */
fc.breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0);
fc.dbg_tick = debug_tick;
fc->breakpoint = dbg_find_breakpoint(FALSE, fp->uf_name, (linenr_T)0);
fc->dbg_tick = debug_tick;
/*
* Note about using fc.fixvar[]: This is an array of FIXVAR_CNT variables
* Note about using fc->fixvar[]: This is an array of FIXVAR_CNT variables
* with names up to VAR_SHORT_LEN long. This avoids having to alloc/free
* each argument variable and saves a lot of time.
*/
/*
* Init l: variables.
*/
init_var_dict(&fc.l_vars, &fc.l_vars_var);
init_var_dict(&fc->l_vars, &fc->l_vars_var);
if (selfdict != NULL)
{
/* Set l:self to "selfdict". Use "name" to avoid a warning from
* some compiler that checks the destination size. */
v = &fc.fixvar[fixvar_idx++].var;
v = &fc->fixvar[fixvar_idx++].var;
name = v->di_key;
STRCPY(name, "self");
v->di_flags = DI_FLAGS_RO + DI_FLAGS_FIX;
hash_add(&fc.l_vars.dv_hashtab, DI2HIKEY(v));
hash_add(&fc->l_vars.dv_hashtab, DI2HIKEY(v));
v->di_tv.v_type = VAR_DICT;
v->di_tv.v_lock = 0;
v->di_tv.vval.v_dict = selfdict;
@@ -21170,31 +21224,31 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
* Set a:0 to "argcount".
* Set a:000 to a list with room for the "..." arguments.
*/
init_var_dict(&fc.l_avars, &fc.l_avars_var);
add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "0",
init_var_dict(&fc->l_avars, &fc->l_avars_var);
add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "0",
(varnumber_T)(argcount - fp->uf_args.ga_len));
/* Use "name" to avoid a warning from some compiler that checks the
* destination size. */
v = &fc.fixvar[fixvar_idx++].var;
v = &fc->fixvar[fixvar_idx++].var;
name = v->di_key;
STRCPY(name, "000");
v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
hash_add(&fc.l_avars.dv_hashtab, DI2HIKEY(v));
hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v));
v->di_tv.v_type = VAR_LIST;
v->di_tv.v_lock = VAR_FIXED;
v->di_tv.vval.v_list = &fc.l_varlist;
vim_memset(&fc.l_varlist, 0, sizeof(list_T));
fc.l_varlist.lv_refcount = 99999;
fc.l_varlist.lv_lock = VAR_FIXED;
v->di_tv.vval.v_list = &fc->l_varlist;
vim_memset(&fc->l_varlist, 0, sizeof(list_T));
fc->l_varlist.lv_refcount = DO_NOT_FREE_CNT;
fc->l_varlist.lv_lock = VAR_FIXED;
/*
* Set a:firstline to "firstline" and a:lastline to "lastline".
* Set a:name to named arguments.
* Set a:N to the "..." arguments.
*/
add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "firstline",
add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "firstline",
(varnumber_T)firstline);
add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "lastline",
add_nr_var(&fc->l_avars, &fc->fixvar[fixvar_idx++].var, "lastline",
(varnumber_T)lastline);
for (i = 0; i < argcount; ++i)
{
@@ -21210,7 +21264,7 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
}
if (fixvar_idx < FIXVAR_CNT && STRLEN(name) <= VAR_SHORT_LEN)
{
v = &fc.fixvar[fixvar_idx++].var;
v = &fc->fixvar[fixvar_idx++].var;
v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
}
else
@@ -21222,7 +21276,7 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
v->di_flags = DI_FLAGS_RO;
}
STRCPY(v->di_key, name);
hash_add(&fc.l_avars.dv_hashtab, DI2HIKEY(v));
hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v));
/* Note: the values are copied directly to avoid alloc/free.
* "argvars" must have VAR_FIXED for v_lock. */
@@ -21231,9 +21285,9 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
if (ai >= 0 && ai < MAX_FUNC_ARGS)
{
list_append(&fc.l_varlist, &fc.l_listitems[ai]);
fc.l_listitems[ai].li_tv = argvars[i];
fc.l_listitems[ai].li_tv.v_lock = VAR_FIXED;
list_append(&fc->l_varlist, &fc->l_listitems[ai]);
fc->l_listitems[ai].li_tv = argvars[i];
fc->l_listitems[ai].li_tv.v_lock = VAR_FIXED;
}
}
@@ -21298,7 +21352,7 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
if (!fp->uf_profiling && has_profiling(FALSE, fp->uf_name, NULL))
func_do_profile(fp);
if (fp->uf_profiling
|| (fc.caller != NULL && fc.caller->func->uf_profiling))
|| (fc->caller != NULL && fc->caller->func->uf_profiling))
{
++fp->uf_tm_count;
profile_start(&call_start);
@@ -21314,7 +21368,7 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
did_emsg = FALSE;
/* call do_cmdline() to execute the lines */
do_cmdline(NULL, get_func_line, (void *)&fc,
do_cmdline(NULL, get_func_line, (void *)fc,
DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT);
--RedrawingDisabled;
@@ -21329,16 +21383,16 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
#ifdef FEAT_PROFILE
if (do_profiling == PROF_YES && (fp->uf_profiling
|| (fc.caller != NULL && fc.caller->func->uf_profiling)))
|| (fc->caller != NULL && fc->caller->func->uf_profiling)))
{
profile_end(&call_start);
profile_sub_wait(&wait_start, &call_start);
profile_add(&fp->uf_tm_total, &call_start);
profile_self(&fp->uf_tm_self, &call_start, &fp->uf_tm_children);
if (fc.caller != NULL && fc.caller->func->uf_profiling)
if (fc->caller != NULL && fc->caller->func->uf_profiling)
{
profile_add(&fc.caller->func->uf_tm_children, &call_start);
profile_add(&fc.caller->func->uf_tml_children, &call_start);
profile_add(&fc->caller->func->uf_tm_children, &call_start);
profile_add(&fc->caller->func->uf_tml_children, &call_start);
}
}
#endif
@@ -21351,9 +21405,9 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
if (aborting())
smsg((char_u *)_("%s aborted"), sourcing_name);
else if (fc.rettv->v_type == VAR_NUMBER)
else if (fc->rettv->v_type == VAR_NUMBER)
smsg((char_u *)_("%s returning #%ld"), sourcing_name,
(long)fc.rettv->vval.v_number);
(long)fc->rettv->vval.v_number);
else
{
char_u buf[MSG_BUF_LEN];
@@ -21364,7 +21418,7 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
/* The value may be very long. Skip the middle part, so that we
* have some idea how it starts and ends. smsg() would always
* truncate it at the end. */
s = tv2string(fc.rettv, &tofree, numbuf2, 0);
s = tv2string(fc->rettv, &tofree, numbuf2, 0);
if (s != NULL)
{
trunc_string(s, buf, MSG_BUF_CLEN);
@@ -21400,14 +21454,84 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
}
did_emsg |= save_did_emsg;
current_funccal = fc.caller;
/* The a: variables typevals were not allocated, only free the allocated
* variables. */
vars_clear_ext(&fc.l_avars.dv_hashtab, FALSE);
vars_clear(&fc.l_vars.dv_hashtab); /* free all l: variables */
current_funccal = fc->caller;
--depth;
/* if the a:000 list and the a: dict are not referenced we can free the
* funccall_T and what's in it. */
if (fc->l_varlist.lv_refcount == DO_NOT_FREE_CNT
&& fc->l_vars.dv_refcount == DO_NOT_FREE_CNT
&& fc->l_avars.dv_refcount == DO_NOT_FREE_CNT)
{
free_funccal(fc, FALSE);
}
else
{
hashitem_T *hi;
listitem_T *li;
int todo;
/* "fc" is still in use. This can happen when returning "a:000" or
* assigning "l:" to a global variable.
* Link "fc" in the list for garbage collection later. */
fc->caller = previous_funccal;
previous_funccal = fc;
/* Make a copy of the a: variables, since we didn't do that above. */
todo = (int)fc->l_avars.dv_hashtab.ht_used;
for (hi = fc->l_avars.dv_hashtab.ht_array; todo > 0; ++hi)
{
if (!HASHITEM_EMPTY(hi))
{
--todo;
v = HI2DI(hi);
copy_tv(&v->di_tv, &v->di_tv);
}
}
/* Make a copy of the a:000 items, since we didn't do that above. */
for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next)
copy_tv(&li->li_tv, &li->li_tv);
}
}
/*
* Return TRUE if items in "fc" do not have "copyID". That means they are not
* referenced from anywyere.
*/
static int
can_free_funccal(fc, copyID)
funccall_T *fc;
int copyID;
{
return (fc->l_varlist.lv_copyID != copyID
&& fc->l_vars.dv_copyID != copyID
&& fc->l_avars.dv_copyID != copyID);
}
/*
* Free "fc" and what it contains.
*/
static void
free_funccal(fc, free_val)
funccall_T *fc;
int free_val; /* a: vars were allocated */
{
listitem_T *li;
/* The a: variables typevals may not have been allocated, only free the
* allocated variables. */
vars_clear_ext(&fc->l_avars.dv_hashtab, free_val);
/* free all l: variables */
vars_clear(&fc->l_vars.dv_hashtab);
/* Free the a:000 variables if they were allocated. */
if (free_val)
for (li = fc->l_varlist.lv_first; li != NULL; li = li->li_next)
clear_tv(&li->li_tv);
vim_free(fc);
}
/*
+1 -1
View File
@@ -1941,7 +1941,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
}
}
+3 -3
View File
@@ -8773,8 +8773,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) == OK)
shorten_fnames(TRUE);
}
failed |= (makeopens(fd, dirnow) == FAIL);
@@ -10134,7 +10134,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;
+7 -6
View File
@@ -2524,7 +2524,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. */
@@ -4900,7 +4900,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 +4941,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 +4973,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;
+5 -5
View File
@@ -2214,7 +2214,7 @@ failed:
{
/* Use stderr for stdin, makes shell commands work. */
close(0);
dup(2);
ignored = dup(2);
}
#endif
@@ -3449,7 +3449,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit,
{
# ifdef UNIX
# ifdef HAVE_FCHOWN
fchown(fd, st_old.st_uid, st_old.st_gid);
ignored = fchown(fd, st_old.st_uid, st_old.st_gid);
# endif
if (mch_stat((char *)IObuff, &st) < 0
|| st.st_uid != st_old.st_uid
@@ -4365,7 +4365,7 @@ restore_backup:
|| st.st_uid != st_old.st_uid
|| st.st_gid != st_old.st_gid)
{
fchown(fd, st_old.st_uid, st_old.st_gid);
ignored = fchown(fd, st_old.st_uid, st_old.st_gid);
if (perm >= 0) /* set permission again, may have changed */
(void)mch_setperm(wfname, perm);
}
@@ -6035,9 +6035,9 @@ vim_fgets(buf, size, fp)
{
tbuf[FGETS_SIZE - 2] = NUL;
#ifdef USE_CR
fgets_cr((char *)tbuf, FGETS_SIZE, fp);
ignoredp = fgets_cr((char *)tbuf, FGETS_SIZE, fp);
#else
fgets((char *)tbuf, FGETS_SIZE, fp);
ignoredp = fgets((char *)tbuf, FGETS_SIZE, fp);
#endif
} while (tbuf[FGETS_SIZE - 2] != NUL && tbuf[FGETS_SIZE - 2] != '\n');
}
+4 -4
View File
@@ -48,7 +48,7 @@ static int checkCloseRec __ARGS((garray_T *gap, linenr_T lnum, int level));
static int foldFind __ARGS((garray_T *gap, linenr_T lnum, fold_T **fpp));
static int foldLevelWin __ARGS((win_T *wp, linenr_T lnum));
static void checkupdate __ARGS((win_T *wp));
static void setFoldRepeat __ARGS((linenr_T lnum, long count, int open));
static void setFoldRepeat __ARGS((linenr_T lnum, long count, int do_open));
static linenr_T setManualFold __ARGS((linenr_T lnum, int opening, int recurse, int *donep));
static linenr_T setManualFoldWin __ARGS((win_T *wp, linenr_T lnum, int opening, int recurse, int *donep));
static void foldOpenNested __ARGS((fold_T *fpr));
@@ -1241,10 +1241,10 @@ checkupdate(wp)
* Repeat "count" times.
*/
static void
setFoldRepeat(lnum, count, open)
setFoldRepeat(lnum, count, do_open)
linenr_T lnum;
long count;
int open;
int do_open;
{
int done;
long n;
@@ -1252,7 +1252,7 @@ setFoldRepeat(lnum, count, open)
for (n = 0; n < count; ++n)
{
done = DONE_NOTHING;
(void)setManualFold(lnum, open, FALSE, &done);
(void)setManualFold(lnum, do_open, FALSE, &done);
if (!(done & DONE_ACTION))
{
/* Only give an error message when no fold could be opened. */
+2 -2
View File
@@ -4702,7 +4702,7 @@ makemap(fd, buf)
return FAIL;
if (mp->m_noremap != REMAP_YES && fprintf(fd, "nore") < 0)
return FAIL;
if (fprintf(fd, cmd) < 0)
if (fputs(cmd, fd) < 0)
return FAIL;
if (buf != NULL && fputs(" <buffer>", fd) < 0)
return FAIL;
@@ -4801,7 +4801,7 @@ put_escstr(fd, strstart, what)
}
if (IS_SPECIAL(c) || modifiers) /* special key */
{
if (fprintf(fd, (char *)get_special_key_name(c, modifiers)) < 0)
if (fputs((char *)get_special_key_name(c, modifiers), fd) < 0)
return FAIL;
continue;
}
+8
View File
@@ -1550,6 +1550,14 @@ EXTERN int xsmp_icefd INIT(= -1); /* The actual connection */
/* For undo we need to know the lowest time possible. */
EXTERN time_t starttime;
/*
* Some compilers warn for not using a return value, but in some situations we
* can't do anything useful with the value. Assign to this variable to avoid
* the warning.
*/
EXTERN int ignored;
EXTERN char *ignoredp;
/*
* Optional Farsi support. Include it here, so EXTERN and INIT are defined.
*/
+17 -13
View File
@@ -211,7 +211,7 @@ http://developer.apple.com/documentation/Darwin/Reference/ManPages/man2/fork.2.h
/* The read returns when the child closes the pipe (or when
* the child dies for some reason). */
close(pipefd[1]);
(void)read(pipefd[0], &dummy, (size_t)1);
ignored = (int)read(pipefd[0], &dummy, (size_t)1);
close(pipefd[0]);
}
@@ -3333,7 +3333,7 @@ gui_init_which_components(oldval)
i = Rows;
gui_update_tabline();
Rows = i;
need_set_size = RESIZE_VERT;
need_set_size |= RESIZE_VERT;
if (using_tabline)
fix_size = TRUE;
if (!gui_use_tabline())
@@ -3367,9 +3367,9 @@ gui_init_which_components(oldval)
if (gui.which_scrollbars[i] != prev_which_scrollbars[i])
{
if (i == SBAR_BOTTOM)
need_set_size = RESIZE_VERT;
need_set_size |= RESIZE_VERT;
else
need_set_size = RESIZE_HOR;
need_set_size |= RESIZE_HOR;
if (gui.which_scrollbars[i])
fix_size = TRUE;
}
@@ -3389,7 +3389,7 @@ gui_init_which_components(oldval)
gui_mch_enable_menu(gui.menu_is_active);
Rows = i;
prev_menu_is_active = gui.menu_is_active;
need_set_size = RESIZE_VERT;
need_set_size |= RESIZE_VERT;
if (gui.menu_is_active)
fix_size = TRUE;
}
@@ -3400,7 +3400,7 @@ gui_init_which_components(oldval)
{
gui_mch_show_toolbar(using_toolbar);
prev_toolbar = using_toolbar;
need_set_size = RESIZE_VERT;
need_set_size |= RESIZE_VERT;
if (using_toolbar)
fix_size = TRUE;
}
@@ -3410,7 +3410,7 @@ gui_init_which_components(oldval)
{
gui_mch_enable_footer(using_footer);
prev_footer = using_footer;
need_set_size = RESIZE_VERT;
need_set_size |= RESIZE_VERT;
if (using_footer)
fix_size = TRUE;
}
@@ -3422,10 +3422,11 @@ gui_init_which_components(oldval)
prev_tearoff = using_tearoff;
}
#endif
if (need_set_size)
if (need_set_size != 0)
{
#ifdef FEAT_GUI_GTK
long c = Columns;
long prev_Columns = Columns;
long prev_Rows = Rows;
#endif
/* Adjust the size of the window to make the text area keep the
* same size and to avoid that part of our window is off-screen
@@ -3441,11 +3442,14 @@ gui_init_which_components(oldval)
* If you remove this, please test this command for resizing
* effects (with optional left scrollbar): ":vsp|q|vsp|q|vsp|q".
* Don't do this while starting up though.
* And don't change Rows, it may have be reduced intentionally
* when adding menu/toolbar/tabline. */
if (!gui.starting)
* Don't change Rows when adding menu/toolbar/tabline.
* Don't change Columns when adding vertical toolbar. */
if (!gui.starting && need_set_size != (RESIZE_VERT | RESIZE_HOR))
(void)char_avail();
Columns = c;
if ((need_set_size & RESIZE_VERT) == 0)
Rows = prev_Rows;
if ((need_set_size & RESIZE_HOR) == 0)
Columns = prev_Columns;
#endif
}
#ifdef FEAT_WINDOWS
+6 -1
View File
@@ -235,7 +235,12 @@ typedef long guicolor_T; /* handle for a GUI color; for X11 this should
displays there is a tiny chance this is an
actual color */
#ifdef FEAT_GUI_GTK
#if defined(FEAT_GUI_MACVIM)
typedef void *GuiFont;
typedef void *GuiFontset;
# define NOFONT (GuiFont)NULL
# define NOFONTSET (GuiFontset)NULL
#elif defined(FEAT_GUI_GTK)
# ifdef HAVE_GTK2
typedef PangoFontDescription *GuiFont; /* handle for a GUI font */
typedef PangoFontDescription *GuiFontset; /* handle for a GUI fontset */
+8 -1
View File
@@ -1078,6 +1078,12 @@ NotifyThumb(w, event, params, num_params)
Cardinal *num_params; /* unused */
{
ScrollbarWidget sbw = (ScrollbarWidget)w;
/* Use a union to avoid a warning for the weird conversion from float to
* XtPointer. Comes from Xaw/Scrollbar.c. */
union {
XtPointer xtp;
float xtf;
} xtpf;
if (LookAhead(w, event))
return;
@@ -1085,7 +1091,8 @@ NotifyThumb(w, event, params, num_params)
/* thumbProc is not pretty, but is necessary for backwards
compatibility on those architectures for which it work{s,ed};
the intent is to pass a (truncated) float by value. */
XtCallCallbacks(w, XtNthumbProc, *(XtPointer*)&sbw->scrollbar.top);
xtpf.xtf = sbw->scrollbar.top;
XtCallCallbacks(w, XtNthumbProc, xtpf.xtp);
XtCallCallbacks(w, XtNjumpProc, (XtPointer)&sbw->scrollbar.top);
}
+6 -6
View File
@@ -4070,14 +4070,14 @@ gui_mch_open(void)
if (mask & (XValue | YValue))
{
int w, h;
gui_mch_get_screen_dimensions(&w, &h);
h += p_ghr + get_menu_tool_height();
w += get_menu_tool_width();
int ww, hh;
gui_mch_get_screen_dimensions(&ww, &hh);
hh += p_ghr + get_menu_tool_height();
ww += get_menu_tool_width();
if (mask & XNegative)
x += w - pixel_width;
x += ww - pixel_width;
if (mask & YNegative)
y += h - pixel_height;
y += hh - pixel_height;
#ifdef HAVE_GTK2
gtk_window_move(GTK_WINDOW(gui.mainwin), x, y);
#else
+1 -1
View File
@@ -4966,7 +4966,7 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx)
char_u *p_actext;
p_actext = menu->actext;
key = find_special_key(&p_actext, &modifiers, /*keycode=*/0);
key = find_special_key(&p_actext, &modifiers, FALSE, FALSE);
if (*p_actext != 0)
key = 0; /* error: trailing text */
/* find_special_key() returns a keycode with as many of the
+5
View File
@@ -1937,6 +1937,11 @@ gui_mch_wait_for_chars(int wtime)
s_need_activate = FALSE;
}
#ifdef FEAT_NETBEANS_INTG
/* Process the queued netbeans messages. */
netbeans_parse_messages();
#endif
/*
* Don't use gui_mch_update() because then we will spin-lock until a
* char arrives, instead we use GetMessage() to hang until an
+38 -38
View File
@@ -369,10 +369,10 @@ fill_lists(enum ListSpecifier fix, SharedFontSelData *data)
char buf[TEMP_BUF_SIZE];
XmString items[MAX_ENTRIES_IN_LIST];
int i;
int index;
int idx;
for (index = (int)ENCODING; index < (int)NONE; ++index)
count[index] = 0;
for (idx = (int)ENCODING; idx < (int)NONE; ++idx)
count[idx] = 0;
/* First we insert the wild char into every single list. */
if (fix != ENCODING)
@@ -503,14 +503,14 @@ fill_lists(enum ListSpecifier fix, SharedFontSelData *data)
/*
* Now loop trough the remaining lists and set them up.
*/
for (index = (int)NAME; index < (int)NONE; ++index)
for (idx = (int)NAME; idx < (int)NONE; ++idx)
{
Widget w;
if (fix == (enum ListSpecifier)index)
if (fix == (enum ListSpecifier)idx)
continue;
switch ((enum ListSpecifier)index)
switch ((enum ListSpecifier)idx)
{
case NAME:
w = data->list[NAME];
@@ -525,21 +525,21 @@ fill_lists(enum ListSpecifier fix, SharedFontSelData *data)
w = (Widget)0; /* for lint */
}
for (i = 0; i < count[index]; ++i)
for (i = 0; i < count[idx]; ++i)
{
items[i] = XmStringCreateLocalized(list[index][i]);
XtFree(list[index][i]);
items[i] = XmStringCreateLocalized(list[idx][i]);
XtFree(list[idx][i]);
}
XmListDeleteAllItems(w);
XmListAddItems(w, items, count[index], 1);
if (data->sel[index])
XmListAddItems(w, items, count[idx], 1);
if (data->sel[idx])
{
XmStringFree(items[0]);
items[0] = XmStringCreateLocalized(data->sel[index]);
items[0] = XmStringCreateLocalized(data->sel[idx]);
XmListSelectItem(w, items[0], False);
XmListSetBottomItem(w, items[0]);
}
for (i = 0; i < count[index]; ++i)
for (i = 0; i < count[idx]; ++i)
XmStringFree(items[i]);
}
}
@@ -695,14 +695,14 @@ do_choice(Widget w,
int n;
XmString str;
Arg args[4];
char *msg = _("no specific match");
char *nomatch_msg = _("no specific match");
n = 0;
str = XmStringCreateLocalized(msg);
str = XmStringCreateLocalized(nomatch_msg);
XtSetArg(args[n], XmNlabelString, str); ++n;
XtSetValues(data->sample, args, n);
apply_fontlist(data->sample);
XmTextSetString(data->name, msg);
XmTextSetString(data->name, nomatch_msg);
XmStringFree(str);
return False;
@@ -886,21 +886,21 @@ gui_xm_select_font(char_u *current)
{
int i;
int max;
int index = 0;
int idx = 0;
int size;
char str[128];
char buf[128];
for (i = 0, max = 0; i < data->num; i++)
{
get_part(fn(data, i), 7, str);
size = atoi(str);
get_part(fn(data, i), 7, buf);
size = atoi(buf);
if ((size > max) && (size < MAX_DISPLAY_SIZE))
{
index = i;
idx = i;
max = size;
}
}
strcpy(big_font, fn(data, index));
strcpy(big_font, fn(data, idx));
}
data->old = XLoadQueryFont(XtDisplay(parent), big_font);
data->old_list = gui_motif_create_fontlist(data->old);
@@ -1217,28 +1217,28 @@ gui_xm_select_font(char_u *current)
if (i != 0)
{
char name[TEMP_BUF_SIZE];
char style[TEMP_BUF_SIZE];
char size[TEMP_BUF_SIZE];
char encoding[TEMP_BUF_SIZE];
char namebuf[TEMP_BUF_SIZE];
char stylebuf[TEMP_BUF_SIZE];
char sizebuf[TEMP_BUF_SIZE];
char encodingbuf[TEMP_BUF_SIZE];
char *found;
found = names[0];
name_part(found, name);
style_part(found, style);
size_part(found, size, data->in_pixels);
encoding_part(found, encoding);
name_part(found, namebuf);
style_part(found, stylebuf);
size_part(found, sizebuf, data->in_pixels);
encoding_part(found, encodingbuf);
if (strlen(name) > 0
&& strlen(style) > 0
&& strlen(size) > 0
&& strlen(encoding) > 0)
if (strlen(namebuf) > 0
&& strlen(stylebuf) > 0
&& strlen(sizebuf) > 0
&& strlen(encodingbuf) > 0)
{
data->sel[NAME] = XtNewString(name);
data->sel[STYLE] = XtNewString(style);
data->sel[SIZE] = XtNewString(size);
data->sel[ENCODING] = XtNewString(encoding);
data->sel[NAME] = XtNewString(namebuf);
data->sel[STYLE] = XtNewString(stylebuf);
data->sel[SIZE] = XtNewString(sizebuf);
data->sel[ENCODING] = XtNewString(encodingbuf);
data->font_name = XtNewString(names[0]);
display_sample(data);
XmTextSetString(data->name, data->font_name);
+3 -4
View File
@@ -1256,7 +1256,7 @@ Redisplay(Widget w, XEvent *event, Region region)
}
else
{
int adjust = 0;
adjust = 0;
#if !defined(LESSTIF_VERSION) && (XmVersion > 1002)
/*
@@ -1268,12 +1268,11 @@ Redisplay(Widget w, XEvent *event, Region region)
{
case XmEXTERNAL_HIGHLIGHT:
adjust = (eb->primitive.highlight_thickness -
(eb->pushbutton.default_button_shadow_thickness ?
Xm3D_ENHANCE_PIXEL : 0));
(eb->pushbutton.default_button_shadow_thickness
? Xm3D_ENHANCE_PIXEL : 0));
break;
case XmINTERNAL_HIGHLIGHT:
adjust = 0;
break;
default:
+4 -4
View File
@@ -166,7 +166,7 @@ EXTERN_C void boot_DynaLoader __ARGS((pTHX_ CV*));
# define Perl_Isv_yes_ptr dll_Perl_Isv_yes_ptr
# define boot_DynaLoader dll_boot_DynaLoader
# define Perl_sys_init3 dll_Perl_sys_init3
# define Perl_sys_init dll_Perl_sys_init
# define Perl_sys_term dll_Perl_sys_term
# define Perl_ISv_ptr dll_Perl_ISv_ptr
# define Perl_Istack_max_ptr dll_Perl_Istack_max_ptr
@@ -272,7 +272,7 @@ static void (*boot_DynaLoader)_((pTHX_ CV*));
#if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
static void (*Perl_sv_free2)(pTHX_ SV*);
static void (*Perl_sys_init3)(int* argc, char*** argv, char*** env);
static void (*Perl_sys_init)(int* argc, char*** argv);
static void (*Perl_sys_term)(void);
static SV** (*Perl_ISv_ptr)(register PerlInterpreter*);
static SV*** (*Perl_Istack_max_ptr)(register PerlInterpreter*);
@@ -372,7 +372,7 @@ static struct {
{"Perl_Tna_ptr", (PERL_PROC*)&Perl_Tna_ptr},
#else
{"Perl_sv_free2", (PERL_PROC*)&Perl_sv_free2},
{"Perl_sys_init3", (PERL_PROC*)&Perl_sys_init3},
{"Perl_sys_init", (PERL_PROC*)&Perl_sys_init},
{"Perl_sys_term", (PERL_PROC*)&Perl_sys_term},
{"Perl_ISv_ptr", (PERL_PROC*)&Perl_ISv_ptr},
{"Perl_Istack_sp_ptr", (PERL_PROC*)&Perl_Istack_sp_ptr},
@@ -460,7 +460,7 @@ perl_init()
static char *argv[] = { "", "-e", "" };
#if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
Perl_sys_init3(&argc, (char***)&argv, NULL);
Perl_sys_init(&argc, (char***)&argv);
#endif
perl_interp = perl_alloc();
perl_construct(perl_interp);
+4 -4
View File
@@ -2,8 +2,6 @@
*
* if_sniff.c Interface between Vim and SNiFF+
*
* $Id$
*
* See README.txt for an overview of the Vim source code.
*/
@@ -716,8 +714,10 @@ ConnectToSniffEmacs()
#else /* UNIX Version of the Code */
int ToSniffEmacs[2], FromSniffEmacs[2];
pipe(ToSniffEmacs);
pipe(FromSniffEmacs);
if (pipe(ToSniffEmacs) != 0)
return 1;
if (pipe(FromSniffEmacs) != 0)
return 1;
/* fork */
if ((sniffemacs_pid=fork()) == 0)
+5 -1
View File
@@ -721,6 +721,10 @@ main
qnx_clip_init();
#endif
#if defined(FEAT_GUI_MACVIM) && defined(FEAT_CLIPBOARD)
clip_init(TRUE);
#endif
#ifdef FEAT_XCLIPBOARD
/* Start using the X clipboard, unless the GUI was started. */
# ifdef FEAT_GUI
@@ -2454,7 +2458,7 @@ read_stdin()
* Is there any other system that cannot do this?
*/
close(0);
dup(2);
ignored = dup(2);
#endif
}
+5 -5
View File
@@ -717,7 +717,7 @@ codepage_invalid:
* where mblen() returns 0 for invalid character.
* Therefore, following condition includes 0.
*/
(void)mblen(NULL, 0); /* First reset the state. */
ignored = mblen(NULL, 0); /* First reset the state. */
if (mblen(buf, (size_t)1) <= 0)
n = 2;
else
@@ -5278,7 +5278,7 @@ xim_decide_input_style()
/*ARGSUSED*/
static void
preedit_start_cbproc(XIC xic, XPointer client_data, XPointer call_data)
preedit_start_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
{
#ifdef XIM_DEBUG
xim_log("xim_decide_input_style()\n");
@@ -5312,7 +5312,7 @@ static gboolean processing_queued_event = FALSE;
/*ARGSUSED*/
static void
preedit_draw_cbproc(XIC xic, XPointer client_data, XPointer call_data)
preedit_draw_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
{
XIMPreeditDrawCallbackStruct *draw_data;
XIMText *text;
@@ -5453,7 +5453,7 @@ im_get_feedback_attr(int col)
/*ARGSUSED*/
static void
preedit_caret_cbproc(XIC xic, XPointer client_data, XPointer call_data)
preedit_caret_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
{
#ifdef XIM_DEBUG
xim_log("preedit_caret_cbproc()\n");
@@ -5462,7 +5462,7 @@ preedit_caret_cbproc(XIC xic, XPointer client_data, XPointer call_data)
/*ARGSUSED*/
static void
preedit_done_cbproc(XIC xic, XPointer client_data, XPointer call_data)
preedit_done_cbproc(XIC thexic, XPointer client_data, XPointer call_data)
{
#ifdef XIM_DEBUG
xim_log("preedit_done_cbproc()\n");
+22 -21
View File
@@ -4585,61 +4585,62 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
if (remove_trailing_zeroes)
{
int i;
char *p;
char *tp;
/* Using %g or %G: remove superfluous zeroes. */
if (fmt_spec == 'f')
p = tmp + str_arg_l - 1;
tp = tmp + str_arg_l - 1;
else
{
p = (char *)vim_strchr((char_u *)tmp,
tp = (char *)vim_strchr((char_u *)tmp,
fmt_spec == 'e' ? 'e' : 'E');
if (p != NULL)
if (tp != NULL)
{
/* Remove superfluous '+' and leading
* zeroes from the exponent. */
if (p[1] == '+')
if (tp[1] == '+')
{
/* Change "1.0e+07" to "1.0e07" */
STRMOVE(p + 1, p + 2);
STRMOVE(tp + 1, tp + 2);
--str_arg_l;
}
i = (p[1] == '-') ? 2 : 1;
while (p[i] == '0')
i = (tp[1] == '-') ? 2 : 1;
while (tp[i] == '0')
{
/* Change "1.0e07" to "1.0e7" */
STRMOVE(p + i, p + i + 1);
STRMOVE(tp + i, tp + i + 1);
--str_arg_l;
}
--p;
--tp;
}
}
if (p != NULL && !precision_specified)
if (tp != NULL && !precision_specified)
/* Remove trailing zeroes, but keep the one
* just after a dot. */
while (p > tmp + 2 && *p == '0' && p[-1] != '.')
while (tp > tmp + 2 && *tp == '0'
&& tp[-1] != '.')
{
STRMOVE(p, p + 1);
--p;
STRMOVE(tp, tp + 1);
--tp;
--str_arg_l;
}
}
else
{
char *p;
char *tp;
/* Be consistent: some printf("%e") use 1.0e+12
* and some 1.0e+012. Remove one zero in the last
* case. */
p = (char *)vim_strchr((char_u *)tmp,
tp = (char *)vim_strchr((char_u *)tmp,
fmt_spec == 'e' ? 'e' : 'E');
if (p != NULL && (p[1] == '+' || p[1] == '-')
&& p[2] == '0'
&& vim_isdigit(p[3])
&& vim_isdigit(p[4]))
if (tp != NULL && (tp[1] == '+' || tp[1] == '-')
&& tp[2] == '0'
&& vim_isdigit(tp[3])
&& vim_isdigit(tp[4]))
{
STRMOVE(p + 2, p + 3);
STRMOVE(tp + 2, tp + 3);
--str_arg_l;
}
}
+6 -4
View File
@@ -2561,7 +2561,7 @@ trans_special(srcp, dst, keycode)
int key;
int dlen = 0;
key = find_special_key(srcp, &modifiers, keycode);
key = find_special_key(srcp, &modifiers, keycode, FALSE);
if (key == 0)
return 0;
@@ -2597,10 +2597,11 @@ trans_special(srcp, dst, keycode)
* returns 0 if there is no match.
*/
int
find_special_key(srcp, modp, keycode)
find_special_key(srcp, modp, keycode, keep_x_key)
char_u **srcp;
int *modp;
int keycode; /* prefer key code, e.g. K_DEL instead of DEL */
int keycode; /* prefer key code, e.g. K_DEL instead of DEL */
int keep_x_key; /* don't translate xHome to Home key */
{
char_u *last_dash;
char_u *end_of_name;
@@ -2668,7 +2669,8 @@ find_special_key(srcp, modp, keycode)
else
{
key = get_special_key_code(last_dash + 1);
key = handle_x_keys(key);
if (!keep_x_key)
key = handle_x_keys(key);
}
/*
+8 -11
View File
@@ -769,11 +769,14 @@ messageFromNetbeans(gpointer clientData, gint unused1,
return; /* don't try to parse it */
}
#ifdef FEAT_GUI_GTK
#if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_W32)
/* Let the main loop handle messages. */
# ifdef FEAT_GUI_GTK
if (gtk_main_level() > 0)
gtk_main_quit();
# endif
#else
/* Parse the messages, but avoid recursion. */
/* Parse the messages now, but avoid recursion. */
if (level == 1)
netbeans_parse_messages();
@@ -1043,7 +1046,7 @@ netbeans_end(void)
nbdebug(("EVT: %s", buf));
/* nb_send(buf, "netbeans_end"); avoid "write failed" messages */
if (sd >= 0)
sock_write(sd, buf, (int)STRLEN(buf)); /* ignore errors */
ignored = sock_write(sd, buf, (int)STRLEN(buf));
}
}
@@ -2277,9 +2280,6 @@ nb_do_cmd(
int serNum;
int localTypeNum;
int typeNum;
# ifdef NBDEBUG
int len;
# endif
pos_T *pos;
if (buf == NULL || buf->bufp == NULL)
@@ -2303,13 +2303,10 @@ nb_do_cmd(
pos = get_off_or_lnum(buf->bufp, &args);
cp = (char *)args;
# ifdef NBDEBUG
len =
# endif
strtol(cp, &cp, 10);
ignored = (int)strtol(cp, &cp, 10);
args = (char_u *)cp;
# ifdef NBDEBUG
if (len != -1)
if (ignored != -1)
{
nbdebug((" partial line annotation -- Not Yet Implemented!\n"));
}
+9
View File
@@ -5167,11 +5167,20 @@ handle_tabmenu()
{
case TABLINE_MENU_CLOSE:
if (current_tab == 0)
#ifdef FEAT_GUI_MACVIM
do_cmdline_cmd((char_u *)"conf tabclose");
#else
do_cmdline_cmd((char_u *)"tabclose");
#endif
else
{
#ifdef FEAT_GUI_MACVIM
vim_snprintf((char *)IObuff, IOSIZE, "conf tabclose %d",
current_tab);
#else
vim_snprintf((char *)IObuff, IOSIZE, "tabclose %d",
current_tab);
#endif
do_cmdline_cmd(IObuff);
}
break;
+5 -2
View File
@@ -2209,12 +2209,15 @@ op_tilde(oap)
{
for (; pos.lnum <= oap->end.lnum; ++pos.lnum)
{
int one_change;
block_prep(oap, &bd, pos.lnum, FALSE);
pos.col = bd.textcol;
did_change = swapchars(oap->op_type, &pos, bd.textlen);
one_change = swapchars(oap->op_type, &pos, bd.textlen);
did_change |= one_change;
# ifdef FEAT_NETBEANS_INTG
if (usingNetbeans && did_change)
if (usingNetbeans && one_change)
{
char_u *ptr = ml_get_buf(curbuf, pos.lnum, FALSE);
+5 -5
View File
@@ -1389,7 +1389,7 @@ static struct vimoption
#else
(char_u *)NULL, PV_NONE,
#endif
#ifdef __sgi
#if defined(__sgi) || defined(FEAT_GUI_MACVIM)
{(char_u *)TRUE, (char_u *)0L}
#else
{(char_u *)FALSE, (char_u *)0L}
@@ -8360,13 +8360,13 @@ set_option_value(name, number, string, opt_flags)
{
if (number == 0 && string != NULL)
{
int index;
int idx;
/* Either we are given a string or we are setting option
* to zero. */
for (index = 0; string[index] == '0'; ++index)
for (idx = 0; string[idx] == '0'; ++idx)
;
if (string[index] != NUL || index == 0)
if (string[idx] != NUL || idx == 0)
{
/* There's another character after zeros or the string
* is empty. In both cases, we are trying to set a
@@ -8456,7 +8456,7 @@ find_key_option(arg)
{
--arg; /* put arg at the '<' */
modifiers = 0;
key = find_special_key(&arg, &modifiers, TRUE);
key = find_special_key(&arg, &modifiers, TRUE, TRUE);
if (modifiers) /* can't handle modifiers here */
key = 0;
}
+21 -11
View File
@@ -315,12 +315,15 @@ static struct signalinfo
{-1, "Unknown!", FALSE}
};
/*
* Write s[len] to the screen.
*/
void
mch_write(s, len)
char_u *s;
int len;
{
write(1, (char *)s, len);
ignored = (int)write(1, (char *)s, len);
if (p_wd) /* Unix is too fast, slow down a bit more */
RealWaitForChar(read_cmd_fd, p_wd, NULL);
}
@@ -3929,9 +3932,9 @@ mch_call_shell(cmd, options)
*/
if (fd >= 0)
{
dup(fd); /* To replace stdin (file descriptor 0) */
dup(fd); /* To replace stdout (file descriptor 1) */
dup(fd); /* To replace stderr (file descriptor 2) */
ignored = dup(fd); /* To replace stdin (fd 0) */
ignored = dup(fd); /* To replace stdout (fd 1) */
ignored = dup(fd); /* To replace stderr (fd 2) */
/* Don't need this now that we've duplicated it */
close(fd);
@@ -3999,13 +4002,13 @@ mch_call_shell(cmd, options)
/* set up stdin/stdout/stderr for the child */
close(0);
dup(pty_slave_fd);
ignored = dup(pty_slave_fd);
close(1);
dup(pty_slave_fd);
ignored = dup(pty_slave_fd);
if (gui.in_use)
{
close(2);
dup(pty_slave_fd);
ignored = dup(pty_slave_fd);
}
close(pty_slave_fd); /* has been dupped, close it now */
@@ -4016,13 +4019,13 @@ mch_call_shell(cmd, options)
/* set up stdin for the child */
close(fd_toshell[1]);
close(0);
dup(fd_toshell[0]);
ignored = dup(fd_toshell[0]);
close(fd_toshell[0]);
/* set up stdout for the child */
close(fd_fromshell[0]);
close(1);
dup(fd_fromshell[1]);
ignored = dup(fd_fromshell[1]);
close(fd_fromshell[1]);
# ifdef FEAT_GUI
@@ -4030,7 +4033,7 @@ mch_call_shell(cmd, options)
{
/* set up stderr for the child */
close(2);
dup(1);
ignored = dup(1);
}
# endif
}
@@ -4161,7 +4164,8 @@ mch_call_shell(cmd, options)
&& (lnum !=
curbuf->b_ml.ml_line_count
|| curbuf->b_p_eol)))
write(toshell_fd, "\n", (size_t)1);
ignored = write(toshell_fd, "\n",
(size_t)1);
++lnum;
if (lnum > curbuf->b_op_end.lnum)
{
@@ -4430,6 +4434,12 @@ mch_call_shell(cmd, options)
windgoto(msg_row, msg_col);
cursor_on();
out_flush();
# if FEAT_GUI_MACVIM
if (gui.in_use) {
fast_breakcheck();
gui_macvim_flush();
}
# endif
if (got_int)
break;
}
+1 -1
View File
@@ -31,7 +31,7 @@ char_u *addstar __ARGS((char_u *fname, int len, int context));
void set_cmd_context __ARGS((expand_T *xp, char_u *str, int len, int col));
int expand_cmdline __ARGS((expand_T *xp, char_u *str, int col, int *matchcount, char_u ***matches));
int ExpandGeneric __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file, char_u *((*func)(expand_T *, int))));
char_u *globpath __ARGS((char_u *path, char_u *file));
char_u *globpath __ARGS((char_u *path, char_u *file, int expand_options));
void init_history __ARGS((void));
int get_histtype __ARGS((char_u *name));
void add_to_history __ARGS((int histype, char_u *new_entry, int in_map, int sep));
+2
View File
@@ -14,6 +14,8 @@ gui_mch_update(void);
void
gui_mch_flush(void);
void
gui_macvim_flush(void);
void
gui_macvim_force_flush(void);
int
gui_mch_wait_for_chars(int wtime);
+1 -1
View File
@@ -59,7 +59,7 @@ int simplify_key __ARGS((int key, int *modifiers));
int handle_x_keys __ARGS((int key));
char_u *get_special_key_name __ARGS((int c, int modifiers));
int trans_special __ARGS((char_u **srcp, char_u *dst, int keycode));
int find_special_key __ARGS((char_u **srcp, int *modp, int keycode));
int find_special_key __ARGS((char_u **srcp, int *modp, int keycode, int keep_x_key));
int extract_modifiers __ARGS((int key, int *modp));
int find_special_key_in_table __ARGS((int c));
int get_special_key_code __ARGS((char_u *name));
+290 -87
View File
@@ -469,6 +469,7 @@ struct slang_S
garray_T sl_comppat; /* CHECKCOMPOUNDPATTERN items */
regprog_T *sl_compprog; /* COMPOUNDRULE turned into a regexp progrm
* (NULL when no compounding) */
char_u *sl_comprules; /* all COMPOUNDRULE concatenated (or NULL) */
char_u *sl_compstartflags; /* flags for first compound word */
char_u *sl_compallflags; /* all flags for compound words */
char_u sl_nobreak; /* When TRUE: no spaces between words */
@@ -839,7 +840,10 @@ static void slang_free __ARGS((slang_T *lp));
static void slang_clear __ARGS((slang_T *lp));
static void slang_clear_sug __ARGS((slang_T *lp));
static void find_word __ARGS((matchinf_T *mip, int mode));
static int match_checkcompoundpattern __ARGS((char_u *ptr, int wlen, garray_T *gap));
static int can_compound __ARGS((slang_T *slang, char_u *word, char_u *flags));
static int can_be_compound __ARGS((trystate_T *sp, slang_T *slang, char_u *compflags, int flag));
static int match_compoundrule __ARGS((slang_T *slang, char_u *compflags));
static int valid_word_prefix __ARGS((int totprefcnt, int arridx, int flags, char_u *word, slang_T *slang, int cond_req));
static void find_prefix __ARGS((matchinf_T *mip, int mode));
static int fold_more __ARGS((matchinf_T *mip));
@@ -1519,6 +1523,11 @@ find_word(mip, mode)
((unsigned)flags >> 24)))
continue;
/* If there is a match with a CHECKCOMPOUNDPATTERN rule
* discard the compound word. */
if (match_checkcompoundpattern(ptr, wlen, &slang->sl_comppat))
continue;
if (mode == FIND_COMPOUND)
{
int capflags;
@@ -1577,6 +1586,11 @@ find_word(mip, mode)
if (!can_compound(slang, fword, mip->mi_compflags))
continue;
}
else if (slang->sl_comprules != NULL
&& !match_compoundrule(slang, mip->mi_compflags))
/* The compound flags collected so far do not match any
* COMPOUNDRULE, discard the compounded word. */
continue;
}
/* Check NEEDCOMPOUND: can't use word without compounding. */
@@ -1726,6 +1740,39 @@ find_word(mip, mode)
}
}
/*
* Return TRUE if there is a match between the word ptr[wlen] and
* CHECKCOMPOUNDPATTERN rules, assuming that we will concatenate with another
* word.
* A match means that the first part of CHECKCOMPOUNDPATTERN matches at the
* end of ptr[wlen] and the second part matches after it.
*/
static int
match_checkcompoundpattern(ptr, wlen, gap)
char_u *ptr;
int wlen;
garray_T *gap; /* &sl_comppat */
{
int i;
char_u *p;
int len;
for (i = 0; i + 1 < gap->ga_len; i += 2)
{
p = ((char_u **)gap->ga_data)[i + 1];
if (STRNCMP(ptr + wlen, p, STRLEN(p)) == 0)
{
/* Second part matches at start of following compound word, now
* check if first part matches at end of previous word. */
p = ((char_u **)gap->ga_data)[i];
len = (int)STRLEN(p);
if (len <= wlen && STRNCMP(ptr + wlen - len, p, len) == 0)
return TRUE;
}
}
return FALSE;
}
/*
* Return TRUE if "flags" is a valid sequence of compound flags and "word"
* does not have too many syllables.
@@ -1772,6 +1819,98 @@ can_compound(slang, word, flags)
return TRUE;
}
/*
* Return TRUE when the sequence of flags in "compflags" plus "flag" can
* possibly form a valid compounded word. This also checks the COMPOUNDRULE
* lines if they don't contain wildcards.
*/
static int
can_be_compound(sp, slang, compflags, flag)
trystate_T *sp;
slang_T *slang;
char_u *compflags;
int flag;
{
/* If the flag doesn't appear in sl_compstartflags or sl_compallflags
* then it can't possibly compound. */
if (!byte_in_str(sp->ts_complen == sp->ts_compsplit
? slang->sl_compstartflags : slang->sl_compallflags, flag))
return FALSE;
/* If there are no wildcards, we can check if the flags collected so far
* possibly can form a match with COMPOUNDRULE patterns. This only
* makes sense when we have two or more words. */
if (slang->sl_comprules != NULL && sp->ts_complen > sp->ts_compsplit)
{
int v;
compflags[sp->ts_complen] = flag;
compflags[sp->ts_complen + 1] = NUL;
v = match_compoundrule(slang, compflags + sp->ts_compsplit);
compflags[sp->ts_complen] = NUL;
return v;
}
return TRUE;
}
/*
* Return TRUE if the compound flags in compflags[] match the start of any
* compound rule. This is used to stop trying a compound if the flags
* collected so far can't possibly match any compound rule.
* Caller must check that slang->sl_comprules is not NULL.
*/
static int
match_compoundrule(slang, compflags)
slang_T *slang;
char_u *compflags;
{
char_u *p;
int i;
int c;
/* loop over all the COMPOUNDRULE entries */
for (p = slang->sl_comprules; *p != NUL; ++p)
{
/* loop over the flags in the compound word we have made, match
* them against the current rule entry */
for (i = 0; ; ++i)
{
c = compflags[i];
if (c == NUL)
/* found a rule that matches for the flags we have so far */
return TRUE;
if (*p == '/' || *p == NUL)
break; /* end of rule, it's too short */
if (*p == '[')
{
int match = FALSE;
/* compare against all the flags in [] */
++p;
while (*p != ']' && *p != NUL)
if (*p++ == c)
match = TRUE;
if (!match)
break; /* none matches */
}
else if (*p != c)
break; /* flag of word doesn't match flag in pattern */
++p;
}
/* Skip to the next "/", where the next pattern starts. */
p = vim_strchr(p, '/');
if (p == NULL)
break;
}
/* Checked all the rules and none of them match the flags, so there
* can't possibly be a compound starting with these flags. */
return FALSE;
}
/*
* Return non-zero if the prefix indicated by "arridx" matches with the prefix
* ID in "flags" for the word "word".
@@ -2513,9 +2652,11 @@ slang_clear(lp)
lp->sl_midword = NULL;
vim_free(lp->sl_compprog);
vim_free(lp->sl_comprules);
vim_free(lp->sl_compstartflags);
vim_free(lp->sl_compallflags);
lp->sl_compprog = NULL;
lp->sl_comprules = NULL;
lp->sl_compstartflags = NULL;
lp->sl_compallflags = NULL;
@@ -3460,6 +3601,7 @@ read_compound(fd, slang, len)
char_u *pp;
char_u *cp;
char_u *ap;
char_u *crp;
int cnt;
garray_T *gap;
@@ -3545,6 +3687,12 @@ read_compound(fd, slang, len)
slang->sl_compallflags = ap;
*ap = NUL;
/* And a list of all patterns in their original form, for checking whether
* compounding may work in match_compoundrule(). This is freed when we
* encounter a wildcard, the check doesn't work then. */
crp = alloc(todo + 1);
slang->sl_comprules = crp;
pp = pat;
*pp++ = '^';
*pp++ = '\\';
@@ -3587,6 +3735,20 @@ read_compound(fd, slang, len)
atstart = 0;
}
}
/* Copy flag to "sl_comprules", unless we run into a wildcard. */
if (crp != NULL)
{
if (c == '+' || c == '*')
{
vim_free(slang->sl_comprules);
slang->sl_comprules = NULL;
crp = NULL;
}
else
*crp++ = c;
}
if (c == '/') /* slash separates two items */
{
*pp++ = '\\';
@@ -3611,6 +3773,9 @@ read_compound(fd, slang, len)
*pp++ = '$';
*pp = NUL;
if (crp != NULL)
*crp = NUL;
slang->sl_compprog = vim_regcomp(pat, RE_MAGIC + RE_STRING + RE_STRICT);
vim_free(pat);
if (slang->sl_compprog == NULL)
@@ -4915,6 +5080,7 @@ typedef struct spellinfo_S
} spellinfo_T;
static afffile_T *spell_read_aff __ARGS((spellinfo_T *spin, char_u *fname));
static int is_aff_rule __ARGS((char_u **items, int itemcnt, char *rulename, int mincount));
static void aff_process_flags __ARGS((afffile_T *affile, affentry_T *entry));
static int spell_info_item __ARGS((char_u *s));
static unsigned affitem2flag __ARGS((int flagtype, char_u *item, char_u *fname, int lnum));
@@ -4950,7 +5116,7 @@ static int node_equal __ARGS((wordnode_T *n1, wordnode_T *n2));
static void put_sugtime __ARGS((spellinfo_T *spin, FILE *fd));
static int write_vim_spell __ARGS((spellinfo_T *spin, char_u *fname));
static void clear_node __ARGS((wordnode_T *node));
static int put_node __ARGS((FILE *fd, wordnode_T *node, int index, int regionmask, int prefixtree));
static int put_node __ARGS((FILE *fd, wordnode_T *node, int idx, int regionmask, int prefixtree));
static void spell_make_sugfile __ARGS((spellinfo_T *spin, char_u *wfname));
static int sug_filltree __ARGS((spellinfo_T *spin, slang_T *slang));
static int sug_maketable __ARGS((spellinfo_T *spin));
@@ -5223,8 +5389,7 @@ spell_read_aff(spin, fname)
/* Handle non-empty lines. */
if (itemcnt > 0)
{
if (STRCMP(items[0], "SET") == 0 && itemcnt == 2
&& aff->af_enc == NULL)
if (is_aff_rule(items, itemcnt, "SET", 2) && aff->af_enc == NULL)
{
#ifdef FEAT_MBYTE
/* Setup for conversion from "ENC" to 'encoding'. */
@@ -5239,7 +5404,7 @@ spell_read_aff(spin, fname)
smsg((char_u *)_("Conversion in %s not supported"), fname);
#endif
}
else if (STRCMP(items[0], "FLAG") == 0 && itemcnt == 2
else if (is_aff_rule(items, itemcnt, "FLAG", 2)
&& aff->af_flagtype == AFT_CHAR)
{
if (STRCMP(items[1], "long") == 0)
@@ -5284,69 +5449,71 @@ spell_read_aff(spin, fname)
spin->si_info = p;
}
}
else if (STRCMP(items[0], "MIDWORD") == 0 && itemcnt == 2
else if (is_aff_rule(items, itemcnt, "MIDWORD", 2)
&& midword == NULL)
{
midword = getroom_save(spin, items[1]);
}
else if (STRCMP(items[0], "TRY") == 0 && itemcnt == 2)
else if (is_aff_rule(items, itemcnt, "TRY", 2))
{
/* ignored, we look in the tree for what chars may appear */
}
/* TODO: remove "RAR" later */
else if ((STRCMP(items[0], "RAR") == 0
|| STRCMP(items[0], "RARE") == 0) && itemcnt == 2
&& aff->af_rare == 0)
else if ((is_aff_rule(items, itemcnt, "RAR", 2)
|| is_aff_rule(items, itemcnt, "RARE", 2))
&& aff->af_rare == 0)
{
aff->af_rare = affitem2flag(aff->af_flagtype, items[1],
fname, lnum);
}
/* TODO: remove "KEP" later */
else if ((STRCMP(items[0], "KEP") == 0
|| STRCMP(items[0], "KEEPCASE") == 0) && itemcnt == 2
else if ((is_aff_rule(items, itemcnt, "KEP", 2)
|| is_aff_rule(items, itemcnt, "KEEPCASE", 2))
&& aff->af_keepcase == 0)
{
aff->af_keepcase = affitem2flag(aff->af_flagtype, items[1],
fname, lnum);
}
else if (STRCMP(items[0], "BAD") == 0 && itemcnt == 2
&& aff->af_bad == 0)
else if ((is_aff_rule(items, itemcnt, "BAD", 2)
|| is_aff_rule(items, itemcnt, "FORBIDDENWORD", 2))
&& aff->af_bad == 0)
{
aff->af_bad = affitem2flag(aff->af_flagtype, items[1],
fname, lnum);
}
else if (STRCMP(items[0], "NEEDAFFIX") == 0 && itemcnt == 2
else if (is_aff_rule(items, itemcnt, "NEEDAFFIX", 2)
&& aff->af_needaffix == 0)
{
aff->af_needaffix = affitem2flag(aff->af_flagtype, items[1],
fname, lnum);
}
else if (STRCMP(items[0], "CIRCUMFIX") == 0 && itemcnt == 2
else if (is_aff_rule(items, itemcnt, "CIRCUMFIX", 2)
&& aff->af_circumfix == 0)
{
aff->af_circumfix = affitem2flag(aff->af_flagtype, items[1],
fname, lnum);
}
else if (STRCMP(items[0], "NOSUGGEST") == 0 && itemcnt == 2
else if (is_aff_rule(items, itemcnt, "NOSUGGEST", 2)
&& aff->af_nosuggest == 0)
{
aff->af_nosuggest = affitem2flag(aff->af_flagtype, items[1],
fname, lnum);
}
else if (STRCMP(items[0], "NEEDCOMPOUND") == 0 && itemcnt == 2
else if ((is_aff_rule(items, itemcnt, "NEEDCOMPOUND", 2)
|| is_aff_rule(items, itemcnt, "ONLYINCOMPOUND", 2))
&& aff->af_needcomp == 0)
{
aff->af_needcomp = affitem2flag(aff->af_flagtype, items[1],
fname, lnum);
}
else if (STRCMP(items[0], "COMPOUNDROOT") == 0 && itemcnt == 2
else if (is_aff_rule(items, itemcnt, "COMPOUNDROOT", 2)
&& aff->af_comproot == 0)
{
aff->af_comproot = affitem2flag(aff->af_flagtype, items[1],
fname, lnum);
}
else if (STRCMP(items[0], "COMPOUNDFORBIDFLAG") == 0
&& itemcnt == 2 && aff->af_compforbid == 0)
else if (is_aff_rule(items, itemcnt, "COMPOUNDFORBIDFLAG", 2)
&& aff->af_compforbid == 0)
{
aff->af_compforbid = affitem2flag(aff->af_flagtype, items[1],
fname, lnum);
@@ -5354,8 +5521,8 @@ spell_read_aff(spin, fname)
smsg((char_u *)_("Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line %d"),
fname, lnum);
}
else if (STRCMP(items[0], "COMPOUNDPERMITFLAG") == 0
&& itemcnt == 2 && aff->af_comppermit == 0)
else if (is_aff_rule(items, itemcnt, "COMPOUNDPERMITFLAG", 2)
&& aff->af_comppermit == 0)
{
aff->af_comppermit = affitem2flag(aff->af_flagtype, items[1],
fname, lnum);
@@ -5363,7 +5530,7 @@ spell_read_aff(spin, fname)
smsg((char_u *)_("Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line %d"),
fname, lnum);
}
else if (STRCMP(items[0], "COMPOUNDFLAG") == 0 && itemcnt == 2
else if (is_aff_rule(items, itemcnt, "COMPOUNDFLAG", 2)
&& compflags == NULL)
{
/* Turn flag "c" into COMPOUNDRULE compatible string "c+",
@@ -5376,7 +5543,15 @@ spell_read_aff(spin, fname)
compflags = p;
}
}
else if (STRCMP(items[0], "COMPOUNDRULE") == 0 && itemcnt == 2)
else if (is_aff_rule(items, itemcnt, "COMPOUNDRULES", 2))
{
/* We don't use the count, but do check that it's a number and
* not COMPOUNDRULE mistyped. */
if (atoi((char *)items[1]) == 0)
smsg((char_u *)_("Wrong COMPOUNDRULES value in %s line %d: %s"),
fname, lnum, items[1]);
}
else if (is_aff_rule(items, itemcnt, "COMPOUNDRULE", 2))
{
/* Concatenate this string to previously defined ones, using a
* slash to separate them. */
@@ -5395,7 +5570,7 @@ spell_read_aff(spin, fname)
compflags = p;
}
}
else if (STRCMP(items[0], "COMPOUNDWORDMAX") == 0 && itemcnt == 2
else if (is_aff_rule(items, itemcnt, "COMPOUNDWORDMAX", 2)
&& compmax == 0)
{
compmax = atoi((char *)items[1]);
@@ -5403,7 +5578,7 @@ spell_read_aff(spin, fname)
smsg((char_u *)_("Wrong COMPOUNDWORDMAX value in %s line %d: %s"),
fname, lnum, items[1]);
}
else if (STRCMP(items[0], "COMPOUNDMIN") == 0 && itemcnt == 2
else if (is_aff_rule(items, itemcnt, "COMPOUNDMIN", 2)
&& compminlen == 0)
{
compminlen = atoi((char *)items[1]);
@@ -5411,7 +5586,7 @@ spell_read_aff(spin, fname)
smsg((char_u *)_("Wrong COMPOUNDMIN value in %s line %d: %s"),
fname, lnum, items[1]);
}
else if (STRCMP(items[0], "COMPOUNDSYLMAX") == 0 && itemcnt == 2
else if (is_aff_rule(items, itemcnt, "COMPOUNDSYLMAX", 2)
&& compsylmax == 0)
{
compsylmax = atoi((char *)items[1]);
@@ -5419,32 +5594,29 @@ spell_read_aff(spin, fname)
smsg((char_u *)_("Wrong COMPOUNDSYLMAX value in %s line %d: %s"),
fname, lnum, items[1]);
}
else if (STRCMP(items[0], "CHECKCOMPOUNDDUP") == 0 && itemcnt == 1)
else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDDUP", 1))
{
compoptions |= COMP_CHECKDUP;
}
else if (STRCMP(items[0], "CHECKCOMPOUNDREP") == 0 && itemcnt == 1)
else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDREP", 1))
{
compoptions |= COMP_CHECKREP;
}
else if (STRCMP(items[0], "CHECKCOMPOUNDCASE") == 0 && itemcnt == 1)
else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDCASE", 1))
{
compoptions |= COMP_CHECKCASE;
}
else if (STRCMP(items[0], "CHECKCOMPOUNDTRIPLE") == 0
&& itemcnt == 1)
else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDTRIPLE", 1))
{
compoptions |= COMP_CHECKTRIPLE;
}
else if (STRCMP(items[0], "CHECKCOMPOUNDPATTERN") == 0
&& itemcnt == 2)
else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 2))
{
if (atoi((char *)items[1]) == 0)
smsg((char_u *)_("Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s"),
fname, lnum, items[1]);
}
else if (STRCMP(items[0], "CHECKCOMPOUNDPATTERN") == 0
&& itemcnt == 3)
else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 3))
{
garray_T *gap = &spin->si_comppat;
int i;
@@ -5463,24 +5635,24 @@ spell_read_aff(spin, fname)
= getroom_save(spin, items[2]);
}
}
else if (STRCMP(items[0], "SYLLABLE") == 0 && itemcnt == 2
else if (is_aff_rule(items, itemcnt, "SYLLABLE", 2)
&& syllable == NULL)
{
syllable = getroom_save(spin, items[1]);
}
else if (STRCMP(items[0], "NOBREAK") == 0 && itemcnt == 1)
else if (is_aff_rule(items, itemcnt, "NOBREAK", 1))
{
spin->si_nobreak = TRUE;
}
else if (STRCMP(items[0], "NOSPLITSUGS") == 0 && itemcnt == 1)
else if (is_aff_rule(items, itemcnt, "NOSPLITSUGS", 1))
{
spin->si_nosplitsugs = TRUE;
}
else if (STRCMP(items[0], "NOSUGFILE") == 0 && itemcnt == 1)
else if (is_aff_rule(items, itemcnt, "NOSUGFILE", 1))
{
spin->si_nosugfile = TRUE;
}
else if (STRCMP(items[0], "PFXPOSTPONE") == 0 && itemcnt == 1)
else if (is_aff_rule(items, itemcnt, "PFXPOSTPONE", 1))
{
aff->af_pfxpostpone = TRUE;
}
@@ -5771,24 +5943,20 @@ spell_read_aff(spin, fname)
}
}
}
else if (STRCMP(items[0], "FOL") == 0 && itemcnt == 2
&& fol == NULL)
else if (is_aff_rule(items, itemcnt, "FOL", 2) && fol == NULL)
{
fol = vim_strsave(items[1]);
}
else if (STRCMP(items[0], "LOW") == 0 && itemcnt == 2
&& low == NULL)
else if (is_aff_rule(items, itemcnt, "LOW", 2) && low == NULL)
{
low = vim_strsave(items[1]);
}
else if (STRCMP(items[0], "UPP") == 0 && itemcnt == 2
&& upp == NULL)
else if (is_aff_rule(items, itemcnt, "UPP", 2) && upp == NULL)
{
upp = vim_strsave(items[1]);
}
else if ((STRCMP(items[0], "REP") == 0
|| STRCMP(items[0], "REPSAL") == 0)
&& itemcnt == 2)
else if (is_aff_rule(items, itemcnt, "REP", 2)
|| is_aff_rule(items, itemcnt, "REPSAL", 2))
{
/* Ignore REP/REPSAL count */;
if (!isdigit(*items[1]))
@@ -5819,7 +5987,7 @@ spell_read_aff(spin, fname)
: &spin->si_rep, items[1], items[2]);
}
}
else if (STRCMP(items[0], "MAP") == 0 && itemcnt == 2)
else if (is_aff_rule(items, itemcnt, "MAP", 2))
{
/* MAP item or count */
if (!found_map)
@@ -5856,9 +6024,8 @@ spell_read_aff(spin, fname)
ga_append(&spin->si_map, '/');
}
}
/* Accept "SAL from to" and "SAL from to # comment". */
else if (STRCMP(items[0], "SAL") == 0
&& (itemcnt == 3 || (itemcnt > 3 && items[3][0] == '#')))
/* Accept "SAL from to" and "SAL from to #comment". */
else if (is_aff_rule(items, itemcnt, "SAL", 3))
{
if (do_sal)
{
@@ -5877,12 +6044,12 @@ spell_read_aff(spin, fname)
: items[2]);
}
}
else if (STRCMP(items[0], "SOFOFROM") == 0 && itemcnt == 2
else if (is_aff_rule(items, itemcnt, "SOFOFROM", 2)
&& sofofrom == NULL)
{
sofofrom = getroom_save(spin, items[1]);
}
else if (STRCMP(items[0], "SOFOTO") == 0 && itemcnt == 2
else if (is_aff_rule(items, itemcnt, "SOFOTO", 2)
&& sofoto == NULL)
{
sofoto = getroom_save(spin, items[1]);
@@ -6016,6 +6183,22 @@ spell_read_aff(spin, fname)
return aff;
}
/*
* Return TRUE when items[0] equals "rulename", there are "mincount" items or
* a comment is following after item "mincount".
*/
static int
is_aff_rule(items, itemcnt, rulename, mincount)
char_u **items;
int itemcnt;
char *rulename;
int mincount;
{
return (STRCMP(items[0], rulename) == 0
&& (itemcnt == mincount
|| (itemcnt > mincount && items[mincount][0] == '#')));
}
/*
* For affix "entry" move COMPOUNDFORBIDFLAG and COMPOUNDPERMITFLAG from
* ae_flags to ae_comppermit and ae_compforbid.
@@ -7926,6 +8109,8 @@ write_vim_spell(spin, fname)
char_u *p;
int rr;
int retval = OK;
size_t fwv = 1; /* collect return value of fwrite() to avoid
warnings from picky compiler */
fd = mch_fopen((char *)fname, "w");
if (fd == NULL)
@@ -7936,11 +8121,11 @@ write_vim_spell(spin, fname)
/* <HEADER>: <fileID> <versionnr> */
/* <fileID> */
if (fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd) != 1)
{
EMSG(_(e_write));
retval = FAIL;
}
fwv &= fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd);
if (fwv != (size_t)1)
/* Catch first write error, don't try writing more. */
goto theend;
putc(VIMSPELLVERSION, fd); /* <versionnr> */
/*
@@ -7955,7 +8140,7 @@ write_vim_spell(spin, fname)
i = (int)STRLEN(spin->si_info);
put_bytes(fd, (long_u)i, 4); /* <sectionlen> */
fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */
fwv &= fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */
}
/* SN_REGION: <regionname> ...
@@ -7966,7 +8151,7 @@ write_vim_spell(spin, fname)
putc(SNF_REQUIRED, fd); /* <sectionflags> */
l = spin->si_region_count * 2;
put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
fwrite(spin->si_region_name, (size_t)l, (size_t)1, fd);
fwv &= fwrite(spin->si_region_name, (size_t)l, (size_t)1, fd);
/* <regionname> ... */
regionmask = (1 << spin->si_region_count) - 1;
}
@@ -8016,7 +8201,7 @@ write_vim_spell(spin, fname)
}
put_bytes(fd, (long_u)l, 2); /* <folcharslen> */
fwrite(folchars, (size_t)l, (size_t)1, fd); /* <folchars> */
fwv &= fwrite(folchars, (size_t)l, (size_t)1, fd); /* <folchars> */
}
/* SN_MIDWORD: <midword> */
@@ -8027,7 +8212,8 @@ write_vim_spell(spin, fname)
i = (int)STRLEN(spin->si_midword);
put_bytes(fd, (long_u)i, 4); /* <sectionlen> */
fwrite(spin->si_midword, (size_t)i, (size_t)1, fd); /* <midword> */
fwv &= fwrite(spin->si_midword, (size_t)i, (size_t)1, fd);
/* <midword> */
}
/* SN_PREFCOND: <prefcondcnt> <prefcond> ... */
@@ -8113,7 +8299,8 @@ write_vim_spell(spin, fname)
p = rr == 1 ? ftp->ft_from : ftp->ft_to;
l = (int)STRLEN(p);
putc(l, fd);
fwrite(p, l, (size_t)1, fd);
if (l > 0)
fwv &= fwrite(p, l, (size_t)1, fd);
}
}
@@ -8131,11 +8318,11 @@ write_vim_spell(spin, fname)
/* <sectionlen> */
put_bytes(fd, (long_u)l, 2); /* <sofofromlen> */
fwrite(spin->si_sofofr, l, (size_t)1, fd); /* <sofofrom> */
fwv &= fwrite(spin->si_sofofr, l, (size_t)1, fd); /* <sofofrom> */
l = (int)STRLEN(spin->si_sofoto);
put_bytes(fd, (long_u)l, 2); /* <sofotolen> */
fwrite(spin->si_sofoto, l, (size_t)1, fd); /* <sofoto> */
fwv &= fwrite(spin->si_sofoto, l, (size_t)1, fd); /* <sofoto> */
}
/* SN_WORDS: <word> ...
@@ -8160,7 +8347,7 @@ write_vim_spell(spin, fname)
l = (int)STRLEN(hi->hi_key) + 1;
len += l;
if (round == 2) /* <word> */
fwrite(hi->hi_key, (size_t)l, (size_t)1, fd);
fwv &= fwrite(hi->hi_key, (size_t)l, (size_t)1, fd);
--todo;
}
if (round == 1)
@@ -8176,7 +8363,7 @@ write_vim_spell(spin, fname)
putc(0, fd); /* <sectionflags> */
l = spin->si_map.ga_len;
put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
fwrite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd);
fwv &= fwrite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd);
/* <mapstr> */
}
@@ -8232,10 +8419,11 @@ write_vim_spell(spin, fname)
{
p = ((char_u **)(spin->si_comppat.ga_data))[i];
putc((int)STRLEN(p), fd); /* <comppatlen> */
fwrite(p, (size_t)STRLEN(p), (size_t)1, fd);/* <comppattext> */
fwv &= fwrite(p, (size_t)STRLEN(p), (size_t)1, fd);
/* <comppattext> */
}
/* <compflags> */
fwrite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags),
fwv &= fwrite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags),
(size_t)1, fd);
}
@@ -8259,7 +8447,8 @@ write_vim_spell(spin, fname)
l = (int)STRLEN(spin->si_syllable);
put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd); /* <syllable> */
fwv &= fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd);
/* <syllable> */
}
/* end of <SECTIONS> */
@@ -8295,13 +8484,18 @@ write_vim_spell(spin, fname)
(void)put_node(fd, tree, 0, regionmask, round == 3);
}
/* Write another byte to check for errors. */
/* Write another byte to check for errors (file system full). */
if (putc(0, fd) == EOF)
retval = FAIL;
theend:
if (fclose(fd) == EOF)
retval = FAIL;
if (fwv != (size_t)1)
retval = FAIL;
if (retval == FAIL)
EMSG(_(e_write));
return retval;
}
@@ -9890,6 +10084,7 @@ write_spell_prefcond(fd, gap)
char_u *p;
int len;
int totlen;
size_t x = 1; /* collect return value of fwrite() */
if (fd != NULL)
put_bytes(fd, (long_u)gap->ga_len, 2); /* <prefcondcnt> */
@@ -9906,7 +10101,7 @@ write_spell_prefcond(fd, gap)
if (fd != NULL)
{
fputc(len, fd);
fwrite(p, (size_t)len, (size_t)1, fd);
x &= fwrite(p, (size_t)len, (size_t)1, fd);
}
totlen += len;
}
@@ -11480,15 +11675,24 @@ suggest_trie_walk(su, lp, fword, soundfold)
vim_strncpy(preword + sp->ts_prewordlen,
tword + sp->ts_splitoff,
sp->ts_twordlen - sp->ts_splitoff);
p = preword;
while (*skiptowhite(p) != NUL)
p = skipwhite(skiptowhite(p));
if (fword_ends && !can_compound(slang, p,
compflags + sp->ts_compsplit))
/* Compound is not allowed. But it may still be
* possible if we add another (short) word. */
/* Verify CHECKCOMPOUNDPATTERN rules. */
if (match_checkcompoundpattern(preword, sp->ts_prewordlen,
&slang->sl_comppat))
compound_ok = FALSE;
if (compound_ok)
{
p = preword;
while (*skiptowhite(p) != NUL)
p = skipwhite(skiptowhite(p));
if (fword_ends && !can_compound(slang, p,
compflags + sp->ts_compsplit))
/* Compound is not allowed. But it may still be
* possible if we add another (short) word. */
compound_ok = FALSE;
}
/* Get pointer to last char of previous word. */
p = preword + sp->ts_prewordlen;
mb_ptr_back(preword, p);
@@ -11685,10 +11889,9 @@ suggest_trie_walk(su, lp, fword, soundfold)
&& (slang->sl_compsylmax < MAXWLEN
|| sp->ts_complen + 1 - sp->ts_compsplit
< slang->sl_compmax)
&& (byte_in_str(sp->ts_complen == sp->ts_compsplit
? slang->sl_compstartflags
: slang->sl_compallflags,
((unsigned)flags >> 24))))
&& (can_be_compound(sp, slang,
compflags, ((unsigned)flags >> 24))))
{
try_compound = TRUE;
compflags[sp->ts_complen] = ((unsigned)flags >> 24);
+19 -2
View File
@@ -2725,7 +2725,24 @@ parse_tag_line(lbuf,
*/
p_7f = vim_strchr(lbuf, 0x7f);
if (p_7f == NULL)
{
etag_fail:
if (vim_strchr(lbuf, '\n') == NULL)
{
/* Truncated line. Ignore it. */
if (p_verbose >= 5)
{
verbose_enter();
MSG(_("Ignoring long line in tags file"));
verbose_leave();
}
tagp->command = lbuf;
tagp->tagname = lbuf;
tagp->tagname_end = lbuf;
return OK;
}
return FAIL;
}
/* Find ^A. If not found the line number is after the 0x7f */
p = vim_strchr(p_7f, Ctrl_A);
@@ -2735,7 +2752,7 @@ parse_tag_line(lbuf,
++p;
if (!VIM_ISDIGIT(*p)) /* check for start of line number */
return FAIL;
goto etag_fail;
tagp->command = p;
@@ -2749,7 +2766,7 @@ parse_tag_line(lbuf,
/* find end of tagname */
for (p = p_7f - 1; !vim_iswordc(*p); --p)
if (p == lbuf)
return FAIL;
goto etag_fail;
tagp->tagname_end = p + 1;
while (p >= lbuf && vim_iswordc(*p))
--p;
+1 -1
View File
@@ -1834,7 +1834,7 @@ fill_input_buf(exit_on_error)
#ifdef HAVE_DUP
/* Use stderr for stdin, also works for shell commands. */
close(0);
dup(2);
ignored = dup(2);
#else
read_cmd_fd = 2; /* read from stderr instead of stdin */
#endif
+78
View File
@@ -691,6 +691,58 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
75,
/**/
74,
/**/
73,
/**/
72,
/**/
71,
/**/
70,
/**/
69,
/**/
68,
/**/
67,
/**/
66,
/**/
65,
/**/
64,
/**/
63,
/**/
62,
/**/
61,
/**/
60,
/**/
59,
/**/
58,
/**/
57,
/**/
56,
/**/
55,
/**/
54,
/**/
53,
/**/
52,
/**/
51,
/**/
50,
/**/
49,
/**/
@@ -793,6 +845,19 @@ static int included_patches[] =
0
};
/*
* Place to put a short description when adding a feature with a patch.
* Keep it short, e.g.,: "relative numbers", "persistent undo".
* Also add a comment marker to separate the lines.
* See the official Vim patches for the diff format: It must use a context of
* one line only. Create it by hand or use "diff -C2" and edit the patch.
*/
static char *(extra_patches[]) =
{ /* Add your patch description below this line */
/**/
NULL
};
int
highest_patch()
{
@@ -938,6 +1003,19 @@ list_version()
}
}
/* Print the list of extra patch descriptions if there is at least one. */
if (extra_patches[0] != NULL)
{
MSG_PUTS(_("\nExtra patches: "));
s = "";
for (i = 0; extra_patches[i] != NULL; ++i)
{
MSG_PUTS(s);
s = ", ";
MSG_PUTS(extra_patches[i]);
}
}
#ifdef MODIFIED_BY
MSG_PUTS("\n");
MSG_PUTS(_("Modified by "));
+3 -3
View File
@@ -4029,14 +4029,14 @@ win_enter_ext(wp, undo_sync, curwin_invalid)
if (mch_dirname(cwd, MAXPATHL) == OK)
globaldir = vim_strsave(cwd);
}
mch_chdir((char *)curwin->w_localdir);
shorten_fnames(TRUE);
if (mch_chdir((char *)curwin->w_localdir) == 0)
shorten_fnames(TRUE);
}
else if (globaldir != NULL)
{
/* Window doesn't have a local directory and we are not in the global
* directory: Change to the global directory. */
mch_chdir((char *)globaldir);
ignored = mch_chdir((char *)globaldir);
vim_free(globaldir);
globaldir = NULL;
shorten_fnames(TRUE);
+6 -2
View File
@@ -1121,8 +1121,12 @@ workshop_get_positions(
? (char *)curbuf->b_sfname : "<None>");
#endif
strcpy(ffname, (char *) curbuf->b_ffname);
*filename = ffname; /* copy so nobody can change b_ffname */
if (curbuf->b_ffname == NULL)
ffname[0] = NUL;
else
/* copy so nobody can change b_ffname */
strcpy(ffname, (char *) curbuf->b_ffname);
*filename = ffname;
*curLine = curwin->w_cursor.lnum;
*curCol = curwin->w_cursor.col;