mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-02 11:19:22 +02:00
Compare commits
199 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 95f42c734a | |||
| e1ece272fa | |||
| 73b5d1837c | |||
| 790f685006 | |||
| a680267d49 | |||
| 5f1547b288 | |||
| 9d9a5983f5 | |||
| 16e57e6189 | |||
| 5d45d4a4d2 | |||
| 0546647038 | |||
| c9ad0b6d4d | |||
| 25306ee0c5 | |||
| 2e024248fa | |||
| 85879328b0 | |||
| 9c530a8030 | |||
| 9105eb1fd0 | |||
| c49868a11f | |||
| 795860de7c | |||
| 90a729a8e4 | |||
| 1a328483b7 | |||
| 5e09d64d77 | |||
| 4591403b7e | |||
| e90f76c1aa | |||
| 8745e4380e | |||
| cd7a1f6539 | |||
| bb21f9f120 | |||
| 38c7ababf6 | |||
| 5aea857883 | |||
| 322b4eec7e | |||
| 886d3d7aed | |||
| b2f7a2f021 | |||
| 4374e9787e | |||
| 080a7c2c6c | |||
| ffef064005 | |||
| d23a68d047 | |||
| c973e12d3e | |||
| 5e0543116b | |||
| d9f633dbb3 | |||
| 32cb07dd61 | |||
| 40ae005819 | |||
| c4e8fcc338 | |||
| 9dbb79f942 | |||
| 031479c46b | |||
| 843a3a41bf | |||
| 01973d329c | |||
| bcfeb7c895 | |||
| 46b250b75f | |||
| 9b06b0a4b2 | |||
| 80b36e7995 | |||
| d29599b7ea | |||
| a63fc2427e | |||
| 393e47945b | |||
| 5100db4427 | |||
| 19ee857237 | |||
| 781ac5b687 | |||
| 9b52c915d9 | |||
| 7a68824771 | |||
| c2aed127ca | |||
| 12b3ecfdcd | |||
| 4143f69655 | |||
| 7a720947c8 | |||
| 9393a4151c | |||
| 95a678d204 | |||
| 68cec2f91b | |||
| 5ed292ebfb | |||
| 6d70e1a179 | |||
| 355d2ec231 | |||
| c6ceb6c969 | |||
| 60c1c58967 | |||
| ba43ddb524 | |||
| 2a032c05b7 | |||
| 8d8aecf662 | |||
| 380d7b2cbf | |||
| 30a12fc740 | |||
| 43050b40f8 | |||
| d5dfed9cfc | |||
| 0e2e98e570 | |||
| d0a875e3af | |||
| b770256474 | |||
| e14b8cd599 | |||
| 938149499b | |||
| 9245af7148 | |||
| a874eae869 | |||
| cca95bae41 | |||
| 243fcce65c | |||
| b8c8a68a5c | |||
| 8502d5f2b2 | |||
| da857362b0 | |||
| 4c50d72cdf | |||
| 9af39a7cb2 | |||
| d4038f59f4 | |||
| 9150d82be1 | |||
| 87694dc1bf | |||
| 22704e2bb4 | |||
| 95676cfcd4 | |||
| 1e901456a5 | |||
| 899f9a6260 | |||
| 6b989afdb1 | |||
| 4f48c32bc3 | |||
| c2ea4b240d | |||
| f81158c840 | |||
| 3950b3a6b1 | |||
| ae65cb89b3 | |||
| f90e3c31ab | |||
| 014700ca55 | |||
| f86423097b | |||
| a4cdb9b1c4 | |||
| 03a1a0ea74 | |||
| 4e1a1cad93 | |||
| e4abcd6741 | |||
| b0f34cac04 | |||
| dd243c8ab1 | |||
| 02592cfe41 | |||
| e706fca4d6 | |||
| 8d00a30b0a | |||
| 76200b7c03 | |||
| e648d3b011 | |||
| 1db4b7903b | |||
| e5e129b933 | |||
| 354968a9b9 | |||
| 87e4ef758b | |||
| 2b721c9e9c | |||
| c50143db47 | |||
| 2153ab22d7 | |||
| aefc975f1b | |||
| 79851d47b1 | |||
| 2c9f69f2bf | |||
| 9dc3e9172c | |||
| 2e69b16f67 | |||
| 462fb78a85 | |||
| d2dbd62e7b | |||
| e1c4adc8c9 | |||
| 2ffc552c25 | |||
| 7845992803 | |||
| 3142e74a3a | |||
| 1eb73428b0 | |||
| c5b2d1b5b4 | |||
| 2ab7e98bb8 | |||
| ebf311d2df | |||
| 88d6d362c3 | |||
| daf5b3430a | |||
| b13dede64d | |||
| bd1000809d | |||
| 2614f8ee3e | |||
| dd3577db8c | |||
| ff92260a55 | |||
| 90c9bf33a2 | |||
| 8f0b9d6525 | |||
| b9eb197443 | |||
| a61f1bf714 | |||
| c7323339d9 | |||
| 48fc2be299 | |||
| a5be20ba89 | |||
| 48874c704b | |||
| b8d2ad693a | |||
| d11de6c31d | |||
| 4c5d17ec00 | |||
| 34207703d8 | |||
| 8ff21dbb7c | |||
| 1cd2bd4a21 | |||
| 32561e2742 | |||
| fe0e293cb9 | |||
| dcaf01ff54 | |||
| adac29fc57 | |||
| 341e36b48d | |||
| 7b26c6980f | |||
| 668c778621 | |||
| 279e83bccc | |||
| c1a71eedb5 | |||
| 4dea3b30d0 | |||
| 05b47ac89e | |||
| 3965aefc79 | |||
| be089b8aa0 | |||
| 7aab071854 | |||
| cff1a9e3c9 | |||
| 7d03b73992 | |||
| 213d223679 | |||
| f00a001406 | |||
| 7ae32a1bef | |||
| 62b5aae721 | |||
| 1741da563b | |||
| 09eb973f44 | |||
| 1dfdf3ebaa | |||
| d50de2f2f0 | |||
| 233164a7d2 | |||
| ae96eb8469 | |||
| d676af07ec | |||
| 73827e6e15 | |||
| 09c7a21e4f | |||
| 9e75f31ff2 | |||
| 950ef8ff2f | |||
| 5d900f6f7e | |||
| 6907698f60 | |||
| ce49edcc1e | |||
| 911a34fed0 | |||
| a57ecd4e2e | |||
| 81a5c6dd4e | |||
| a53e7167fc | |||
| 6cf044c8fc |
+10
@@ -3,6 +3,16 @@
|
||||
src/MacVim/MacVim.xcodeproj/*.mode1
|
||||
src/MacVim/MacVim.xcodeproj/*.mode1v3
|
||||
src/MacVim/MacVim.xcodeproj/*.pbxuser
|
||||
src/MacVim/icons/*.pyc
|
||||
src/MacVim/icons/*.ttf
|
||||
src/MacVim/icons/*.reg
|
||||
src/MacVim/icons/*.zip
|
||||
src/MacVim/icons/*.txt
|
||||
src/MacVim/icons/*.so
|
||||
src/MacVim/icons/*.egg-info
|
||||
src/MacVim/icons/build
|
||||
src/MacVim/icons/makeicns/*.o
|
||||
src/MacVim/icons/makeicns/makeicns
|
||||
src/MacVim/PSMTabBarControl/PSMTabBarControl.xcodeproj/*.mode1
|
||||
src/MacVim/PSMTabBarControl/PSMTabBarControl.xcodeproj/*.pbxuser
|
||||
src/MacVim/PSMTabBarControl/build
|
||||
|
||||
+22
-14
@@ -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|.
|
||||
|
||||
+19
-5
@@ -1,4 +1,4 @@
|
||||
*gui_mac.txt* For Vim version 7.2. Last change: 2008 Oct 25
|
||||
*gui_mac.txt* For Vim version 7.2. Last change: 2009 Mar 15
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bjorn Winckler
|
||||
@@ -117,9 +117,19 @@ really bad once you start using tabs. For example, dropping two files, then
|
||||
dropping two more, and switching back to the first tab would cause weird
|
||||
strings like "((3) of 2)" to appear in the window title.
|
||||
|
||||
*macvim-tablabel*
|
||||
Tab labels only show the tail of the file name to make the tabs more readable
|
||||
when editing files in deeply nested folders. Add the line "set guitablabel="
|
||||
to your .gvimrc file to revert back to the default Vim tab label.
|
||||
|
||||
*macvim-options*
|
||||
These are the non-standard options that MacVim supports:
|
||||
'fullscreen' 'fuoptions' 'toolbariconsize' 'transparency' 'antialias'
|
||||
'antialias' 'fullscreen' 'fuoptions'
|
||||
'macmeta' 'toolbariconsize' 'transparency'
|
||||
|
||||
*macvim-commands*
|
||||
These are the non-standard commands that MacVim supports:
|
||||
|:macaction| |:macmenu|
|
||||
|
||||
*macvim-find*
|
||||
Whenever you search for something in Vim (e.g. using "/") the search query is
|
||||
@@ -255,9 +265,11 @@ Here is a list of relevant dictionary entries:
|
||||
KEY VALUE ~
|
||||
MMCellWidthMultiplier width of a normal glyph in em units [float]
|
||||
MMDialogsTrackPwd open/save dialogs track the Vim pwd [bool]
|
||||
MMLoadDefaultFont load font (disable for faster startup) [bool]
|
||||
MMLoginShellArgument login shell parameter [string]
|
||||
MMLoginShellCommand which shell to use to launch Vim [string]
|
||||
MMNoFontSubstitution disable automatic font substitution [bool]
|
||||
MMShowAddTabButton enable "add tab" button on tabline [bool]
|
||||
MMTabMaxWidth maximum width of a tab [int]
|
||||
MMTabMinWidth minimum width of a tab [int]
|
||||
MMTabOptimumWidth default width of a tab [int]
|
||||
@@ -556,9 +568,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
|
||||
|
||||
@@ -63,7 +63,8 @@ already running vim will never fork in MacVim.
|
||||
"gvim --nofork" does the same as "gvim -f".
|
||||
|
||||
If you want the GUI to run in the foreground always, include the 'f'
|
||||
flag in 'guioptions'. |-f|.
|
||||
flag in 'guioptions'. |-f|. MacVim does not support this flag in
|
||||
'guioptions'.
|
||||
|
||||
==============================================================================
|
||||
2. GUI Resources *gui-resources* *.Xdefaults*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*if_cscop.txt* For Vim version 7.2. Last change: 2005 Mar 29
|
||||
*if_cscop.txt* For Vim version 7.2. Last change: 2009 Mar 18
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Andy Kahn
|
||||
@@ -131,11 +131,22 @@ The available subcommands are:
|
||||
7 or f: Find this file
|
||||
8 or i: Find files #including this file
|
||||
|
||||
For all types, except 4 and 6, leading white space for {name} is
|
||||
removed. For 4 and 6 there is exactly one space between {querytype}
|
||||
and {name}. Further white space is included in {name}.
|
||||
|
||||
EXAMPLES >
|
||||
:cscope find c vim_free
|
||||
:cscope find 3 vim_free
|
||||
:cscope find 3 vim_free
|
||||
<
|
||||
These two examples perform the same query. >
|
||||
These two examples perform the same query: functions calling
|
||||
"vim_free". >
|
||||
|
||||
:cscope find t initOnce
|
||||
:cscope find t initOnce
|
||||
<
|
||||
The first one searches for the text "initOnce", the second one for
|
||||
" initOnce". >
|
||||
|
||||
:cscope find 0 DEFAULT_TERM
|
||||
<
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*netbeans.txt* For Vim version 7.2. Last change: 2008 Jun 28
|
||||
*netbeans.txt* For Vim version 7.2. Last change: 2009 Jan 06
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Gordon Prieur et al.
|
||||
@@ -722,8 +722,10 @@ keyAtPos keyName lnum/col
|
||||
of the cursor.
|
||||
New in version 2.1.
|
||||
|
||||
killed A file was closed by the user. Only for files that have been
|
||||
assigned a number by the IDE.
|
||||
killed A file was deleted or wiped out by the user and the buffer
|
||||
annotations have been removed. The bufID number for this
|
||||
buffer has become invalid. Only for files that have been
|
||||
assigned a bufID number by the IDE.
|
||||
|
||||
newDotAndMark off off
|
||||
Reports the position of the cursor being at "off" bytes into
|
||||
|
||||
@@ -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
|
||||
@@ -3490,6 +3490,8 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
foreground. |gui-fork|
|
||||
Note: Set this option in the vimrc file. The forking may have
|
||||
happened already when the |gvimrc| file is read.
|
||||
MacVim does not support this flag due to limitations with
|
||||
forking on Mac OS X.
|
||||
*'go-i'*
|
||||
'i' Use a Vim icon. For GTK with KDE it is used in the left-upper
|
||||
corner of the window. It's black&white on non-GTK, because of
|
||||
@@ -3867,14 +3869,14 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
characters with dead keys.
|
||||
|
||||
*'imdisable'* *'imd'* *'nodisable'* *'noimd'*
|
||||
'imdisable' 'imd' boolean (default off, on for some systems (SGI))
|
||||
'imdisable' 'imd' boolean (default off, on for SGI and MacVim)
|
||||
global
|
||||
{not in Vi}
|
||||
{only available when compiled with the |+xim|
|
||||
|+multi_byte_ime| or |global-ime| feature}
|
||||
When set the Input Method is never used. This is useful to disable
|
||||
the IM when it doesn't work properly.
|
||||
Currently this option is on by default for SGI/IRIX machines. This
|
||||
Currently this option is on by default for SGI/IRIX and MacVim. This
|
||||
may change in later releases.
|
||||
|
||||
*'iminsert'* *'imi'*
|
||||
@@ -4273,9 +4275,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
be able to execute Normal mode commands.
|
||||
This is the opposite of the 'keymap' option, where characters are
|
||||
mapped in Insert mode.
|
||||
This only works for 8-bit characters. The value of 'langmap' may be
|
||||
specified with multi-byte characters (e.g., UTF-8), but only the lower
|
||||
8 bits of each character will be used.
|
||||
|
||||
Example (for Greek, in UTF-8): *greek* >
|
||||
:set langmap=ΑA,ΒB,ΨC,ΔD,ΕE,ΦF,ΓG,ΗH,ΙI,ΞJ,ΚK,ΛL,ΜM,ΝN,ΟO,ΠP,QQ,ΡR,ΣS,ΤT,ΘU,ΩV,WW,ΧX,ΥY,ΖZ,αa,βb,ψc,δd,εe,φf,γg,ηh,ιi,ξj,κk,λl,μm,νn,οo,πp,qq,ρr,σs,τt,θu,ωv,ςw,χx,υy,ζz
|
||||
@@ -7595,7 +7594,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
@@ -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|
|
||||
|
||||
+464
-461
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf350
|
||||
{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf430
|
||||
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
|
||||
{\colortbl;\red255\green255\blue255;}
|
||||
\vieww9000\viewh8400\viewkind0
|
||||
@@ -40,8 +40,6 @@ Thank you to {\field{\*\fldinst{HYPERLINK "http://www.positivespinmedia.com"}}{\
|
||||
\
|
||||
Toolbar icons by {\field{\*\fldinst{HYPERLINK "http://www.mattballdesign.com/"}}{\fldrslt Matt Ball}} (free Developer Icons), {\field{\*\fldinst{HYPERLINK "http://www.jonasraskdesign.com/"}}{\fldrslt Jonas Rask}} (Danish Royalty Free icon set), and {\field{\*\fldinst{HYPERLINK "http://www.everaldo.com"}}{\fldrslt Everaldo Coelho}} (Crystal Project Icons, released under LGPL license).\
|
||||
\
|
||||
Vim icons made by {\field{\*\fldinst{HYPERLINK "http://www.cs.princeton.edu/~mtwebb/vim_icon/vim_icons.html"}}{\fldrslt Matthew Webb}}.\
|
||||
\
|
||||
The default font in MacVim, DejaVu Sans Mono, is based on the Bitstream Vera\'99 and Arev fonts. Bitstream Vera\'99 is \'a9 2003 by Bitstream, Inc. Arev is \'a9 2006 by Tavmjong Bah. The DejaVu changes to these fonts are in the public domain.\
|
||||
\
|
||||
Thanks to Andy Matuschak for {\field{\*\fldinst{HYPERLINK "http://sparkle.andymatuschak.org/"}}{\fldrslt Sparkle}}.\
|
||||
@@ -52,4 +50,6 @@ Thanks to Allan Odgaard for making the "Edit in TextMate" input manager source c
|
||||
\
|
||||
Thanks to Rainer Brockerhoff for RBSplitView.\
|
||||
\
|
||||
Thanks to Chad Weider for CTGradient.}
|
||||
Thanks to Chad Weider for CTGradient.\
|
||||
\
|
||||
Thanks to Damien Guard for {\field{\*\fldinst{HYPERLINK "http://damieng.com/blog/2008/05/26/envy-code-r-preview-7-coding-font-released"}}{\fldrslt Envy Code R}} (used in MacVim's 16x16 document icons).}
|
||||
+628
-33
@@ -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>38</string>
|
||||
<string>44</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
|
||||
@@ -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;
|
||||
|
||||
+219
-83
@@ -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];
|
||||
@@ -345,14 +341,17 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
// The user default MMUntitledWindow can be set to control whether an
|
||||
// untitled window should open on 'Open' and 'Reopen' events.
|
||||
int untitledWindowFlag = [ud integerForKey:MMUntitledWindowKey];
|
||||
if ([desc eventID] == kAEOpenApplication
|
||||
&& (untitledWindowFlag & MMUntitledWindowOnOpen) == 0)
|
||||
|
||||
BOOL isAppOpenEvent = [desc eventID] == kAEOpenApplication;
|
||||
if (isAppOpenEvent && (untitledWindowFlag & MMUntitledWindowOnOpen) == 0)
|
||||
return NO;
|
||||
else if ([desc eventID] == kAEReopenApplication
|
||||
|
||||
BOOL isAppReopenEvent = [desc eventID] == kAEReopenApplication;
|
||||
if (isAppReopenEvent
|
||||
&& (untitledWindowFlag & MMUntitledWindowOnReopen) == 0)
|
||||
return NO;
|
||||
|
||||
// When a process is started from the command line, the 'Open' event will
|
||||
// When a process is started from the command line, the 'Open' event may
|
||||
// contain a parameter to surpress the opening of an untitled window.
|
||||
desc = [desc paramDescriptorForKeyword:keyAEPropData];
|
||||
desc = [desc paramDescriptorForKeyword:keyMMUntitledWindow];
|
||||
@@ -365,8 +364,12 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
return NO;
|
||||
|
||||
// NOTE! This way it possible to start the app with the command-line
|
||||
// argument '-nowindow yes' and no window will be opened by default.
|
||||
return ![ud boolForKey:MMNoWindowKey];
|
||||
// argument '-nowindow yes' and no window will be opened by default but
|
||||
// this argument will only be heeded when the application is opening.
|
||||
if (isAppOpenEvent && [ud boolForKey:MMNoWindowKey] == YES)
|
||||
return NO;
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)applicationOpenUntitledFile:(NSApplication *)sender
|
||||
@@ -457,14 +460,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 +512,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 +563,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 +639,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
|
||||
@@ -636,21 +676,26 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
|
||||
[win setFrameTopLeftPoint:topLeft];
|
||||
|
||||
NSPoint screenOrigin = [[win screen] frame].origin;
|
||||
if ([win frame].origin.y < screenOrigin.y) {
|
||||
// Try to avoid shifting the new window downwards if it means that
|
||||
// the bottom of the window will be off the screen. E.g. if the
|
||||
// user has set windows to open maximized in the vertical direction
|
||||
// then the new window will cascade horizontally only.
|
||||
topLeft.y = oldTopLeft.y;
|
||||
[win setFrameTopLeftPoint:topLeft];
|
||||
}
|
||||
if ([win screen]) {
|
||||
NSPoint screenOrigin = [[win screen] frame].origin;
|
||||
if ([win frame].origin.y < screenOrigin.y) {
|
||||
// Try to avoid shifting the new window downwards if it means
|
||||
// that the bottom of the window will be off the screen. E.g.
|
||||
// if the user has set windows to open maximized in the
|
||||
// vertical direction then the new window will cascade
|
||||
// horizontally only.
|
||||
topLeft.y = oldTopLeft.y;
|
||||
[win setFrameTopLeftPoint:topLeft];
|
||||
}
|
||||
|
||||
if ([win frame].origin.y < screenOrigin.y) {
|
||||
// Move the window to the top of the screen if the bottom of the
|
||||
// window is still obscured.
|
||||
topLeft.y = NSMaxY([[win screen] frame]);
|
||||
[win setFrameTopLeftPoint:topLeft];
|
||||
if ([win frame].origin.y < screenOrigin.y) {
|
||||
// Move the window to the top of the screen if the bottom of
|
||||
// the window is still obscured.
|
||||
topLeft.y = NSMaxY([[win screen] frame]);
|
||||
[win setFrameTopLeftPoint:topLeft];
|
||||
}
|
||||
} else {
|
||||
NSLog(@"[%s] WINDOW NOT ON SCREEN, don't constrain position", _cmd);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -797,6 +842,17 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
firstController = vc;
|
||||
}
|
||||
|
||||
// The meaning of "layout" is defined by the WIN_* defines in main.c.
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
int layout = [ud integerForKey:MMOpenLayoutKey];
|
||||
BOOL splitVert = [ud boolForKey:MMVerticalSplitKey];
|
||||
BOOL openInCurrentWindow = [ud boolForKey:MMOpenInCurrentWindowKey];
|
||||
|
||||
if (splitVert && MMLayoutHorizontalSplit == layout)
|
||||
layout = MMLayoutVerticalSplit;
|
||||
if (layout < 0 || (layout > MMLayoutTabs && openInCurrentWindow))
|
||||
layout = MMLayoutTabs;
|
||||
|
||||
if ([filenames count] == 0) {
|
||||
// Raise the window containing the first file that was already open,
|
||||
// and make sure that the tab containing that file is selected. Only
|
||||
@@ -804,10 +860,18 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
// the window with 'firstFile' will be raised, other times it might be
|
||||
// the window that will open with the files in the 'filenames' array.
|
||||
firstFile = [firstFile stringByEscapingSpecialFilenameCharacters];
|
||||
|
||||
NSString *bufCmd = @"tab sb";
|
||||
switch (layout) {
|
||||
case MMLayoutHorizontalSplit: bufCmd = @"sb"; break;
|
||||
case MMLayoutVerticalSplit: bufCmd = @"vert sb"; break;
|
||||
case MMLayoutArglist: bufCmd = @"b"; break;
|
||||
}
|
||||
|
||||
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];
|
||||
"%@ %@|let &swb=oldswb|unl oldswb|"
|
||||
"cal foreground()<CR>", bufCmd, firstFile];
|
||||
|
||||
[firstController addVimInput:input];
|
||||
|
||||
@@ -824,23 +888,13 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
//
|
||||
// b) Open any remaining files
|
||||
//
|
||||
MMVimController *vc;
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
BOOL openInCurrentWindow = [ud boolForKey:MMOpenInCurrentWindowKey];
|
||||
|
||||
// The meaning of "layout" is defined by the WIN_* defines in main.c.
|
||||
int layout = [ud integerForKey:MMOpenLayoutKey];
|
||||
BOOL splitVert = [ud boolForKey:MMVerticalSplitKey];
|
||||
if (splitVert && MMLayoutHorizontalSplit == layout)
|
||||
layout = MMLayoutVerticalSplit;
|
||||
if (layout < 0 || (layout > MMLayoutTabs && openInCurrentWindow))
|
||||
layout = MMLayoutTabs;
|
||||
|
||||
[arguments setObject:[NSNumber numberWithInt:layout] forKey:@"layout"];
|
||||
[arguments setObject:filenames forKey:@"filenames"];
|
||||
// (Indicate that files should be opened from now on.)
|
||||
[arguments setObject:[NSNumber numberWithBool:NO] forKey:@"dontOpen"];
|
||||
|
||||
MMVimController *vc;
|
||||
if (openInCurrentWindow && (vc = [self topmostVimController])) {
|
||||
// Open files in an already open window.
|
||||
[[[vc windowController] window] makeKeyAndOrderFront:self];
|
||||
@@ -935,7 +989,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 +1131,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 +1266,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 +1326,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,9 +1336,18 @@ 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.
|
||||
// The 'pidArguments' dictionary keeps arguments to be passed to the
|
||||
// process when it connects (this is in contrast to arguments which are
|
||||
// passed on the command line, like '-f' and '-g').
|
||||
// If this method is called with nil arguments we take this as a hint
|
||||
// that this is an "untitled window" being launched and add a null
|
||||
// object to the 'pidArguments' dictionary. This way we can detect if
|
||||
// an untitled window is being launched by looking for null objects in
|
||||
// this dictionary.
|
||||
// If this method is called with non-nil arguments then it is assumed
|
||||
// that the caller takes care of adding items to 'pidArguments' as
|
||||
// necessary (only some arguments are passed on connect, e.g. files to
|
||||
// open).
|
||||
if (!args)
|
||||
[pidArguments setObject:[NSNull null]
|
||||
forKey:[NSNumber numberWithInt:pid]];
|
||||
@@ -1523,7 +1586,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 +1801,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 +1948,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,13 +2066,15 @@ 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);
|
||||
|
||||
// Without the following call warning messages like this appear on the
|
||||
// console:
|
||||
// com.apple.launchd[69] : Stray process with PGID equal to this
|
||||
// dead job: PID 1589 PPID 1 Vim
|
||||
setsid();
|
||||
|
||||
execv(shellPath, shellArgv);
|
||||
|
||||
// Never reached unless execv fails
|
||||
@@ -1976,7 +2089,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)
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
+173
-123
@@ -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;
|
||||
@@ -346,7 +342,7 @@ static NSString *MMSymlinkWarningString =
|
||||
frontendProxy = [proxy connectBackend:self pid:pid];
|
||||
if (frontendProxy) {
|
||||
[frontendProxy retain];
|
||||
[frontendProxy setProtocolForProxy:@protocol(MMAppProtocol)];
|
||||
[frontendProxy setProtocolForProxy:@protocol(MMFrontendProtocol)];
|
||||
ok = YES;
|
||||
}
|
||||
}
|
||||
@@ -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,30 @@ 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). Don't preserve modified files since the user would
|
||||
// already have been presented with a dialog warning if there were any
|
||||
// modified files when we get here.
|
||||
isTerminating = YES;
|
||||
getout(0);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1230,11 +1223,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 +1443,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 +1458,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 +1476,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 +1520,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 +1562,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 +1700,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 +2012,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 +2158,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 +2439,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 +2470,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?).
|
||||
@@ -2499,9 +2524,7 @@ static NSString *MMSymlinkWarningString =
|
||||
|
||||
NSString *searchText = [args objectForKey:@"searchText"];
|
||||
if (searchText) {
|
||||
// TODO: Searching is an exclusive motion, so if the pattern would
|
||||
// match on row 0 column 0 then this pattern will miss that match.
|
||||
[self addInput:[NSString stringWithFormat:@"<C-\\><C-N>gg/\\c%@<CR>",
|
||||
[self addInput:[NSString stringWithFormat:@"<C-\\><C-N>gg/\\c%@/e<CR>",
|
||||
searchText]];
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
@@ -139,8 +149,10 @@ static int numFullscreenWindows = 0;
|
||||
|
||||
int fuRows = currRows, fuColumns = currColumns;
|
||||
|
||||
// NOTE: Do not use [NSScreen visibleFrame] when determining the screen
|
||||
// size since it compensates for menu and dock.
|
||||
int maxRows, maxColumns;
|
||||
NSSize size = [[self screen] visibleFrame].size;
|
||||
NSSize size = [[self screen] frame].size;
|
||||
[view constrainRows:&maxRows columns:&maxColumns toSize:size];
|
||||
|
||||
// Store current pre-fu vim size
|
||||
@@ -277,8 +289,6 @@ static int numFullscreenWindows = 0;
|
||||
CGReleaseDisplayFadeReservation(token);
|
||||
}
|
||||
|
||||
[self revealDockIfAppropriate];
|
||||
|
||||
[self autorelease]; // Balance the above retain
|
||||
}
|
||||
|
||||
@@ -347,38 +357,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -52,7 +52,9 @@ static float MMDragAreaSize = 73.0f;
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[insertionPointColor release]; insertionPointColor = nil;
|
||||
[markedText release]; markedText = nil;
|
||||
[markedTextAttributes release]; markedTextAttributes = nil;
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
@@ -100,14 +102,19 @@ static float MMDragAreaSize = 73.0f;
|
||||
int flags = [event modifierFlags];
|
||||
if ((flags & NSControlKeyMask) ||
|
||||
((flags & NSAlternateKeyMask) && (flags & NSFunctionKeyMask))) {
|
||||
BOOL unmodIsPrintable = YES;
|
||||
NSString *unmod = [event charactersIgnoringModifiers];
|
||||
if ([unmod length] == 1 && [unmod characterAtIndex:0] <= 0x7f
|
||||
&& [unmod characterAtIndex:0] >= 0x60) {
|
||||
// HACK! Send Ctrl-letter keys (and C-@, C-[, C-\, C-], C-^, C-_)
|
||||
// as normal text to be added to the Vim input buffer. This must
|
||||
// be done in order for the backend to be able to separate e.g.
|
||||
// Ctrl-i and Ctrl-tab.
|
||||
[self insertText:[event characters]];
|
||||
if (unmod && [unmod length] > 0 && [unmod characterAtIndex:0] < 0x20)
|
||||
unmodIsPrintable = NO;
|
||||
|
||||
NSString *chars = [event characters];
|
||||
if ([chars length] == 1 && [chars characterAtIndex:0] < 0x20
|
||||
&& unmodIsPrintable) {
|
||||
// HACK! Send unprintable characters (such as C-@, C-[, C-\, C-],
|
||||
// C-^, C-_) as normal text to be added to the Vim input buffer.
|
||||
// This must be done in order for the backend to be able to
|
||||
// separate e.g. Ctrl-i and Ctrl-tab.
|
||||
[self insertText:chars];
|
||||
} else {
|
||||
[self dispatchKeyEvent:event];
|
||||
}
|
||||
@@ -264,10 +271,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;
|
||||
}
|
||||
|
||||
@@ -741,7 +752,7 @@ static float MMDragAreaSize = 73.0f;
|
||||
NSString *chars = [event characters];
|
||||
NSString *unmodchars = [event charactersIgnoringModifiers];
|
||||
unichar c = [chars characterAtIndex:0];
|
||||
unichar imc = [unmodchars characterAtIndex:0];
|
||||
unichar imc = [unmodchars length] > 0 ? [unmodchars characterAtIndex:0] : 0;
|
||||
int len = 0;
|
||||
const char *bytes = 0;
|
||||
int mods = [event modifierFlags];
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
- (NSString *)serverName;
|
||||
- (MMWindowController *)windowController;
|
||||
- (NSDictionary *)vimState;
|
||||
- (id)objectForVimStateKey:(NSString *)key;
|
||||
- (NSMenu *)mainMenu;
|
||||
- (BOOL)isPreloading;
|
||||
- (void)setIsPreloading:(BOOL)yn;
|
||||
|
||||
@@ -200,6 +200,11 @@ static BOOL isUnsafeMessage(int msgid);
|
||||
return vimState;
|
||||
}
|
||||
|
||||
- (id)objectForVimStateKey:(NSString *)key
|
||||
{
|
||||
return [vimState objectForKey:key];
|
||||
}
|
||||
|
||||
- (NSMenu *)mainMenu
|
||||
{
|
||||
return mainMenu;
|
||||
@@ -247,6 +252,10 @@ static BOOL isUnsafeMessage(int msgid);
|
||||
if (layout < 0 || layout > MMLayoutTabs)
|
||||
layout = MMLayoutTabs;
|
||||
|
||||
BOOL splitVert = [ud boolForKey:MMVerticalSplitKey];
|
||||
if (splitVert && MMLayoutHorizontalSplit == layout)
|
||||
layout = MMLayoutVerticalSplit;
|
||||
|
||||
NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSNumber numberWithInt:layout], @"layout",
|
||||
filenames, @"filenames",
|
||||
@@ -859,10 +868,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
@@ -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
|
||||
|
||||
+11
-1
@@ -142,8 +142,18 @@
|
||||
|
||||
- (IBAction)zoom:(id)sender
|
||||
{
|
||||
NSScreen *screen = [self screen];
|
||||
if (!screen) {
|
||||
NSLog(@"[%s] WINDOW NOT ON SCREEN, zoom to main screen", _cmd);
|
||||
screen = [NSScreen mainScreen];
|
||||
if (!screen) {
|
||||
NSLog(@"[%s] NO MAIN SCREEN, abort zoom", _cmd);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
NSRect frame = [self frame];
|
||||
NSRect defaultFrame = [[self screen] visibleFrame];
|
||||
NSRect defaultFrame = [screen visibleFrame];
|
||||
defaultFrame = [[self delegate] windowWillUseStandardFrame:self
|
||||
defaultFrame:defaultFrame];
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
MMVimView *vimView;
|
||||
BOOL setupDone;
|
||||
BOOL shouldResizeVimView;
|
||||
int shouldUpdateToolbar;
|
||||
BOOL keepOnScreen;
|
||||
BOOL fullscreenEnabled;
|
||||
NSString *windowAutosaveKey;
|
||||
|
||||
@@ -81,6 +81,7 @@
|
||||
- (BOOL)askBackendForStarRegister:(NSPasteboard *)pb;
|
||||
- (void)hideTablineSeparator:(BOOL)hide;
|
||||
- (void)doFindNext:(BOOL)next;
|
||||
- (void)updateToolbar;
|
||||
@end
|
||||
|
||||
|
||||
@@ -428,6 +429,9 @@
|
||||
// If we were to immediately resize then the vim view size would jitter
|
||||
// (e.g. hiding/showing scrollbars often happens several time in one
|
||||
// update).
|
||||
// Also delay toggling the toolbar until after scrollbars otherwise
|
||||
// problems arise when showing toolbar and scrollbar at the same time, i.e.
|
||||
// on "set go+=rT".
|
||||
|
||||
if (shouldResizeVimView) {
|
||||
shouldResizeVimView = NO;
|
||||
@@ -448,6 +452,11 @@
|
||||
|
||||
keepOnScreen = NO;
|
||||
}
|
||||
|
||||
if (shouldUpdateToolbar != 0) {
|
||||
[self updateToolbar];
|
||||
shouldUpdateToolbar = 0;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)showTabBar:(BOOL)on
|
||||
@@ -481,20 +490,16 @@
|
||||
|
||||
[toolbar setSizeMode:size];
|
||||
[toolbar setDisplayMode:mode];
|
||||
[toolbar setVisible:on];
|
||||
|
||||
if (([decoratedWindow styleMask] & NSTexturedBackgroundWindowMask) == 0) {
|
||||
if (!on) {
|
||||
[self hideTablineSeparator:YES];
|
||||
} else {
|
||||
[self hideTablineSeparator:![[vimView tabBarControl] isHidden]];
|
||||
}
|
||||
// NOTE: If the window is not visible we must toggle the toolbar
|
||||
// immediately, otherwise "set go-=T" in .gvimrc will lead to the toolbar
|
||||
// showing its hide animation every time a new window is opened. (See
|
||||
// processCommandQueueDidFinish for the reason why we need to delay
|
||||
// toggling the toolbar when the window is visible.)
|
||||
if ([decoratedWindow isVisible]) {
|
||||
shouldUpdateToolbar = on ? 1 : -1;
|
||||
} else {
|
||||
// Textured windows don't have a line below there title bar, so we
|
||||
// need the separator in this case as well. In fact, the only case
|
||||
// where we don't need the separator is when the tab bar control
|
||||
// is visible (because it brings its own separator).
|
||||
[self hideTablineSeparator:![[vimView tabBarControl] isHidden]];
|
||||
[self updateToolbar];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -757,7 +762,19 @@
|
||||
|
||||
- (void)windowDidMove:(NSNotification *)notification
|
||||
{
|
||||
if (setupDone && windowAutosaveKey) {
|
||||
if (!setupDone)
|
||||
return;
|
||||
|
||||
if (fullscreenEnabled) {
|
||||
// HACK! The full-screen is not supposed to be able to be moved. If we
|
||||
// do get here while in full-screen something unexpected happened (e.g.
|
||||
// the full-screen window was on an external display that got
|
||||
// unplugged) and we handle this situation by leaving full-screen.
|
||||
[self leaveFullscreen];
|
||||
return;
|
||||
}
|
||||
|
||||
if (windowAutosaveKey) {
|
||||
NSRect frame = [decoratedWindow frame];
|
||||
NSPoint topLeft = { frame.origin.x, NSMaxY(frame) };
|
||||
NSString *topLeftString = NSStringFromPoint(topLeft);
|
||||
@@ -774,7 +791,11 @@
|
||||
// size in updateResizeConstraints since the screen's visible frame may
|
||||
// change at any time (dock could move, resolution could change, window
|
||||
// could be moved to another screen, ...).
|
||||
if (![win screen])
|
||||
return proposedFrameSize;
|
||||
|
||||
// NOTE: Not called in full-screen mode so use "visibleFrame" instead of
|
||||
// "frame".
|
||||
NSRect maxFrame = [self constrainFrame:[[win screen] visibleFrame]];
|
||||
|
||||
if (proposedFrameSize.width > maxFrame.size.width)
|
||||
@@ -891,24 +912,28 @@
|
||||
|
||||
NSRect newFrame = [decoratedWindow frameRectForContentRect:contentRect];
|
||||
|
||||
// Ensure that the window fits inside the visible part of the screen.
|
||||
NSRect maxFrame = [[decoratedWindow screen] visibleFrame];
|
||||
maxFrame = [self constrainFrame:maxFrame];
|
||||
if ([decoratedWindow screen]) {
|
||||
// Ensure that the window fits inside the visible part of the screen.
|
||||
// NOTE: Not called in full-screen mode so use "visibleFrame' instead
|
||||
// of "frame".
|
||||
NSRect maxFrame = [[decoratedWindow screen] visibleFrame];
|
||||
maxFrame = [self constrainFrame:maxFrame];
|
||||
|
||||
if (newFrame.size.width > maxFrame.size.width) {
|
||||
newFrame.size.width = maxFrame.size.width;
|
||||
newFrame.origin.x = maxFrame.origin.x;
|
||||
}
|
||||
if (newFrame.size.height > maxFrame.size.height) {
|
||||
newFrame.size.height = maxFrame.size.height;
|
||||
newFrame.origin.y = maxFrame.origin.y;
|
||||
}
|
||||
|
||||
if (onScreen) {
|
||||
if (newFrame.origin.y < maxFrame.origin.y)
|
||||
if (newFrame.size.width > maxFrame.size.width) {
|
||||
newFrame.size.width = maxFrame.size.width;
|
||||
newFrame.origin.x = maxFrame.origin.x;
|
||||
}
|
||||
if (newFrame.size.height > maxFrame.size.height) {
|
||||
newFrame.size.height = maxFrame.size.height;
|
||||
newFrame.origin.y = maxFrame.origin.y;
|
||||
if (NSMaxX(newFrame) > NSMaxX(maxFrame))
|
||||
newFrame.origin.x = NSMaxX(maxFrame) - newFrame.size.width;
|
||||
}
|
||||
|
||||
if (onScreen) {
|
||||
if (newFrame.origin.y < maxFrame.origin.y)
|
||||
newFrame.origin.y = maxFrame.origin.y;
|
||||
if (NSMaxX(newFrame) > NSMaxX(maxFrame))
|
||||
newFrame.origin.x = NSMaxX(maxFrame) - newFrame.size.width;
|
||||
}
|
||||
}
|
||||
|
||||
[decoratedWindow setFrame:newFrame display:YES];
|
||||
@@ -917,7 +942,15 @@
|
||||
- (NSSize)constrainContentSizeToScreenSize:(NSSize)contentSize
|
||||
{
|
||||
NSWindow *win = [self window];
|
||||
NSRect rect = [win contentRectForFrameRect:[[win screen] visibleFrame]];
|
||||
if (![win screen])
|
||||
return contentSize;
|
||||
|
||||
// NOTE: This may be called in both windowed and full-screen mode. The
|
||||
// "visibleFrame" method does not overlap menu and dock so should not be
|
||||
// used in full-screen.
|
||||
NSRect screenRect = fullscreenEnabled ? [[win screen] frame]
|
||||
: [[win screen] visibleFrame];
|
||||
NSRect rect = [win contentRectForFrameRect:screenRect];
|
||||
|
||||
if (contentSize.height > rect.size.height)
|
||||
contentSize.height = rect.size.height;
|
||||
@@ -1025,4 +1058,27 @@
|
||||
[vimController addVimInput:input];
|
||||
}
|
||||
|
||||
- (void)updateToolbar
|
||||
{
|
||||
NSToolbar *toolbar = [decoratedWindow toolbar];
|
||||
if (!toolbar) return;
|
||||
|
||||
BOOL on = shouldUpdateToolbar > 0 ? YES : NO;
|
||||
[toolbar setVisible:on];
|
||||
|
||||
if (([decoratedWindow styleMask] & NSTexturedBackgroundWindowMask) == 0) {
|
||||
if (!on) {
|
||||
[self hideTablineSeparator:YES];
|
||||
} else {
|
||||
[self hideTablineSeparator:![[vimView tabBarControl] isHidden]];
|
||||
}
|
||||
} else {
|
||||
// Textured windows don't have a line below there title bar, so we
|
||||
// need the separator in this case as well. In fact, the only case
|
||||
// where we don't need the separator is when the tab bar control
|
||||
// is visible (because it brings its own separator).
|
||||
[self hideTablineSeparator:![[vimView tabBarControl] isHidden]];
|
||||
}
|
||||
}
|
||||
|
||||
@end // MMWindowController (Private)
|
||||
|
||||
+7
-6
@@ -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;
|
||||
|
||||
+1
-35
@@ -29,7 +29,7 @@ char *MessageStrings[] =
|
||||
"ShowTabBarMsgID",
|
||||
"HideTabBarMsgID",
|
||||
"SetTextRowsMsgID",
|
||||
"SetTextColumsMsgID",
|
||||
"SetTextColumnsMsgID",
|
||||
"SetTextDimensionsMsgID",
|
||||
"LiveResizeMsgID",
|
||||
"SetTextDimensionsReplyMsgID",
|
||||
@@ -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
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
0395A95A0D74D47B00881434 /* Integration.png in Resources */ = {isa = PBXBuildFile; fileRef = 0395A9590D74D47B00881434 /* Integration.png */; };
|
||||
0395A9BF0D75D02400881434 /* AuthorizedShellCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = 0395A9BE0D75D02400881434 /* AuthorizedShellCommand.m */; };
|
||||
0395A9C30D75D04D00881434 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0395A9C20D75D04D00881434 /* Security.framework */; };
|
||||
0395AA780D76E77800881434 /* Info in CopyFiles */ = {isa = PBXBuildFile; fileRef = 0395AA770D76E77800881434 /* Info */; };
|
||||
0395AAAD0D76E94000881434 /* Edit in ODBEditor.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 0395AA210D76E22700881434 /* Edit in ODBEditor.bundle */; };
|
||||
0395AA780D76E77800881434 /* Info in Copy ODBEditor */ = {isa = PBXBuildFile; fileRef = 0395AA770D76E77800881434 /* Info */; };
|
||||
0395AAAD0D76E94000881434 /* Edit in ODBEditor.bundle in Copy ODBEditor */ = {isa = PBXBuildFile; fileRef = 0395AA210D76E22700881434 /* Edit in ODBEditor.bundle */; };
|
||||
1D09AB420C6A4D520045497E /* MMTypesetter.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D09AB400C6A4D520045497E /* MMTypesetter.m */; };
|
||||
1D0E051C0BA5F83800B6049E /* Colors.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1D0E051B0BA5F83800B6049E /* Colors.plist */; };
|
||||
1D145C7F0E5227CE00691AA0 /* MMTextViewHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D145C7E0E5227CE00691AA0 /* MMTextViewHelper.m */; };
|
||||
@@ -28,28 +28,18 @@
|
||||
1D3D19120CA690FF0004A0A5 /* DejaVuSansMono-BoldOblique.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 1D3D190E0CA690FF0004A0A5 /* DejaVuSansMono-BoldOblique.ttf */; };
|
||||
1D3D19130CA690FF0004A0A5 /* DejaVuSansMono-Oblique.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 1D3D190F0CA690FF0004A0A5 /* DejaVuSansMono-Oblique.ttf */; };
|
||||
1D3D19140CA690FF0004A0A5 /* DejaVuSansMono.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 1D3D19100CA690FF0004A0A5 /* DejaVuSansMono.ttf */; };
|
||||
1D493D580C5247BF00AB718C /* Vim in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1D493D570C5247BF00AB718C /* Vim */; };
|
||||
1D493DBA0C52534300AB718C /* PSMTabBarControl.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1D493DB90C52533B00AB718C /* PSMTabBarControl.framework */; };
|
||||
1D493D580C5247BF00AB718C /* Vim in Copy Executables */ = {isa = PBXBuildFile; fileRef = 1D493D570C5247BF00AB718C /* Vim */; };
|
||||
1D493DBA0C52534300AB718C /* PSMTabBarControl.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 1D493DB90C52533B00AB718C /* PSMTabBarControl.framework */; };
|
||||
1D6008830E96886D003763F0 /* FindAndReplace.nib in Resources */ = {isa = PBXBuildFile; fileRef = 1D6008820E96886D003763F0 /* FindAndReplace.nib */; };
|
||||
1D60088B0E96A0B2003763F0 /* MMFindReplaceController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D60088A0E96A0B2003763F0 /* MMFindReplaceController.m */; };
|
||||
1D71ACB40BC702AB002F2B60 /* doc-bm-c.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D71ACA90BC702AB002F2B60 /* doc-bm-c.icns */; };
|
||||
1D71ACB50BC702AC002F2B60 /* doc-bm-h.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D71ACAA0BC702AB002F2B60 /* doc-bm-h.icns */; };
|
||||
1D71ACB60BC702AC002F2B60 /* doc-bm-html.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D71ACAB0BC702AB002F2B60 /* doc-bm-html.icns */; };
|
||||
1D71ACB70BC702AC002F2B60 /* doc-bm-java.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D71ACAC0BC702AB002F2B60 /* doc-bm-java.icns */; };
|
||||
1D71ACB80BC702AC002F2B60 /* doc-bm-php.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D71ACAD0BC702AB002F2B60 /* doc-bm-php.icns */; };
|
||||
1D71ACB90BC702AC002F2B60 /* doc-bm-pl.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D71ACAE0BC702AB002F2B60 /* doc-bm-pl.icns */; };
|
||||
1D71ACBA0BC702AC002F2B60 /* doc-bm-sh.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D71ACAF0BC702AB002F2B60 /* doc-bm-sh.icns */; };
|
||||
1D71ACBB0BC702AC002F2B60 /* doc-bm-tex.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D71ACB00BC702AB002F2B60 /* doc-bm-tex.icns */; };
|
||||
1D71ACBC0BC702AC002F2B60 /* doc-bm-txt.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D71ACB10BC702AB002F2B60 /* doc-bm-txt.icns */; };
|
||||
1D71ACBD0BC702AC002F2B60 /* doc-bm-xml.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D71ACB20BC702AB002F2B60 /* doc-bm-xml.icns */; };
|
||||
1D71ACBE0BC702AC002F2B60 /* doc-bm.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D71ACB30BC702AB002F2B60 /* doc-bm.icns */; };
|
||||
1D7F74580E4CE1AE003225C6 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D7F74570E4CE1AE003225C6 /* Sparkle.framework */; };
|
||||
1D7F745B0E4CE1CD003225C6 /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1D7F74570E4CE1AE003225C6 /* Sparkle.framework */; };
|
||||
1D7F745B0E4CE1CD003225C6 /* Sparkle.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 1D7F74570E4CE1AE003225C6 /* Sparkle.framework */; };
|
||||
1D80591F0E1185EA001699D1 /* Miscellaneous.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D80591D0E1185EA001699D1 /* Miscellaneous.m */; };
|
||||
1D80FBD40CBBD3B700102A1C /* MMFullscreenWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D80FBD00CBBD3B700102A1C /* MMFullscreenWindow.m */; };
|
||||
1D80FBD60CBBD3B700102A1C /* MMVimView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D80FBD20CBBD3B700102A1C /* MMVimView.m */; };
|
||||
1D80FBE40CBBD6F200102A1C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D80FBE30CBBD6F200102A1C /* Carbon.framework */; };
|
||||
1D9918490D299F9900A96335 /* MMAtsuiTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D9918470D299F9900A96335 /* MMAtsuiTextView.m */; };
|
||||
1D9C60520EF79C0C0034AD44 /* MacVim.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D9C602E0EF79C0C0034AD44 /* MacVim.icns */; };
|
||||
1DCD00BF0E50B2B700460166 /* Attention.png in Resources */ = {isa = PBXBuildFile; fileRef = 1DCD00AA0E50B2B700460166 /* Attention.png */; };
|
||||
1DCD00C00E50B2B700460166 /* Copy.png in Resources */ = {isa = PBXBuildFile; fileRef = 1DCD00AB0E50B2B700460166 /* Copy.png */; };
|
||||
1DCD00C10E50B2B700460166 /* Cut.png in Resources */ = {isa = PBXBuildFile; fileRef = 1DCD00AC0E50B2B700460166 /* Cut.png */; };
|
||||
@@ -72,18 +62,17 @@
|
||||
1DCD00D20E50B2B700460166 /* TagJump.png in Resources */ = {isa = PBXBuildFile; fileRef = 1DCD00BD0E50B2B700460166 /* TagJump.png */; };
|
||||
1DCD00D30E50B2B700460166 /* Undo.png in Resources */ = {isa = PBXBuildFile; fileRef = 1DCD00BE0E50B2B700460166 /* Undo.png */; };
|
||||
1DD04DEC0C529C5E006CDC2B /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 1DD04DEB0C529C5E006CDC2B /* Credits.rtf */; };
|
||||
1DD0C20C0C60FFB4008CD84A /* gvimrc in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1DD0C20A0C60FF9A008CD84A /* gvimrc */; };
|
||||
1DD0C20C0C60FFB4008CD84A /* gvimrc in Copy Vim Runtime Files */ = {isa = PBXBuildFile; fileRef = 1DD0C20A0C60FF9A008CD84A /* gvimrc */; };
|
||||
1DD3D51E0D82D4C9006E4320 /* ibeam.png in Resources */ = {isa = PBXBuildFile; fileRef = 1DD3D51D0D82D4C9006E4320 /* ibeam.png */; };
|
||||
1DD66ECE0C803D3600EBDAB3 /* MMApplication.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DD66ECC0C803D3600EBDAB3 /* MMApplication.m */; };
|
||||
1DD703B90BA9D15D008679E9 /* vim_gloss.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1DD703B80BA9D15D008679E9 /* vim_gloss.icns */; };
|
||||
1DD704310BA9F9C2008679E9 /* SpecialKeys.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1DD704300BA9F9C2008679E9 /* SpecialKeys.plist */; };
|
||||
1DD9F5E50C85D60500E8D5A5 /* SystemColors.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1DD9F5E40C85D60500E8D5A5 /* SystemColors.plist */; };
|
||||
1DE3F8E70D50F80500052B9E /* Preferences.nib in Resources */ = {isa = PBXBuildFile; fileRef = 1DE3F8E50D50F80500052B9E /* Preferences.nib */; };
|
||||
1DE3F8EB0D50F84600052B9E /* MMPreferenceController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DE3F8E90D50F84600052B9E /* MMPreferenceController.m */; };
|
||||
1DE608B40C587FDA0055263D /* runtime in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1DE602470C587FD10055263D /* runtime */; };
|
||||
1DE608B40C587FDA0055263D /* runtime in Copy Vim Runtime Files */ = {isa = PBXBuildFile; fileRef = 1DE602470C587FD10055263D /* runtime */; };
|
||||
1DE8CC620C5E2AAD003F56E3 /* Actions.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1DE8CC610C5E2AAD003F56E3 /* Actions.plist */; };
|
||||
1DE9B9500D341AB8008FEDD4 /* MMWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DE9B94E0D341AB8008FEDD4 /* MMWindow.m */; };
|
||||
1DED78600C6DE43D0079945F /* vimrc in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1DED785F0C6DE43D0079945F /* vimrc */; };
|
||||
1DED78600C6DE43D0079945F /* vimrc in Copy Vim Runtime Files */ = {isa = PBXBuildFile; fileRef = 1DED785F0C6DE43D0079945F /* vimrc */; };
|
||||
1DFE25A50C527BC4003000F7 /* PSMTabBarControl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D493DB90C52533B00AB718C /* PSMTabBarControl.framework */; };
|
||||
8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; };
|
||||
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
|
||||
@@ -130,48 +119,52 @@
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
0395AA790D76E77800881434 /* CopyFiles */ = {
|
||||
0395AA790D76E77800881434 /* Copy ODBEditor */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "Edit in ODBEditor";
|
||||
dstSubfolderSpec = 7;
|
||||
files = (
|
||||
0395AAAD0D76E94000881434 /* Edit in ODBEditor.bundle in CopyFiles */,
|
||||
0395AA780D76E77800881434 /* Info in CopyFiles */,
|
||||
0395AAAD0D76E94000881434 /* Edit in ODBEditor.bundle in Copy ODBEditor */,
|
||||
0395AA780D76E77800881434 /* Info in Copy ODBEditor */,
|
||||
);
|
||||
name = "Copy ODBEditor";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
1D0DCAD80BA3604D00B6CCFA /* CopyFiles */ = {
|
||||
1D0DCAD80BA3604D00B6CCFA /* Copy Executables */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 6;
|
||||
files = (
|
||||
1D493D580C5247BF00AB718C /* Vim in CopyFiles */,
|
||||
1D493D580C5247BF00AB718C /* Vim in Copy Executables */,
|
||||
);
|
||||
name = "Copy Executables";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
1D9EB2840C366D7B0074B739 /* CopyFiles */ = {
|
||||
1D9EB2840C366D7B0074B739 /* Copy Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
1D7F745B0E4CE1CD003225C6 /* Sparkle.framework in CopyFiles */,
|
||||
1D493DBA0C52534300AB718C /* PSMTabBarControl.framework in CopyFiles */,
|
||||
1D7F745B0E4CE1CD003225C6 /* Sparkle.framework in Copy Frameworks */,
|
||||
1D493DBA0C52534300AB718C /* PSMTabBarControl.framework in Copy Frameworks */,
|
||||
);
|
||||
name = "Copy Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
1DE608B80C58807F0055263D /* CopyFiles */ = {
|
||||
1DE608B80C58807F0055263D /* Copy Vim Runtime Files */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = vim;
|
||||
dstSubfolderSpec = 7;
|
||||
files = (
|
||||
1DED78600C6DE43D0079945F /* vimrc in CopyFiles */,
|
||||
1DD0C20C0C60FFB4008CD84A /* gvimrc in CopyFiles */,
|
||||
1DE608B40C587FDA0055263D /* runtime in CopyFiles */,
|
||||
1DED78600C6DE43D0079945F /* vimrc in Copy Vim Runtime Files */,
|
||||
1DD0C20C0C60FFB4008CD84A /* gvimrc in Copy Vim Runtime Files */,
|
||||
1DE608B40C587FDA0055263D /* runtime in Copy Vim Runtime Files */,
|
||||
);
|
||||
name = "Copy Vim Runtime Files";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
@@ -215,17 +208,6 @@
|
||||
1D6008820E96886D003763F0 /* FindAndReplace.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; path = FindAndReplace.nib; sourceTree = "<group>"; };
|
||||
1D6008890E96A0B2003763F0 /* MMFindReplaceController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMFindReplaceController.h; sourceTree = "<group>"; };
|
||||
1D60088A0E96A0B2003763F0 /* MMFindReplaceController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMFindReplaceController.m; sourceTree = "<group>"; };
|
||||
1D71ACA90BC702AB002F2B60 /* doc-bm-c.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "doc-bm-c.icns"; sourceTree = "<group>"; };
|
||||
1D71ACAA0BC702AB002F2B60 /* doc-bm-h.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "doc-bm-h.icns"; sourceTree = "<group>"; };
|
||||
1D71ACAB0BC702AB002F2B60 /* doc-bm-html.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "doc-bm-html.icns"; sourceTree = "<group>"; };
|
||||
1D71ACAC0BC702AB002F2B60 /* doc-bm-java.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "doc-bm-java.icns"; sourceTree = "<group>"; };
|
||||
1D71ACAD0BC702AB002F2B60 /* doc-bm-php.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "doc-bm-php.icns"; sourceTree = "<group>"; };
|
||||
1D71ACAE0BC702AB002F2B60 /* doc-bm-pl.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "doc-bm-pl.icns"; sourceTree = "<group>"; };
|
||||
1D71ACAF0BC702AB002F2B60 /* doc-bm-sh.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "doc-bm-sh.icns"; sourceTree = "<group>"; };
|
||||
1D71ACB00BC702AB002F2B60 /* doc-bm-tex.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "doc-bm-tex.icns"; sourceTree = "<group>"; };
|
||||
1D71ACB10BC702AB002F2B60 /* doc-bm-txt.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "doc-bm-txt.icns"; sourceTree = "<group>"; };
|
||||
1D71ACB20BC702AB002F2B60 /* doc-bm-xml.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "doc-bm-xml.icns"; sourceTree = "<group>"; };
|
||||
1D71ACB30BC702AB002F2B60 /* doc-bm.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "doc-bm.icns"; sourceTree = "<group>"; };
|
||||
1D7F74570E4CE1AE003225C6 /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Sparkle.framework; sourceTree = "<group>"; };
|
||||
1D80591D0E1185EA001699D1 /* Miscellaneous.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Miscellaneous.m; sourceTree = "<group>"; };
|
||||
1D8059220E118663001699D1 /* Miscellaneous.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Miscellaneous.h; sourceTree = "<group>"; };
|
||||
@@ -236,6 +218,7 @@
|
||||
1D80FBE30CBBD6F200102A1C /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
|
||||
1D9918460D299F9900A96335 /* MMAtsuiTextView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MMAtsuiTextView.h; sourceTree = "<group>"; };
|
||||
1D9918470D299F9900A96335 /* MMAtsuiTextView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MMAtsuiTextView.m; sourceTree = "<group>"; };
|
||||
1D9C602E0EF79C0C0034AD44 /* MacVim.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = MacVim.icns; path = icons/MacVim.icns; sourceTree = "<group>"; };
|
||||
1DCD00AA0E50B2B700460166 /* Attention.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Attention.png; path = Toolbar/Attention.png; sourceTree = "<group>"; };
|
||||
1DCD00AB0E50B2B700460166 /* Copy.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Copy.png; path = Toolbar/Copy.png; sourceTree = "<group>"; };
|
||||
1DCD00AC0E50B2B700460166 /* Cut.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Cut.png; path = Toolbar/Cut.png; sourceTree = "<group>"; };
|
||||
@@ -262,7 +245,6 @@
|
||||
1DD3D51D0D82D4C9006E4320 /* ibeam.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ibeam.png; sourceTree = "<group>"; };
|
||||
1DD66ECB0C803D3600EBDAB3 /* MMApplication.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MMApplication.h; sourceTree = "<group>"; };
|
||||
1DD66ECC0C803D3600EBDAB3 /* MMApplication.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MMApplication.m; sourceTree = "<group>"; };
|
||||
1DD703B80BA9D15D008679E9 /* vim_gloss.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = vim_gloss.icns; sourceTree = "<group>"; };
|
||||
1DD704300BA9F9C2008679E9 /* SpecialKeys.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = SpecialKeys.plist; sourceTree = "<group>"; };
|
||||
1DD9F5E40C85D60500E8D5A5 /* SystemColors.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = SystemColors.plist; sourceTree = "<group>"; };
|
||||
1DE3F8E60D50F80500052B9E /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/Preferences.nib; sourceTree = "<group>"; };
|
||||
@@ -442,27 +424,6 @@
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1DCE78490C460C6C006305A6 /* Icons */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1D71ACA90BC702AB002F2B60 /* doc-bm-c.icns */,
|
||||
1D71ACAA0BC702AB002F2B60 /* doc-bm-h.icns */,
|
||||
1D71ACAB0BC702AB002F2B60 /* doc-bm-html.icns */,
|
||||
1D71ACAC0BC702AB002F2B60 /* doc-bm-java.icns */,
|
||||
1D71ACAD0BC702AB002F2B60 /* doc-bm-php.icns */,
|
||||
1D71ACAE0BC702AB002F2B60 /* doc-bm-pl.icns */,
|
||||
1D71ACAF0BC702AB002F2B60 /* doc-bm-sh.icns */,
|
||||
1D71ACB00BC702AB002F2B60 /* doc-bm-tex.icns */,
|
||||
1D71ACB10BC702AB002F2B60 /* doc-bm-txt.icns */,
|
||||
1D71ACB20BC702AB002F2B60 /* doc-bm-xml.icns */,
|
||||
1D71ACB30BC702AB002F2B60 /* doc-bm.icns */,
|
||||
0395A8A90D72D88B00881434 /* General.png */,
|
||||
0395A9590D74D47B00881434 /* Integration.png */,
|
||||
1DD703B80BA9D15D008679E9 /* vim_gloss.icns */,
|
||||
);
|
||||
name = Icons;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1DE602460C587F760055263D /* Vim Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -517,12 +478,14 @@
|
||||
29B97317FDCFA39411CA2CEA /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1D9C602E0EF79C0C0034AD44 /* MacVim.icns */,
|
||||
1D6008820E96886D003763F0 /* FindAndReplace.nib */,
|
||||
0395A8A90D72D88B00881434 /* General.png */,
|
||||
0395A9590D74D47B00881434 /* Integration.png */,
|
||||
1D22374A0E45DF4800E6FFFF /* Advanced.png */,
|
||||
BD9DF09F0DB2BA020025C97C /* PlugInView.nib */,
|
||||
1DD3D51D0D82D4C9006E4320 /* ibeam.png */,
|
||||
1D0F11480D58C77800D5DA09 /* Font */,
|
||||
1DCE78490C460C6C006305A6 /* Icons */,
|
||||
1DE9726C0C48050600F96A9F /* Toolbar */,
|
||||
1DD9F5E40C85D60500E8D5A5 /* SystemColors.plist */,
|
||||
1DE8CC610C5E2AAD003F56E3 /* Actions.plist */,
|
||||
@@ -560,10 +523,11 @@
|
||||
8D1107290486CEB800E47090 /* Resources */,
|
||||
8D11072C0486CEB800E47090 /* Sources */,
|
||||
8D11072E0486CEB800E47090 /* Frameworks */,
|
||||
1D0DCAD80BA3604D00B6CCFA /* CopyFiles */,
|
||||
1D9EB2840C366D7B0074B739 /* CopyFiles */,
|
||||
1DE608B80C58807F0055263D /* CopyFiles */,
|
||||
0395AA790D76E77800881434 /* CopyFiles */,
|
||||
1D0DCAD80BA3604D00B6CCFA /* Copy Executables */,
|
||||
1D9EB2840C366D7B0074B739 /* Copy Frameworks */,
|
||||
1DE608B80C58807F0055263D /* Copy Vim Runtime Files */,
|
||||
0395AA790D76E77800881434 /* Copy ODBEditor */,
|
||||
1D1C31F00EFFBFD6003FE9A5 /* Make Document Icons */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -629,19 +593,7 @@
|
||||
8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */,
|
||||
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
|
||||
1D0E051C0BA5F83800B6049E /* Colors.plist in Resources */,
|
||||
1DD703B90BA9D15D008679E9 /* vim_gloss.icns in Resources */,
|
||||
1DD704310BA9F9C2008679E9 /* SpecialKeys.plist in Resources */,
|
||||
1D71ACB40BC702AB002F2B60 /* doc-bm-c.icns in Resources */,
|
||||
1D71ACB50BC702AC002F2B60 /* doc-bm-h.icns in Resources */,
|
||||
1D71ACB60BC702AC002F2B60 /* doc-bm-html.icns in Resources */,
|
||||
1D71ACB70BC702AC002F2B60 /* doc-bm-java.icns in Resources */,
|
||||
1D71ACB80BC702AC002F2B60 /* doc-bm-php.icns in Resources */,
|
||||
1D71ACB90BC702AC002F2B60 /* doc-bm-pl.icns in Resources */,
|
||||
1D71ACBA0BC702AC002F2B60 /* doc-bm-sh.icns in Resources */,
|
||||
1D71ACBB0BC702AC002F2B60 /* doc-bm-tex.icns in Resources */,
|
||||
1D71ACBC0BC702AC002F2B60 /* doc-bm-txt.icns in Resources */,
|
||||
1D71ACBD0BC702AC002F2B60 /* doc-bm-xml.icns in Resources */,
|
||||
1D71ACBE0BC702AC002F2B60 /* doc-bm.icns in Resources */,
|
||||
1DD04DEC0C529C5E006CDC2B /* Credits.rtf in Resources */,
|
||||
1DE8CC620C5E2AAD003F56E3 /* Actions.plist in Resources */,
|
||||
1DD9F5E50C85D60500E8D5A5 /* SystemColors.plist in Resources */,
|
||||
@@ -677,11 +629,30 @@
|
||||
1DCD00D20E50B2B700460166 /* TagJump.png in Resources */,
|
||||
1DCD00D30E50B2B700460166 /* Undo.png in Resources */,
|
||||
1D6008830E96886D003763F0 /* FindAndReplace.nib in Resources */,
|
||||
1D9C60520EF79C0C0034AD44 /* MacVim.icns in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
1D1C31F00EFFBFD6003FE9A5 /* Make Document Icons */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Make Document Icons";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "# Clear deployment target, else the python script always thinks we're building on Tiger\nunset MACOSX_DEPLOYMENT_TARGET\n\n# Generate the icons (redirect stderr to ignore warnings)\ncd $PROJECT_DIR/icons/\nmake OUTDIR=$TARGET_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH 2> /dev/null\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
8D11072C0486CEB800E47090 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
@@ -766,7 +737,7 @@
|
||||
i386,
|
||||
);
|
||||
COPY_PHASE_STRIP = YES;
|
||||
CURRENT_PROJECT_VERSION = 38;
|
||||
CURRENT_PROJECT_VERSION = 44;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
|
||||
@@ -807,7 +778,7 @@
|
||||
buildSettings = {
|
||||
ARCHS = "$(NATIVE_ARCH)";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 38;
|
||||
CURRENT_PROJECT_VERSION = 44;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
|
||||
@@ -826,7 +797,7 @@
|
||||
HEADER_SEARCH_PATHS = PSMTabBarControl/source/;
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
INSTALL_PATH = "$(HOME)/Applications";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.4;
|
||||
MACOSX_DEPLOYMENT_TARGET = "";
|
||||
PRODUCT_NAME = MacVim;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
WRAPPER_EXTENSION = app;
|
||||
@@ -839,7 +810,7 @@
|
||||
buildSettings = {
|
||||
ARCHS = "$(NATIVE_ARCH)";
|
||||
COPY_PHASE_STRIP = YES;
|
||||
CURRENT_PROJECT_VERSION = 38;
|
||||
CURRENT_PROJECT_VERSION = 44;
|
||||
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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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];
|
||||
|
||||
+6
-6
@@ -70,14 +70,14 @@ MacVim:
|
||||
|
||||
The main nib of MacVim.app is MainMenu.nib which contains the default menu and
|
||||
an instance of MMAppController, which is connected as the delegate of
|
||||
NSApplication. That mens, when MacVim starts it will load this nib file and
|
||||
NSApplication. That means, when MacVim starts it will load this nib file and
|
||||
automatically create an instance of the MMAppController singleton.
|
||||
|
||||
A new editor window is opened by calling
|
||||
-[MMAppController launchVimProcessWithArguments:]. This functions starts a
|
||||
new Vim process (by executing the Vim binary). The Vim process lets MacVim
|
||||
know when it has launched by calling -[MMAppController connectBackend:pid:]
|
||||
and MacVim responds to this message by calling a new frontend object
|
||||
and MacVim responds to this message by creating a new frontend object
|
||||
(MMVimController) and returns a proxy to this object back to the Vim process.
|
||||
From this point onward the Vim process communicates directly with the
|
||||
MMVimController.
|
||||
@@ -87,8 +87,8 @@ It coordinates all communication with the Vim process and delegates output
|
||||
that affects visual presentation to a MMWindowController object. Read the
|
||||
Cocoa documentation on the responsibilities of a window controller.
|
||||
|
||||
Input (keyboard & mouse) handling and drawing is handled by a MMTextView
|
||||
object.
|
||||
Input (keyboard & mouse) handling and drawing is handled by a helper object
|
||||
(MMTextViewHelper) to the current text view (MMTextView, MMAtsuiTextView).
|
||||
|
||||
|
||||
Distributed Object dangers:
|
||||
@@ -149,7 +149,7 @@ Steps to build MacVim.app (the text before the '$' shows the folder you should
|
||||
be in when executing these commands):
|
||||
|
||||
1. Configure Vim
|
||||
src/$ configure --enable-gui=macvim
|
||||
src/$ ./configure --enable-gui=macvim
|
||||
|
||||
2. Build Vim executable
|
||||
src/$ make
|
||||
@@ -161,4 +161,4 @@ The application bundle can be found inside "src/MacVim/build/Release".
|
||||
|
||||
|
||||
Bjorn Winckler <bjorn.winckler@gmail.com>
|
||||
June 22, 2008
|
||||
November 22, 2008
|
||||
|
||||
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.
+148
-91
@@ -22,13 +22,12 @@
|
||||
|
||||
// NOTE: The default font is bundled with the application.
|
||||
static NSString *MMDefaultFontName = @"DejaVu Sans Mono";
|
||||
static float MMDefaultFontSize = 12.0f;
|
||||
static float MMMinFontSize = 6.0f;
|
||||
static float MMMaxFontSize = 100.0f;
|
||||
static BOOL gui_mch_init_has_finished = NO;
|
||||
static int MMDefaultFontSize = 12;
|
||||
static int MMMinFontSize = 6;
|
||||
static int MMMaxFontSize = 100;
|
||||
|
||||
|
||||
static NSFont *gui_macvim_font_with_name(char_u *name);
|
||||
static GuiFont gui_macvim_font_with_name(char_u *name);
|
||||
static int specialKeyToNSKey(int key);
|
||||
static int vimModMaskToEventModifierFlags(int mods);
|
||||
|
||||
@@ -99,15 +98,6 @@ gui_mch_init(void)
|
||||
{
|
||||
//NSLog(@"gui_mch_init()");
|
||||
|
||||
// NOTE! Because OS X has to exec after fork we effectively end up doing
|
||||
// the initialization twice (because this function is called before the
|
||||
// fork). To avoid all this extra work we check if Vim is about to fork,
|
||||
// and if so do nothing for now.
|
||||
//
|
||||
// TODO: Is this check 100% foolproof?
|
||||
if (gui.dofork && (vim_strchr(p_go, GO_FORG) == NULL))
|
||||
return OK;
|
||||
|
||||
if (![[MMBackend sharedInstance] checkin]) {
|
||||
// TODO: Kill the process if there is no terminal to fall back on,
|
||||
// otherwise the process will run outputting to the console.
|
||||
@@ -140,8 +130,6 @@ gui_mch_init(void)
|
||||
// in [g]vimrc.
|
||||
gui_mch_adjust_charheight();
|
||||
|
||||
gui_mch_init_has_finished = YES;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -162,12 +150,6 @@ gui_mch_exit(int rc)
|
||||
int
|
||||
gui_mch_open(void)
|
||||
{
|
||||
//NSLog(@"gui_mch_open()");
|
||||
|
||||
// This check is to avoid doing extra work when we're about to fork.
|
||||
if (!gui_mch_init_has_finished)
|
||||
return OK;
|
||||
|
||||
return [[MMBackend sharedInstance] openGUIWindow];
|
||||
}
|
||||
|
||||
@@ -189,7 +171,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 +193,48 @@ gui_mch_flush(void)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gui_macvim_flush(void)
|
||||
{
|
||||
// This function counts how many times it is called and only flushes the
|
||||
// draw queue if called sufficiently often. The first few times it is
|
||||
// called it will flush often, but the more it is called the less likely is
|
||||
// it that anything will be flushed. (The counter resets itself if the
|
||||
// function isn't called for a second.)
|
||||
//
|
||||
// NOTE: Should only be used in loops where it is impossible to know how
|
||||
// often Vim needs to flush. It was written to handle output from external
|
||||
// commands (see mch_call_shell() in os_unix.c).
|
||||
|
||||
static CFAbsoluteTime lastTime = 0;
|
||||
static int delay = 1;
|
||||
static int counter = 0;
|
||||
static int scrolls = 0;
|
||||
|
||||
CFAbsoluteTime nowTime = CFAbsoluteTimeGetCurrent();
|
||||
CFAbsoluteTime delta = nowTime - lastTime;
|
||||
if (delta > 1.0)
|
||||
delay = 1;
|
||||
|
||||
// We assume that each call corresponds roughly to one line of output.
|
||||
// When one page has scrolled by we increase the delay before the next
|
||||
// flush.
|
||||
if (++scrolls > gui.num_rows) {
|
||||
delay <<= 1;
|
||||
if (delay > 2048)
|
||||
delay = 2048;
|
||||
scrolls = 0;
|
||||
}
|
||||
|
||||
if (++counter > delay) {
|
||||
gui_macvim_force_flush();
|
||||
counter = 0;
|
||||
}
|
||||
|
||||
lastTime = nowTime;
|
||||
}
|
||||
|
||||
|
||||
/* Force flush output to MacVim. Do not call this method unless absolutely
|
||||
* necessary. */
|
||||
void
|
||||
@@ -695,6 +720,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 +761,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 +922,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 +943,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 +957,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 +982,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 +1013,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 ------------------------------------------------------------
|
||||
@@ -1646,6 +1700,9 @@ gui_mch_leave_fullscreen()
|
||||
void
|
||||
gui_mch_fuopt_update()
|
||||
{
|
||||
if (!gui.in_use)
|
||||
return;
|
||||
|
||||
guicolor_T fg, bg;
|
||||
if (fuoptions_flags & FUOPT_BGCOLOR_HLGROUP) {
|
||||
syn_id2colors(fuoptions_bgcolor, &fg, &bg);
|
||||
|
||||
+7
-1
@@ -1,7 +1,7 @@
|
||||
" System gvimrc file for MacVim
|
||||
"
|
||||
" Maintainer: Bjorn Winckler <bjorn.winckler@gmail.com>
|
||||
" Last Change: Sun Oct 04 2008
|
||||
" Last Change: Sun Mar 15 2009
|
||||
"
|
||||
" This is a work in progress. If you feel so inclined, please help me improve
|
||||
" this file.
|
||||
@@ -26,6 +26,9 @@ if !exists("colors_name")
|
||||
colorscheme macvim
|
||||
endif
|
||||
|
||||
" To make tabs more readable, the label only contains the tail of the file
|
||||
" name and the buffer modified flag.
|
||||
set guitablabel=%M%t
|
||||
|
||||
|
||||
" Send print jobs to Preview.app. This does not delete the temporary ps file
|
||||
@@ -161,6 +164,9 @@ if !exists("macvim_skip_cmd_opt_movement")
|
||||
ino <D-Down> <C-End>
|
||||
map <M-Down> }
|
||||
imap <M-Down> <C-o>}
|
||||
|
||||
imap <M-BS> <C-w>
|
||||
imap <D-BS> <C-u>
|
||||
endif " !exists("macvim_skip_cmd_opt_movement")
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
.PHONY: clean
|
||||
|
||||
OUTDIR ?= .
|
||||
|
||||
$(OUTDIR)/MacVim-generic.icns: make_icons.py vim-noshadow-512.png loadfont.so Envy\ Code\ R\ Bold.ttf
|
||||
$(MAKE) -C makeicns
|
||||
/usr/bin/python make_icons.py $(OUTDIR)
|
||||
|
||||
loadfont.so: loadfont.c
|
||||
/usr/bin/python setup.py install --install-lib .
|
||||
|
||||
Envy\ Code\ R\ Bold.ttf: EnvyCodeR.zip
|
||||
unzip -jo EnvyCodeR.zip
|
||||
# unzip uses the file date from the zip file. Change the file date to
|
||||
# "now", so that the zip is not unzipped in every `make` run.`
|
||||
touch Envy\ Code\ R\ Bold.ttf
|
||||
|
||||
ENVYCODE_URL=http://download.damieng.com/latest/EnvyCodeR
|
||||
EnvyCodeR.zip:
|
||||
curl ${ENVYCODE_URL} --location -o EnvyCodeR.zip
|
||||
|
||||
clean:
|
||||
$(MAKE) -C makeicns clean
|
||||
rm -f $(OUTDIR)/MacVim-*.icns loadfont.so *.pyc \
|
||||
EnvyCodeR.zip *.ttf *.reg *.txt
|
||||
rm -rf *.egginfo build # Created by setup.py
|
||||
@@ -0,0 +1,605 @@
|
||||
from Foundation import *
|
||||
from AppKit import *
|
||||
|
||||
import itertools
|
||||
import math
|
||||
import operator
|
||||
import os
|
||||
|
||||
from optparse import OptionParser
|
||||
|
||||
|
||||
# Resources
|
||||
DEFAULT_BACKGROUND = '/System/Library/CoreServices/CoreTypes.bundle/' + \
|
||||
'Contents/Resources/GenericDocumentIcon.icns' # might require leopard?
|
||||
|
||||
|
||||
# Cache both images and background renderers globally
|
||||
imageCache = {}
|
||||
bgCache = {}
|
||||
|
||||
|
||||
# Make us not crash
|
||||
# http://www.cocoabuilder.com/archive/message/cocoa/2008/8/6/214964
|
||||
NSApplicationLoad()
|
||||
|
||||
|
||||
class Surface(object):
|
||||
"""Represents a simple bitmapped image."""
|
||||
|
||||
def __init__(self, *p, **kw):
|
||||
if not 'premultiplyAlpha' in kw:
|
||||
kw['premultiplyAlpha'] = True
|
||||
if len(p) == 1 and isinstance(p[0], NSBitmapImageRep):
|
||||
self.bitmapRep = p[0]
|
||||
elif len(p) == 2 and isinstance(p[0], int) and isinstance(p[1], int):
|
||||
format = NSAlphaFirstBitmapFormat
|
||||
if not kw['premultiplyAlpha']:
|
||||
format += NSAlphaNonpremultipliedBitmapFormat
|
||||
self.bitmapRep = NSBitmapImageRep.alloc().initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bitmapFormat_bytesPerRow_bitsPerPixel_(
|
||||
None, p[0], p[1], 8, 4, True, False, NSDeviceRGBColorSpace,
|
||||
format, 0, 0)
|
||||
|
||||
if not hasattr(self, 'bitmapRep') or not self.bitmapRep:
|
||||
raise Exception('Failed to create surface: ' + str(p))
|
||||
|
||||
def size(self):
|
||||
return map(int, self.bitmapRep.size()) # cocoa returns floats. cocoa ftw
|
||||
|
||||
def data(self):
|
||||
"""Returns data in ARGB order (on intel, at least)."""
|
||||
r = self.bitmapRep
|
||||
if r.bitmapFormat() != (NSAlphaNonpremultipliedBitmapFormat |
|
||||
NSAlphaFirstBitmapFormat) or \
|
||||
r.bitsPerPixel() != 32 or \
|
||||
r.isPlanar() or \
|
||||
r.samplesPerPixel() != 4:
|
||||
raise Exception("Unsupported image format")
|
||||
return self.bitmapRep.bitmapData()
|
||||
|
||||
def save(self, filename):
|
||||
"""Saves image as png file."""
|
||||
self.bitmapRep.representationUsingType_properties_(NSPNGFileType, None) \
|
||||
.writeToFile_atomically_(filename, True)
|
||||
|
||||
def draw(self):
|
||||
self.bitmapRep.draw()
|
||||
|
||||
def context(self):
|
||||
# Note: Cocoa only supports contexts with premultiplied alpha
|
||||
return NSGraphicsContext.graphicsContextWithBitmapImageRep_(self.bitmapRep)
|
||||
|
||||
def copy(self):
|
||||
return Surface(self.bitmapRep.copy())
|
||||
|
||||
|
||||
class Image(object):
|
||||
"""Represents an image that can consist of several Surfaces."""
|
||||
|
||||
def __init__(self, param):
|
||||
if isinstance(param, str):
|
||||
self.image = NSImage.alloc().initWithContentsOfFile_(param)
|
||||
elif isinstance(param, Surface):
|
||||
self.image = NSImage.alloc().initWithSize_( param.size() )
|
||||
self.image.addRepresentation_(param.bitmapRep)
|
||||
|
||||
if not self.image:
|
||||
raise Exception('Failed to load image: ' + str(param))
|
||||
|
||||
def surfaceOfSize(self, w, h):
|
||||
"""Returns an ARGB, non-premultiplied surface of size w*h or throws."""
|
||||
r = None
|
||||
for rep in self.image.representations():
|
||||
# Cocoa reports fraction widths for pngs (wtf?!), so use round()
|
||||
if map(lambda x: int(round(x)), rep.size()) == [w, h]:
|
||||
r = rep
|
||||
break
|
||||
|
||||
# XXX: Resample in this case? That'd make the program easier to use, but
|
||||
# can silently create blurry backgrounds. Since this happens with
|
||||
# the app icon anyways, this might not be a huge deal?
|
||||
if not r:
|
||||
raise Exception('Unsupported size %dx%d', w, h)
|
||||
return Surface(r)
|
||||
|
||||
def blend(self):
|
||||
self.compositeInRect( ((0, 0), self.image.size()) )
|
||||
|
||||
def compositeInRect(self, r, mode=NSCompositeSourceOver):
|
||||
self.image.drawInRect_fromRect_operation_fraction_(r, NSZeroRect,
|
||||
mode, 1.0)
|
||||
|
||||
def sizes(self):
|
||||
s = set()
|
||||
for rep in self.image.representations():
|
||||
s.add(tuple(map(lambda x: int(round(x)), rep.size())))
|
||||
return s
|
||||
|
||||
|
||||
class Context(object):
|
||||
# Tiger has only Python2.3, so we can't use __enter__ / __exit__ for this :-(
|
||||
|
||||
def __init__(self, surface):
|
||||
NSGraphicsContext.saveGraphicsState()
|
||||
c = surface.context()
|
||||
c.setShouldAntialias_(True);
|
||||
c.setImageInterpolation_(NSImageInterpolationHigh);
|
||||
NSGraphicsContext.setCurrentContext_(c)
|
||||
|
||||
def done(self):
|
||||
NSGraphicsContext.restoreGraphicsState()
|
||||
|
||||
|
||||
class SplittableBackground(object):
|
||||
|
||||
def __init__(self, unsplitted, shouldSplit=True):
|
||||
self.unsplitted = unsplitted
|
||||
self.shouldSplit = shouldSplit
|
||||
self.ground = {}
|
||||
self.shadow = {}
|
||||
|
||||
def rawGroundAtSize(self, s):
|
||||
return self.unsplitted.surfaceOfSize(s, s)
|
||||
|
||||
def groundAtSize(self, s):
|
||||
if not self.shouldSplit:
|
||||
return self.rawGroundAtSize(s)
|
||||
self._performSplit(s)
|
||||
return self.ground[s]
|
||||
|
||||
def shadowAtSize(self, s):
|
||||
if not self.shouldSplit:
|
||||
return None
|
||||
self._performSplit(s)
|
||||
return self.shadow[s]
|
||||
|
||||
def _performSplit(self, s):
|
||||
if s in self.ground:
|
||||
assert s in self.shadow
|
||||
return
|
||||
assert s not in self.shadow
|
||||
ground, shadow = splitGenericDocumentIcon(self.unsplitted, s)
|
||||
self.ground[s] = ground
|
||||
self.shadow[s] = shadow
|
||||
|
||||
|
||||
class BackgroundRenderer(object):
|
||||
|
||||
def __init__(self, bg, icon=None, r={}):
|
||||
self.bgRenderer = bg
|
||||
self.icon = icon
|
||||
self.cache = {}
|
||||
self.rect = r
|
||||
|
||||
def drawIcon(self, s):
|
||||
if not self.icon:
|
||||
return
|
||||
|
||||
assert s in [16, 32, 128, 256, 512]
|
||||
a = list(self.rect[s])
|
||||
|
||||
# convert from `flow` coords to cocoa
|
||||
a[2] = -a[2] # mirror y
|
||||
|
||||
w, h = s*a[1], s*a[3]
|
||||
self.icon.compositeInRect( (((s-w)/2 + a[0], (s-h)/2 + a[2]), (w, h)) )
|
||||
|
||||
def drawAtSize(self, s):
|
||||
if not self.icon:
|
||||
# No need to split the background if no icons is interleaved -- take
|
||||
# the faster code path in that case.
|
||||
self.bgRenderer.rawGroundAtSize(s).draw()
|
||||
return
|
||||
|
||||
self.bgRenderer.groundAtSize(s).draw()
|
||||
self.drawIcon(s)
|
||||
if self.bgRenderer.shouldSplit:
|
||||
# shadow needs to be composited, so it needs to be in an image
|
||||
Image(self.bgRenderer.shadowAtSize(s)).blend()
|
||||
|
||||
def backgroundAtSize(self, s):
|
||||
if not s in self.cache:
|
||||
result = Surface(s, s)
|
||||
context = Context(result)
|
||||
self.drawAtSize(s)
|
||||
context.done()
|
||||
self.cache[s] = result
|
||||
return self.cache[s]
|
||||
|
||||
|
||||
def splitGenericDocumentIcon(img, s):
|
||||
"""Takes the generic document icon and splits it into a background and a
|
||||
shadow layer. For the 32x32 and 16x16 variants, the white pixels of the page
|
||||
curl are hardcoded into the otherwise transparent shadow layer."""
|
||||
|
||||
w, h = s, s
|
||||
r = img.surfaceOfSize(w, h)
|
||||
bps = 4*w
|
||||
data = r.data()
|
||||
|
||||
ground = Surface(w, h, premultiplyAlpha=False)
|
||||
shadow = Surface(w, h, premultiplyAlpha=False)
|
||||
|
||||
grounddata = ground.data()
|
||||
shadowdata = shadow.data()
|
||||
|
||||
for y in xrange(h):
|
||||
for x in xrange(w):
|
||||
idx = y*bps + 4*x
|
||||
ia, ir, ig, ib = data[idx:idx + 4]
|
||||
if ia != chr(255):
|
||||
# buffer objects don't support slice assignment :-(
|
||||
grounddata[idx] = ia
|
||||
grounddata[idx + 1] = ir
|
||||
grounddata[idx + 2] = ig
|
||||
grounddata[idx + 3] = ib
|
||||
shadowdata[idx] = chr(0)
|
||||
shadowdata[idx + 1] = chr(0)
|
||||
shadowdata[idx + 2] = chr(0)
|
||||
shadowdata[idx + 3] = chr(0)
|
||||
continue
|
||||
|
||||
assert ir == ig == ib
|
||||
grounddata[idx] = chr(255)
|
||||
grounddata[idx + 1] = chr(255)
|
||||
grounddata[idx + 2] = chr(255)
|
||||
grounddata[idx + 3] = chr(255)
|
||||
shadowdata[idx] = chr(255 - ord(ir))
|
||||
shadowdata[idx + 1] = chr(0)
|
||||
shadowdata[idx + 2] = chr(0)
|
||||
shadowdata[idx + 3] = chr(0)
|
||||
|
||||
# Special-case 16x16 and 32x32 cases: Make some pixels on the fold white.
|
||||
# Ideally, I could make the fold whiteish in all variants, but I can't.
|
||||
whitePix = { 16: [(10, 2), (10, 3), (11, 3), (10, 4), (11, 4), (12, 4)],
|
||||
32: [(21, 4), (21, 5), (22, 5), (21, 6), (22, 6), (23, 6)]}
|
||||
if (w, h) in [(16, 16), (32, 32)]:
|
||||
for x, y in whitePix[w]:
|
||||
idx = y*bps + 4*x
|
||||
shadowdata[idx] = chr(255)
|
||||
shadowdata[idx + 1] = chr(255)
|
||||
shadowdata[idx + 2] = chr(255)
|
||||
shadowdata[idx + 3] = chr(255)
|
||||
|
||||
return ground, shadow
|
||||
|
||||
|
||||
class TextRenderer(object):
|
||||
|
||||
def __init__(self):
|
||||
self.cache = {}
|
||||
|
||||
def attribsAtSize(self, s):
|
||||
if s not in self.cache:
|
||||
self.cache[s] = self._attribsAtSize(s)
|
||||
return self.cache[s]
|
||||
|
||||
def centeredStyle(self):
|
||||
style = NSMutableParagraphStyle.new()
|
||||
style.setParagraphStyle_(NSParagraphStyle.defaultParagraphStyle())
|
||||
style.setAlignment_(NSCenterTextAlignment)
|
||||
return style
|
||||
|
||||
def _attribsAtSize(self, s):
|
||||
# This looks not exactly like the font on Preview.app's document icons,
|
||||
# but I believe that's because Preview's icons are drawn by Photoshop,
|
||||
# and Adobe's font rendering is different from Apple's.
|
||||
fontname = 'LucidaGrande-Bold'
|
||||
|
||||
# Prepare text format
|
||||
fontsizes = { 512: 72.0, 256: 36.0, 128: 18.0, 32: 7.0, 16: 3.0 }
|
||||
# http://developer.apple.com/documentation/Cocoa/Conceptual/AttributedStrings/Articles/standardAttributes.html#//apple_ref/doc/uid/TP40004903
|
||||
attribs = {
|
||||
NSParagraphStyleAttributeName: self.centeredStyle(),
|
||||
NSForegroundColorAttributeName: NSColor.colorWithDeviceWhite_alpha_(
|
||||
0.34, 1),
|
||||
NSFontAttributeName: NSFont.fontWithName_size_(fontname, fontsizes[s])
|
||||
}
|
||||
|
||||
# tighten font a bit for some sizes
|
||||
if s in [256, 512]:
|
||||
attribs[NSKernAttributeName] = -1.0
|
||||
elif s == 32:
|
||||
attribs[NSKernAttributeName] = -0.25
|
||||
|
||||
if not attribs[NSFontAttributeName]:
|
||||
raise Exception('Failed to load font %s' % fontname)
|
||||
return attribs
|
||||
|
||||
def drawTextAtSize(self, text, s):
|
||||
"""Draws text `s` into the current context of size `s`."""
|
||||
|
||||
textRects = {
|
||||
512: ((0, 7), (512, 119)),
|
||||
128: ((0, 6), (128, 26.5)),
|
||||
256: ((0, 7), (256, 57)),
|
||||
16: ((1, 1), (15, 5)),
|
||||
#32: ((1, 1), (31, 9))
|
||||
}
|
||||
|
||||
attribs = self.attribsAtSize(s)
|
||||
text = NSString.stringWithString_(text)
|
||||
if s in [16, 128, 256, 512]:
|
||||
text.drawInRect_withAttributes_(textRects[s], attribs)
|
||||
elif s == 32:
|
||||
# Try to align text on pixel boundary:
|
||||
attribs = attribs.copy()
|
||||
attribs[NSParagraphStyleAttributeName] = \
|
||||
NSParagraphStyle.defaultParagraphStyle()
|
||||
ts = text.sizeWithAttributes_(attribs)
|
||||
text.drawAtPoint_withAttributes_( (math.floor((32.0-ts[0])/2) + 0.5, 1.5),
|
||||
attribs)
|
||||
|
||||
|
||||
class OfficeTextRenderer(TextRenderer):
|
||||
"""Uses Office's LucidaSans font for 32x32.
|
||||
|
||||
This font looks much better for certain strings (e.g. "PDF") but much worse
|
||||
for most others (e.g. "VIM", "JAVA") -- and office fonts are usually not
|
||||
installed. Hence, this class is better not used.
|
||||
"""
|
||||
|
||||
def _attribsAtSize(self, s):
|
||||
self.useOfficeFont = False
|
||||
attribs = TextRenderer._attribsAtSize(self, s)
|
||||
if s == 32:
|
||||
font = NSFont.fontWithName_size_('LucidaSans-Demi', 7.0)
|
||||
if font:
|
||||
attribs[NSFontAttributeName] = font
|
||||
attribs[NSKernAttributeName] = 0
|
||||
self.useOfficeFont = True
|
||||
return attribs
|
||||
|
||||
def drawTextAtSize(self, text, s):
|
||||
attribs = self.attribsAtSize(s)
|
||||
if not self.useOfficeFont or s != 32:
|
||||
TextRenderer.drawTextAtSize(self, text, s)
|
||||
return
|
||||
text = NSString.stringWithString_(text)
|
||||
text.drawInRect_withAttributes_( ((0, 1), (31, 11)), attribs)
|
||||
|
||||
|
||||
def createIcon(s, bg, textRenderer, text):
|
||||
|
||||
# Fill in background
|
||||
output = bg.backgroundAtSize(s).copy()
|
||||
|
||||
# Draw text on top of shadow
|
||||
context = Context(output)
|
||||
if s in text and text[s]:
|
||||
textRenderer.drawTextAtSize(text[s], s)
|
||||
context.done()
|
||||
|
||||
return output
|
||||
|
||||
|
||||
def textDictFromTextList(l):
|
||||
assert 1 <= len(l) <= 3
|
||||
if len(l) == 1:
|
||||
return dict.fromkeys([16, 32, 128, 256, 512], l[0])
|
||||
elif len(l) == 2:
|
||||
return dict(zip([16, 32], 2*[l[1]]) + zip((128, 256, 512), 3*[l[0]]))
|
||||
elif len(l) == 3:
|
||||
return dict([(16, l[2]), (32, l[1])] + zip((128, 256, 512), 3*[l[0]]))
|
||||
|
||||
|
||||
def saveIcns(icons, icnsName, makeIcns='./makeicns'):
|
||||
"""Creates an icns file with several variants.
|
||||
|
||||
Params:
|
||||
icons: A dict that contains icon size as key and Surface as value.
|
||||
Valid keys are 512, 256, 128, 32, 16
|
||||
icnsname: Name of the output file
|
||||
"""
|
||||
# If IconFamily was less buggy, we could wrap it into a python module and
|
||||
# call it directly, which is about a lot faster. However, IconFamily does not
|
||||
# work with NSAlphaNonpremultipliedBitmapFormat correctly, so this has to
|
||||
# wait.
|
||||
#import IconFamily
|
||||
#typeDict = {
|
||||
#16: IconFamily.kSmall32BitData,
|
||||
#32: IconFamily.kLarge32BitData,
|
||||
#128: IconFamily.kThumbnail32BitData,
|
||||
#256: IconFamily.kIconServices256PixelDataARGB,
|
||||
#512: IconFamily.IconServices512PixelDataARGB,
|
||||
#}
|
||||
#maskDict = {
|
||||
#16: IconFamily.kSmall8BitMask,
|
||||
#32: IconFamily.kLarge8BitMask,
|
||||
#128: IconFamily.kThumbnail8BitMask,
|
||||
#}
|
||||
#output = IconFamily.IconFamily.iconFamily()
|
||||
#for s, icon in icons.items():
|
||||
#output.setIconFamilyElement_fromBitmapImageRep_(typeDict[s], icon.bitmapRep)
|
||||
#if s in maskDict:
|
||||
#output.setIconFamilyElement_fromBitmapImageRep_(
|
||||
#maskDict[s], icon.bitmapRep)
|
||||
#output.writeToFile_(icnsName)
|
||||
TMPFILE = 'docerator_tmp_%d.png'
|
||||
try:
|
||||
args = []
|
||||
for s, icon in icons.items():
|
||||
assert s in [512, 256, 128, 32, 16]
|
||||
assert icon.size() == [s, s]
|
||||
icon.save(TMPFILE % s)
|
||||
args.append('-%d %s' % (s, TMPFILE % s))
|
||||
return \
|
||||
os.system('%s %s -out %s' % (makeIcns, ' '.join(args), icnsName)) == 0
|
||||
finally:
|
||||
for s in icons:
|
||||
if os.access(TMPFILE % s, os.F_OK):
|
||||
os.remove(TMPFILE % s)
|
||||
|
||||
|
||||
def getOutname(options):
|
||||
def saneBasename(p):
|
||||
""" '/my/path/to/file.txt' -> 'file' """
|
||||
return os.path.splitext(os.path.basename(p))[0]
|
||||
textPart = 'Generic'
|
||||
if options.text:
|
||||
textPart = options.text.split(',')[0]
|
||||
if options.appicon:
|
||||
base = saneBasename(options.appicon)
|
||||
else:
|
||||
base = saneBasename(getBgName(options))
|
||||
return '%s-%s.icns' % (base, textPart)
|
||||
|
||||
|
||||
def cachedImage(filename):
|
||||
absPath = os.path.abspath(filename)
|
||||
if not absPath in imageCache:
|
||||
imageCache[absPath] = Image(absPath)
|
||||
return imageCache[absPath]
|
||||
|
||||
|
||||
def cachedBackground(img, split):
|
||||
key = (img, split)
|
||||
if not key in bgCache:
|
||||
bgCache[key] = SplittableBackground(img, shouldSplit=split)
|
||||
return bgCache[key]
|
||||
|
||||
|
||||
# taken from running flow on preview
|
||||
defaultRects = {
|
||||
16: (-0.30890000000000001, 0.4919, -1.2968, 0.4743),
|
||||
32: (-0.27810000000000001,
|
||||
0.58930000000000005,
|
||||
-2.2292999999999998,
|
||||
0.57140000000000002),
|
||||
128: (1.1774, 0.56820000000000004, -0.8246, 0.56799999999999995),
|
||||
256: (0.5917, 0.56489999999999996, -1.8994, 0.56499999999999995),
|
||||
512: (0.68700000000000006,
|
||||
0.56530000000000002,
|
||||
-4.2813999999999997,
|
||||
0.56540000000000001)
|
||||
}
|
||||
|
||||
|
||||
def getBgName(options):
|
||||
if not hasattr(options, 'background') \
|
||||
or options.background in ['default-split', 'default-unsplit']:
|
||||
return DEFAULT_BACKGROUND
|
||||
else:
|
||||
return options.background
|
||||
|
||||
|
||||
class IconGenerator(object):
|
||||
def __init__(self, options):
|
||||
if hasattr(options, 'textrenderer') and options.textrenderer:
|
||||
self.textRenderer = options.textrenderer()
|
||||
else:
|
||||
self.textRenderer = TextRenderer()
|
||||
|
||||
# Prepare input images
|
||||
splitBackground = options.background == 'default-split'
|
||||
self.bgIcon = cachedImage(getBgName(options))
|
||||
|
||||
self.testIcon = None
|
||||
if options.appicon:
|
||||
self.testIcon = cachedImage(options.appicon)
|
||||
|
||||
rects = defaultRects.copy()
|
||||
rects[16] = [ 0.0000, 0.5000, -1.0000, 0.5000] # manually, better
|
||||
if hasattr(options, 'rects'):
|
||||
rects.update(options.rects)
|
||||
|
||||
bg = cachedBackground(self.bgIcon, splitBackground)
|
||||
|
||||
if hasattr(options, 'backgroundrenderer') and options.backgroundrenderer:
|
||||
self.bgRenderer = options.backgroundrenderer(bg, self.testIcon, rects)
|
||||
else:
|
||||
self.bgRenderer = BackgroundRenderer(bg, self.testIcon, rects)
|
||||
|
||||
self.testtext = textDictFromTextList(options.text.split(','))
|
||||
|
||||
def createIconAtSize(self, s):
|
||||
return createIcon(s, self.bgRenderer, self.textRenderer, self.testtext)
|
||||
|
||||
|
||||
def iconGenerator(**kwargs):
|
||||
return IconGenerator(optsFromDict(**kwargs))
|
||||
|
||||
|
||||
def makedocicon_opts(options):
|
||||
renderer = IconGenerator(options)
|
||||
|
||||
if hasattr(options, 'sizes') and options.sizes:
|
||||
if isinstance(options.sizes, list):
|
||||
sizes = options.sizes
|
||||
else:
|
||||
sizes = map(int, options.sizes.split(','))
|
||||
else:
|
||||
sizes = renderer.bgIcon.sizes()
|
||||
if renderer.testIcon:
|
||||
sizes = sizes.intersection(renderer.testIcon.sizes())
|
||||
sizes = sorted(map(operator.itemgetter(0), sizes))
|
||||
|
||||
icons = dict([(s, renderer.createIconAtSize(s)) for s in sizes])
|
||||
|
||||
if options.debug:
|
||||
for s, icon in icons.iteritems():
|
||||
icon.save(options.debug % s)
|
||||
|
||||
if hasattr(options, 'outname') and options.outname:
|
||||
outname = options.outname
|
||||
else:
|
||||
outname = getOutname(options)
|
||||
if saveIcns(icons, outname, options.makeicns):
|
||||
print 'Wrote', outname
|
||||
else:
|
||||
print 'Failed to write %s. Make sure makeicns is in your path.' % outname
|
||||
|
||||
|
||||
def optsFromDict(**kwargs):
|
||||
options, _ = getopts().parse_args([]) # get default options
|
||||
for k in kwargs:
|
||||
setattr(options, k, kwargs[k])
|
||||
return options
|
||||
|
||||
|
||||
def makedocicon(**kwargs):
|
||||
makedocicon_opts(optsFromDict(**kwargs))
|
||||
|
||||
|
||||
def makedocicons_opts(options):
|
||||
if not hasattr(options, 'text') or not options.text:
|
||||
options.text = ['']
|
||||
texts = options.text
|
||||
for text in texts:
|
||||
options.text = text
|
||||
makedocicon_opts(options)
|
||||
|
||||
|
||||
def makedocicons(**kwargs):
|
||||
makedocicons_opts(optsFromDict(**kwargs))
|
||||
|
||||
|
||||
def getopts():
|
||||
parser = OptionParser(usage='%prog [options]', version='%prog 1.01')
|
||||
parser.add_option('--background', '--bg', default='default-split',
|
||||
help='Used as background (special values: "default-split" (default), ' \
|
||||
'"default-unsplit").')
|
||||
parser.add_option('--appicon', help='App icon, defaults to no icon.')
|
||||
|
||||
parser.add_option('--text', help='Text on icon. Defaults to empty. '
|
||||
'More than one text is supported, multiple docicons are generated in '
|
||||
'that case.', action='append')
|
||||
parser.add_option('--sizes', help='Sizes of icons. ' \
|
||||
'Defaults to all sizes available in input appicon. Example: "512,128,16"')
|
||||
# XXX(Nico): This has to go
|
||||
parser.add_option('--debug', help='If set, write out pngs for all variants.' \
|
||||
' This needs to look like "debug%d.png".')
|
||||
# XXX(Nico): This has to go once IconFamily is less buggy and can be used
|
||||
# directly
|
||||
parser.add_option('--makeicns', help='Path to makeicns binary',
|
||||
default='./makeicns')
|
||||
return parser
|
||||
|
||||
|
||||
def main():
|
||||
options, args = getopts().parse_args()
|
||||
makedocicons_opts(options)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -0,0 +1,65 @@
|
||||
import docerator
|
||||
import unittest
|
||||
|
||||
|
||||
class TextDictFromTextListTest(unittest.TestCase):
|
||||
|
||||
def testBasic(self):
|
||||
|
||||
self.assertEquals({16: 'a', 32: 'a', 128: 'a', 256: 'a', 512: 'a'},
|
||||
docerator.textDictFromTextList(['a']))
|
||||
self.assertEquals({16: 'b', 32: 'b', 128: 'a', 256: 'a', 512: 'a'},
|
||||
docerator.textDictFromTextList(['a', 'b']))
|
||||
self.assertEquals({16: 'c', 32: 'b', 128: 'a', 256: 'a', 512: 'a'},
|
||||
docerator.textDictFromTextList(['a', 'b', 'c']))
|
||||
|
||||
|
||||
class OutnameTest(unittest.TestCase):
|
||||
|
||||
class FakeOptions(object):
|
||||
def __init__(self, **kwargs):
|
||||
for k in kwargs:
|
||||
self.__setattr__(k, kwargs[k])
|
||||
|
||||
def testBasic(self):
|
||||
options = OutnameTest.FakeOptions(
|
||||
appicon = '/Applications/iTunes.app/Contents/Resources/iTunes.icns',
|
||||
text='MP3')
|
||||
self.assertEquals('iTunes-MP3.icns', docerator.getOutname(options))
|
||||
|
||||
def testTextList(self):
|
||||
options = OutnameTest.FakeOptions(
|
||||
appicon = '/Applications/iTunes.app/Contents/Resources/iTunes.icns',
|
||||
text='PYTHON,PY')
|
||||
self.assertEquals('iTunes-PYTHON.icns',
|
||||
docerator.getOutname(options))
|
||||
|
||||
def testEmptyText(self):
|
||||
options = OutnameTest.FakeOptions(
|
||||
appicon = '/Applications/iTunes.app/Contents/Resources/iTunes.icns',
|
||||
text='')
|
||||
self.assertEquals('iTunes-Generic.icns', docerator.getOutname(options))
|
||||
options = OutnameTest.FakeOptions(
|
||||
appicon = '/Applications/iTunes.app/Contents/Resources/iTunes.icns',
|
||||
text=None)
|
||||
self.assertEquals('iTunes-Generic.icns',
|
||||
docerator.getOutname(options))
|
||||
|
||||
def testEmptyIcon(self):
|
||||
options = OutnameTest.FakeOptions(appicon=None, text='MP3')
|
||||
self.assertEquals('GenericDocumentIcon-MP3.icns',
|
||||
docerator.getOutname(options))
|
||||
options = OutnameTest.FakeOptions(appicon=None, text='')
|
||||
self.assertEquals('GenericDocumentIcon-Generic.icns',
|
||||
docerator.getOutname(options))
|
||||
options = OutnameTest.FakeOptions(appicon=None, text='',
|
||||
background='/Applications/Bla/bgicon.icns')
|
||||
self.assertEquals('bgicon-Generic.icns',
|
||||
docerator.getOutname(options))
|
||||
|
||||
|
||||
# XXX(Nico): Look at the doctest module.
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,56 @@
|
||||
// A small python module that registers a font with ATS, given the name of
|
||||
// the font.
|
||||
|
||||
#include <Python/Python.h>
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <Carbon/Carbon.h>
|
||||
|
||||
static PyObject* loadfont(PyObject* self, PyObject* args) {
|
||||
PyObject* result = Py_False;
|
||||
const char* path = NULL;
|
||||
int ok = PyArg_ParseTuple(args, "s", &path);
|
||||
|
||||
if (ok) {
|
||||
CFStringRef componentPath = CFStringCreateWithCString(kCFAllocatorDefault,
|
||||
path, kCFStringEncodingUTF8);
|
||||
CFURLRef componentURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,
|
||||
componentPath, kCFURLPOSIXPathStyle, false);
|
||||
FSRef fsref;
|
||||
|
||||
if (CFURLGetFSRef(componentURL, &fsref)) {
|
||||
OSStatus err = noErr;
|
||||
ATSFontContainerRef fontContainerRef; // we don't deactivate the font
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4)
|
||||
err = ATSFontActivateFromFileReference(&fsref,
|
||||
kATSFontContextLocal, kATSFontFormatUnspecified, NULL,
|
||||
kATSOptionFlagsDefault, &fontContainerRef);
|
||||
#else
|
||||
FSSpec fsSpec;
|
||||
FSRef fsRef;
|
||||
if ((err = FSGetCatalogInfo(
|
||||
&fsRef, kFSCatInfoNone, NULL, NULL, &fsSpec, NULL)) == noErr) {
|
||||
err = ATSFontActivateFromFileSpecification(&fsSpec,
|
||||
kATSFontContextLocal, kATSFontFormatUnspecified, NULL,
|
||||
kATSOptionFlagsDefault, &fontContainerRef);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (err == noErr) {
|
||||
result = Py_True;
|
||||
}
|
||||
}
|
||||
CFRelease(componentURL);
|
||||
CFRelease(componentPath);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static PyMethodDef LoadfontMethods[] = {
|
||||
{ "loadfont", loadfont, METH_VARARGS, "Locally activates font from file." },
|
||||
{ NULL, NULL, 0, NULL }
|
||||
};
|
||||
|
||||
PyMODINIT_FUNC initloadfont(void) {
|
||||
Py_InitModule("loadfont", LoadfontMethods);
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
# Creates all of MacVim document icons.
|
||||
|
||||
# http://www.macresearch.org/cocoa-scientists-part-xx-python-scriptersmeet-cocoa
|
||||
try:
|
||||
# Make us independent of sysprefs->appearance->antialias fonts smaller than...
|
||||
# Needs to happen before docerator is imported.
|
||||
from AppKit import NSUserDefaults
|
||||
prefs = NSUserDefaults.standardUserDefaults()
|
||||
prefs.setInteger_forKey_(4, 'AppleAntiAliasingThreshold')
|
||||
|
||||
import docerator
|
||||
|
||||
# Load Envy Code R from a file and register it under its postscript name
|
||||
# Thanks to DamienG for this font (redistributed with permission):
|
||||
# http://damieng.com/blog/2008/05/26/envy-code-r-preview-7-coding-font-released
|
||||
import loadfont
|
||||
loadfont.loadfont('Envy Code R Bold.ttf')
|
||||
|
||||
from Foundation import NSString
|
||||
from AppKit import *
|
||||
|
||||
dont_create = False
|
||||
except:
|
||||
dont_create = True # most likely because we're on tiger
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
# icon types
|
||||
LARGE = 0 # 512, 128, 32, 16; about 96kB
|
||||
SMALL = 1 # 128, 32, 16; about 36kB
|
||||
LINK = 2 # Create link to generic icon; 4kB (== smallest block size on HFS+)
|
||||
|
||||
iconsizes = {
|
||||
SMALL: [128, 32, 16],
|
||||
LARGE: [512, 128, 32, 16],
|
||||
}
|
||||
|
||||
|
||||
# Resources
|
||||
MAKEICNS = 'makeicns/makeicns'
|
||||
APPICON = 'vim-noshadow-512.png'
|
||||
DEFAULT_BACKGROUND = '/System/Library/CoreServices/CoreTypes.bundle/' + \
|
||||
'Contents/Resources/GenericDocumentIcon.icns'
|
||||
|
||||
|
||||
# List of icons to create
|
||||
GENERIC_ICON_NAME = 'MacVim-generic'
|
||||
vimIcons = {
|
||||
GENERIC_ICON_NAME: [u'', LARGE],
|
||||
'MacVim-vim': [u'VIM', LARGE],
|
||||
'MacVim-txt': [u'TXT', SMALL],
|
||||
'MacVim-tex': [u'TEX', SMALL],
|
||||
'MacVim-h': [u'H', SMALL],
|
||||
'MacVim-c': [u'C', SMALL],
|
||||
'MacVim-m': [u'M', SMALL],
|
||||
'MacVim-mm': [u'MM', SMALL],
|
||||
'MacVim-cpp': [u'C\uff0b\uff0b,C++,C++', SMALL], # fullwidth plusses
|
||||
'MacVim-java': [u'JAVA', SMALL],
|
||||
'MacVim-f': [u'FTRAN', SMALL],
|
||||
'MacVim-html': [u'HTML', SMALL],
|
||||
'MacVim-xml': [u'XML', SMALL],
|
||||
'MacVim-js': [u'JS', SMALL],
|
||||
'MacVim-perl': [u'PERL,PL', SMALL],
|
||||
'MacVim-py': [u'PYTHON,PY', SMALL],
|
||||
'MacVim-php': [u'PHP', SMALL],
|
||||
'MacVim-rb': [u'RUBY,RB', SMALL],
|
||||
'MacVim-bash': [u'SH', SMALL],
|
||||
'MacVim-patch': [u'DIFF', SMALL],
|
||||
'MacVim-applescript': [u'\uf8ffSCPT,\uf8ffS', SMALL], # apple sign
|
||||
'MacVim-as': [u'FLASH', LINK],
|
||||
'MacVim-asp': [u'ASP', LINK],
|
||||
'MacVim-bib': [u'BIB', LINK],
|
||||
'MacVim-cs': [u'C#', LINK],
|
||||
'MacVim-csfg': [u'CFDG', LINK],
|
||||
'MacVim-csv': [u'CSV', LINK],
|
||||
'MacVim-tsv': [u'TSV', LINK],
|
||||
'MacVim-cgi': [u'CGI', LINK],
|
||||
'MacVim-cfg': [u'CFG', LINK],
|
||||
'MacVim-css': [u'CSS', SMALL],
|
||||
'MacVim-dtd': [u'DTD', LINK],
|
||||
'MacVim-dylan': [u'DYLAN', LINK],
|
||||
'MacVim-erl': [u'ERLANG,ERL', SMALL],
|
||||
'MacVim-fscript': [u'FSCPT,FSCR,FS', SMALL],
|
||||
'MacVim-hs': [u'HS', SMALL],
|
||||
'MacVim-inc': [u'INC', LINK],
|
||||
'MacVim-ics': [u'ICS', SMALL],
|
||||
'MacVim-ini': [u'INI', LINK],
|
||||
'MacVim-io': [u'IO', LINK],
|
||||
'MacVim-bsh': [u'BSH', LINK],
|
||||
'MacVim-properties': [u'PROP', LINK],
|
||||
'MacVim-jsp': [u'JSP', SMALL],
|
||||
'MacVim-lisp': [u'LISP,LISP,LSP', SMALL],
|
||||
'MacVim-log': [u'LOG', SMALL],
|
||||
'MacVim-wiki': [u'WIKI', SMALL],
|
||||
'MacVim-ps': [u'PS', LINK],
|
||||
#'MacVim-plist': [u'PLIST', SMALL],
|
||||
'MacVim-sch': [u'SCHEME,SCM', SMALL],
|
||||
'MacVim-sql': [u'SQL', SMALL],
|
||||
'MacVim-tcl': [u'TCL', SMALL],
|
||||
'MacVim-xsl': [u'XSL', LINK],
|
||||
'MacVim-vcf': [u'VCARD,VCF', SMALL],
|
||||
'MacVim-vb': [u'VBASIC,VB', LINK],
|
||||
'MacVim-yaml': [u'YAML,YAML,YML', SMALL],
|
||||
'MacVim-gtd': [u'GTD', LINK],
|
||||
}
|
||||
|
||||
|
||||
def createLinks(icons, target):
|
||||
assert len(icons) > 0
|
||||
for name in icons:
|
||||
icnsName = '%s.icns' % name
|
||||
if os.access(icnsName, os.F_OK):
|
||||
os.remove(icnsName)
|
||||
os.symlink(target, icnsName)
|
||||
|
||||
|
||||
if not dont_create:
|
||||
# define a few classes to render custom 16x16 icons
|
||||
|
||||
class NoTextRenderer(docerator.TextRenderer):
|
||||
def drawTextAtSize(self, text, s):
|
||||
if s == 16: return # No text at 16x16
|
||||
docerator.TextRenderer.drawTextAtSize(self, text, s)
|
||||
|
||||
class NoIconRenderer(docerator.BackgroundRenderer):
|
||||
def drawIcon(self, s):
|
||||
if s == 16: return # no "MacVim" icon on the sheet at 16x16
|
||||
docerator.BackgroundRenderer.drawIcon(self, s)
|
||||
|
||||
class SmallTextRenderer(docerator.TextRenderer):
|
||||
def _attribsAtSize(self, s):
|
||||
attribs = docerator.TextRenderer._attribsAtSize(self, s)
|
||||
if s == 16:
|
||||
font = NSFont.fontWithName_size_('EnvyCodeR-Bold', 7.0)
|
||||
assert font
|
||||
attribs[NSFontAttributeName] = font
|
||||
attribs[NSForegroundColorAttributeName] = \
|
||||
NSColor.colorWithDeviceRed_green_blue_alpha_(
|
||||
0/255.0, 82/255.0, 0/255.0, 1)
|
||||
return attribs
|
||||
|
||||
def drawTextAtSize(self, text, s):
|
||||
if s != 16:
|
||||
docerator.TextRenderer.drawTextAtSize(self, text, s)
|
||||
return
|
||||
text = NSString.stringWithString_(text.lower()[0:3]) # at most 3 chars
|
||||
attribs = self.attribsAtSize(s)
|
||||
if len(text) <= 2:
|
||||
attribs[NSKernAttributeName] = 0 # we have some space
|
||||
else:
|
||||
attribs[NSKernAttributeName] = -1 # we need all the room we can get
|
||||
text.drawInRect_withAttributes_( ((1, 2), (15, 11)), attribs)
|
||||
|
||||
|
||||
def main():
|
||||
if dont_create:
|
||||
print "PyObjC not found, only using a stock icon for document icons."
|
||||
# Can't use the constants from docerator in this case
|
||||
import shutil
|
||||
shutil.copyfile(DEFAULT_BACKGROUND, '%s.icns' % GENERIC_ICON_NAME)
|
||||
createLinks([name for name in vimIcons if name != GENERIC_ICON_NAME],
|
||||
'%s.icns' % GENERIC_ICON_NAME)
|
||||
return
|
||||
|
||||
srcdir = os.getcwd()
|
||||
if len(sys.argv) > 1:
|
||||
os.chdir(sys.argv[1])
|
||||
appIcon = os.path.join(srcdir, APPICON)
|
||||
makeIcns = os.path.join(srcdir, MAKEICNS)
|
||||
|
||||
# create LARGE and SMALL icons first...
|
||||
for name, t in vimIcons.iteritems():
|
||||
text, size = t
|
||||
if size == LINK: continue
|
||||
print name
|
||||
if name == GENERIC_ICON_NAME:
|
||||
# The generic icon has no text; make the appicon a bit larger
|
||||
docerator.makedocicon(outname='%s.icns' % name, appicon=appIcon,
|
||||
text=text, sizes=iconsizes[size], makeicns=makeIcns,
|
||||
textrenderer=NoTextRenderer, rects={16:(0.0, 0.5533, 0.0, 0.5533)})
|
||||
else:
|
||||
# For the other icons, leave out appicon and render text in Envy Code R
|
||||
docerator.makedocicon(outname='%s.icns' % name, appicon=appIcon,
|
||||
text=text, sizes=iconsizes[size], makeicns=makeIcns,
|
||||
textrenderer=SmallTextRenderer, backgroundrenderer=NoIconRenderer)
|
||||
|
||||
# ...create links later (to make sure the link targets exist)
|
||||
createLinks([name for (name, t) in vimIcons.items() if t[1] == LINK],
|
||||
'%s.icns' % GENERIC_ICON_NAME)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -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
@@ -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
|
||||
@@ -0,0 +1,173 @@
|
||||
// makeicns
|
||||
// Converts images to Apple's icns format.
|
||||
// Written by nicolasweber@gmx.de, released under MIT license.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#include "IconFamily.h"
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4
|
||||
// This is defined in 10.5 and beyond in IconStorage.h
|
||||
enum {
|
||||
kIconServices512PixelDataARGB = 'ic09' /* non-premultiplied 512x512 ARGB bitmap*/
|
||||
};
|
||||
#endif
|
||||
|
||||
#define VERSION "1.0 (20081122)"
|
||||
|
||||
void usage() {
|
||||
fprintf(stderr,
|
||||
"makeicns v%s\n\n", VERSION);
|
||||
fprintf(stderr,
|
||||
"Usage: makeicns [k1=v1] [k2=v2] ...\n\n");
|
||||
fprintf(stderr,
|
||||
"Keys and values include:\n");
|
||||
fprintf(stderr,
|
||||
" 512: Name of input image for 512x512 variant of icon\n");
|
||||
fprintf(stderr,
|
||||
" 256: Name of input image for 256x256 variant of icon\n");
|
||||
fprintf(stderr,
|
||||
" 128: Name of input image for 128x128 variant of icon\n");
|
||||
fprintf(stderr,
|
||||
" 32: Name of input image for 32x32 variant of icon\n");
|
||||
fprintf(stderr,
|
||||
" 16: Name of input image for 16x16 variant of icon\n");
|
||||
fprintf(stderr,
|
||||
" in: Name of input image for all variants not having an explicit name\n");
|
||||
fprintf(stderr,
|
||||
" out: Name of output file, defaults to first nonempty input name,\n"
|
||||
" but with icns extension\n\n");
|
||||
fprintf(stderr,
|
||||
"Examples:\n\n"
|
||||
" icns -512 image.png -32 image.png\n"
|
||||
" Creates image.icns with only a 512x512 and a 32x32 variant.\n\n"
|
||||
" icns -in myfile.jpg -32 otherfile.png -out outfile.icns\n"
|
||||
" Creates outfile.icns with sizes 512, 256, 128, and 16 containing data\n"
|
||||
" from myfile.jpg and with size 32 containing data from otherfile.png.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
NSBitmapImageRep* getBitmapImageRepOfSize(NSImage* img, int size) {
|
||||
|
||||
// Don't resample if it's not necessary
|
||||
#if 0
|
||||
// IconFamily does not work correctly with
|
||||
// NSAlphaNonpremultipliedBitmapFormat images, so this has to stay disabled
|
||||
// until IconFamily is fixed (if ever).
|
||||
NSEnumerator* e = [[img representations] objectEnumerator];
|
||||
NSImageRep* ir;
|
||||
while ((ir = [e nextObject])) {
|
||||
if (![ir isKindOfClass:[NSBitmapImageRep class]]) continue;
|
||||
|
||||
NSBitmapImageRep* br = (NSBitmapImageRep*)ir;
|
||||
//NSLog(@"%@", br);
|
||||
if ([br pixelsWide] == size && [br pixelsHigh] == size
|
||||
&& ([[br colorSpaceName] isEqualToString:NSDeviceRGBColorSpace]
|
||||
|| [[br colorSpaceName] isEqualToString:NSCalibratedRGBColorSpace])
|
||||
&& ([br bitsPerPixel] == 24 || [br bitsPerPixel] == 32)
|
||||
)
|
||||
return br;
|
||||
}
|
||||
#endif
|
||||
|
||||
NSLog(@"Resampling for size %d", size);
|
||||
NSBitmapImageRep* r = [[NSBitmapImageRep alloc]
|
||||
initWithBitmapDataPlanes:NULL
|
||||
pixelsWide:size
|
||||
pixelsHigh:size
|
||||
bitsPerSample:8
|
||||
samplesPerPixel:4
|
||||
hasAlpha:YES
|
||||
isPlanar:NO
|
||||
colorSpaceName:NSDeviceRGBColorSpace
|
||||
bitmapFormat:0
|
||||
bytesPerRow:0
|
||||
bitsPerPixel:0];
|
||||
|
||||
[NSGraphicsContext saveGraphicsState];
|
||||
NSGraphicsContext* context = [NSGraphicsContext
|
||||
graphicsContextWithBitmapImageRep:r];
|
||||
[context setShouldAntialias:YES];
|
||||
[context setImageInterpolation:NSImageInterpolationHigh];
|
||||
[NSGraphicsContext setCurrentContext:context];
|
||||
|
||||
[img drawInRect:NSMakeRect(0, 0, size, size)
|
||||
fromRect:NSZeroRect
|
||||
operation:NSCompositeCopy
|
||||
fraction:1.0];
|
||||
|
||||
[NSGraphicsContext restoreGraphicsState];
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
int i;
|
||||
|
||||
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
||||
NSApplicationLoad();
|
||||
|
||||
struct {
|
||||
NSString* paramName;
|
||||
OSType type, mask;
|
||||
int size;
|
||||
NSString* inputName;
|
||||
} inputs[] = {
|
||||
{ @"512", kIconServices512PixelDataARGB, 0, 512, nil },
|
||||
{ @"256", kIconServices256PixelDataARGB, 0, 256, nil },
|
||||
{ @"128", kThumbnail32BitData, kThumbnail8BitMask, 128, nil },
|
||||
{ @"32", kLarge32BitData, kLarge8BitMask, 32, nil },
|
||||
{ @"16", kSmall32BitData, kSmall8BitMask, 16, nil },
|
||||
};
|
||||
const int N = sizeof(inputs)/sizeof(inputs[0]);
|
||||
|
||||
// Process arguments -- Thanks Greg!
|
||||
//http://unixjunkie.blogspot.com/2006/07/command-line-processing-in-cocoa.html
|
||||
NSUserDefaults* args = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
BOOL foundInputParam = NO;
|
||||
NSString* outputName = [args stringForKey:@"out"];
|
||||
NSString* defaultIn = [args stringForKey:@"in"];
|
||||
for (i = 0; i < N; ++i) {
|
||||
inputs[i].inputName = [args stringForKey:inputs[i].paramName];
|
||||
if (inputs[i].inputName == nil)
|
||||
inputs[i].inputName = defaultIn;
|
||||
foundInputParam = foundInputParam || inputs[i].inputName != nil;
|
||||
|
||||
// Create default output name if necessary
|
||||
if (outputName == nil && inputs[i].inputName != nil)
|
||||
outputName = [[inputs[i].inputName stringByDeletingPathExtension]
|
||||
stringByAppendingPathExtension:@"icns"];
|
||||
}
|
||||
|
||||
if (!foundInputParam)
|
||||
usage();
|
||||
|
||||
// Create output
|
||||
IconFamily* output = [IconFamily iconFamily];
|
||||
|
||||
for (i = 0; i < N; ++i) {
|
||||
if (inputs[i].inputName == nil) continue;
|
||||
NSImage* img = [[[NSImage alloc] initWithContentsOfFile:inputs[i].inputName]
|
||||
autorelease];
|
||||
|
||||
NSBitmapImageRep* rep = getBitmapImageRepOfSize(img, inputs[i].size);
|
||||
[output setIconFamilyElement:inputs[i].type fromBitmapImageRep:rep];
|
||||
if (inputs[i].mask != 0)
|
||||
[output setIconFamilyElement:inputs[i].mask fromBitmapImageRep:rep];
|
||||
}
|
||||
|
||||
// Write output
|
||||
if ([output writeToFile:outputName])
|
||||
NSLog(@"Wrote output file \"%@\"", outputName);
|
||||
else
|
||||
NSLog(@"Failed to write \"%@\"", outputName);
|
||||
|
||||
[pool drain];
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
from distutils.core import setup, Extension
|
||||
|
||||
setup(name="loadfont", version="1.0",
|
||||
ext_modules = [Extension("loadfont", ["loadfont.c"])])
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 65 KiB |
+121
-20
@@ -41,37 +41,138 @@
|
||||
-->
|
||||
|
||||
<item>
|
||||
<title>Snapshot 38 released</title>
|
||||
<title>Snapshot 44 released</title>
|
||||
<description><![CDATA[
|
||||
<h1>MacVim snapshot 38 released</h1>
|
||||
<h1>MacVim snapshot 44 released</h1>
|
||||
|
||||
<p> Snapshot 37 had a problem with the "Login shell" option, so I've built a new snapshot containing a fix (by Ben Schmidt).</p>
|
||||
|
||||
<p> Changes since snapshot 37:
|
||||
<p> Changes since snapshot 43:
|
||||
<ul>
|
||||
<li> Dropping multiple files on a window no longer results in an error </li>
|
||||
<li> Fix "Login shell" problems (Ben Schmidt) </li>
|
||||
<li> Exit Vim process if connection becomes invalid -- this should avoid the system log filling up with error messages, but please let me know when it happens (and send me the output from Console.app) </li>
|
||||
<li> The color table had many erroneous entries which have been corrected (Zvezdan Petkovic) </li>
|
||||
<li> Ctrl+tab works again </li>
|
||||
<li> Tab labels only show file tail by default to make them more legible (reset to default by adding "set guitablabel&" to .gvimrc) </li>
|
||||
<li> The number of columns does not change on ":set go+=rT" </li>
|
||||
<li> Fixed problems with view not maximizing when entering full-screen and the Dock was visible </li>
|
||||
<li> Fix various problems related to having windows on a screen that got unplugged (fixes Issue 162) </li>
|
||||
<li> Latest source code version and runtime files (e.g. the Python syntax file is fixed, fixes Issue 160) </li>
|
||||
</ul>
|
||||
</p>
|
||||
]]></description>
|
||||
<pubDate>Sat, 21 Nov 2008 16:26 CET</pubDate>
|
||||
<pubDate>Sun, 29 Mar 2009 16:56 CET</pubDate>
|
||||
<enclosure type="application/octet-stream"
|
||||
url="http://newmacvim.muskokamug.org/mirror/files/MacVim-snapshot-38.tbz"
|
||||
length="8007082"
|
||||
sparkle:version="38"
|
||||
url="http://newmacvim.muskokamug.org/mirror/files/MacVim-snapshot-44.tbz"
|
||||
length="8139075"
|
||||
sparkle:version="44"
|
||||
sparkle:shortVersionString="7.2"
|
||||
/>
|
||||
</item>
|
||||
|
||||
|
||||
<item>
|
||||
<title>Snapshot 37 released</title>
|
||||
<title>Snapshot 43 released</title>
|
||||
<description><![CDATA[
|
||||
<h1>MacVim snapshot 37 released</h1>
|
||||
<h1>MacVim snapshot 43 released</h1>
|
||||
|
||||
<p> Changes since snapshot 36:
|
||||
<p><b>The automatic updating feature is broken in snapshots 39 and 40. If the automatic updating never finishes extracting then you are affected by this bug and will have to upgrade manually. To do so, simply go to the <a href="http://code.google.com/p/macvim/wiki/Snapshot">Snapshot page</a> to download the latest version.</b></p>
|
||||
|
||||
<p> Changes since snapshot 42:
|
||||
<ul>
|
||||
<li> Do inclusive search when opening files (Jonathon Mah) </li>
|
||||
<li> Respect layout prefs when double-clicking an already open file </li>
|
||||
<li> Fix two minor memory leaks </li>
|
||||
<li> Ctrl-] works on German keyboard layout </li>
|
||||
<li> The .viminfo file is written on Cmd-q </li>
|
||||
<li> New 16x16 icons (Nico Weber) </li>
|
||||
<li> Untitled window again opens on reopen event if requested in prefs </li>
|
||||
<li> Fork earlier; fixes bug with 'autochdir', faster startup, "f" no longer supported in 'guioptions' </li>
|
||||
<li> Some other minor bug fixes </li>
|
||||
<li> Use latest runtime files and Vim patches </li>
|
||||
</ul>
|
||||
</p>
|
||||
]]></description>
|
||||
<pubDate>Fri, 20 Feb 2009 13:49 CET</pubDate>
|
||||
<enclosure type="application/octet-stream"
|
||||
url="http://newmacvim.muskokamug.org/mirror/files/MacVim-snapshot-43.tbz"
|
||||
length="8136440"
|
||||
sparkle:version="43"
|
||||
sparkle:shortVersionString="7.2"
|
||||
/>
|
||||
</item>
|
||||
|
||||
|
||||
<item>
|
||||
<title>Snapshot 42 released</title>
|
||||
<description><![CDATA[
|
||||
<h1>MacVim snapshot 42 released</h1>
|
||||
|
||||
<p><b>The automatic updating feature is broken in snapshots 39 and 40. If the automatic updating never finishes extracting then you are affected by this bug and will have to upgrade manually. To do so, simply go to the <a href="http://code.google.com/p/macvim/wiki/Snapshot">Snapshot page</a> to download the latest version.</b></p>
|
||||
|
||||
<p> Changes since snapshot 40:
|
||||
<ul>
|
||||
<li> The menu bar behaves better when using full-screen and switching Spaces (Nico Weber) </li>
|
||||
<li> Don't switch Spaces when using "mvim" on one Space and a MacVim window is open on another Space </li>
|
||||
<li> Add user default to toggle the "add tab" button on the tabline (to disable, enter "defaults org.vim.MacVim MMShowAddTabButton 0" in Terminal) </li>
|
||||
<li> Avoid the "Press ENTER..." prompt when dragging and dropping </li>
|
||||
<li> Faster startup (and shutdown, but you're not likely to notice that unless you are me ;-) </li>
|
||||
<li> Automatic updating works again </li>
|
||||
<li> Possible to interrupt external commands (e.g. you can Ctrl-C during a lenghty :grep now) </li>
|
||||
<li> The output from external commands is displayed "interactively" (i.e. you don't have to wait for the command to finish before any output is drawn; try ":!ls -l /usr/lib" and compare with snap 40 to see what I mean) </li>
|
||||
<li> Cmd-. sends SIGINT (so that if a Vim process is stuck you should always be able to interrupt it with Cmd-. even if Ctrl-C doesn't work) </li>
|
||||
<li> Fix crashing bug: e.g. with snap 40 if you go to the src/ folder of Vim and type ":grep a *.c" MacVim would crash </li>
|
||||
<li> Toggle loading of default font with user default MMLoadDefaultFont </li>
|
||||
</ul>
|
||||
</p>
|
||||
]]></description>
|
||||
<pubDate>Sat, 12 Jan 2009 16:12 CET</pubDate>
|
||||
<enclosure type="application/octet-stream"
|
||||
url="http://newmacvim.muskokamug.org/mirror/files/MacVim-snapshot-42.tbz"
|
||||
length="8131516"
|
||||
sparkle:version="42"
|
||||
sparkle:shortVersionString="7.2"
|
||||
/>
|
||||
</item>
|
||||
|
||||
|
||||
<item>
|
||||
<title>Snapshot 40 released</title>
|
||||
<description><![CDATA[
|
||||
<h1>MacVim snapshot 40 released</h1>
|
||||
|
||||
<p> Changes since snapshot 39:
|
||||
<ul>
|
||||
<li> Fix problems with Quickstart "leaking" Vim processes </li>
|
||||
<li> 'imdisable' now on by default (i.e. IM is disabled by default) </li>
|
||||
<li> Clipboard support in non-GUI mode (Kent Sibilev) </li>
|
||||
<li> New document icons, more filetype associations (Nico Weber) </li>
|
||||
<li> Add support for 'guitabtooltip' (hint: add the line "set gtl=%t gtt=%F" to your .gvimrc to make tabs display the name of the file and have the tooltip display the full path) (Jonathon Mah) </li>
|
||||
<li> Look for toolbar icons in runtime path (plugins such as TVO now display toolbar icons properly) </li>
|
||||
<li> Show dialog when clicking to close tab with modified buffers </li>
|
||||
<li> Update documentation </li>
|
||||
<li> Latest runtime files, and Vim patches </li>
|
||||
</ul>
|
||||
</p>
|
||||
]]></description>
|
||||
<pubDate>Sun, 28 Dec 2008 17:26 CET</pubDate>
|
||||
<enclosure type="application/octet-stream"
|
||||
url="http://newmacvim.muskokamug.org/mirror/files/MacVim-snapshot-40.tbz"
|
||||
length="8138981"
|
||||
sparkle:version="40"
|
||||
sparkle:shortVersionString="7.2"
|
||||
/>
|
||||
</item>
|
||||
|
||||
|
||||
<item>
|
||||
<title>Snapshot 39 released</title>
|
||||
<description><![CDATA[
|
||||
<h1>MacVim snapshot 39 released</h1>
|
||||
|
||||
<p> Changes since snapshot 36 (snapshots 37 and 38 were skipped):
|
||||
<ul>
|
||||
<li> Avoid "Stray process..." warning messages (Ben Schmidt) </li>
|
||||
<li> Add Cmd-BackSpace and Alt-BackSpace insert mode mappings (Nico Weber) </li>
|
||||
<li> Dropping multiple files on a window no longer results in an error </li>
|
||||
<li> Fix "Login shell" problems (Ben Schmidt) </li>
|
||||
<li> Exit Vim process if connection becomes invalid -- this should avoid the system log filling up with error messages, but please let me know when it happens (and send me the output from Console.app) </li>
|
||||
<li> Fix bug where Vim would crash when resizing a window with double-width characters </li>
|
||||
<li> Add option 'macmeta' to use "alt/option" as meta key to allow bindings to <M-..> (see ":h 'macmeta') </li>
|
||||
<li> Add basic support for AppleScript (Jason Foreman). E.g. to zoom a window:
|
||||
@@ -91,15 +192,15 @@ end tell
|
||||
<li> Tentative support for receiving input from system services (Try this: insert "2+3", select the text, then hit Cmd-*. Result: "2+3" is replaced with "5". Sometimes it seems you have to choose "MacVim->Services->Script Editor->Get Result of AppleScript" instead of pressing Cmd-* for this to work.) </li>
|
||||
<li> No more Vim zombie processes </li>
|
||||
<li> Add "Reload"/"Ignore All" buttons to the file changed dialog </li>
|
||||
<li> (Almost) Latest runtime files, and Vim patches </li>
|
||||
<li> Latest runtime files, and Vim patches </li>
|
||||
</ul>
|
||||
</p>
|
||||
]]></description>
|
||||
<pubDate>Sat, 15 Nov 2008 13:04 CET</pubDate>
|
||||
<pubDate>Sun, 23 Nov 2008 18:09 CET</pubDate>
|
||||
<enclosure type="application/octet-stream"
|
||||
url="http://newmacvim.muskokamug.org/mirror/files/MacVim-snapshot-37.tbz"
|
||||
length="8007921"
|
||||
sparkle:version="37"
|
||||
url="http://newmacvim.muskokamug.org/mirror/files/MacVim-snapshot-39.tbz"
|
||||
length="8012682"
|
||||
sparkle:version="39"
|
||||
sparkle:shortVersionString="7.2"
|
||||
/>
|
||||
</item>
|
||||
|
||||
@@ -354,6 +354,9 @@ MSVCVER = 9.0
|
||||
!if "$(_NMAKE_VER)" == "9.00.21022.08"
|
||||
MSVCVER = 9.0
|
||||
!endif
|
||||
!if "$(_NMAKE_VER)" == "9.00.30729.01"
|
||||
MSVCVER = 9.0
|
||||
!endif
|
||||
!endif
|
||||
|
||||
# Abort bulding VIM if version of VC is unrecognised.
|
||||
|
||||
Vendored
+78
-9
@@ -11565,6 +11565,67 @@ _ACEOF
|
||||
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:$LINENO: checking for working volatile" >&5
|
||||
$as_echo_n "checking for working volatile... " >&6; }
|
||||
if test "${ac_cv_c_volatile+set}" = set; then
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
volatile int x;
|
||||
int * volatile y = (int *) 0;
|
||||
return !x && !y;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (ac_try="$ac_compile"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
||||
$as_echo "$ac_try_echo") >&5
|
||||
(eval "$ac_compile") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_c_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest.$ac_objext; then
|
||||
ac_cv_c_volatile=yes
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_c_volatile=no
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_volatile" >&5
|
||||
$as_echo "$ac_cv_c_volatile" >&6; }
|
||||
if test $ac_cv_c_volatile = no; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define volatile /**/
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:$LINENO: checking for mode_t" >&5
|
||||
$as_echo_n "checking for mode_t... " >&6; }
|
||||
if test "${ac_cv_type_mode_t+set}" = set; then
|
||||
@@ -16819,21 +16880,29 @@ if test "x$MACARCH" = "xboth"; then
|
||||
LDFLAGS="$LDFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:$LINENO: checking for GCC 3 or later" >&5
|
||||
$as_echo_n "checking for GCC 3 or later... " >&6; }
|
||||
DEPEND_CFLAGS_FILTER=
|
||||
if test "$GCC" = yes; then
|
||||
{ $as_echo "$as_me:$LINENO: checking for GCC 3 or later" >&5
|
||||
$as_echo_n "checking for GCC 3 or later... " >&6; }
|
||||
gccmajor=`echo "$gccversion" | sed -e 's/^\([1-9]\)\..*$/\1/g'`
|
||||
if test "$gccmajor" -gt "2"; then
|
||||
DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
|
||||
fi
|
||||
fi
|
||||
if test "$DEPEND_CFLAGS_FILTER" = ""; then
|
||||
{ $as_echo "$as_me:$LINENO: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:$LINENO: result: yes" >&5
|
||||
{ $as_echo "$as_me:$LINENO: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:$LINENO: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
{ $as_echo "$as_me:$LINENO: checking whether we need -D_FORTIFY_SOURCE=1" >&5
|
||||
$as_echo_n "checking whether we need -D_FORTIFY_SOURCE=1... " >&6; }
|
||||
if test "$gccmajor" -gt "3"; then
|
||||
CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1"
|
||||
{ $as_echo "$as_me:$LINENO: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
else
|
||||
{ $as_echo "$as_me:$LINENO: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
+79
-29
@@ -33,7 +33,7 @@ static char_u *buflist_match __ARGS((regprog_T *prog, buf_T *buf));
|
||||
static char_u *fname_match __ARGS((regprog_T *prog, char_u *name));
|
||||
#endif
|
||||
static void buflist_setfpos __ARGS((buf_T *buf, win_T *win, linenr_T lnum, colnr_T col, int copy_options));
|
||||
static wininfo_T *find_wininfo __ARGS((buf_T *buf));
|
||||
static wininfo_T *find_wininfo __ARGS((buf_T *buf, int skip_diff_buffer));
|
||||
#ifdef UNIX
|
||||
static buf_T *buflist_findname_stat __ARGS((char_u *ffname, struct stat *st));
|
||||
static int otherfile_buf __ARGS((buf_T *buf, char_u *ffname, struct stat *stp));
|
||||
@@ -437,10 +437,6 @@ close_buffer(win, buf, action)
|
||||
return;
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_NETBEANS_INTG
|
||||
if (usingNetbeans)
|
||||
netbeans_file_closed(buf);
|
||||
#endif
|
||||
#ifdef FEAT_ODB_EDITOR
|
||||
odb_buffer_close(buf);
|
||||
#endif
|
||||
@@ -643,6 +639,10 @@ free_buffer_stuff(buf, free_options)
|
||||
#ifdef FEAT_SIGNS
|
||||
buf_delete_signs(buf); /* delete any signs */
|
||||
#endif
|
||||
#ifdef FEAT_NETBEANS_INTG
|
||||
if (usingNetbeans)
|
||||
netbeans_file_killed(buf);
|
||||
#endif
|
||||
#ifdef FEAT_LOCALMAP
|
||||
map_clear_int(buf, MAP_ALL_MODES, TRUE, FALSE); /* clear local mappings */
|
||||
map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE); /* clear local abbrevs */
|
||||
@@ -651,6 +651,9 @@ free_buffer_stuff(buf, free_options)
|
||||
vim_free(buf->b_start_fenc);
|
||||
buf->b_start_fenc = NULL;
|
||||
#endif
|
||||
#ifdef FEAT_SPELL
|
||||
ga_clear(&buf->b_langp);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -816,9 +819,6 @@ do_bufdel(command, arg, addr_count, start_bnr, end_bnr, forceit)
|
||||
int bnr; /* buffer number */
|
||||
char_u *p;
|
||||
|
||||
#ifdef FEAT_NETBEANS_INTG
|
||||
netbeansCloseFile = 1;
|
||||
#endif
|
||||
if (addr_count == 0)
|
||||
{
|
||||
(void)do_buffer(command, DOBUF_CURRENT, FORWARD, 0, forceit);
|
||||
@@ -913,9 +913,6 @@ do_bufdel(command, arg, addr_count, start_bnr, end_bnr, forceit)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef FEAT_NETBEANS_INTG
|
||||
netbeansCloseFile = 0;
|
||||
#endif
|
||||
|
||||
return errormsg;
|
||||
}
|
||||
@@ -1094,7 +1091,7 @@ do_buffer(action, start, dir, count, forceit)
|
||||
#endif
|
||||
setpcmark();
|
||||
retval = do_ecmd(0, NULL, NULL, NULL, ECMD_ONE,
|
||||
forceit ? ECMD_FORCEIT : 0);
|
||||
forceit ? ECMD_FORCEIT : 0, curwin);
|
||||
|
||||
/*
|
||||
* do_ecmd() may create a new buffer, then we have to delete
|
||||
@@ -1241,7 +1238,7 @@ do_buffer(action, start, dir, count, forceit)
|
||||
* "buf" if one exists */
|
||||
if ((swb_flags & SWB_USEOPEN) && buf_jump_open_win(buf))
|
||||
return OK;
|
||||
/* If 'switchbuf' contians "usetab": jump to first window in any tab
|
||||
/* If 'switchbuf' contains "usetab": jump to first window in any tab
|
||||
* page containing "buf" if one exists */
|
||||
if ((swb_flags & SWB_USETAB) && buf_jump_open_tab(buf))
|
||||
return OK;
|
||||
@@ -1317,7 +1314,7 @@ set_curbuf(buf, action)
|
||||
setpcmark();
|
||||
if (!cmdmod.keepalt)
|
||||
curwin->w_alt_fnum = curbuf->b_fnum; /* remember alternate file */
|
||||
buflist_altfpos(); /* remember curpos */
|
||||
buflist_altfpos(curwin); /* remember curpos */
|
||||
|
||||
#ifdef FEAT_VISUAL
|
||||
/* Don't restart Select mode after switching to another buffer. */
|
||||
@@ -1402,6 +1399,9 @@ enter_buffer(buf)
|
||||
curwin->w_cursor.coladd = 0;
|
||||
#endif
|
||||
curwin->w_set_curswant = TRUE;
|
||||
#ifdef FEAT_AUTOCMD
|
||||
curwin->w_topline_was_set = FALSE;
|
||||
#endif
|
||||
|
||||
/* Make sure the buffer is loaded. */
|
||||
if (curbuf->b_ml.ml_mfp == NULL) /* need to load the file */
|
||||
@@ -1441,7 +1441,8 @@ enter_buffer(buf)
|
||||
maketitle();
|
||||
#endif
|
||||
#ifdef FEAT_AUTOCMD
|
||||
if (curwin->w_topline == 1) /* when autocmds didn't change it */
|
||||
/* when autocmds didn't change it */
|
||||
if (curwin->w_topline == 1 && !curwin->w_topline_was_set)
|
||||
#endif
|
||||
scroll_cursor_halfway(FALSE); /* redisplay at correct position */
|
||||
|
||||
@@ -2405,22 +2406,70 @@ buflist_setfpos(buf, win, lnum, col, copy_options)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef FEAT_DIFF
|
||||
static int wininfo_other_tab_diff __ARGS((wininfo_T *wip));
|
||||
|
||||
/*
|
||||
* Return TRUE when "wip" has 'diff' set and the diff is only for another tab
|
||||
* page. That's because a diff is local to a tab page.
|
||||
*/
|
||||
static int
|
||||
wininfo_other_tab_diff(wip)
|
||||
wininfo_T *wip;
|
||||
{
|
||||
win_T *wp;
|
||||
|
||||
if (wip->wi_opt.wo_diff)
|
||||
{
|
||||
for (wp = firstwin; wp != NULL; wp = wp->w_next)
|
||||
/* return FALSE when it's a window in the current tab page, thus
|
||||
* the buffer was in diff mode here */
|
||||
if (wip->wi_win == wp)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Find info for the current window in buffer "buf".
|
||||
* If not found, return the info for the most recently used window.
|
||||
* When "skip_diff_buffer" is TRUE avoid windows with 'diff' set that is in
|
||||
* another tab page.
|
||||
* Returns NULL when there isn't any info.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static wininfo_T *
|
||||
find_wininfo(buf)
|
||||
find_wininfo(buf, skip_diff_buffer)
|
||||
buf_T *buf;
|
||||
int skip_diff_buffer;
|
||||
{
|
||||
wininfo_T *wip;
|
||||
|
||||
for (wip = buf->b_wininfo; wip != NULL; wip = wip->wi_next)
|
||||
if (wip->wi_win == curwin)
|
||||
if (wip->wi_win == curwin
|
||||
#ifdef FEAT_DIFF
|
||||
&& (!skip_diff_buffer || !wininfo_other_tab_diff(wip))
|
||||
#endif
|
||||
)
|
||||
break;
|
||||
if (wip == NULL) /* if no fpos for curwin, use the first in the list */
|
||||
wip = buf->b_wininfo;
|
||||
|
||||
/* If no wininfo for curwin, use the first in the list (that doesn't have
|
||||
* 'diff' set and is in another tab page). */
|
||||
if (wip == NULL)
|
||||
{
|
||||
#ifdef FEAT_DIFF
|
||||
if (skip_diff_buffer)
|
||||
{
|
||||
for (wip = buf->b_wininfo; wip != NULL; wip = wip->wi_next)
|
||||
if (!wininfo_other_tab_diff(wip))
|
||||
break;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
wip = buf->b_wininfo;
|
||||
}
|
||||
return wip;
|
||||
}
|
||||
|
||||
@@ -2441,7 +2490,7 @@ get_winopts(buf)
|
||||
clearFolding(curwin);
|
||||
#endif
|
||||
|
||||
wip = find_wininfo(buf);
|
||||
wip = find_wininfo(buf, TRUE);
|
||||
if (wip != NULL && wip->wi_optset)
|
||||
{
|
||||
copy_winopt(&wip->wi_opt, &curwin->w_onebuf_opt);
|
||||
@@ -2473,7 +2522,7 @@ buflist_findfpos(buf)
|
||||
wininfo_T *wip;
|
||||
static pos_T no_position = {1, 0};
|
||||
|
||||
wip = find_wininfo(buf);
|
||||
wip = find_wininfo(buf, FALSE);
|
||||
if (wip != NULL)
|
||||
return &(wip->wi_fpos);
|
||||
else
|
||||
@@ -2794,14 +2843,14 @@ buflist_slash_adjust()
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set alternate cursor position for current window.
|
||||
* Set alternate cursor position for the current buffer and window "win".
|
||||
* Also save the local window option values.
|
||||
*/
|
||||
void
|
||||
buflist_altfpos()
|
||||
buflist_altfpos(win)
|
||||
win_T *win;
|
||||
{
|
||||
buflist_setfpos(curbuf, curwin, curwin->w_cursor.lnum,
|
||||
curwin->w_cursor.col, TRUE);
|
||||
buflist_setfpos(curbuf, win, win->w_cursor.lnum, win->w_cursor.col, TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3974,7 +4023,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
|
||||
width = vim_strsize(out);
|
||||
if (maxwidth > 0 && width > maxwidth)
|
||||
{
|
||||
/* Result is too long, must trunctate somewhere. */
|
||||
/* Result is too long, must truncate somewhere. */
|
||||
l = 0;
|
||||
if (itemcnt == 0)
|
||||
s = out;
|
||||
@@ -4499,7 +4548,7 @@ do_arg_all(count, forceit, keep_tabs)
|
||||
ECMD_ONE,
|
||||
((P_HID(curwin->w_buffer)
|
||||
|| bufIsChanged(curwin->w_buffer)) ? ECMD_HIDE : 0)
|
||||
+ ECMD_OLDBUF);
|
||||
+ ECMD_OLDBUF, curwin);
|
||||
#ifdef FEAT_AUTOCMD
|
||||
if (use_firstwin)
|
||||
++autocmd_no_leave;
|
||||
@@ -5059,7 +5108,8 @@ buf_spname(buf)
|
||||
*/
|
||||
FOR_ALL_TAB_WINDOWS(tp, win)
|
||||
if (win->w_buffer == buf)
|
||||
break;
|
||||
goto win_found;
|
||||
win_found:
|
||||
if (win != NULL && win->w_llist_ref != NULL)
|
||||
return _("[Location List]");
|
||||
else
|
||||
@@ -5073,7 +5123,7 @@ buf_spname(buf)
|
||||
{
|
||||
if (buf->b_sfname != NULL)
|
||||
return (char *)buf->b_sfname;
|
||||
return "[Scratch]";
|
||||
return _("[Scratch]");
|
||||
}
|
||||
#endif
|
||||
if (buf->b_fname == NULL)
|
||||
|
||||
@@ -50,6 +50,9 @@
|
||||
/* Define to empty if the keyword does not work. */
|
||||
#undef const
|
||||
|
||||
/* Define to empty if the keyword does not work. */
|
||||
#undef volatile
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#undef mode_t
|
||||
|
||||
|
||||
+14
-6
@@ -2184,6 +2184,7 @@ fi
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
AC_C_CONST
|
||||
AC_C_VOLATILE
|
||||
AC_TYPE_MODE_T
|
||||
AC_TYPE_OFF_T
|
||||
AC_TYPE_PID_T
|
||||
@@ -3188,18 +3189,25 @@ dnl use "-isystem" instead of "-I" for all non-Vim include dirs.
|
||||
dnl But only when making dependencies, cproto and lint don't take "-isystem".
|
||||
dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
|
||||
dnl the number before the version number.
|
||||
AC_MSG_CHECKING(for GCC 3 or later)
|
||||
DEPEND_CFLAGS_FILTER=
|
||||
if test "$GCC" = yes; then
|
||||
AC_MSG_CHECKING(for GCC 3 or later)
|
||||
gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'`
|
||||
if test "$gccmajor" -gt "2"; then
|
||||
DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is
|
||||
dnl declared as char x[1] but actually longer. Introduced in gcc 4.0.
|
||||
AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
|
||||
if test "$gccmajor" -gt "3"; then
|
||||
CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1"
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
if test "$DEPEND_CFLAGS_FILTER" = ""; then
|
||||
AC_MSG_RESULT(no)
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
fi
|
||||
AC_SUBST(DEPEND_CFLAGS_FILTER)
|
||||
|
||||
|
||||
+28
-11
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* diff.c: code for diff'ing two or three buffers.
|
||||
* diff.c: code for diff'ing two, three or four buffers.
|
||||
*/
|
||||
|
||||
#include "vim.h"
|
||||
@@ -73,6 +73,8 @@ diff_buf_delete(buf)
|
||||
{
|
||||
tp->tp_diffbuf[i] = NULL;
|
||||
tp->tp_diff_invalid = TRUE;
|
||||
if (tp == curtab)
|
||||
diff_redraw(TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -102,6 +104,7 @@ diff_buf_adjust(win)
|
||||
{
|
||||
curtab->tp_diffbuf[i] = NULL;
|
||||
curtab->tp_diff_invalid = TRUE;
|
||||
diff_redraw(TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -113,7 +116,7 @@ diff_buf_adjust(win)
|
||||
* Add a buffer to make diffs for.
|
||||
* Call this when a new buffer is being edited in the current window where
|
||||
* 'diff' is set.
|
||||
* Marks the current buffer as being part of the diff and requireing updating.
|
||||
* Marks the current buffer as being part of the diff and requiring updating.
|
||||
* This must be done before any autocmd, because a command may use info
|
||||
* about the screen contents.
|
||||
*/
|
||||
@@ -131,6 +134,7 @@ diff_buf_add(buf)
|
||||
{
|
||||
curtab->tp_diffbuf[i] = buf;
|
||||
curtab->tp_diff_invalid = TRUE;
|
||||
diff_redraw(TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
@@ -914,7 +929,7 @@ ex_diffpatch(eap)
|
||||
goto theend;
|
||||
|
||||
#ifdef UNIX
|
||||
/* Temporaraly chdir to /tmp, to avoid patching files in the current
|
||||
/* Temporarily chdir to /tmp, to avoid patching files in the current
|
||||
* directory when the patch file contains more than one patch. When we
|
||||
* have our own temp dir use that instead, it will be cleaned up when we
|
||||
* exit (any .rej files created). Don't change directory if we can't
|
||||
@@ -925,10 +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
|
||||
@@ -1138,7 +1153,7 @@ ex_diffoff(eap)
|
||||
|
||||
for (wp = firstwin; wp != NULL; wp = wp->w_next)
|
||||
{
|
||||
if (wp == curwin || eap->forceit)
|
||||
if (wp == curwin || (eap->forceit && wp->w_p_diff))
|
||||
{
|
||||
/* Set 'diff', 'scrollbind' off and 'wrap' on. */
|
||||
wp->w_p_diff = FALSE;
|
||||
@@ -2114,6 +2129,8 @@ ex_diffgetput(eap)
|
||||
EMSG2(_("E102: Can't find buffer \"%s\""), eap->arg);
|
||||
return;
|
||||
}
|
||||
if (buf == curbuf)
|
||||
return; /* nothing to do */
|
||||
idx_other = diff_buf_idx(buf);
|
||||
if (idx_other == DB_COUNT)
|
||||
{
|
||||
|
||||
+77
-24
@@ -147,6 +147,7 @@ static void ins_compl_clear __ARGS((void));
|
||||
static int ins_compl_bs __ARGS((void));
|
||||
static void ins_compl_new_leader __ARGS((void));
|
||||
static void ins_compl_addleader __ARGS((int c));
|
||||
static int ins_compl_len __ARGS((void));
|
||||
static void ins_compl_restart __ARGS((void));
|
||||
static void ins_compl_set_original_text __ARGS((char_u *str));
|
||||
static void ins_compl_addfrommatch __ARGS((void));
|
||||
@@ -197,7 +198,8 @@ static void replace_pop_ins __ARGS((void));
|
||||
static void mb_replace_pop_ins __ARGS((int cc));
|
||||
#endif
|
||||
static void replace_flush __ARGS((void));
|
||||
static void replace_do_bs __ARGS((void));
|
||||
static void replace_do_bs __ARGS((int limit_col));
|
||||
static int del_char_after_col __ARGS((int limit_col));
|
||||
#ifdef FEAT_CINDENT
|
||||
static int cindent_on __ARGS((void));
|
||||
#endif
|
||||
@@ -1933,6 +1935,8 @@ truncate_spaces(line)
|
||||
/*
|
||||
* Backspace the cursor until the given column. Handles REPLACE and VREPLACE
|
||||
* modes correctly. May also be used when not in insert mode at all.
|
||||
* Will attempt not to go before "col" even when there is a composing
|
||||
* character.
|
||||
*/
|
||||
void
|
||||
backspace_until_column(col)
|
||||
@@ -1942,13 +1946,50 @@ backspace_until_column(col)
|
||||
{
|
||||
curwin->w_cursor.col--;
|
||||
if (State & REPLACE_FLAG)
|
||||
replace_do_bs();
|
||||
else
|
||||
(void)del_char(FALSE);
|
||||
replace_do_bs(col);
|
||||
else if (!del_char_after_col(col))
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Like del_char(), but make sure not to go before column "limit_col".
|
||||
* Only matters when there are composing characters.
|
||||
* Return TRUE when something was deleted.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static int
|
||||
del_char_after_col(limit_col)
|
||||
int limit_col;
|
||||
{
|
||||
#ifdef FEAT_MBYTE
|
||||
if (enc_utf8 && limit_col >= 0)
|
||||
{
|
||||
int ecol = curwin->w_cursor.col + 1;
|
||||
|
||||
/* Make sure the cursor is at the start of a character, but
|
||||
* skip forward again when going too far back because of a
|
||||
* composing character. */
|
||||
mb_adjust_cursor();
|
||||
while (curwin->w_cursor.col < (colnr_T)limit_col)
|
||||
{
|
||||
int l = utf_ptr2len(ml_get_cursor());
|
||||
|
||||
if (l == 0) /* end of line */
|
||||
break;
|
||||
curwin->w_cursor.col += l;
|
||||
}
|
||||
if (*ml_get_cursor() == NUL || curwin->w_cursor.col == ecol)
|
||||
return FALSE;
|
||||
del_bytes((long)(ecol - curwin->w_cursor.col), FALSE, TRUE);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
(void)del_char(FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#if defined(FEAT_INS_EXPAND) || defined(PROTO)
|
||||
/*
|
||||
* CTRL-X pressed in Insert mode.
|
||||
@@ -2418,7 +2459,7 @@ ins_compl_longest_match(match)
|
||||
{
|
||||
had_match = (curwin->w_cursor.col > compl_col);
|
||||
ins_compl_delete();
|
||||
ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
|
||||
ins_bytes(compl_leader + ins_compl_len());
|
||||
ins_redraw(FALSE);
|
||||
|
||||
/* When the match isn't there (to avoid matching itself) remove it
|
||||
@@ -2470,7 +2511,7 @@ ins_compl_longest_match(match)
|
||||
*p = NUL;
|
||||
had_match = (curwin->w_cursor.col > compl_col);
|
||||
ins_compl_delete();
|
||||
ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
|
||||
ins_bytes(compl_leader + ins_compl_len());
|
||||
ins_redraw(FALSE);
|
||||
|
||||
/* When the match isn't there (to avoid matching itself) remove it
|
||||
@@ -3209,7 +3250,7 @@ ins_compl_new_leader()
|
||||
{
|
||||
ins_compl_del_pum();
|
||||
ins_compl_delete();
|
||||
ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
|
||||
ins_bytes(compl_leader + ins_compl_len());
|
||||
compl_used_match = FALSE;
|
||||
|
||||
if (compl_started)
|
||||
@@ -3263,6 +3304,20 @@ ins_compl_new_leader()
|
||||
compl_enter_selects = FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the length of the completion, from the completion start column to
|
||||
* the cursor column. Making sure it never goes below zero.
|
||||
*/
|
||||
static int
|
||||
ins_compl_len()
|
||||
{
|
||||
int off = curwin->w_cursor.col - compl_col;
|
||||
|
||||
if (off < 0)
|
||||
return 0;
|
||||
return off;
|
||||
}
|
||||
|
||||
/*
|
||||
* Append one character to the match leader. May reduce the number of
|
||||
* matches.
|
||||
@@ -3621,10 +3676,9 @@ ins_compl_prep(c)
|
||||
{
|
||||
ins_compl_delete();
|
||||
if (compl_leader != NULL)
|
||||
ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
|
||||
ins_bytes(compl_leader + ins_compl_len());
|
||||
else if (compl_first_match != NULL)
|
||||
ins_bytes(compl_orig_text
|
||||
+ curwin->w_cursor.col - compl_col);
|
||||
ins_bytes(compl_orig_text + ins_compl_len());
|
||||
retval = TRUE;
|
||||
}
|
||||
|
||||
@@ -4187,7 +4241,7 @@ ins_compl_get_exp(ini)
|
||||
}
|
||||
|
||||
/* check if compl_curr_match has changed, (e.g. other type of
|
||||
* expansion added somenthing) */
|
||||
* expansion added something) */
|
||||
if (type != 0 && compl_curr_match != old_match)
|
||||
found_new_match = OK;
|
||||
|
||||
@@ -4256,7 +4310,7 @@ ins_compl_delete()
|
||||
static void
|
||||
ins_compl_insert()
|
||||
{
|
||||
ins_bytes(compl_shown_match->cp_str + curwin->w_cursor.col - compl_col);
|
||||
ins_bytes(compl_shown_match->cp_str + ins_compl_len());
|
||||
if (compl_shown_match->cp_flags & ORIGINAL_TEXT)
|
||||
compl_used_match = FALSE;
|
||||
else
|
||||
@@ -4425,7 +4479,7 @@ ins_compl_next(allow_get_expansion, count, insert_match)
|
||||
if (!compl_get_longest || compl_used_match)
|
||||
ins_compl_insert();
|
||||
else
|
||||
ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
|
||||
ins_bytes(compl_leader + ins_compl_len());
|
||||
}
|
||||
else
|
||||
compl_used_match = FALSE;
|
||||
@@ -4688,7 +4742,7 @@ ins_complete(c)
|
||||
}
|
||||
compl_length = curwin->w_cursor.col - (int)compl_col;
|
||||
/* IObuff is used to add a "word from the next line" would we
|
||||
* have enough space? just being paranoic */
|
||||
* have enough space? just being paranoid */
|
||||
#define MIN_SPACE 75
|
||||
if (compl_length > (IOSIZE - MIN_SPACE))
|
||||
{
|
||||
@@ -7123,9 +7177,12 @@ replace_flush()
|
||||
* cc == 0: character was inserted, delete it
|
||||
* cc > 0: character was replaced, put cc (first byte of original char) back
|
||||
* and check for more characters to be put back
|
||||
* When "limit_col" is >= 0, don't delete before this column. Matters when
|
||||
* using composing characters, use del_char_after_col() instead of del_char().
|
||||
*/
|
||||
static void
|
||||
replace_do_bs()
|
||||
replace_do_bs(limit_col)
|
||||
int limit_col;
|
||||
{
|
||||
int cc;
|
||||
#ifdef FEAT_VREPLACE
|
||||
@@ -7153,7 +7210,7 @@ replace_do_bs()
|
||||
#ifdef FEAT_MBYTE
|
||||
if (has_mbyte)
|
||||
{
|
||||
del_char(FALSE);
|
||||
(void)del_char_after_col(limit_col);
|
||||
# ifdef FEAT_VREPLACE
|
||||
if (State & VREPLACE_FLAG)
|
||||
orig_len = (int)STRLEN(ml_get_cursor());
|
||||
@@ -7203,7 +7260,7 @@ replace_do_bs()
|
||||
changed_bytes(curwin->w_cursor.lnum, curwin->w_cursor.col);
|
||||
}
|
||||
else if (cc == 0)
|
||||
(void)del_char(FALSE);
|
||||
(void)del_char_after_col(limit_col);
|
||||
}
|
||||
|
||||
#ifdef FEAT_CINDENT
|
||||
@@ -7646,9 +7703,7 @@ ins_reg()
|
||||
*/
|
||||
++no_mapping;
|
||||
regname = plain_vgetc();
|
||||
#ifdef FEAT_LANGMAP
|
||||
LANGMAP_ADJUST(regname, TRUE);
|
||||
#endif
|
||||
if (regname == Ctrl_R || regname == Ctrl_O || regname == Ctrl_P)
|
||||
{
|
||||
/* Get a third key for literal register insertion */
|
||||
@@ -7657,9 +7712,7 @@ ins_reg()
|
||||
add_to_showcmd_c(literally);
|
||||
#endif
|
||||
regname = plain_vgetc();
|
||||
#ifdef FEAT_LANGMAP
|
||||
LANGMAP_ADJUST(regname, TRUE);
|
||||
#endif
|
||||
}
|
||||
--no_mapping;
|
||||
|
||||
@@ -8150,7 +8203,7 @@ ins_ctrl_o()
|
||||
/*
|
||||
* If the cursor is on an indent, ^T/^D insert/delete one
|
||||
* shiftwidth. Otherwise ^T/^D behave like a "<<" or ">>".
|
||||
* Always round the indent to 'shiftwith', this is compatible
|
||||
* Always round the indent to 'shiftwidth', this is compatible
|
||||
* with vi. But vi only supports ^T and ^D after an
|
||||
* autoindent, we support it everywhere.
|
||||
*/
|
||||
@@ -8239,7 +8292,7 @@ ins_bs_one(vcolp)
|
||||
* Replace mode */
|
||||
if (curwin->w_cursor.lnum != Insstart.lnum
|
||||
|| curwin->w_cursor.col >= Insstart.col)
|
||||
replace_do_bs();
|
||||
replace_do_bs(-1);
|
||||
}
|
||||
else
|
||||
(void)del_char(FALSE);
|
||||
@@ -8556,7 +8609,7 @@ ins_bs(c, mode, inserted_space_p)
|
||||
break;
|
||||
}
|
||||
if (State & REPLACE_FLAG)
|
||||
replace_do_bs();
|
||||
replace_do_bs(-1);
|
||||
else
|
||||
{
|
||||
#ifdef FEAT_MBYTE
|
||||
|
||||
+205
-73
@@ -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));
|
||||
@@ -856,6 +861,7 @@ eval_clear()
|
||||
}
|
||||
}
|
||||
hash_clear(&vimvarht);
|
||||
hash_init(&vimvarht); /* garbage_collect() will access it */
|
||||
hash_clear(&compat_hashtab);
|
||||
|
||||
/* script-local variables */
|
||||
@@ -922,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.
|
||||
*/
|
||||
@@ -3918,7 +3928,7 @@ eval0(arg, rettv, nextcmd, evaluate)
|
||||
|
||||
/*
|
||||
* Handle top level expression:
|
||||
* expr1 ? expr0 : expr0
|
||||
* expr2 ? expr1 : expr1
|
||||
*
|
||||
* "arg" must point to the first non-white of the expression.
|
||||
* "arg" is advanced to the next non-white after the recognized expression.
|
||||
@@ -6489,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;
|
||||
@@ -6573,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;
|
||||
}
|
||||
|
||||
@@ -7563,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},
|
||||
@@ -7894,9 +7918,9 @@ get_func_tv(name, len, rettv, arg, firstline, lastline, doesrange,
|
||||
else if (!aborting())
|
||||
{
|
||||
if (argcount == MAX_FUNC_ARGS)
|
||||
emsg_funcname("E740: Too many arguments for function %s", name);
|
||||
emsg_funcname(N_("E740: Too many arguments for function %s"), name);
|
||||
else
|
||||
emsg_funcname("E116: Invalid arguments for function %s", name);
|
||||
emsg_funcname(N_("E116: Invalid arguments for function %s"), name);
|
||||
}
|
||||
|
||||
while (--argcount >= 0)
|
||||
@@ -8129,6 +8153,7 @@ call_func(name, len, rettv, argcount, argvars, firstline, lastline,
|
||||
|
||||
/*
|
||||
* Give an error message with a function name. Handle <SNR> things.
|
||||
* "ermsg" is to be passed without translation, use N_() instead of _().
|
||||
*/
|
||||
static void
|
||||
emsg_funcname(ermsg, name)
|
||||
@@ -9556,7 +9581,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;
|
||||
@@ -10338,7 +10363,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
|
||||
{
|
||||
@@ -10640,7 +10666,7 @@ f_getchar(argvars, rettv)
|
||||
# ifdef FEAT_WINDOWS
|
||||
win_T *wp;
|
||||
# endif
|
||||
int n = 1;
|
||||
int winnr = 1;
|
||||
|
||||
if (row >= 0 && col >= 0)
|
||||
{
|
||||
@@ -10650,9 +10676,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;
|
||||
}
|
||||
@@ -11322,13 +11348,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;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -11339,14 +11377,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);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -11832,6 +11878,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();
|
||||
@@ -16647,8 +16697,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':
|
||||
@@ -18165,14 +18218,17 @@ get_vim_var_list(idx)
|
||||
}
|
||||
|
||||
/*
|
||||
* Set v:count, v:count1 and v:prevcount.
|
||||
* Set v:count to "count" and v:count1 to "count1".
|
||||
* When "set_prevcount" is TRUE first set v:prevcount from v:count.
|
||||
*/
|
||||
void
|
||||
set_vcount(count, count1)
|
||||
set_vcount(count, count1, set_prevcount)
|
||||
long count;
|
||||
long count1;
|
||||
int set_prevcount;
|
||||
{
|
||||
vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr;
|
||||
if (set_prevcount)
|
||||
vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr;
|
||||
vimvars[VV_COUNT].vv_nr = count;
|
||||
vimvars[VV_COUNT1].vv_nr = count1;
|
||||
}
|
||||
@@ -18950,7 +19006,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;
|
||||
@@ -19287,6 +19343,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)
|
||||
@@ -19830,7 +19888,7 @@ ex_function(eap)
|
||||
}
|
||||
}
|
||||
else
|
||||
emsg_funcname("E123: Undefined function: %s", name);
|
||||
emsg_funcname(N_("E123: Undefined function: %s"), name);
|
||||
}
|
||||
goto ret_free;
|
||||
}
|
||||
@@ -19874,7 +19932,7 @@ ex_function(eap)
|
||||
: eval_isnamec(arg[j])))
|
||||
++j;
|
||||
if (arg[j] != NUL)
|
||||
emsg_funcname(_(e_invarg2), arg);
|
||||
emsg_funcname((char *)e_invarg2, arg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20146,7 +20204,7 @@ ex_function(eap)
|
||||
v = find_var(name, &ht);
|
||||
if (v != NULL && v->di_tv.v_type == VAR_FUNC)
|
||||
{
|
||||
emsg_funcname("E707: Function name conflicts with variable: %s",
|
||||
emsg_funcname(N_("E707: Function name conflicts with variable: %s"),
|
||||
name);
|
||||
goto erret;
|
||||
}
|
||||
@@ -20161,7 +20219,7 @@ ex_function(eap)
|
||||
}
|
||||
if (fp->uf_calls > 0)
|
||||
{
|
||||
emsg_funcname("E127: Cannot redefine function %s: It is in use",
|
||||
emsg_funcname(N_("E127: Cannot redefine function %s: It is in use"),
|
||||
name);
|
||||
goto erret;
|
||||
}
|
||||
@@ -21099,7 +21157,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;
|
||||
@@ -21125,36 +21183,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;
|
||||
@@ -21166,28 +21225,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));
|
||||
v = &fc.fixvar[fixvar_idx++].var;
|
||||
STRCPY(v->di_key, "000");
|
||||
/* Use "name" to avoid a warning from some compiler that checks the
|
||||
* destination size. */
|
||||
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)
|
||||
{
|
||||
@@ -21203,7 +21265,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
|
||||
@@ -21215,7 +21277,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. */
|
||||
@@ -21224,9 +21286,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21291,7 +21353,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);
|
||||
@@ -21307,7 +21369,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;
|
||||
@@ -21322,16 +21384,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
|
||||
@@ -21344,9 +21406,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];
|
||||
@@ -21357,7 +21419,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);
|
||||
@@ -21393,14 +21455,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 anywhere.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+69
-25
@@ -49,6 +49,7 @@ do_ascii(eap)
|
||||
exarg_T *eap;
|
||||
{
|
||||
int c;
|
||||
int cval;
|
||||
char buf1[20];
|
||||
char buf2[20];
|
||||
char_u buf3[7];
|
||||
@@ -75,6 +76,10 @@ do_ascii(eap)
|
||||
{
|
||||
if (c == NL) /* NUL is stored as NL */
|
||||
c = NUL;
|
||||
if (c == CAR && get_fileformat(curbuf) == EOL_MAC)
|
||||
cval = NL; /* NL is stored as CR */
|
||||
else
|
||||
cval = c;
|
||||
if (vim_isprintc_strict(c) && (c < ' '
|
||||
#ifndef EBCDIC
|
||||
|| c > '~'
|
||||
@@ -94,7 +99,7 @@ do_ascii(eap)
|
||||
buf2[0] = NUL;
|
||||
vim_snprintf((char *)IObuff, IOSIZE,
|
||||
_("<%s>%s%s %d, Hex %02x, Octal %03o"),
|
||||
transchar(c), buf1, buf2, c, c, c);
|
||||
transchar(c), buf1, buf2, cval, cval, cval);
|
||||
#ifdef FEAT_MBYTE
|
||||
if (enc_utf8)
|
||||
c = cc[ci++];
|
||||
@@ -1941,7 +1946,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
|
||||
}
|
||||
}
|
||||
@@ -2412,8 +2417,8 @@ print_line(lnum, use_number, list)
|
||||
cursor_on(); /* msg_start() switches it off */
|
||||
out_flush();
|
||||
silent_mode = save_silent;
|
||||
info_message = FALSE;
|
||||
}
|
||||
info_message = FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2702,7 +2707,12 @@ do_write(eap)
|
||||
if (eap->cmdidx == CMD_saveas)
|
||||
{
|
||||
if (retval == OK)
|
||||
{
|
||||
curbuf->b_p_ro = FALSE;
|
||||
#ifdef FEAT_WINDOWS
|
||||
redraw_tabline = TRUE;
|
||||
#endif
|
||||
}
|
||||
/* Change directories when the 'acd' option is set. */
|
||||
DO_AUTOCHDIR
|
||||
}
|
||||
@@ -3052,7 +3062,8 @@ getfile(fnum, ffname, sfname, setpm, lnum, forceit)
|
||||
retval = 0; /* it's in the same file */
|
||||
}
|
||||
else if (do_ecmd(fnum, ffname, sfname, NULL, lnum,
|
||||
(P_HID(curbuf) ? ECMD_HIDE : 0) + (forceit ? ECMD_FORCEIT : 0)) == OK)
|
||||
(P_HID(curbuf) ? ECMD_HIDE : 0) + (forceit ? ECMD_FORCEIT : 0),
|
||||
curwin) == OK)
|
||||
retval = -1; /* opened another file */
|
||||
else
|
||||
retval = 1; /* error encountered */
|
||||
@@ -3085,17 +3096,21 @@ theend:
|
||||
* ECMD_OLDBUF: use existing buffer if it exists
|
||||
* ECMD_FORCEIT: ! used for Ex command
|
||||
* ECMD_ADDBUF: don't edit, just add to buffer list
|
||||
* oldwin: Should be "curwin" when editing a new buffer in the current
|
||||
* window, NULL when splitting the window first. When not NULL info
|
||||
* of the previous buffer for "oldwin" is stored.
|
||||
*
|
||||
* return FAIL for failure, OK otherwise
|
||||
*/
|
||||
int
|
||||
do_ecmd(fnum, ffname, sfname, eap, newlnum, flags)
|
||||
do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin)
|
||||
int fnum;
|
||||
char_u *ffname;
|
||||
char_u *sfname;
|
||||
exarg_T *eap; /* can be NULL! */
|
||||
linenr_T newlnum;
|
||||
int flags;
|
||||
win_T *oldwin;
|
||||
{
|
||||
int other_file; /* TRUE if editing another file */
|
||||
int oldbuf; /* TRUE if using existing buffer */
|
||||
@@ -3267,7 +3282,8 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags)
|
||||
{
|
||||
if (!cmdmod.keepalt)
|
||||
curwin->w_alt_fnum = curbuf->b_fnum;
|
||||
buflist_altfpos();
|
||||
if (oldwin != NULL)
|
||||
buflist_altfpos(oldwin);
|
||||
}
|
||||
|
||||
if (fnum)
|
||||
@@ -3371,7 +3387,7 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags)
|
||||
|
||||
/* close the link to the current buffer */
|
||||
u_sync(FALSE);
|
||||
close_buffer(curwin, curbuf,
|
||||
close_buffer(oldwin, curbuf,
|
||||
(flags & ECMD_HIDE) ? 0 : DOBUF_UNLOAD);
|
||||
|
||||
#ifdef FEAT_AUTOCMD
|
||||
@@ -5609,7 +5625,13 @@ ex_help(eap)
|
||||
*/
|
||||
alt_fnum = curbuf->b_fnum;
|
||||
(void)do_ecmd(0, NULL, NULL, NULL, ECMD_LASTL,
|
||||
ECMD_HIDE + ECMD_SET_HELP);
|
||||
ECMD_HIDE + ECMD_SET_HELP,
|
||||
#ifdef FEAT_WINDOWS
|
||||
NULL /* buffer is still open, don't store info */
|
||||
#else
|
||||
curwin
|
||||
#endif
|
||||
);
|
||||
if (!cmdmod.keepalt)
|
||||
curwin->w_alt_fnum = alt_fnum;
|
||||
empty_fnum = curbuf->b_fnum;
|
||||
@@ -6519,6 +6541,7 @@ static sign_T *first_sign = NULL;
|
||||
static int last_sign_typenr = MAX_TYPENR; /* is decremented */
|
||||
|
||||
static void sign_list_defined __ARGS((sign_T *sp));
|
||||
static void sign_undefine __ARGS((sign_T *sp, sign_T *sp_prev));
|
||||
|
||||
/*
|
||||
* ":sign" command
|
||||
@@ -6727,24 +6750,8 @@ ex_sign(eap)
|
||||
/* ":sign list {name}" */
|
||||
sign_list_defined(sp);
|
||||
else
|
||||
{
|
||||
/* ":sign undefine {name}" */
|
||||
vim_free(sp->sn_name);
|
||||
vim_free(sp->sn_icon);
|
||||
#ifdef FEAT_SIGN_ICONS
|
||||
if (sp->sn_image != NULL)
|
||||
{
|
||||
out_flush();
|
||||
gui_mch_destroy_sign(sp->sn_image);
|
||||
}
|
||||
#endif
|
||||
vim_free(sp->sn_text);
|
||||
if (sp_prev == NULL)
|
||||
first_sign = sp->sn_next;
|
||||
else
|
||||
sp_prev->sn_next = sp->sn_next;
|
||||
vim_free(sp);
|
||||
}
|
||||
sign_undefine(sp, sp_prev);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -6992,6 +6999,31 @@ sign_list_defined(sp)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Undefine a sign and free its memory.
|
||||
*/
|
||||
static void
|
||||
sign_undefine(sp, sp_prev)
|
||||
sign_T *sp;
|
||||
sign_T *sp_prev;
|
||||
{
|
||||
vim_free(sp->sn_name);
|
||||
vim_free(sp->sn_icon);
|
||||
#ifdef FEAT_SIGN_ICONS
|
||||
if (sp->sn_image != NULL)
|
||||
{
|
||||
out_flush();
|
||||
gui_mch_destroy_sign(sp->sn_image);
|
||||
}
|
||||
#endif
|
||||
vim_free(sp->sn_text);
|
||||
if (sp_prev == NULL)
|
||||
first_sign = sp->sn_next;
|
||||
else
|
||||
sp_prev->sn_next = sp->sn_next;
|
||||
vim_free(sp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get highlighting attribute for sign "typenr".
|
||||
* If "line" is TRUE: line highl, if FALSE: text highl.
|
||||
@@ -7066,6 +7098,18 @@ sign_typenr2name(typenr)
|
||||
return (char_u *)_("[Deleted]");
|
||||
}
|
||||
|
||||
#if defined(EXITFREE) || defined(PROTO)
|
||||
/*
|
||||
* Undefine/free all signs.
|
||||
*/
|
||||
void
|
||||
free_signs()
|
||||
{
|
||||
while (first_sign != NULL)
|
||||
sign_undefine(first_sign, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(FEAT_GUI) || defined(FEAT_CLIENTSERVER) || defined(PROTO)
|
||||
|
||||
+26
-21
@@ -2205,8 +2205,8 @@ do_argfile(eap, argn)
|
||||
* argument index. */
|
||||
if (do_ecmd(0, alist_name(&ARGLIST[curwin->w_arg_idx]), NULL,
|
||||
eap, ECMD_LAST,
|
||||
(P_HID(curwin->w_buffer) ? ECMD_HIDE : 0) +
|
||||
(eap->forceit ? ECMD_FORCEIT : 0)) == FAIL)
|
||||
(P_HID(curwin->w_buffer) ? ECMD_HIDE : 0)
|
||||
+ (eap->forceit ? ECMD_FORCEIT : 0), curwin) == FAIL)
|
||||
curwin->w_arg_idx = old_arg_idx;
|
||||
/* like Vi: set the mark where the cursor is in the file. */
|
||||
else if (eap->cmdidx != CMD_argdo)
|
||||
@@ -2915,6 +2915,7 @@ do_source(fname, check_other, is_vimrc)
|
||||
linenr_T save_sourcing_lnum;
|
||||
char_u *p;
|
||||
char_u *fname_exp;
|
||||
char_u *firstline = NULL;
|
||||
int retval = FAIL;
|
||||
#ifdef FEAT_EVAL
|
||||
scid_T save_current_SID;
|
||||
@@ -3065,23 +3066,6 @@ do_source(fname, check_other, is_vimrc)
|
||||
|
||||
cookie.level = ex_nesting_level;
|
||||
#endif
|
||||
#ifdef FEAT_MBYTE
|
||||
cookie.conv.vc_type = CONV_NONE; /* no conversion */
|
||||
|
||||
/* Try reading the first few bytes to check for a UTF-8 BOM. */
|
||||
{
|
||||
char_u buf[3];
|
||||
|
||||
if (fread((char *)buf, sizeof(char_u), (size_t)3, cookie.fp)
|
||||
== (size_t)3
|
||||
&& buf[0] == 0xef && buf[1] == 0xbb && buf[2] == 0xbf)
|
||||
/* Found BOM, setup conversion and skip over it. */
|
||||
convert_setup(&cookie.conv, (char_u *)"utf-8", p_enc);
|
||||
else
|
||||
/* No BOM found, rewind. */
|
||||
fseek(cookie.fp, 0L, SEEK_SET);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Keep the sourcing name/lnum, for recursive calls.
|
||||
@@ -3091,6 +3075,27 @@ do_source(fname, check_other, is_vimrc)
|
||||
save_sourcing_lnum = sourcing_lnum;
|
||||
sourcing_lnum = 0;
|
||||
|
||||
#ifdef FEAT_MBYTE
|
||||
cookie.conv.vc_type = CONV_NONE; /* no conversion */
|
||||
|
||||
/* Read the first line so we can check for a UTF-8 BOM. */
|
||||
firstline = getsourceline(0, (void *)&cookie, 0);
|
||||
if (firstline != NULL && STRLEN(firstline) >= 3 && firstline[0] == 0xef
|
||||
&& firstline[1] == 0xbb && firstline[2] == 0xbf)
|
||||
{
|
||||
/* Found BOM; setup conversion, skip over BOM and recode the line. */
|
||||
convert_setup(&cookie.conv, (char_u *)"utf-8", p_enc);
|
||||
p = string_convert(&cookie.conv, firstline + 3, NULL);
|
||||
if (p == NULL)
|
||||
p = vim_strsave(firstline + 3);
|
||||
if (p != NULL)
|
||||
{
|
||||
vim_free(firstline);
|
||||
firstline = p;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef STARTUPTIME
|
||||
time_push(&tv_rel, &tv_start);
|
||||
#endif
|
||||
@@ -3184,9 +3189,8 @@ do_source(fname, check_other, is_vimrc)
|
||||
/*
|
||||
* Call do_cmdline, which will call getsourceline() to get the lines.
|
||||
*/
|
||||
do_cmdline(NULL, getsourceline, (void *)&cookie,
|
||||
do_cmdline(firstline, getsourceline, (void *)&cookie,
|
||||
DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_REPEAT);
|
||||
|
||||
retval = OK;
|
||||
|
||||
#ifdef FEAT_PROFILE
|
||||
@@ -3244,6 +3248,7 @@ almosttheend:
|
||||
#endif
|
||||
fclose(cookie.fp);
|
||||
vim_free(cookie.nextline);
|
||||
vim_free(firstline);
|
||||
#ifdef FEAT_MBYTE
|
||||
convert_setup(&cookie.conv, NULL, NULL);
|
||||
#endif
|
||||
|
||||
+70
-11
@@ -3690,6 +3690,11 @@ set_one_cmd_context(xp, buff)
|
||||
case CMD_highlight:
|
||||
set_context_in_highlight_cmd(xp, arg);
|
||||
break;
|
||||
#ifdef FEAT_CSCOPE
|
||||
case CMD_cscope:
|
||||
set_context_in_cscope_cmd(xp, arg);
|
||||
break;
|
||||
#endif
|
||||
#ifdef FEAT_LISTCMDS
|
||||
case CMD_bdelete:
|
||||
case CMD_bwipeout:
|
||||
@@ -5142,7 +5147,11 @@ uc_add_command(name, name_len, rep, argt, def, flags, compl, compl_arg, force)
|
||||
}
|
||||
|
||||
vim_free(cmd->uc_rep);
|
||||
cmd->uc_rep = 0;
|
||||
cmd->uc_rep = NULL;
|
||||
#if defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL)
|
||||
vim_free(cmd->uc_compl_arg);
|
||||
cmd->uc_compl_arg = NULL;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -5201,6 +5210,9 @@ static struct
|
||||
{EXPAND_AUGROUP, "augroup"},
|
||||
{EXPAND_BUFFERS, "buffer"},
|
||||
{EXPAND_COMMANDS, "command"},
|
||||
#if defined(FEAT_CSCOPE)
|
||||
{EXPAND_CSCOPE, "cscope"},
|
||||
#endif
|
||||
#if defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL)
|
||||
{EXPAND_USER_DEFINED, "custom"},
|
||||
{EXPAND_USER_LIST, "customlist"},
|
||||
@@ -5500,6 +5512,9 @@ invalid_count:
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* ":command ..."
|
||||
*/
|
||||
static void
|
||||
ex_command(eap)
|
||||
exarg_T *eap;
|
||||
@@ -5931,7 +5946,8 @@ do_ucmd(eap)
|
||||
char_u *q;
|
||||
|
||||
char_u *start;
|
||||
char_u *end;
|
||||
char_u *end = NULL;
|
||||
char_u *ksp;
|
||||
size_t len, totlen;
|
||||
|
||||
size_t split_len = 0;
|
||||
@@ -5948,16 +5964,51 @@ do_ucmd(eap)
|
||||
|
||||
/*
|
||||
* Replace <> in the command by the arguments.
|
||||
* First round: "buf" is NULL, compute length, allocate "buf".
|
||||
* Second round: copy result into "buf".
|
||||
*/
|
||||
buf = NULL;
|
||||
for (;;)
|
||||
{
|
||||
p = cmd->uc_rep;
|
||||
q = buf;
|
||||
p = cmd->uc_rep; /* source */
|
||||
q = buf; /* destination */
|
||||
totlen = 0;
|
||||
while ((start = vim_strchr(p, '<')) != NULL
|
||||
&& (end = vim_strchr(start + 1, '>')) != NULL)
|
||||
|
||||
for (;;)
|
||||
{
|
||||
start = vim_strchr(p, '<');
|
||||
if (start != NULL)
|
||||
end = vim_strchr(start + 1, '>');
|
||||
if (buf != NULL)
|
||||
{
|
||||
ksp = vim_strchr(p, K_SPECIAL);
|
||||
if (ksp != NULL && (start == NULL || ksp < start || end == NULL)
|
||||
&& ((ksp[1] == KS_SPECIAL && ksp[2] == KE_FILLER)
|
||||
# ifdef FEAT_GUI
|
||||
|| (ksp[1] == KS_EXTRA && ksp[2] == (int)KE_CSI)
|
||||
# endif
|
||||
))
|
||||
{
|
||||
/* K_SPECIAL han been put in the buffer as K_SPECIAL
|
||||
* KS_SPECIAL KE_FILLER, like for mappings, but
|
||||
* do_cmdline() doesn't handle that, so convert it back.
|
||||
* Also change K_SPECIAL KS_EXTRA KE_CSI into CSI. */
|
||||
len = ksp - p;
|
||||
if (len > 0)
|
||||
{
|
||||
mch_memmove(q, p, len);
|
||||
q += len;
|
||||
}
|
||||
*q++ = ksp[1] == KS_SPECIAL ? K_SPECIAL : CSI;
|
||||
p = ksp + 3;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* break if there no <item> is found */
|
||||
if (start == NULL || end == NULL)
|
||||
break;
|
||||
|
||||
/* Include the '>' */
|
||||
++end;
|
||||
|
||||
@@ -7507,7 +7558,8 @@ do_exedit(eap, old_curwin)
|
||||
/* ":new" or ":tabnew" without argument: edit an new empty buffer */
|
||||
setpcmark();
|
||||
(void)do_ecmd(0, NULL, NULL, eap, ECMD_ONE,
|
||||
ECMD_HIDE + (eap->forceit ? ECMD_FORCEIT : 0));
|
||||
ECMD_HIDE + (eap->forceit ? ECMD_FORCEIT : 0),
|
||||
old_curwin == NULL ? curwin : NULL);
|
||||
}
|
||||
else if ((eap->cmdidx != CMD_split
|
||||
#ifdef FEAT_VERTSPLIT
|
||||
@@ -7544,7 +7596,7 @@ do_exedit(eap, old_curwin)
|
||||
#ifdef FEAT_LISTCMDS
|
||||
+ (eap->cmdidx == CMD_badd ? ECMD_ADDBUF : 0 )
|
||||
#endif
|
||||
) == FAIL)
|
||||
, old_curwin == NULL ? curwin : NULL) == FAIL)
|
||||
{
|
||||
/* Editing the file failed. If the window was split, close it. */
|
||||
#ifdef FEAT_WINDOWS
|
||||
@@ -7826,6 +7878,9 @@ free_cd_dir()
|
||||
{
|
||||
vim_free(prev_dir);
|
||||
prev_dir = NULL;
|
||||
|
||||
vim_free(globaldir);
|
||||
globaldir = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -7848,6 +7903,10 @@ ex_cd(eap)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#ifdef FEAT_AUTOCMD
|
||||
if (allbuf_locked())
|
||||
return;
|
||||
#endif
|
||||
if (vim_strchr(p_cpo, CPO_CHDIR) != NULL && curbufIsChanged()
|
||||
&& !eap->forceit)
|
||||
{
|
||||
@@ -8772,8 +8831,8 @@ ex_mkrc(eap)
|
||||
else if (*dirnow != NUL
|
||||
&& (ssop_flags & SSOP_CURDIR) && globaldir != NULL)
|
||||
{
|
||||
(void)mch_chdir((char *)globaldir);
|
||||
shorten_fnames(TRUE);
|
||||
if (mch_chdir((char *)globaldir) == 0)
|
||||
shorten_fnames(TRUE);
|
||||
}
|
||||
|
||||
failed |= (makeopens(fd, dirnow) == FAIL);
|
||||
@@ -10133,7 +10192,7 @@ makeopens(fd, dirnow)
|
||||
*/
|
||||
if (put_line(fd, "let s:sx = expand(\"<sfile>:p:r\").\"x.vim\"") == FAIL
|
||||
|| put_line(fd, "if file_readable(s:sx)") == FAIL
|
||||
|| put_line(fd, " exe \"source \" . s:sx") == FAIL
|
||||
|| put_line(fd, " exe \"source \" . fnameescape(s:sx)") == FAIL
|
||||
|| put_line(fd, "endif") == FAIL)
|
||||
return FAIL;
|
||||
|
||||
|
||||
+30
-13
@@ -2000,8 +2000,8 @@ text_locked_msg()
|
||||
|
||||
#if defined(FEAT_AUTOCMD) || defined(PROTO)
|
||||
/*
|
||||
* Check if "curbuf_lock" is set and return TRUE when it is and give an error
|
||||
* message.
|
||||
* Check if "curbuf_lock" or "allbuf_lock" is set and return TRUE when it is
|
||||
* and give an error message.
|
||||
*/
|
||||
int
|
||||
curbuf_locked()
|
||||
@@ -2011,6 +2011,21 @@ curbuf_locked()
|
||||
EMSG(_("E788: Not allowed to edit another buffer now"));
|
||||
return TRUE;
|
||||
}
|
||||
return allbuf_locked();
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if "allbuf_lock" is set and return TRUE when it is and give an error
|
||||
* message.
|
||||
*/
|
||||
int
|
||||
allbuf_locked()
|
||||
{
|
||||
if (allbuf_lock > 0)
|
||||
{
|
||||
EMSG(_("E811: Not allowed to change buffer information now"));
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
@@ -2524,7 +2539,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. */
|
||||
@@ -4503,6 +4518,9 @@ ExpandFromContext(xp, pat, num_file, file, options)
|
||||
{EXPAND_EVENTS, get_event_name, TRUE},
|
||||
{EXPAND_AUGROUP, get_augroup_name, TRUE},
|
||||
#endif
|
||||
#ifdef FEAT_CSCOPE
|
||||
{EXPAND_CSCOPE, get_cscope_name, TRUE},
|
||||
#endif
|
||||
#if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
|
||||
&& (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE))
|
||||
{EXPAND_LANGUAGE, get_lang_arg, TRUE},
|
||||
@@ -4900,7 +4918,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 +4959,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 +4991,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;
|
||||
|
||||
@@ -6049,12 +6068,10 @@ ex_window()
|
||||
# endif
|
||||
return K_IGNORE;
|
||||
}
|
||||
cmdwin_type = ccline.cmdfirstc;
|
||||
if (cmdwin_type == NUL)
|
||||
cmdwin_type = '-';
|
||||
cmdwin_type = get_cmdline_type();
|
||||
|
||||
/* Create the command-line buffer empty. */
|
||||
(void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE);
|
||||
(void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, NULL);
|
||||
(void)setfname(curbuf, (char_u *)"[Command Line]", NULL, TRUE);
|
||||
set_option_value((char_u *)"bt", 0L, (char_u *)"nofile", OPT_LOCAL);
|
||||
set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
|
||||
@@ -6075,7 +6092,7 @@ ex_window()
|
||||
/* Showing the prompt may have set need_wait_return, reset it. */
|
||||
need_wait_return = FALSE;
|
||||
|
||||
histtype = hist_char2type(ccline.cmdfirstc);
|
||||
histtype = hist_char2type(cmdwin_type);
|
||||
if (histtype == HIST_CMD || histtype == HIST_DEBUG)
|
||||
{
|
||||
if (p_wc == TAB)
|
||||
|
||||
+135
-21
@@ -69,7 +69,7 @@ static int apply_autocmds_exarg __ARGS((event_T event, char_u *fname, char_u *fn
|
||||
static int au_find_group __ARGS((char_u *name));
|
||||
|
||||
# define AUGROUP_DEFAULT -1 /* default autocmd group */
|
||||
# define AUGROUP_ERROR -2 /* errornouse autocmd group */
|
||||
# define AUGROUP_ERROR -2 /* erroneous autocmd group */
|
||||
# define AUGROUP_ALL -3 /* all autocmd groups */
|
||||
#endif
|
||||
|
||||
@@ -144,7 +144,9 @@ static int get_mac_fio_flags __ARGS((char_u *ptr));
|
||||
# endif
|
||||
#endif
|
||||
static int move_lines __ARGS((buf_T *frombuf, buf_T *tobuf));
|
||||
|
||||
#ifdef FEAT_AUTOCMD
|
||||
static char *e_auchangedbuf = N_("E812: Autocommands changed buffer or buffer name");
|
||||
#endif
|
||||
|
||||
void
|
||||
filemess(buf, name, s, attr)
|
||||
@@ -295,6 +297,19 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags)
|
||||
int conv_restlen = 0; /* nr of bytes in conv_rest[] */
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_AUTOCMD
|
||||
/* Remember the initial values of curbuf, curbuf->b_ffname and
|
||||
* curbuf->b_fname to detect whether they are altered as a result of
|
||||
* executing nasty autocommands. Also check if "fname" and "sfname"
|
||||
* point to one of these values. */
|
||||
buf_T *old_curbuf = curbuf;
|
||||
char_u *old_b_ffname = curbuf->b_ffname;
|
||||
char_u *old_b_fname = curbuf->b_fname;
|
||||
int using_b_ffname = (fname == curbuf->b_ffname)
|
||||
|| (sfname == curbuf->b_ffname);
|
||||
int using_b_fname = (fname == curbuf->b_fname)
|
||||
|| (sfname == curbuf->b_fname);
|
||||
#endif
|
||||
write_no_eol_lnum = 0; /* in case it was set by the previous read */
|
||||
|
||||
/*
|
||||
@@ -589,7 +604,21 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags)
|
||||
#ifdef FEAT_QUICKFIX
|
||||
if (!bt_dontwrite(curbuf))
|
||||
#endif
|
||||
{
|
||||
check_need_swap(newfile);
|
||||
#ifdef FEAT_AUTOCMD
|
||||
/* SwapExists autocommand may mess things up */
|
||||
if (curbuf != old_curbuf
|
||||
|| (using_b_ffname
|
||||
&& (old_b_ffname != curbuf->b_ffname))
|
||||
|| (using_b_fname
|
||||
&& (old_b_fname != curbuf->b_fname)))
|
||||
{
|
||||
EMSG(_(e_auchangedbuf));
|
||||
return FAIL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (dir_of_file_exists(fname))
|
||||
filemess(curbuf, sfname, (char_u *)_("[New File]"), 0);
|
||||
else
|
||||
@@ -668,6 +697,17 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags)
|
||||
#endif
|
||||
{
|
||||
check_need_swap(newfile);
|
||||
#ifdef FEAT_AUTOCMD
|
||||
if (!read_stdin && (curbuf != old_curbuf
|
||||
|| (using_b_ffname && (old_b_ffname != curbuf->b_ffname))
|
||||
|| (using_b_fname && (old_b_fname != curbuf->b_fname))))
|
||||
{
|
||||
EMSG(_(e_auchangedbuf));
|
||||
if (!read_buffer)
|
||||
close(fd);
|
||||
return FAIL;
|
||||
}
|
||||
#endif
|
||||
#ifdef UNIX
|
||||
/* Set swap file protection bits after creating it. */
|
||||
if (swap_mode > 0 && curbuf->b_ml.ml_mfp->mf_fname != NULL)
|
||||
@@ -698,7 +738,6 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags)
|
||||
{
|
||||
int m = msg_scroll;
|
||||
int n = msg_scrolled;
|
||||
buf_T *old_curbuf = curbuf;
|
||||
|
||||
/*
|
||||
* The file must be closed again, the autocommands may want to change
|
||||
@@ -740,8 +779,13 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags)
|
||||
/*
|
||||
* Don't allow the autocommands to change the current buffer.
|
||||
* Try to re-open the file.
|
||||
*
|
||||
* Don't allow the autocommands to change the buffer name either
|
||||
* (cd for example) if it invalidates fname or sfname.
|
||||
*/
|
||||
if (!read_stdin && (curbuf != old_curbuf
|
||||
|| (using_b_ffname && (old_b_ffname != curbuf->b_ffname))
|
||||
|| (using_b_fname && (old_b_fname != curbuf->b_fname))
|
||||
|| (fd = mch_open((char *)fname, O_RDONLY | O_EXTRA, 0)) < 0))
|
||||
{
|
||||
--no_wait_return;
|
||||
@@ -932,7 +976,10 @@ retry:
|
||||
else
|
||||
{
|
||||
if (eap != NULL && eap->force_ff != 0)
|
||||
{
|
||||
fileformat = get_fileformat_force(curbuf, eap);
|
||||
try_unix = try_dos = try_mac = FALSE;
|
||||
}
|
||||
else if (curbuf->b_p_bin)
|
||||
fileformat = EOL_UNIX; /* binary: use Unix format */
|
||||
else if (*p_ffs == NUL)
|
||||
@@ -2211,7 +2258,7 @@ failed:
|
||||
{
|
||||
/* Use stderr for stdin, makes shell commands work. */
|
||||
close(0);
|
||||
dup(2);
|
||||
ignored = dup(2);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2341,11 +2388,6 @@ failed:
|
||||
STRCAT(IObuff, _("[CR missing]"));
|
||||
c = TRUE;
|
||||
}
|
||||
if (ff_error == EOL_MAC)
|
||||
{
|
||||
STRCAT(IObuff, _("[NL found]"));
|
||||
c = TRUE;
|
||||
}
|
||||
if (split)
|
||||
{
|
||||
STRCAT(IObuff, _("[long lines split]"));
|
||||
@@ -3451,7 +3493,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
|
||||
@@ -4367,7 +4409,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);
|
||||
}
|
||||
@@ -5250,13 +5292,16 @@ buf_write_bytes(ip)
|
||||
/* Convert with iconv(). */
|
||||
if (ip->bw_restlen > 0)
|
||||
{
|
||||
char *fp;
|
||||
|
||||
/* Need to concatenate the remainder of the previous call and
|
||||
* the bytes of the current call. Use the end of the
|
||||
* conversion buffer for this. */
|
||||
fromlen = len + ip->bw_restlen;
|
||||
from = (char *)ip->bw_conv_buf + ip->bw_conv_buflen - fromlen;
|
||||
mch_memmove((void *)from, ip->bw_rest, (size_t)ip->bw_restlen);
|
||||
mch_memmove((void *)(from + ip->bw_restlen), buf, (size_t)len);
|
||||
fp = (char *)ip->bw_conv_buf + ip->bw_conv_buflen - fromlen;
|
||||
mch_memmove(fp, ip->bw_rest, (size_t)ip->bw_restlen);
|
||||
mch_memmove(fp + ip->bw_restlen, buf, (size_t)len);
|
||||
from = fp;
|
||||
tolen = ip->bw_conv_buflen - fromlen;
|
||||
}
|
||||
else
|
||||
@@ -5554,9 +5599,10 @@ check_for_bom(p, size, lenp, flags)
|
||||
name = "ucs-4le"; /* FF FE 00 00 */
|
||||
len = 4;
|
||||
}
|
||||
else if (flags == FIO_ALL || flags == (FIO_UCS2 | FIO_ENDIAN_L))
|
||||
else if (flags == (FIO_UCS2 | FIO_ENDIAN_L))
|
||||
name = "ucs-2le"; /* FF FE */
|
||||
else if (flags == (FIO_UTF16 | FIO_ENDIAN_L))
|
||||
else if (flags == FIO_ALL || flags == (FIO_UTF16 | FIO_ENDIAN_L))
|
||||
/* utf-16le is preferred, it also works for ucs-2le text */
|
||||
name = "utf-16le"; /* FF FE */
|
||||
}
|
||||
else if (p[0] == 0xfe && p[1] == 0xff
|
||||
@@ -6036,9 +6082,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');
|
||||
}
|
||||
@@ -6112,12 +6158,24 @@ vim_rename(from, to)
|
||||
#ifdef HAVE_ACL
|
||||
vim_acl_T acl; /* ACL from original file */
|
||||
#endif
|
||||
#if defined(UNIX) || defined(CASE_INSENSITIVE_FILENAME)
|
||||
int use_tmp_file = FALSE;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* When the names are identical, there is nothing to do.
|
||||
* When the names are identical, there is nothing to do. When they refer
|
||||
* to the same file (ignoring case and slash/backslash differences) but
|
||||
* the file name differs we need to go through a temp file.
|
||||
*/
|
||||
if (fnamecmp(from, to) == 0)
|
||||
return 0;
|
||||
{
|
||||
#ifdef CASE_INSENSITIVE_FILENAME
|
||||
if (STRCMP(gettail(from), gettail(to)) != 0)
|
||||
use_tmp_file = TRUE;
|
||||
else
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Fail if the "from" file doesn't exist. Avoids that "to" is deleted.
|
||||
@@ -6125,6 +6183,55 @@ vim_rename(from, to)
|
||||
if (mch_stat((char *)from, &st) < 0)
|
||||
return -1;
|
||||
|
||||
#ifdef UNIX
|
||||
{
|
||||
struct stat st_to;
|
||||
|
||||
/* It's possible for the source and destination to be the same file.
|
||||
* This happens when "from" and "to" differ in case and are on a FAT32
|
||||
* filesystem. In that case go through a temp file name. */
|
||||
if (mch_stat((char *)to, &st_to) >= 0
|
||||
&& st.st_dev == st_to.st_dev
|
||||
&& st.st_ino == st_to.st_ino)
|
||||
use_tmp_file = TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(UNIX) || defined(CASE_INSENSITIVE_FILENAME)
|
||||
if (use_tmp_file)
|
||||
{
|
||||
char tempname[MAXPATHL + 1];
|
||||
|
||||
/*
|
||||
* Find a name that doesn't exist and is in the same directory.
|
||||
* Rename "from" to "tempname" and then rename "tempname" to "to".
|
||||
*/
|
||||
if (STRLEN(from) >= MAXPATHL - 5)
|
||||
return -1;
|
||||
STRCPY(tempname, from);
|
||||
for (n = 123; n < 99999; ++n)
|
||||
{
|
||||
sprintf((char *)gettail((char_u *)tempname), "%d", n);
|
||||
if (mch_stat(tempname, &st) < 0)
|
||||
{
|
||||
if (mch_rename((char *)from, tempname) == 0)
|
||||
{
|
||||
if (mch_rename(tempname, (char *)to) == 0)
|
||||
return 0;
|
||||
/* Strange, the second step failed. Try moving the
|
||||
* file back and return failure. */
|
||||
mch_rename(tempname, (char *)from);
|
||||
return -1;
|
||||
}
|
||||
/* If it fails for one temp name it will most likely fail
|
||||
* for any temp name, give up. */
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Delete the "to" file, this is required on some systems to make the
|
||||
* mch_rename() work, on other systems it makes sure that we don't have
|
||||
@@ -6268,7 +6375,7 @@ check_timestamps(focus)
|
||||
|
||||
if (!stuff_empty() || global_busy || !typebuf_typed()
|
||||
#ifdef FEAT_AUTOCMD
|
||||
|| autocmd_busy || curbuf_lock > 0
|
||||
|| autocmd_busy || curbuf_lock > 0 || allbuf_lock > 0
|
||||
#endif
|
||||
)
|
||||
need_check_timestamps = TRUE; /* check later */
|
||||
@@ -6476,8 +6583,10 @@ buf_check_timestamp(buf, focus)
|
||||
set_vim_var_string(VV_FCS_REASON, (char_u *)reason, -1);
|
||||
set_vim_var_string(VV_FCS_CHOICE, (char_u *)"", -1);
|
||||
# endif
|
||||
++allbuf_lock;
|
||||
n = apply_autocmds(EVENT_FILECHANGEDSHELL,
|
||||
buf->b_fname, buf->b_fname, FALSE, buf);
|
||||
--allbuf_lock;
|
||||
busy = FALSE;
|
||||
if (n)
|
||||
{
|
||||
@@ -6552,6 +6661,11 @@ buf_check_timestamp(buf, focus)
|
||||
tbuf = alloc((unsigned)(STRLEN(path) + STRLEN(mesg)
|
||||
+ STRLEN(mesg2) + 2));
|
||||
sprintf((char *)tbuf, mesg, path);
|
||||
#ifdef FEAT_EVAL
|
||||
/* Set warningmsg here, before the unimportant and output-specific
|
||||
* mesg2 has been appended. */
|
||||
set_vim_var_string(VV_WARNINGMSG, tbuf, -1);
|
||||
#endif
|
||||
#if defined(FEAT_CON_DIALOG) || defined(FEAT_GUI_DIALOG)
|
||||
if (can_reload)
|
||||
{
|
||||
|
||||
+16
-10
@@ -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));
|
||||
@@ -740,7 +740,7 @@ deleteFold(start, end, recursive, had_visual)
|
||||
garray_T *found_ga;
|
||||
fold_T *found_fp = NULL;
|
||||
linenr_T found_off = 0;
|
||||
int use_level = FALSE;
|
||||
int use_level;
|
||||
int maybe_small = FALSE;
|
||||
int level = 0;
|
||||
linenr_T lnum = start;
|
||||
@@ -757,6 +757,7 @@ deleteFold(start, end, recursive, had_visual)
|
||||
gap = &curwin->w_folds;
|
||||
found_ga = NULL;
|
||||
lnum_off = 0;
|
||||
use_level = FALSE;
|
||||
for (;;)
|
||||
{
|
||||
if (!foldFind(gap, lnum - lnum_off, &fp))
|
||||
@@ -783,20 +784,21 @@ deleteFold(start, end, recursive, had_visual)
|
||||
else
|
||||
{
|
||||
lnum = found_fp->fd_top + found_fp->fd_len + found_off;
|
||||
did_one = TRUE;
|
||||
|
||||
if (foldmethodIsManual(curwin))
|
||||
deleteFoldEntry(found_ga,
|
||||
(int)(found_fp - (fold_T *)found_ga->ga_data), recursive);
|
||||
else
|
||||
{
|
||||
if (found_fp->fd_top + found_off < first_lnum)
|
||||
first_lnum = found_fp->fd_top;
|
||||
if (lnum > last_lnum)
|
||||
if (first_lnum > found_fp->fd_top + found_off)
|
||||
first_lnum = found_fp->fd_top + found_off;
|
||||
if (last_lnum < lnum)
|
||||
last_lnum = lnum;
|
||||
parseMarker(curwin);
|
||||
if (!did_one)
|
||||
parseMarker(curwin);
|
||||
deleteFoldMarkers(found_fp, recursive, found_off);
|
||||
}
|
||||
did_one = TRUE;
|
||||
|
||||
/* redraw window */
|
||||
changed_window_setting();
|
||||
@@ -811,6 +813,10 @@ deleteFold(start, end, recursive, had_visual)
|
||||
redraw_curbuf_later(INVERTED);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
/* Deleting markers may make cursor column invalid. */
|
||||
check_cursor_col();
|
||||
|
||||
if (last_lnum > 0)
|
||||
changed_lines(first_lnum, (colnr_T)0, last_lnum, 0L);
|
||||
}
|
||||
@@ -1241,10 +1247,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 +1258,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. */
|
||||
|
||||
+6
-2
@@ -3816,7 +3816,11 @@ showmap(mp, local)
|
||||
int len = 1;
|
||||
|
||||
if (msg_didout || msg_silent != 0)
|
||||
{
|
||||
msg_putchar('\n');
|
||||
if (got_int) /* 'q' typed at MORE prompt */
|
||||
return;
|
||||
}
|
||||
if ((mp->m_mode & (INSERT + CMDLINE)) == INSERT + CMDLINE)
|
||||
msg_putchar('!'); /* :map! */
|
||||
else if (mp->m_mode & INSERT)
|
||||
@@ -4702,7 +4706,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 +4805,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;
|
||||
}
|
||||
|
||||
+25
-7
@@ -482,8 +482,10 @@ EXTERN char *foreground_argument INIT(= NULL);
|
||||
/*
|
||||
* While executing external commands or in Ex mode, should not insert GUI
|
||||
* events in the input buffer: Set hold_gui_events to non-zero.
|
||||
*
|
||||
* volatile because it is used in signal handler sig_sysmouse().
|
||||
*/
|
||||
EXTERN int hold_gui_events INIT(= 0);
|
||||
EXTERN volatile int hold_gui_events INIT(= 0);
|
||||
|
||||
/*
|
||||
* When resizing the shell is postponed, remember the new size, and call
|
||||
@@ -597,7 +599,8 @@ EXTERN int exiting INIT(= FALSE);
|
||||
EXTERN int really_exiting INIT(= FALSE);
|
||||
/* TRUE when we are sure to exit, e.g., after
|
||||
* a deadly signal */
|
||||
EXTERN int full_screen INIT(= FALSE);
|
||||
/* volatile because it is used in signal handler deathtrap(). */
|
||||
EXTERN volatile int full_screen INIT(= FALSE);
|
||||
/* TRUE when doing full-screen output
|
||||
* otherwise only writing some messages */
|
||||
|
||||
@@ -616,6 +619,11 @@ EXTERN int textlock INIT(= 0);
|
||||
EXTERN int curbuf_lock INIT(= 0);
|
||||
/* non-zero when the current buffer can't be
|
||||
* changed. Used for FileChangedRO. */
|
||||
EXTERN int allbuf_lock INIT(= 0);
|
||||
/* non-zero when no buffer name can be
|
||||
* changed, no buffer can be deleted and
|
||||
* current directory can't be changed.
|
||||
* Used for SwapExists et al. */
|
||||
#endif
|
||||
#ifdef FEAT_EVAL
|
||||
# define HAVE_SANDBOX
|
||||
@@ -739,10 +747,12 @@ EXTERN JMP_BUF x_jump_env;
|
||||
*/
|
||||
EXTERN JMP_BUF lc_jump_env; /* argument to SETJMP() */
|
||||
# ifdef SIGHASARG
|
||||
EXTERN int lc_signal; /* catched signal number, 0 when no was signal
|
||||
catched; used for mch_libcall() */
|
||||
/* volatile because it is used in signal handlers. */
|
||||
EXTERN volatile int lc_signal; /* caught signal number, 0 when no was signal
|
||||
caught; used for mch_libcall() */
|
||||
# endif
|
||||
EXTERN int lc_active INIT(= FALSE); /* TRUE when lc_jump_env is valid. */
|
||||
/* volatile because it is used in signal handler deathtrap(). */
|
||||
EXTERN volatile int lc_active INIT(= FALSE); /* TRUE when lc_jump_env is valid. */
|
||||
#endif
|
||||
|
||||
#if defined(FEAT_MBYTE) || defined(FEAT_POSTSCRIPT)
|
||||
@@ -986,7 +996,8 @@ EXTERN int curscript INIT(= 0); /* index in scriptin[] */
|
||||
EXTERN FILE *scriptout INIT(= NULL); /* stream to write script to */
|
||||
EXTERN int read_cmd_fd INIT(= 0); /* fd to read commands from */
|
||||
|
||||
EXTERN int got_int INIT(= FALSE); /* set to TRUE when interrupt
|
||||
/* volatile because it is used in signal handler catch_sigint(). */
|
||||
EXTERN volatile int got_int INIT(= FALSE); /* set to TRUE when interrupt
|
||||
signal occurred */
|
||||
#ifdef USE_TERM_CONSOLE
|
||||
EXTERN int term_console INIT(= FALSE); /* set to TRUE when console used */
|
||||
@@ -1342,7 +1353,6 @@ EXTERN garray_T error_ga
|
||||
|
||||
#ifdef FEAT_NETBEANS_INTG
|
||||
EXTERN char *netbeansArg INIT(= NULL); /* the -nb[:host:port:passwd] arg */
|
||||
EXTERN int netbeansCloseFile INIT(= 0); /* send killed if != 0 */
|
||||
EXTERN int netbeansFireChanges INIT(= 1); /* send buffer changes if != 0 */
|
||||
EXTERN int netbeansForcedQuit INIT(= 0);/* don't write modified files */
|
||||
EXTERN int netbeansReadFile INIT(= 1); /* OK to read from disk if != 0 */
|
||||
@@ -1550,6 +1560,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.
|
||||
*/
|
||||
|
||||
@@ -58,7 +58,11 @@ static int can_update_cursor = TRUE; /* can display the cursor */
|
||||
gui_start()
|
||||
{
|
||||
char_u *old_term;
|
||||
#if defined(UNIX) && !defined(__BEOS__)
|
||||
#if defined(UNIX) && !defined(__BEOS__) && !defined(MACOS_X)
|
||||
/* By the time we get here Mac OS X will already have forked (it does so
|
||||
* right after scanning the command line) so don't do anything here. This
|
||||
* means that "f" in 'guioptions' cannot be supported.
|
||||
*/
|
||||
# define MAY_FORK
|
||||
int dofork = TRUE;
|
||||
#endif
|
||||
@@ -117,82 +121,10 @@ gui_start()
|
||||
*/
|
||||
if (gui.in_use && dofork)
|
||||
{
|
||||
pid_t pid = -1;
|
||||
|
||||
# if defined MACOS_X
|
||||
int i;
|
||||
|
||||
/* on os x, you have to exec after a fork, otherwise calls to
|
||||
* frameworks will assert (and without corefoundation, you can't start
|
||||
* the gui. what fun.). See CAVEATS at
|
||||
http://developer.apple.com/documentation/Darwin/Reference/ManPages/man2/fork.2.html
|
||||
*
|
||||
* Since we have to go through this anyways, we might as well use vfork.
|
||||
* But: then we can't detach from our starting shell, so stick with
|
||||
* fork.
|
||||
*
|
||||
* Kinda sucks to restart vim when doing :gui, so don't fork in that
|
||||
* case (make sure gui.dofork is only set when interpreting argv, not
|
||||
* when doing :gui. Currently, gui.dofork is set to false in ex_gui().
|
||||
*
|
||||
* Also doesn't work well if vim starts cscope (or some other
|
||||
* subprocess I guess), because it's not transferred to the newly
|
||||
* exec'd process, leaving an orphaned process (not a zombie process)
|
||||
* behind. The Right Thing is to kill all our child processes before
|
||||
* calling exec.
|
||||
*/
|
||||
|
||||
/* stolen from http://paste.lisp.org/display/50906 */
|
||||
extern int *_NSGetArgc(void);
|
||||
extern char ***_NSGetArgv(void);
|
||||
|
||||
int argc = *_NSGetArgc();
|
||||
char ** argv = *_NSGetArgv();
|
||||
char * newargv[argc+2];
|
||||
|
||||
newargv[0] = argv[0];
|
||||
|
||||
/*
|
||||
* make sure "-f" is in front of potential "--remote" flags, else
|
||||
* they would consume it.
|
||||
*/
|
||||
newargv[1] = "-f";
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
newargv[i + 1] = argv[i];
|
||||
}
|
||||
newargv[argc+1] = NULL;
|
||||
|
||||
/* shut down all the stuff we just started, just to start
|
||||
* it again from the exec :-\ */
|
||||
prepare_getout();
|
||||
|
||||
pid = fork();
|
||||
switch(pid) {
|
||||
case -1:
|
||||
# ifndef NDEBUG
|
||||
fprintf(stderr, "vim: Mac OS X workaround fork() failed!");
|
||||
# endif
|
||||
_exit(255);
|
||||
case 0:
|
||||
/* Child. */
|
||||
|
||||
/* make sure we survive our shell */
|
||||
setsid();
|
||||
|
||||
/* Restarts the vim process, will not return. */
|
||||
execvp(argv[0], newargv);
|
||||
|
||||
/* if we come here, exec has failed. bail. */
|
||||
_exit(255);
|
||||
default:
|
||||
/* Parent */
|
||||
_exit(0);
|
||||
}
|
||||
# else
|
||||
int pipefd[2]; /* pipe between parent and child */
|
||||
int pipe_error;
|
||||
char dummy;
|
||||
pid_t pid = -1;
|
||||
|
||||
/* Setup a pipe between the child and the parent, so that the parent
|
||||
* knows when the child has done the setsid() call and is allowed to
|
||||
@@ -211,7 +143,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]);
|
||||
}
|
||||
|
||||
@@ -227,30 +159,27 @@ http://developer.apple.com/documentation/Darwin/Reference/ManPages/man2/fork.2.h
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
# if defined(HAVE_SETSID) || defined(HAVE_SETPGID)
|
||||
# if defined(HAVE_SETSID) || defined(HAVE_SETPGID)
|
||||
/*
|
||||
* Change our process group. On some systems/shells a CTRL-C in the
|
||||
* shell where Vim was started would otherwise kill gvim!
|
||||
*/
|
||||
if (pid == 0) /* child */
|
||||
# if defined(HAVE_SETSID)
|
||||
# if defined(HAVE_SETSID)
|
||||
(void)setsid();
|
||||
# else
|
||||
# else
|
||||
(void)setpgid(0, 0);
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
if (!pipe_error)
|
||||
{
|
||||
close(pipefd[0]);
|
||||
close(pipefd[1]);
|
||||
}
|
||||
|
||||
|
||||
# if defined(FEAT_GUI_GNOME) && defined(FEAT_SESSION)
|
||||
# if defined(FEAT_GUI_GNOME) && defined(FEAT_SESSION)
|
||||
/* Tell the session manager our new PID */
|
||||
gui_mch_forked();
|
||||
# endif
|
||||
|
||||
# endif
|
||||
}
|
||||
#else
|
||||
@@ -3333,7 +3262,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 +3296,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 +3318,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 +3329,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 +3339,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 +3351,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 +3371,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
|
||||
@@ -4816,6 +4749,8 @@ ex_gui(eap)
|
||||
* Check for "-f" argument: foreground, don't fork.
|
||||
* Also don't fork when started with "gvim -f".
|
||||
* Do fork when using "gui -b".
|
||||
* Note that Mac OS X will never fork on :gui since it can only fork on
|
||||
* startup right after scanning the command line.
|
||||
*/
|
||||
if (arg[0] == '-'
|
||||
&& (arg[1] == 'f' || arg[1] == 'b')
|
||||
@@ -4828,13 +4763,6 @@ ex_gui(eap)
|
||||
{
|
||||
/* Clear the command. Needed for when forking+exiting, to avoid part
|
||||
* of the argument ending up after the shell prompt. */
|
||||
|
||||
#ifdef MACOS_X
|
||||
/* os x doesn't really support fork(), so we can't fork of a gui
|
||||
* in an already running vim. see gui_start() for more details.
|
||||
*/
|
||||
gui.dofork = FALSE;
|
||||
#endif
|
||||
msg_clr_eos_force();
|
||||
gui_start();
|
||||
}
|
||||
|
||||
@@ -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
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -1291,6 +1291,23 @@ drawBalloon(beval)
|
||||
XtNy, ty,
|
||||
NULL);
|
||||
#endif
|
||||
/* Set tooltip colors */
|
||||
{
|
||||
Arg args[2];
|
||||
|
||||
#ifdef FEAT_GUI_MOTIF
|
||||
args[0].name = XmNbackground;
|
||||
args[0].value = gui.tooltip_bg_pixel;
|
||||
args[1].name = XmNforeground;
|
||||
args[1].value = gui.tooltip_fg_pixel;
|
||||
#else /* Athena */
|
||||
args[0].name = XtNbackground;
|
||||
args[0].value = gui.tooltip_bg_pixel;
|
||||
args[1].name = XtNforeground;
|
||||
args[1].value = gui.tooltip_fg_pixel;
|
||||
#endif
|
||||
XtSetValues(beval->balloonLabel, &args[0], XtNumber(args));
|
||||
}
|
||||
|
||||
XtPopup(beval->balloonShell, XtGrabNone);
|
||||
|
||||
|
||||
+6
-6
@@ -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
@@ -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
|
||||
|
||||
+2
-2
@@ -695,7 +695,7 @@ gui_mch_set_winpos(int x, int y)
|
||||
gui_mch_set_shellsize(width, height, min_width, min_height, base_width, base_height, direction)
|
||||
int width; /* In OS units */
|
||||
int height;
|
||||
int min_width; /* Smallest permissable window size (ignored) */
|
||||
int min_width; /* Smallest permissible window size (ignored) */
|
||||
int min_height;
|
||||
int base_width; /* Space for scroll bars, etc */
|
||||
int base_height;
|
||||
@@ -863,7 +863,7 @@ zap_load_file(name, style)
|
||||
if (strncmp(file, "ZapFont\015", 8) == 0)
|
||||
return file; /* Loaded OK! */
|
||||
|
||||
free(file);
|
||||
vim_free(file);
|
||||
return NULL; /* Not a valid font file */
|
||||
}
|
||||
|
||||
|
||||
+36
-6
@@ -992,7 +992,7 @@ _WndProc(
|
||||
SendMessage(lpdi->hdr.hwndFrom, TTM_SETMAXTIPWIDTH,
|
||||
0, 500);
|
||||
|
||||
tt_text = enc_to_ucs2(str, NULL);
|
||||
tt_text = enc_to_utf16(str, NULL);
|
||||
lpdi->lpszText = tt_text;
|
||||
/* can't show tooltip if failed */
|
||||
}
|
||||
@@ -1582,6 +1582,17 @@ gui_mch_init(void)
|
||||
s_findrep_struct.lpstrReplaceWith[0] = NUL;
|
||||
s_findrep_struct.wFindWhatLen = MSWIN_FR_BUFSIZE;
|
||||
s_findrep_struct.wReplaceWithLen = MSWIN_FR_BUFSIZE;
|
||||
# if defined(FEAT_MBYTE) && defined(WIN3264)
|
||||
s_findrep_struct_w.lStructSize = sizeof(s_findrep_struct_w);
|
||||
s_findrep_struct_w.lpstrFindWhat =
|
||||
(LPWSTR)alloc(MSWIN_FR_BUFSIZE * sizeof(WCHAR));
|
||||
s_findrep_struct_w.lpstrFindWhat[0] = NUL;
|
||||
s_findrep_struct_w.lpstrReplaceWith =
|
||||
(LPWSTR)alloc(MSWIN_FR_BUFSIZE * sizeof(WCHAR));
|
||||
s_findrep_struct_w.lpstrReplaceWith[0] = NUL;
|
||||
s_findrep_struct_w.wFindWhatLen = MSWIN_FR_BUFSIZE;
|
||||
s_findrep_struct_w.wReplaceWithLen = MSWIN_FR_BUFSIZE;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
theend:
|
||||
@@ -1935,7 +1946,7 @@ GetResultStr(HWND hwnd, int GCS, int *lenp)
|
||||
if (buf == NULL)
|
||||
return NULL;
|
||||
|
||||
convbuf = ucs2_to_enc(buf, lenp);
|
||||
convbuf = utf16_to_enc(buf, lenp);
|
||||
pImmReleaseContext(hwnd, hIMC);
|
||||
vim_free(buf);
|
||||
return convbuf;
|
||||
@@ -2566,7 +2577,7 @@ gui_mch_add_menu(
|
||||
{
|
||||
/* 'encoding' differs from active codepage: convert menu name
|
||||
* and use wide function */
|
||||
wn = enc_to_ucs2(menu->name, NULL);
|
||||
wn = enc_to_utf16(menu->name, NULL);
|
||||
if (wn != NULL)
|
||||
{
|
||||
MENUITEMINFOW infow;
|
||||
@@ -2728,7 +2739,7 @@ gui_mch_add_menu_item(
|
||||
{
|
||||
/* 'encoding' differs from active codepage: convert menu item name
|
||||
* and use wide function */
|
||||
wn = enc_to_ucs2(menu->name, NULL);
|
||||
wn = enc_to_utf16(menu->name, NULL);
|
||||
if (wn != NULL)
|
||||
{
|
||||
n = InsertMenuW(parent->submenu_id, (UINT)idx,
|
||||
@@ -2938,8 +2949,27 @@ dialog_callback(
|
||||
|
||||
/* If the edit box exists, copy the string. */
|
||||
if (s_textfield != NULL)
|
||||
GetDlgItemText(hwnd, DLG_NONBUTTON_CONTROL + 2,
|
||||
{
|
||||
# if defined(FEAT_MBYTE) && defined(WIN3264)
|
||||
/* If the OS is Windows NT, and 'encoding' differs from active
|
||||
* codepage: use wide function and convert text. */
|
||||
if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT
|
||||
&& enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
{
|
||||
WCHAR *wp = (WCHAR *)alloc(IOSIZE * sizeof(WCHAR));
|
||||
char_u *p;
|
||||
|
||||
GetDlgItemTextW(hwnd, DLG_NONBUTTON_CONTROL + 2, wp, IOSIZE);
|
||||
p = utf16_to_enc(wp, NULL);
|
||||
vim_strncpy(s_textfield, p, IOSIZE);
|
||||
vim_free(p);
|
||||
vim_free(wp);
|
||||
}
|
||||
else
|
||||
# endif
|
||||
GetDlgItemText(hwnd, DLG_NONBUTTON_CONTROL + 2,
|
||||
s_textfield, IOSIZE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Need to check for IDOK because if the user just hits Return to
|
||||
@@ -3570,7 +3600,7 @@ nCopyAnsiToWideChar(
|
||||
if (enc_codepage == 0 && (int)GetACP() != enc_codepage)
|
||||
{
|
||||
/* Not a codepage, use our own conversion function. */
|
||||
wn = enc_to_ucs2(lpAnsiIn, NULL);
|
||||
wn = enc_to_utf16(lpAnsiIn, NULL);
|
||||
if (wn != NULL)
|
||||
{
|
||||
wcscpy(lpWCStr, wn);
|
||||
|
||||
+113
-21
@@ -153,6 +153,9 @@ static int destroying = FALSE; /* call DestroyWindow() ourselves */
|
||||
#ifdef MSWIN_FIND_REPLACE
|
||||
static UINT s_findrep_msg = 0; /* set in gui_w[16/32].c */
|
||||
static FINDREPLACE s_findrep_struct;
|
||||
# if defined(FEAT_MBYTE) && defined(WIN3264)
|
||||
static FINDREPLACEW s_findrep_struct_w;
|
||||
# endif
|
||||
static HWND s_findrep_hwnd = NULL;
|
||||
static int s_findrep_is_find; /* TRUE for find dialog, FALSE
|
||||
for find/replace dialog */
|
||||
@@ -547,7 +550,7 @@ char_to_string(int ch, char_u *string, int slen, int had_alt)
|
||||
else
|
||||
{
|
||||
len = 1;
|
||||
ws = ucs2_to_enc(wstring, &len);
|
||||
ws = utf16_to_enc(wstring, &len);
|
||||
if (ws == NULL)
|
||||
len = 0;
|
||||
else
|
||||
@@ -884,6 +887,45 @@ _OnMenu(
|
||||
#endif
|
||||
|
||||
#ifdef MSWIN_FIND_REPLACE
|
||||
# if defined(FEAT_MBYTE) && defined(WIN3264)
|
||||
/*
|
||||
* copy useful data from structure LPFINDREPLACE to structure LPFINDREPLACEW
|
||||
*/
|
||||
static void
|
||||
findrep_atow(LPFINDREPLACEW lpfrw, LPFINDREPLACE lpfr)
|
||||
{
|
||||
WCHAR *wp;
|
||||
|
||||
lpfrw->hwndOwner = lpfr->hwndOwner;
|
||||
lpfrw->Flags = lpfr->Flags;
|
||||
|
||||
wp = enc_to_utf16(lpfr->lpstrFindWhat, NULL);
|
||||
wcsncpy(lpfrw->lpstrFindWhat, wp, lpfrw->wFindWhatLen - 1);
|
||||
vim_free(wp);
|
||||
|
||||
/* the field "lpstrReplaceWith" doesn't need to be copied */
|
||||
}
|
||||
|
||||
/*
|
||||
* copy useful data from structure LPFINDREPLACEW to structure LPFINDREPLACE
|
||||
*/
|
||||
static void
|
||||
findrep_wtoa(LPFINDREPLACE lpfr, LPFINDREPLACEW lpfrw)
|
||||
{
|
||||
char_u *p;
|
||||
|
||||
lpfr->Flags = lpfrw->Flags;
|
||||
|
||||
p = utf16_to_enc(lpfrw->lpstrFindWhat, NULL);
|
||||
vim_strncpy(lpfr->lpstrFindWhat, p, lpfr->wFindWhatLen - 1);
|
||||
vim_free(p);
|
||||
|
||||
p = utf16_to_enc(lpfrw->lpstrReplaceWith, NULL);
|
||||
vim_strncpy(lpfr->lpstrReplaceWith, p, lpfr->wReplaceWithLen - 1);
|
||||
vim_free(p);
|
||||
}
|
||||
# endif
|
||||
|
||||
/*
|
||||
* Handle a Find/Replace window message.
|
||||
*/
|
||||
@@ -893,6 +935,16 @@ _OnFindRepl(void)
|
||||
int flags = 0;
|
||||
int down;
|
||||
|
||||
# if defined(FEAT_MBYTE) && defined(WIN3264)
|
||||
/* If the OS is Windows NT, and 'encoding' differs from active codepage:
|
||||
* convert text from wide string. */
|
||||
if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT
|
||||
&& enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
{
|
||||
findrep_wtoa(&s_findrep_struct, &s_findrep_struct_w);
|
||||
}
|
||||
# endif
|
||||
|
||||
if (s_findrep_struct.Flags & FR_DIALOGTERM)
|
||||
/* Give main window the focus back. */
|
||||
(void)SetFocus(s_hwnd);
|
||||
@@ -1663,8 +1715,17 @@ process_message(void)
|
||||
if (msg.message == WM_OLE)
|
||||
{
|
||||
char_u *str = (char_u *)msg.lParam;
|
||||
add_to_input_buf(str, (int)STRLEN(str));
|
||||
vim_free(str);
|
||||
if (str == NULL || *str == NUL)
|
||||
{
|
||||
/* Message can't be ours, forward it. Fixes problem with Ultramon
|
||||
* 3.0.4 */
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
add_to_input_buf(str, (int)STRLEN(str));
|
||||
vim_free(str); /* was allocated in CVim::SendKeys() */
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -1937,6 +1998,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
|
||||
@@ -2128,7 +2194,7 @@ GetTextWidthEnc(HDC hdc, char_u *str, int len)
|
||||
{
|
||||
/* 'encoding' differs from active codepage: convert text and use wide
|
||||
* function */
|
||||
wstr = enc_to_ucs2(str, &wlen);
|
||||
wstr = enc_to_utf16(str, &wlen);
|
||||
if (wstr != NULL)
|
||||
{
|
||||
n = GetTextExtentPointW(hdc, wstr, wlen, &size);
|
||||
@@ -2252,7 +2318,7 @@ add_tabline_popup_menu_entry(HMENU pmenu, UINT item_id, char_u *item_text)
|
||||
{
|
||||
/* 'encoding' differs from active codepage: convert menu name
|
||||
* and use wide function */
|
||||
wn = enc_to_ucs2(item_text, NULL);
|
||||
wn = enc_to_utf16(item_text, NULL);
|
||||
if (wn != NULL)
|
||||
{
|
||||
MENUITEMINFOW infow;
|
||||
@@ -2422,7 +2488,7 @@ gui_mch_update_tabline(void)
|
||||
if (use_unicode)
|
||||
{
|
||||
/* Need to go through Unicode. */
|
||||
wstr = enc_to_ucs2(NameBuff, NULL);
|
||||
wstr = enc_to_utf16(NameBuff, NULL);
|
||||
if (wstr != NULL)
|
||||
{
|
||||
TCITEMW tiw;
|
||||
@@ -2521,8 +2587,8 @@ set_window_title(HWND hwnd, char *title)
|
||||
WCHAR *wbuf;
|
||||
int n;
|
||||
|
||||
/* Convert the title from 'encoding' to ucs2. */
|
||||
wbuf = (WCHAR *)enc_to_ucs2((char_u *)title, NULL);
|
||||
/* Convert the title from 'encoding' to UTF-16. */
|
||||
wbuf = (WCHAR *)enc_to_utf16((char_u *)title, NULL);
|
||||
if (wbuf != NULL)
|
||||
{
|
||||
n = SetWindowTextW(hwnd, wbuf);
|
||||
@@ -2548,7 +2614,19 @@ gui_mch_find_dialog(exarg_T *eap)
|
||||
if (!IsWindow(s_findrep_hwnd))
|
||||
{
|
||||
initialise_findrep(eap->arg);
|
||||
s_findrep_hwnd = FindText((LPFINDREPLACE) &s_findrep_struct);
|
||||
# if defined(FEAT_MBYTE) && defined(WIN3264)
|
||||
/* If the OS is Windows NT, and 'encoding' differs from active
|
||||
* codepage: convert text and use wide function. */
|
||||
if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT
|
||||
&& enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
{
|
||||
findrep_atow(&s_findrep_struct_w, &s_findrep_struct);
|
||||
s_findrep_hwnd = FindTextW(
|
||||
(LPFINDREPLACEW) &s_findrep_struct_w);
|
||||
}
|
||||
else
|
||||
# endif
|
||||
s_findrep_hwnd = FindText((LPFINDREPLACE) &s_findrep_struct);
|
||||
}
|
||||
|
||||
set_window_title(s_findrep_hwnd,
|
||||
@@ -2573,7 +2651,18 @@ gui_mch_replace_dialog(exarg_T *eap)
|
||||
if (!IsWindow(s_findrep_hwnd))
|
||||
{
|
||||
initialise_findrep(eap->arg);
|
||||
s_findrep_hwnd = ReplaceText((LPFINDREPLACE) &s_findrep_struct);
|
||||
# if defined(FEAT_MBYTE) && defined(WIN3264)
|
||||
if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT
|
||||
&& enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
{
|
||||
findrep_atow(&s_findrep_struct_w, &s_findrep_struct);
|
||||
s_findrep_hwnd = ReplaceTextW(
|
||||
(LPFINDREPLACEW) &s_findrep_struct_w);
|
||||
}
|
||||
else
|
||||
# endif
|
||||
s_findrep_hwnd = ReplaceText(
|
||||
(LPFINDREPLACE) &s_findrep_struct);
|
||||
}
|
||||
|
||||
set_window_title(s_findrep_hwnd,
|
||||
@@ -3222,7 +3311,7 @@ gui_mch_browseW(
|
||||
char_u *initdir,
|
||||
char_u *filter)
|
||||
{
|
||||
/* We always use the wide function. This means enc_to_ucs2() must work,
|
||||
/* We always use the wide function. This means enc_to_utf16() must work,
|
||||
* otherwise it fails miserably! */
|
||||
OPENFILENAMEW fileStruct;
|
||||
WCHAR fileBuf[MAXPATHL];
|
||||
@@ -3238,7 +3327,7 @@ gui_mch_browseW(
|
||||
fileBuf[0] = NUL;
|
||||
else
|
||||
{
|
||||
wp = enc_to_ucs2(dflt, NULL);
|
||||
wp = enc_to_utf16(dflt, NULL);
|
||||
if (wp == NULL)
|
||||
fileBuf[0] = NUL;
|
||||
else
|
||||
@@ -3263,11 +3352,11 @@ gui_mch_browseW(
|
||||
#endif
|
||||
|
||||
if (title != NULL)
|
||||
titlep = enc_to_ucs2(title, NULL);
|
||||
titlep = enc_to_utf16(title, NULL);
|
||||
fileStruct.lpstrTitle = titlep;
|
||||
|
||||
if (ext != NULL)
|
||||
extp = enc_to_ucs2(ext, NULL);
|
||||
extp = enc_to_utf16(ext, NULL);
|
||||
fileStruct.lpstrDefExt = extp;
|
||||
|
||||
fileStruct.lpstrFile = fileBuf;
|
||||
@@ -3278,7 +3367,7 @@ gui_mch_browseW(
|
||||
if (initdir != NULL && *initdir != NUL)
|
||||
{
|
||||
/* Must have backslashes here, no matter what 'shellslash' says */
|
||||
initdirp = enc_to_ucs2(initdir, NULL);
|
||||
initdirp = enc_to_utf16(initdir, NULL);
|
||||
if (initdirp != NULL)
|
||||
{
|
||||
for (wp = initdirp; *wp != NUL; ++wp)
|
||||
@@ -3318,7 +3407,7 @@ gui_mch_browseW(
|
||||
vim_free(extp);
|
||||
|
||||
/* Convert from UCS2 to 'encoding'. */
|
||||
p = ucs2_to_enc(fileBuf, NULL);
|
||||
p = utf16_to_enc(fileBuf, NULL);
|
||||
if (p != NULL)
|
||||
/* when out of memory we get garbage for non-ASCII chars */
|
||||
STRCPY(fileBuf, p);
|
||||
@@ -3335,7 +3424,7 @@ gui_mch_browseW(
|
||||
|
||||
/*
|
||||
* Convert the string s to the proper format for a filter string by replacing
|
||||
* the \t and \n delimeters with \0.
|
||||
* the \t and \n delimiters with \0.
|
||||
* Returns the converted string in allocated memory.
|
||||
*
|
||||
* Keep in sync with convert_filterW() above!
|
||||
@@ -3518,7 +3607,7 @@ _OnDropFiles(
|
||||
{
|
||||
#ifdef FEAT_MBYTE
|
||||
if (DragQueryFileW(hDrop, i, wszFile, BUFPATHLEN) > 0)
|
||||
fnames[i] = ucs2_to_enc(wszFile, NULL);
|
||||
fnames[i] = utf16_to_enc(wszFile, NULL);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
@@ -3674,7 +3763,8 @@ _OnScroll(
|
||||
* Use "prog" as the name of the program and "cmdline" as the arguments.
|
||||
* Copy the arguments to allocated memory.
|
||||
* Return the number of arguments (including program name).
|
||||
* Return pointers to the arguments in "argvp".
|
||||
* Return pointers to the arguments in "argvp". Memory is allocated with
|
||||
* malloc(), use free() instead of vim_free().
|
||||
* Return pointer to buffer in "tofree".
|
||||
* Returns zero when out of memory.
|
||||
*/
|
||||
@@ -3692,6 +3782,8 @@ get_cmd_args(char *prog, char *cmdline, char ***argvp, char **tofree)
|
||||
char **argv = NULL;
|
||||
int round;
|
||||
|
||||
*tofree = NULL;
|
||||
|
||||
#ifdef FEAT_MBYTE
|
||||
/* Try using the Unicode version first, it takes care of conversion when
|
||||
* 'encoding' is changed. */
|
||||
@@ -3802,15 +3894,15 @@ get_cmd_args(char *prog, char *cmdline, char ***argvp, char **tofree)
|
||||
argv = (char **)malloc((argc + 1) * sizeof(char *));
|
||||
if (argv == NULL )
|
||||
{
|
||||
vim_free(newcmdline);
|
||||
free(newcmdline);
|
||||
return 0; /* malloc error */
|
||||
}
|
||||
pnew = newcmdline;
|
||||
*tofree = newcmdline;
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
|
||||
argv[argc] = NULL; /* NULL-terminated list */
|
||||
*argvp = argv;
|
||||
return argc;
|
||||
|
||||
+27
-34
@@ -1587,6 +1587,8 @@ gui_mch_uninit()
|
||||
XtCloseDisplay(gui.dpy);
|
||||
gui.dpy = NULL;
|
||||
vimShell = (Widget)0;
|
||||
vim_free(gui_argv);
|
||||
gui_argv = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1761,6 +1763,8 @@ gui_mch_exit(rc)
|
||||
* says that this isn't needed when exiting, so just skip it. */
|
||||
XtCloseDisplay(gui.dpy);
|
||||
#endif
|
||||
vim_free(gui_argv);
|
||||
gui_argv = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2450,7 +2454,7 @@ find_closest_color(colormap, colorPtr)
|
||||
*colorPtr = colortable[closest];
|
||||
}
|
||||
|
||||
free(colortable);
|
||||
vim_free(colortable);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -3439,47 +3443,37 @@ gui_mch_register_sign(signfile)
|
||||
char_u *signfile;
|
||||
{
|
||||
XpmAttributes attrs;
|
||||
XImage *sign;
|
||||
XImage *sign = NULL;
|
||||
int status;
|
||||
|
||||
/*
|
||||
* Setup the color substitution table.
|
||||
*/
|
||||
sign = NULL;
|
||||
if (signfile[0] != NUL && signfile[0] != '-')
|
||||
{
|
||||
sign = (XImage *)alloc(sizeof(XImage));
|
||||
if (sign != NULL)
|
||||
XpmColorSymbol color[5] =
|
||||
{
|
||||
XpmColorSymbol color[5] =
|
||||
{
|
||||
{"none", NULL, 0},
|
||||
{"iconColor1", NULL, 0},
|
||||
{"bottomShadowColor", NULL, 0},
|
||||
{"topShadowColor", NULL, 0},
|
||||
{"selectColor", NULL, 0}
|
||||
};
|
||||
attrs.valuemask = XpmColorSymbols;
|
||||
attrs.numsymbols = 2;
|
||||
attrs.colorsymbols = color;
|
||||
attrs.colorsymbols[0].pixel = gui.back_pixel;
|
||||
attrs.colorsymbols[1].pixel = gui.norm_pixel;
|
||||
status = XpmReadFileToImage(gui.dpy, (char *)signfile,
|
||||
{"none", NULL, 0},
|
||||
{"iconColor1", NULL, 0},
|
||||
{"bottomShadowColor", NULL, 0},
|
||||
{"topShadowColor", NULL, 0},
|
||||
{"selectColor", NULL, 0}
|
||||
};
|
||||
attrs.valuemask = XpmColorSymbols;
|
||||
attrs.numsymbols = 2;
|
||||
attrs.colorsymbols = color;
|
||||
attrs.colorsymbols[0].pixel = gui.back_pixel;
|
||||
attrs.colorsymbols[1].pixel = gui.norm_pixel;
|
||||
status = XpmReadFileToImage(gui.dpy, (char *)signfile,
|
||||
&sign, NULL, &attrs);
|
||||
|
||||
if (status == 0)
|
||||
{
|
||||
/* Sign width is fixed at two columns now.
|
||||
if (sign->width > gui.sign_width)
|
||||
gui.sign_width = sign->width + 8; */
|
||||
}
|
||||
else
|
||||
{
|
||||
vim_free(sign);
|
||||
sign = NULL;
|
||||
EMSG(_(e_signdata));
|
||||
}
|
||||
if (status == 0)
|
||||
{
|
||||
/* Sign width is fixed at two columns now.
|
||||
if (sign->width > gui.sign_width)
|
||||
gui.sign_width = sign->width + 8; */
|
||||
}
|
||||
else
|
||||
EMSG(_(e_signdata));
|
||||
}
|
||||
|
||||
return (void *)sign;
|
||||
@@ -3489,8 +3483,7 @@ gui_mch_register_sign(signfile)
|
||||
gui_mch_destroy_sign(sign)
|
||||
void *sign;
|
||||
{
|
||||
XFree(((XImage *)sign)->data);
|
||||
vim_free(sign);
|
||||
XDestroyImage((XImage*)sign);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+38
-38
@@ -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
@@ -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:
|
||||
|
||||
+128
-7
@@ -93,12 +93,117 @@ cs_usage_msg(x)
|
||||
(void)EMSG2(_("E560: Usage: cs[cope] %s"), cs_cmds[(int)x].usage);
|
||||
}
|
||||
|
||||
#if defined(FEAT_CMDL_COMPL) || defined(PROTO)
|
||||
|
||||
static enum
|
||||
{
|
||||
EXP_CSCOPE_SUBCMD, /* expand ":cscope" sub-commands */
|
||||
EXP_CSCOPE_FIND, /* expand ":cscope find" arguments */
|
||||
EXP_CSCOPE_KILL /* expand ":cscope kill" arguments */
|
||||
} expand_what;
|
||||
|
||||
/*
|
||||
* Function given to ExpandGeneric() to obtain the cscope command
|
||||
* expansion.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
char_u *
|
||||
get_cscope_name(xp, idx)
|
||||
expand_T *xp;
|
||||
int idx;
|
||||
{
|
||||
switch (expand_what)
|
||||
{
|
||||
case EXP_CSCOPE_SUBCMD:
|
||||
/* Complete with sub-commands of ":cscope":
|
||||
* add, find, help, kill, reset, show */
|
||||
return (char_u *)cs_cmds[idx].name;
|
||||
case EXP_CSCOPE_FIND:
|
||||
{
|
||||
const char *query_type[] =
|
||||
{
|
||||
"c", "d", "e", "f", "g", "i", "s", "t", NULL
|
||||
};
|
||||
|
||||
/* Complete with query type of ":cscope find {query_type}".
|
||||
* {query_type} can be letters (c, d, ... t) or numbers (0, 1,
|
||||
* ..., 8) but only complete with letters, since numbers are
|
||||
* redundant. */
|
||||
return (char_u *)query_type[idx];
|
||||
}
|
||||
case EXP_CSCOPE_KILL:
|
||||
{
|
||||
int i;
|
||||
int current_idx = 0;
|
||||
static char_u connection[2];
|
||||
|
||||
/* ":cscope kill" accepts connection numbers or partial names of
|
||||
* the pathname of the cscope database as argument. Only complete
|
||||
* with connection numbers. -1 can also be used to kill all
|
||||
* connections. */
|
||||
for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++)
|
||||
{
|
||||
if (csinfo[i].fname == NULL)
|
||||
continue;
|
||||
if (current_idx++ == idx)
|
||||
{
|
||||
/* Connection number fits in one character since
|
||||
* CSCOPE_MAX_CONNECTIONS is < 10 */
|
||||
connection[0] = i + '0';
|
||||
connection[1] = NUL;
|
||||
return connection;
|
||||
}
|
||||
}
|
||||
return (current_idx == idx && idx > 0) ? (char_u *)"-1" : NULL;
|
||||
}
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle command line completion for :cscope command.
|
||||
*/
|
||||
void
|
||||
set_context_in_cscope_cmd(xp, arg)
|
||||
expand_T *xp;
|
||||
char_u *arg;
|
||||
{
|
||||
char_u *p;
|
||||
|
||||
/* Default: expand subcommands */
|
||||
xp->xp_context = EXPAND_CSCOPE;
|
||||
expand_what = EXP_CSCOPE_SUBCMD;
|
||||
xp->xp_pattern = arg;
|
||||
|
||||
/* (part of) subcommand already typed */
|
||||
if (*arg != NUL)
|
||||
{
|
||||
p = skiptowhite(arg);
|
||||
if (*p != NUL) /* past first word */
|
||||
{
|
||||
xp->xp_pattern = skipwhite(p);
|
||||
if (*skiptowhite(xp->xp_pattern) != NUL)
|
||||
xp->xp_context = EXPAND_NOTHING;
|
||||
else if (STRNICMP(arg, "add", p - arg) == 0)
|
||||
xp->xp_context = EXPAND_FILES;
|
||||
else if (STRNICMP(arg, "kill", p - arg) == 0)
|
||||
expand_what = EXP_CSCOPE_KILL;
|
||||
else if (STRNICMP(arg, "find", p - arg) == 0)
|
||||
expand_what = EXP_CSCOPE_FIND;
|
||||
else
|
||||
xp->xp_context = EXPAND_NOTHING;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* FEAT_CMDL_COMPL */
|
||||
|
||||
/*
|
||||
* PRIVATE: do_cscope_general
|
||||
*
|
||||
* find the command, print help if invalid, and the then call the
|
||||
* corresponding command function,
|
||||
* called from do_cscope and do_scscope
|
||||
* Find the command, print help if invalid, and then call the corresponding
|
||||
* command function.
|
||||
*/
|
||||
static void
|
||||
do_cscope_general(eap, make_split)
|
||||
@@ -659,6 +764,7 @@ cs_create_cmd(csoption, pattern)
|
||||
{
|
||||
char *cmd;
|
||||
short search;
|
||||
char *pat;
|
||||
|
||||
switch (csoption[0])
|
||||
{
|
||||
@@ -692,10 +798,17 @@ cs_create_cmd(csoption, pattern)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((cmd = (char *)alloc((unsigned)(strlen(pattern) + 2))) == NULL)
|
||||
/* Skip white space before the patter, except for text and pattern search,
|
||||
* they may want to use the leading white space. */
|
||||
pat = pattern;
|
||||
if (search != 4 && search != 6)
|
||||
while vim_iswhite(*pat)
|
||||
++pat;
|
||||
|
||||
if ((cmd = (char *)alloc((unsigned)(strlen(pat) + 2))) == NULL)
|
||||
return NULL;
|
||||
|
||||
(void)sprintf(cmd, "%d%s", search, pattern);
|
||||
(void)sprintf(cmd, "%d%s", search, pat);
|
||||
|
||||
return cmd;
|
||||
} /* cs_create_cmd */
|
||||
@@ -1177,8 +1290,16 @@ cs_help(eap)
|
||||
(void)MSG_PUTS(_("cscope commands:\n"));
|
||||
while (cmdp->name != NULL)
|
||||
{
|
||||
(void)smsg((char_u *)_("%-5s: %-30s (Usage: %s)"),
|
||||
cmdp->name, _(cmdp->help), cmdp->usage);
|
||||
char *help = _(cmdp->help);
|
||||
int space_cnt = 30 - vim_strsize((char_u *)help);
|
||||
|
||||
/* Use %*s rather than %30s to ensure proper alignment in utf-8 */
|
||||
if (space_cnt < 0)
|
||||
space_cnt = 0;
|
||||
(void)smsg((char_u *)_("%-5s: %s%*s (Usage: %s)"),
|
||||
cmdp->name,
|
||||
help, space_cnt, " ",
|
||||
cmdp->usage);
|
||||
if (strcmp(cmdp->name, "find") == 0)
|
||||
MSG_PUTS(_("\n"
|
||||
" c: Find functions calling this function\n"
|
||||
|
||||
+6
-2
@@ -353,9 +353,13 @@ CVim::SendKeys(BSTR keys)
|
||||
}
|
||||
|
||||
/* Pass the string to the main input loop. The memory will be freed when
|
||||
* the message is processed.
|
||||
* the message is processed. Except for an empty message, we don't need
|
||||
* to post it then.
|
||||
*/
|
||||
PostMessage(NULL, WM_OLE, 0, (LPARAM)str);
|
||||
if (*str == NUL)
|
||||
vim_free(str);
|
||||
else
|
||||
PostMessage(NULL, WM_OLE, 0, (LPARAM)str);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
+4
-4
@@ -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);
|
||||
|
||||
+27
-11
@@ -531,6 +531,12 @@ Python_Init(void)
|
||||
if (PythonMod_Init())
|
||||
goto fail;
|
||||
|
||||
/* Remove the element from sys.path that was added because of our
|
||||
* argv[0] value in PythonMod_Init(). Previously we used an empty
|
||||
* string, but dependinding on the OS we then get an empty entry or
|
||||
* the current directory in sys.path. */
|
||||
PyRun_SimpleString("import sys; sys.path = filter(lambda x: x != '/must>not&exist', sys.path)");
|
||||
|
||||
/* the first python thread is vim's, release the lock */
|
||||
Python_SaveThread();
|
||||
|
||||
@@ -1145,14 +1151,23 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookupDict)
|
||||
|
||||
/* Check if we run into a recursive loop. The item must be in lookupDict
|
||||
* then and we can use it again. */
|
||||
sprintf(ptrBuf, PRINTF_DECIMAL_LONG_U, (long_u)our_tv);
|
||||
result = PyDict_GetItemString(lookupDict, ptrBuf);
|
||||
if (result != NULL)
|
||||
Py_INCREF(result);
|
||||
else if (our_tv->v_type == VAR_STRING)
|
||||
if ((our_tv->v_type == VAR_LIST && our_tv->vval.v_list != NULL)
|
||||
|| (our_tv->v_type == VAR_DICT && our_tv->vval.v_dict != NULL))
|
||||
{
|
||||
sprintf(ptrBuf, PRINTF_DECIMAL_LONG_U,
|
||||
our_tv->v_type == VAR_LIST ? (long_u)our_tv->vval.v_list
|
||||
: (long_u)our_tv->vval.v_dict);
|
||||
result = PyDict_GetItemString(lookupDict, ptrBuf);
|
||||
if (result != NULL)
|
||||
{
|
||||
Py_INCREF(result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
if (our_tv->v_type == VAR_STRING)
|
||||
{
|
||||
result = Py_BuildValue("s", our_tv->vval.v_string);
|
||||
PyDict_SetItemString(lookupDict, ptrBuf, result);
|
||||
}
|
||||
else if (our_tv->v_type == VAR_NUMBER)
|
||||
{
|
||||
@@ -1161,7 +1176,6 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookupDict)
|
||||
/* For backwards compatibility numbers are stored as strings. */
|
||||
sprintf(buf, "%ld", (long)our_tv->vval.v_number);
|
||||
result = Py_BuildValue("s", buf);
|
||||
PyDict_SetItemString(lookupDict, ptrBuf, result);
|
||||
}
|
||||
# ifdef FEAT_FLOAT
|
||||
else if (our_tv->v_type == VAR_FLOAT)
|
||||
@@ -1170,7 +1184,6 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookupDict)
|
||||
|
||||
sprintf(buf, "%f", our_tv->vval.v_float);
|
||||
result = Py_BuildValue("s", buf);
|
||||
PyDict_SetItemString(lookupDict, ptrBuf, result);
|
||||
}
|
||||
# endif
|
||||
else if (our_tv->v_type == VAR_LIST)
|
||||
@@ -1179,10 +1192,11 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookupDict)
|
||||
listitem_T *curr;
|
||||
|
||||
result = PyList_New(0);
|
||||
PyDict_SetItemString(lookupDict, ptrBuf, result);
|
||||
|
||||
if (list != NULL)
|
||||
{
|
||||
PyDict_SetItemString(lookupDict, ptrBuf, result);
|
||||
|
||||
for (curr = list->lv_first; curr != NULL; curr = curr->li_next)
|
||||
{
|
||||
newObj = VimToPython(&curr->li_tv, depth + 1, lookupDict);
|
||||
@@ -1194,7 +1208,6 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookupDict)
|
||||
else if (our_tv->v_type == VAR_DICT)
|
||||
{
|
||||
result = PyDict_New();
|
||||
PyDict_SetItemString(lookupDict, ptrBuf, result);
|
||||
|
||||
if (our_tv->vval.v_dict != NULL)
|
||||
{
|
||||
@@ -1203,6 +1216,8 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookupDict)
|
||||
hashitem_T *hi;
|
||||
dictitem_T *di;
|
||||
|
||||
PyDict_SetItemString(lookupDict, ptrBuf, result);
|
||||
|
||||
for (hi = ht->ht_array; todo > 0; ++hi)
|
||||
{
|
||||
if (!HASHITEM_EMPTY(hi))
|
||||
@@ -2345,7 +2360,8 @@ PythonMod_Init(void)
|
||||
{
|
||||
PyObject *mod;
|
||||
PyObject *dict;
|
||||
static char *(argv[2]) = {"", NULL};
|
||||
/* The special value is removed from sys.path in Python_Init(). */
|
||||
static char *(argv[2]) = {"/must>not&exist/foo", NULL};
|
||||
|
||||
/* Fixups... */
|
||||
BufferType.ob_type = &PyType_Type;
|
||||
|
||||
+6
-5
@@ -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)
|
||||
@@ -1114,7 +1114,8 @@ vi_open_file(fname)
|
||||
char *fname;
|
||||
{
|
||||
++no_wait_return;
|
||||
do_ecmd(0, (char_u *)fname, NULL, NULL, ECMD_ONE, ECMD_HIDE+ECMD_OLDBUF);
|
||||
do_ecmd(0, (char_u *)fname, NULL, NULL, ECMD_ONE, ECMD_HIDE+ECMD_OLDBUF,
|
||||
curwin);
|
||||
curbuf->b_sniff = TRUE;
|
||||
--no_wait_return; /* [ex_docmd.c] */
|
||||
}
|
||||
|
||||
+3
-3
@@ -737,7 +737,7 @@ ServerReplyFind(w, op)
|
||||
+ serverReply.ga_len;
|
||||
e.id = w;
|
||||
ga_init2(&e.strings, 1, 100);
|
||||
memcpy(p, &e, sizeof(e));
|
||||
mch_memmove(p, &e, sizeof(e));
|
||||
serverReply.ga_len++;
|
||||
}
|
||||
}
|
||||
@@ -1019,7 +1019,7 @@ LookupName(dpy, name, delete, loose)
|
||||
p++;
|
||||
count = numItems - (p - regProp);
|
||||
if (count > 0)
|
||||
memcpy(entry, p, count);
|
||||
mch_memmove(entry, p, count);
|
||||
XChangeProperty(dpy, RootWindow(dpy, 0), registryProperty, XA_STRING,
|
||||
8, PropModeReplace, regProp,
|
||||
(int)(numItems - (p - entry)));
|
||||
@@ -1073,7 +1073,7 @@ DeleteAnyLingerer(dpy, win)
|
||||
p++;
|
||||
lastHalf = numItems - (p - regProp);
|
||||
if (lastHalf > 0)
|
||||
memcpy(entry, p, lastHalf);
|
||||
mch_memmove(entry, p, lastHalf);
|
||||
numItems = (entry - regProp) + lastHalf;
|
||||
p = entry;
|
||||
continue;
|
||||
|
||||
+21
-5
@@ -127,15 +127,31 @@
|
||||
#ifdef FEAT_LANGMAP
|
||||
/*
|
||||
* Adjust chars in a language according to 'langmap' option.
|
||||
* NOTE that there is NO overhead if 'langmap' is not set; but even
|
||||
* when set we only have to do 2 ifs and an array lookup.
|
||||
* NOTE that there is no noticeable overhead if 'langmap' is not set.
|
||||
* When set the overhead for characters < 256 is small.
|
||||
* Don't apply 'langmap' if the character comes from the Stuff buffer.
|
||||
* The do-while is just to ignore a ';' after the macro.
|
||||
*/
|
||||
# define LANGMAP_ADJUST(c, condition) do { \
|
||||
if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0 && (c) < 256) \
|
||||
c = langmap_mapchar[c]; \
|
||||
# ifdef FEAT_MBYTE
|
||||
# define LANGMAP_ADJUST(c, condition) \
|
||||
do { \
|
||||
if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0) \
|
||||
{ \
|
||||
if ((c) < 256) \
|
||||
c = langmap_mapchar[c]; \
|
||||
else \
|
||||
c = langmap_adjust_mb(c); \
|
||||
} \
|
||||
} while (0)
|
||||
# else
|
||||
# define LANGMAP_ADJUST(c, condition) \
|
||||
do { \
|
||||
if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0 && (c) < 256) \
|
||||
c = langmap_mapchar[c]; \
|
||||
} while (0)
|
||||
# endif
|
||||
#else
|
||||
# define LANGMAP_ADJUST(c, condition) /* nop */
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
+30
-18
@@ -360,6 +360,11 @@ main
|
||||
command_line_scan(¶ms);
|
||||
TIME_MSG("parsing arguments");
|
||||
|
||||
#ifdef MACOS_X
|
||||
if (gui.starting && gui.dofork)
|
||||
macosx_fork(); /* Never returns */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* On some systems, when we compile with the GUI, we always use it. On Mac
|
||||
* there is no terminal version, and on Windows we can't fork one off with
|
||||
@@ -721,6 +726,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
|
||||
@@ -1278,9 +1287,10 @@ getout_preserve_modified(exitval)
|
||||
#endif
|
||||
|
||||
|
||||
/* Prepare proper exit*/
|
||||
/* Exit properly */
|
||||
void
|
||||
prepare_getout()
|
||||
getout(exitval)
|
||||
int exitval;
|
||||
{
|
||||
#ifdef FEAT_AUTOCMD
|
||||
buf_T *buf;
|
||||
@@ -1290,6 +1300,12 @@ prepare_getout()
|
||||
|
||||
exiting = TRUE;
|
||||
|
||||
/* When running in Ex mode an error causes us to exit with a non-zero exit
|
||||
* code. POSIX requires this, although it's not 100% clear from the
|
||||
* standard. */
|
||||
if (exmode_active)
|
||||
exitval += ex_exitval;
|
||||
|
||||
/* Position the cursor on the last screen line, below all the text */
|
||||
#ifdef FEAT_GUI
|
||||
if (!gui.in_use)
|
||||
@@ -1406,20 +1422,7 @@ prepare_getout()
|
||||
if (garbage_collect_at_exit)
|
||||
garbage_collect();
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Exit properly */
|
||||
void
|
||||
getout(exitval)
|
||||
int exitval;
|
||||
{
|
||||
/* When running in Ex mode an error causes us to exit with a non-zero exit
|
||||
* code. POSIX requires this, although it's not 100% clear from the
|
||||
* standard. */
|
||||
if (exmode_active)
|
||||
exitval += ex_exitval;
|
||||
|
||||
prepare_getout();
|
||||
mch_exit(exitval);
|
||||
}
|
||||
|
||||
@@ -1592,7 +1595,8 @@ parse_command_name(parmp)
|
||||
early_arg_scan(parmp)
|
||||
mparm_T *parmp;
|
||||
{
|
||||
#if defined(FEAT_XCLIPBOARD) || defined(FEAT_CLIENTSERVER)
|
||||
#if defined(FEAT_XCLIPBOARD) || defined(FEAT_CLIENTSERVER) \
|
||||
|| !defined(FEAT_NETBEANS_INTG)
|
||||
int argc = parmp->argc;
|
||||
char **argv = parmp->argv;
|
||||
int i;
|
||||
@@ -1664,6 +1668,14 @@ early_arg_scan(parmp)
|
||||
else if (STRICMP(argv[i], "--echo-wid") == 0)
|
||||
echo_wid_arg = TRUE;
|
||||
# endif
|
||||
# ifndef FEAT_NETBEANS_INTG
|
||||
else if (strncmp(argv[i], "-nb", (size_t)3) == 0)
|
||||
{
|
||||
mch_errmsg(_("'-nb' cannot be used: not enabled at compile time\n"));
|
||||
mch_exit(2);
|
||||
}
|
||||
# endif
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -2445,7 +2457,7 @@ read_stdin()
|
||||
* Is there any other system that cannot do this?
|
||||
*/
|
||||
close(0);
|
||||
dup(2);
|
||||
ignored = dup(2);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2670,7 +2682,7 @@ edit_buffers(parmp)
|
||||
# endif
|
||||
(void)do_ecmd(0, arg_idx < GARGCOUNT
|
||||
? alist_name(&GARGLIST[arg_idx]) : NULL,
|
||||
NULL, NULL, ECMD_LASTL, ECMD_HIDE);
|
||||
NULL, NULL, ECMD_LASTL, ECMD_HIDE, curwin);
|
||||
# ifdef HAS_SWAP_EXISTS_ACTION
|
||||
if (swap_exists_did_quit)
|
||||
{
|
||||
|
||||
+11
-11
@@ -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
|
||||
@@ -3131,7 +3131,7 @@ enc_locale()
|
||||
else
|
||||
s = p + 1;
|
||||
}
|
||||
for (i = 0; s[i] != NUL && s + i < buf + sizeof(buf) - 1; ++i)
|
||||
for (i = 0; s[i] != NUL && i < sizeof(buf) - 1; ++i)
|
||||
{
|
||||
if (s[i] == '_' || s[i] == '-')
|
||||
buf[i] = '-';
|
||||
@@ -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;
|
||||
@@ -5384,7 +5384,7 @@ preedit_draw_cbproc(XIC xic, XPointer client_data, XPointer call_data)
|
||||
draw_feedback = (char *)alloc(draw_data->chg_first
|
||||
+ text->length);
|
||||
else
|
||||
draw_feedback = realloc(draw_feedback,
|
||||
draw_feedback = vim_realloc(draw_feedback,
|
||||
draw_data->chg_first + text->length);
|
||||
if (draw_feedback != NULL)
|
||||
{
|
||||
@@ -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");
|
||||
@@ -6101,7 +6101,7 @@ string_convert_ext(vcp, ptr, lenp, unconvlenp)
|
||||
|
||||
/* 1. codepage/UTF-8 -> ucs-2. */
|
||||
if (vcp->vc_cpfrom == 0)
|
||||
tmp_len = utf8_to_ucs2(ptr, len, NULL, NULL);
|
||||
tmp_len = utf8_to_utf16(ptr, len, NULL, NULL);
|
||||
else
|
||||
tmp_len = MultiByteToWideChar(vcp->vc_cpfrom, 0,
|
||||
ptr, len, 0, 0);
|
||||
@@ -6109,13 +6109,13 @@ string_convert_ext(vcp, ptr, lenp, unconvlenp)
|
||||
if (tmp == NULL)
|
||||
break;
|
||||
if (vcp->vc_cpfrom == 0)
|
||||
utf8_to_ucs2(ptr, len, tmp, unconvlenp);
|
||||
utf8_to_utf16(ptr, len, tmp, unconvlenp);
|
||||
else
|
||||
MultiByteToWideChar(vcp->vc_cpfrom, 0, ptr, len, tmp, tmp_len);
|
||||
|
||||
/* 2. ucs-2 -> codepage/UTF-8. */
|
||||
if (vcp->vc_cpto == 0)
|
||||
retlen = ucs2_to_utf8(tmp, tmp_len, NULL);
|
||||
retlen = utf16_to_utf8(tmp, tmp_len, NULL);
|
||||
else
|
||||
retlen = WideCharToMultiByte(vcp->vc_cpto, 0,
|
||||
tmp, tmp_len, 0, 0, 0, 0);
|
||||
@@ -6123,7 +6123,7 @@ string_convert_ext(vcp, ptr, lenp, unconvlenp)
|
||||
if (retval != NULL)
|
||||
{
|
||||
if (vcp->vc_cpto == 0)
|
||||
ucs2_to_utf8(tmp, tmp_len, retval);
|
||||
utf16_to_utf8(tmp, tmp_len, retval);
|
||||
else
|
||||
WideCharToMultiByte(vcp->vc_cpto, 0,
|
||||
tmp, tmp_len, retval, retlen, 0, 0);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user