mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-02 11:19:22 +02:00
Compare commits
36 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 07831f45b2 | |||
| 9a69ad0d62 | |||
| be6ecb5d92 | |||
| 138be9d567 | |||
| 0430474168 | |||
| 0f1ee64746 | |||
| d08cc220fd | |||
| 04d9ab21b0 | |||
| 9c7523e944 | |||
| 030d0d07ec | |||
| 0578f14843 | |||
| 11274e43c4 | |||
| ebfad47ec6 | |||
| 48e6f325d6 | |||
| e899e2dfc7 | |||
| 1bc466c774 | |||
| f08c899208 | |||
| 31bd050607 | |||
| 2e6fb2ea53 | |||
| 862da53932 | |||
| 15763286bd | |||
| fed823a238 | |||
| 5d5176aabf | |||
| 19468d3117 | |||
| 0402b6b5c4 | |||
| b6932fb3ae | |||
| 22695b7f3b | |||
| bc8b62f3d9 | |||
| bd542602dd | |||
| e5159c3b6a | |||
| b36829bcaa | |||
| 07c344444b | |||
| bafcc3365d | |||
| 41ca0e5508 | |||
| 246dfc17f4 | |||
| 9aae3ba3cc |
@@ -193,6 +193,7 @@ SRC_UNIX = \
|
||||
src/vim_icon.xbm \
|
||||
src/vim_mask.xbm \
|
||||
src/vimtutor \
|
||||
src/gvimtutor \
|
||||
src/which.sh \
|
||||
src/workshop.c \
|
||||
src/workshop.h \
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" MacVim colorscheme
|
||||
"
|
||||
" Maintainer: Bjorn Winckler <bjorn.winckler@gmail.com>
|
||||
" Last Change: 2007 Nov 17
|
||||
" Last Change: 2008 May 9
|
||||
"
|
||||
" This is the default MacVim color scheme. It supports both light and dark
|
||||
" backgrounds (see :h 'background').
|
||||
@@ -50,7 +50,11 @@ hi TabLineFill gui=reverse
|
||||
hi TabLineSel gui=bold
|
||||
hi Title gui=bold guifg=DeepSkyBlue3
|
||||
hi VertSplit gui=NONE guifg=DarkSlateGray guibg=Gray90
|
||||
hi Visual guibg=MacSelectedTextBackgroundColor
|
||||
if has("gui_macvim")
|
||||
hi Visual guibg=MacSelectedTextBackgroundColor
|
||||
else
|
||||
hi Visual guibg=#72F7FF
|
||||
endif
|
||||
hi WarningMsg guifg=Firebrick2
|
||||
|
||||
" Syntax items (`:he group-name` -- more groups are available, these are just
|
||||
@@ -101,7 +105,11 @@ else
|
||||
hi DiffText gui=NONE guibg=Gold
|
||||
hi LineNr guifg=#888888 guibg=#E6E6E6
|
||||
hi MatchParen guifg=White guibg=MediumPurple1
|
||||
hi Normal gui=NONE guifg=MacTextColor guibg=MacTextBackgroundColor
|
||||
if has("gui_macvim")
|
||||
hi Normal gui=NONE guifg=MacTextColor guibg=MacTextBackgroundColor
|
||||
else
|
||||
hi Normal gui=NONE guifg=Black guibg=White
|
||||
endif
|
||||
hi Search guibg=CadetBlue1 guifg=NONE
|
||||
hi Statement gui=bold guifg=Maroon guibg=NONE
|
||||
hi Todo gui=NONE guifg=DarkGreen guibg=PaleGreen1
|
||||
@@ -115,7 +123,7 @@ endif
|
||||
" Change the selection color on focus change (but only if the "macvim"
|
||||
" colorscheme is active).
|
||||
"
|
||||
if !exists("s:augroups_defined")
|
||||
if has("gui_macvim") && !exists("s:augroups_defined")
|
||||
au FocusLost * if exists("colors_name") && colors_name == "macvim" | hi Visual guibg=MacSecondarySelectedControlColor | endif
|
||||
au FocusGained * if exists("colors_name") && colors_name == "macvim" | hi Visual guibg=MacSelectedTextBackgroundColor | endif
|
||||
|
||||
|
||||
+75
-48
@@ -1,4 +1,4 @@
|
||||
*gui_mac.txt* For Vim version 7.1. Last change: 2008 Mar 16
|
||||
*gui_mac.txt* For Vim version 7.1. Last change: 2008 May 25
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bjorn Winckler
|
||||
@@ -124,7 +124,7 @@ strings like "((3) of 2)" to appear in the window title.
|
||||
|
||||
*macvim-options*
|
||||
These are the non-standard options that MacVim supports:
|
||||
'fullscreen' 'fuoptions' 'toolbariconsize' 'transparency'
|
||||
'fullscreen' 'fuoptions' 'toolbariconsize' 'transparency' 'antialias'
|
||||
|
||||
*macvim-find*
|
||||
Whenever you search for something in Vim (e.g. using "/") the search query is
|
||||
@@ -142,6 +142,11 @@ another in MacVim. Simply search for something in one window (using "/") then
|
||||
switch to another (e.g. with <D-`>) and hit <D-g> and the search will be
|
||||
repeated in the new window.
|
||||
|
||||
*macvim-backspace* *macvim-delete*
|
||||
The 'backspace' option is set in the system vimrc to make the delete key
|
||||
behave in a more familiar way to new users. If you dislike this non-default
|
||||
behaviour, then add the line "set backspace&" to your "~/.vimrc" file.
|
||||
|
||||
==============================================================================
|
||||
2. Starting MacVim *macvim-start*
|
||||
|
||||
@@ -222,6 +227,7 @@ Here is a list of relevant dictionary entries:
|
||||
KEY VALUE ~
|
||||
MMAtsuiRenderer enable ATSUI renderer [bool]
|
||||
MMCellWidthMultiplier width of a normal glyph in em units [float]
|
||||
MMDialogsTrackPwd open/save dialogs track the Vim pwd [bool]
|
||||
MMLoginShellArgument login shell parameter [string]
|
||||
MMLoginShellCommand which shell to use to launch Vim [string]
|
||||
MMNoFontSubstitution disable automatic font substitution [bool]
|
||||
@@ -310,50 +316,79 @@ than the default?) then post them to |vim_mac|.
|
||||
==============================================================================
|
||||
5. Menus *macvim-menus*
|
||||
|
||||
*:macm* *:macmenukey*
|
||||
MacVim has a special way of binding keys to menu items that differs from other
|
||||
Vim GUI ports. A menu binding is called a "key equivalent" in Mac OS X
|
||||
terminology, this is displayed on the right side of a menu item. The
|
||||
":macmenukey" command is used to set the key equivalent of a menu item. This
|
||||
command takes two parameters, the first names the menu item to bind to, the
|
||||
second gives the key combination. For example: >
|
||||
:macmenukey File.New\ Tab <D-t>
|
||||
This sets the key equivalent of the "New Tab" menu item under the "File" menu
|
||||
to Cmd+t.
|
||||
Menus in Mac OS X behave slightly different from other platforms. For that
|
||||
reason two new commands have been added to Vim. To understand what these
|
||||
commands do you must first understand how menus work on OS X.
|
||||
|
||||
Note that key equivalents:
|
||||
* must contain the Cmd modifier flag (<D-...>)
|
||||
* take precedence over normal mappings made with ":map"
|
||||
* can only be modified during startup (e.g. in .gvimrc)
|
||||
Each entry in a menu is called a "menu item". With each menu item is
|
||||
associated: a title, a key equivalent and an action message. When a menu is
|
||||
displayed the title is shown on the left and the key equivalent (if any) is
|
||||
shown on the right. Key equivalents enable you to access a menu item using
|
||||
the keyboard instead of having to use the mouse. When a menu item is clicked
|
||||
it will send it's associated action message. Actions can be used to instruct
|
||||
MacVim to paste some text (paste:), open a new window (newWindow:), etc.
|
||||
Certain actions are standard throughout OS X which is why MacVim must be able
|
||||
to set these for each menu item. (E.g. the menu item "Edit.Paste" must be
|
||||
bound to the action "paste:" otherwise pasting won't work in dialogs since
|
||||
that is the action that instructs them to paste something.)
|
||||
|
||||
It is possible to reset a key equivalent by calling :macmenukey with a menu
|
||||
name but no key. This is so that the default key equivalents can be reset in
|
||||
"~/.gvimrc". For example, if you would like to free up <D-s> (which is the
|
||||
key equivalent of "File.Save") then add the following line to "~/.gvimrc": >
|
||||
macmenukey File.Save
|
||||
Now you can use :map to bind <D-s> to whatever you like.
|
||||
Menus are configured using the |:macmenu| command and the |:macaction| command
|
||||
can be used to send action messages.
|
||||
|
||||
It is not necessary to reset a key equivalent if all you want to do is to
|
||||
change the key equivalent of a menu item. For example, say you want to use
|
||||
<D-M-Right> as the key equivalent for "Next Tab", then add the following line
|
||||
to "~/.gvimrc": >
|
||||
macmenukey Window.Next\ Tab <D-M-Right>
|
||||
<
|
||||
*:maca* *:macaction*
|
||||
It is typical for menu items in Cocoa applications to bind to Objective-C
|
||||
selectors. To support this, MacVim introduces the |:macaction| command. This
|
||||
command takes the name of an action message as its only parameter. (An action
|
||||
message is an Objective-C message with "void" return type and a single
|
||||
parameter of type "id".) For example, the "New Window" menu item on the
|
||||
"File" menu is created in the following manner: >
|
||||
:an 10.290 File.New\ Window :macaction newWindow:<CR>
|
||||
:maca[ction] {action:} Send the message "action:" to the first responder.
|
||||
The list of allowed actions can be seen by typing
|
||||
:maca <C-d>
|
||||
An attempt to send an action not listed here will
|
||||
result in an error. This list is specified in a
|
||||
property list file called |Actions.plist|.
|
||||
|
||||
Note 1: A menu item which is bound to |:macaction| will automatically be bound
|
||||
to that action in all modes (as if ":an" was used). It is not possible to
|
||||
bind to |:macaction| in one mode only.
|
||||
Note 2: The action is "nil-targeted", which means it is passed down the first
|
||||
responder chain.
|
||||
*:macm* *:macmenu*
|
||||
:mac[menu] {menu} {key}={arg} ...
|
||||
Set Mac specific properties for {menu}. The
|
||||
properties that can be set are:
|
||||
action the action this menu sends
|
||||
alt "yes" if alternate of previous menu
|
||||
key the key equivalent of this menu
|
||||
This command must be used in a startup file, for
|
||||
example in "~/.gvimrc". It has no effect otherwise.
|
||||
|
||||
For convenience, a menu with "action=name:" which is
|
||||
bound to <Nop> will act as if bound to
|
||||
":maca name:<CR>". Thus, if "Menu.Item" is given by
|
||||
:an Menu.Item <Nop>
|
||||
:macm Menu.Item action=name:
|
||||
then ":emenu Menu.Item" is equivalent to
|
||||
":maca name:".
|
||||
|
||||
The key equivalent is specified with the <D-..>
|
||||
syntax. Note that key equivalents must contain the
|
||||
Cmd modifier flag (<D-...>), and they take precedence
|
||||
over normal mappings.
|
||||
Use the syntax "key=<nop>" to clear the key equivalent
|
||||
of a menu. This can be used to free up a key
|
||||
combination that is set in the system gvimrc so that
|
||||
it may be mapped to using ":map".
|
||||
|
||||
Recognised values of "alt" are "0", "no", "1", and
|
||||
"yes". The default is "no". An alternate menu must
|
||||
have the same key equivalent as the previous menu,
|
||||
except the modifier flags must differ. The alternate
|
||||
menu is by default hidden and only shows up when the
|
||||
modifier is held down.
|
||||
|
||||
Here are some examples on how to use these commands:
|
||||
|
||||
1. Create a menu item with title "New Window" under the "File" menu, with key
|
||||
equivalent Cmd-n, which opens a new window when selected: >
|
||||
:an 10.290 File.New\ Window <Nop>
|
||||
:macm File.New\ Window action=newWindow: key=<D-n>
|
||||
2. Change the key equivalent to cycle through tabs to Cmd-Left/Right: >
|
||||
:macm Window.Previous\ Tab key=<D-Left>
|
||||
:macm Window.Next\ Tab key=<D-Right>
|
||||
3. Create a mapping in normal mode which closes the current tab/window: >
|
||||
:map <C-w> :maca performClose:<CR>
|
||||
>
|
||||
*Actions.plist*
|
||||
Some action messages would not be suitable to call from within Vim, so there
|
||||
is a dictionary called "Actions.plist" (in the Resources folder of the
|
||||
@@ -381,14 +416,6 @@ performZoom: Zoom window (same as clicking the green blob)
|
||||
selectNextWindow: Select next window (similar to <D-`>)
|
||||
selectPreviousWindow: Select previous window (similar to <S-D-`>)
|
||||
|
||||
As an example, to map <C-z> to performZoom: you could do something like this: >
|
||||
:map <silent> <C-z> :macaction performZoom:<CR>
|
||||
A better way to map to performZoom: would be to set the key equivalent of the
|
||||
menu item "Window.Zoom" to the above action. This can be done by adding the
|
||||
following line to "~/.gvimrc": >
|
||||
macmenukey Window.Zoom <D-C-z>
|
||||
(Note that key equivalents must contain the 'D' flag.)
|
||||
|
||||
==============================================================================
|
||||
6. Toolbar *macvim-toolbar*
|
||||
|
||||
|
||||
@@ -1289,7 +1289,7 @@ The commands are sorted on the non-optional part of their name.
|
||||
|:move| :m[ove] move lines
|
||||
|:mark| :ma[rk] set a mark
|
||||
|:macation| :maca[ction] send action message
|
||||
|:macmenukey| :macm[eyequiv] set key equivalent for menu item
|
||||
|:macmenu| :macm[enu] set Mac specific properties for menu item
|
||||
|:make| :mak[e] execute external command 'makeprg' and parse
|
||||
error messages
|
||||
|:map| :map show or enter a mapping
|
||||
|
||||
+20
-3
@@ -3057,8 +3057,8 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
(e.g. toolbar, title bar). The tab bar and scroll bars remain visible.
|
||||
Updates to the window position are ignored in fullscreen mode.
|
||||
|
||||
See 'fuoptions' for how Vim resizes when entering and leaving
|
||||
fullscreen mode.
|
||||
See 'fuoptions' for how Vim resizes and colors the background when
|
||||
entering and leaving fullscreen mode.
|
||||
|
||||
XXX: Add fuenter/fuleave autocommands? You might want to display
|
||||
a NERDTree or a Tlist only in fullscreen for example. Then again, this
|
||||
@@ -3073,7 +3073,8 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
{only in MacVim GUI}
|
||||
In fullscreen mode, most of the screen is black, only a part of the
|
||||
screen is covered by the actual Vim control. The control is centered.
|
||||
This option controls the size of the Vim control.
|
||||
This option controls the size of the Vim control as well as the color
|
||||
of the unused screen area.
|
||||
value effect ~
|
||||
maxvert When entering fullscreen, 'lines' is set to the maximum number
|
||||
of lines fitting on the screen in fullscreen mode. When
|
||||
@@ -3085,12 +3086,28 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
leaving fullscreen, if 'columns' is still equal to the maximized
|
||||
number of columns, it is restored to the value it had before
|
||||
entering fullscreen.
|
||||
background:color
|
||||
When entering fullscreen, 'color' defines the color of the part
|
||||
of the screen that is not occupied by the Vim control. If
|
||||
'color' is an 8-digit hexadecimal number preceded by '#',
|
||||
it is interpreted as an explicit color value '#aarrggbb', with
|
||||
one byte each for the alpha, red, green, and blue values.
|
||||
Otherwise, 'color' is interpreted as a highlight group name,
|
||||
and the fullscreen background is filled with that highlight
|
||||
group's background color, as defined by the current color
|
||||
scheme.
|
||||
|
||||
Examples:
|
||||
Don't change size of Vim when entering fullscreen: >
|
||||
:set fuoptions=
|
||||
< Maximize Vim when entering fullscreen: >
|
||||
:set fuoptions=maxvert,maxhorz
|
||||
< Maximize Vim only vertically when entering fullscreen, and color the
|
||||
background dark blue: >
|
||||
:set fuoptions=maxvert,background:#FF003042
|
||||
< Don't change the size of Vim when entering fullscreen, and color the
|
||||
background like the current text background: >
|
||||
:set fuoptions=background:Normal
|
||||
<
|
||||
XXX: what if the font size is changed? you probably never want to
|
||||
restore the old 'lines' or 'columns' in that case.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*os_mac.txt* For Vim version 7.1. Last change: 2006 Apr 30
|
||||
*os_mac.txt* For Vim version 7.1. Last change: 2008 May 19
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar et al.
|
||||
@@ -6,9 +6,13 @@
|
||||
|
||||
*mac* *Mac* *macintosh* *Macintosh*
|
||||
|
||||
This file documents the particularities of the Macintosh version of Vim.
|
||||
This file documents the particularities of the Mac version of Vim. It was
|
||||
written with the older Carbon version of Vim in mind. If you are using the
|
||||
newer MacVim.app then please go to |macvim|. Some of the information here
|
||||
does not apply to MacVim.app.
|
||||
|
||||
NOTE: This file is a bit outdated. You might find more useful info here:
|
||||
NOTE: This file is a bit outdated. You might find more useful info on the old
|
||||
Carbon version of Vim here:
|
||||
http://macvim.org/
|
||||
|
||||
1. Filename Convention |mac-filename|
|
||||
|
||||
@@ -766,7 +766,8 @@ accordingly. Vim proceeds in this order:
|
||||
Note that this file is ALWAYS read in 'compatible' mode, since the
|
||||
automatic resetting of 'compatible' is only done later. Add a ":set
|
||||
nocp" command if you like.
|
||||
For the Macintosh the $VIMRUNTIME/macmap.vim is read.
|
||||
For the Macintosh the $VIMRUNTIME/macmap.vim is read (not on
|
||||
MacVim.app, this only applies to the older Carbon version).
|
||||
|
||||
*VIMINIT* *.vimrc* *_vimrc* *EXINIT* *.exrc* *_exrc*
|
||||
c. Four places are searched for initializations. The first that exists
|
||||
|
||||
@@ -1177,6 +1177,8 @@ goes from 2.2 to 2.3. (Gordon Prieur)
|
||||
|
||||
Mac: When starting up Vim will load the $VIMRUNTIME/macmap.vim script to
|
||||
define default command-key mappings. (mostly by Benji Fisher)
|
||||
This only applies to the older Carbon version of Vim, MacVim.app does not
|
||||
source this file.
|
||||
|
||||
Mac: Add the selection type to the clipboard, so that Block, line and
|
||||
character selections can be used between two Vims. (Eckehard Berns)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
vimtutor \- the Vim tutor
|
||||
.SH SYNOPSIS
|
||||
.br
|
||||
.B vimtutor [language]
|
||||
.B vimtutor [-g] [language]
|
||||
.SH DESCRIPTION
|
||||
.B Vimtutor
|
||||
starts the
|
||||
@@ -18,6 +18,9 @@ is useful for people that want to learn their first
|
||||
.B Vim
|
||||
commands.
|
||||
.PP
|
||||
The optional argument -g starts vimtutor with gvim rather than vim, if the
|
||||
GUI version of vim is available, or falls back to Vim if gvim is not found.
|
||||
.PP
|
||||
The optional [language] argument is the two-letter name of a language, like
|
||||
"it" or "es".
|
||||
If the [language] argument is missing, the language of the current locale will
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>addNewTab:</key>
|
||||
<string></string>
|
||||
<key>arrangeInFront:</key>
|
||||
<string></string>
|
||||
<key>clearRecentDocuments:</key>
|
||||
<string></string>
|
||||
<key>copy:</key>
|
||||
<string></string>
|
||||
<key>cut:</key>
|
||||
<string></string>
|
||||
<key>fileOpen:</key>
|
||||
<string></string>
|
||||
<key>findNext:</key>
|
||||
@@ -32,18 +38,28 @@
|
||||
<string></string>
|
||||
<key>orderFrontPreferencePanel:</key>
|
||||
<string></string>
|
||||
<key>paste:</key>
|
||||
<string></string>
|
||||
<key>performClose:</key>
|
||||
<string></string>
|
||||
<key>performMiniaturize:</key>
|
||||
<string></string>
|
||||
<key>performZoom:</key>
|
||||
<string></string>
|
||||
<key>recentFilesDummy:</key>
|
||||
<string></string>
|
||||
<key>redo:</key>
|
||||
<string></string>
|
||||
<key>selectAll:</key>
|
||||
<string></string>
|
||||
<key>selectNextWindow:</key>
|
||||
<string></string>
|
||||
<key>selectPreviousWindow:</key>
|
||||
<string></string>
|
||||
<key>terminate:</key>
|
||||
<string></string>
|
||||
<key>undo:</key>
|
||||
<string></string>
|
||||
<key>unhide:</key>
|
||||
<string></string>
|
||||
<key>unhideAllApplications:</key>
|
||||
|
||||
+12
-12
@@ -1,33 +1,33 @@
|
||||
{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf440
|
||||
{\fonttbl\f0\fswiss\fcharset77 Helvetica-Bold;\f1\fswiss\fcharset77 Helvetica;\f2\fswiss\fcharset77 Helvetica-Oblique;
|
||||
}
|
||||
{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf270
|
||||
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
|
||||
{\colortbl;\red255\green255\blue255;}
|
||||
\vieww9000\viewh8400\viewkind0
|
||||
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\ql\qnatural\pardirnatural
|
||||
|
||||
\f0\b\fs24 \cf0 VIM - Vi IMproved
|
||||
\f1\b0 \
|
||||
\b0 \
|
||||
|
||||
\f2\i Bram Moolenaar et al.
|
||||
\f1\i0 \
|
||||
\i Bram Moolenaar et al.
|
||||
\i0 \
|
||||
\
|
||||
|
||||
\f0\b MacVim GUI\
|
||||
\b MacVim GUI\
|
||||
|
||||
\f2\i\b0 Bj\'9arn Winckler\
|
||||
\i\b0 Bj\'f6rn Winckler\
|
||||
|
||||
\f1\i0 \
|
||||
\i0 \
|
||||
with the help of:\
|
||||
|
||||
\f2\i Nico Weber\
|
||||
\i Nico Weber\
|
||||
George Harker\
|
||||
Jjgod Jiang\
|
||||
Tim Allen\
|
||||
Chris Willmore\
|
||||
Ben Schmidt\
|
||||
Scott Renfro\
|
||||
Enno L\'fcbbers\
|
||||
|
||||
\f1\i0 \
|
||||
\i0 \
|
||||
...and many others who have helped by reporting bugs etc.\
|
||||
\
|
||||
\
|
||||
@@ -37,7 +37,7 @@ Toolbar icons from {\field{\*\fldinst{HYPERLINK "http://svn.gnome.org/viewvc/gno
|
||||
\
|
||||
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\'aa and Arev fonts. Bitstream Vera\'aa is \'a9 2003 by Bitstream, Inc. Arev is \'a9 2006 by Tavmjong Bah. The DejaVu changes to these fonts are in the public domain.\
|
||||
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}}.\
|
||||
\
|
||||
|
||||
@@ -545,7 +545,7 @@
|
||||
<key>CFBundleSignature</key>
|
||||
<string>VIMM</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>25</string>
|
||||
<string>28</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
|
||||
@@ -16,10 +16,13 @@
|
||||
|
||||
|
||||
@interface MMAppController : NSObject <MMAppProtocol> {
|
||||
NSConnection *connection;
|
||||
NSMutableArray *vimControllers;
|
||||
NSString *openSelectionString;
|
||||
ATSFontContainerRef fontContainerRef;
|
||||
NSMutableDictionary *pidArguments;
|
||||
|
||||
NSMenuItem *recentFilesMenuItem;
|
||||
}
|
||||
|
||||
- (void)removeVimController:(id)controller;
|
||||
|
||||
@@ -124,6 +124,7 @@ static int executeInLoginShell(NSString *path, NSArray *args);
|
||||
[NSNumber numberWithBool:NO], MMZoomBothKey,
|
||||
@"", MMLoginShellCommandKey,
|
||||
@"", MMLoginShellArgumentKey,
|
||||
[NSNumber numberWithBool:YES], MMDialogsTrackPwdKey,
|
||||
nil];
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] registerDefaults:dict];
|
||||
@@ -140,24 +141,30 @@ static int executeInLoginShell(NSString *path, NSArray *args);
|
||||
vimControllers = [NSMutableArray new];
|
||||
pidArguments = [NSMutableDictionary new];
|
||||
|
||||
// NOTE: Do not use the default connection since the Logitech Control
|
||||
// Center (LCC) input manager steals and this would cause MacVim to
|
||||
// never open any windows. (This is a bug in LCC but since they are
|
||||
// unlikely to fix it, we graciously give them the default connection.)
|
||||
connection = [[NSConnection alloc] initWithReceivePort:[NSPort port]
|
||||
sendPort:nil];
|
||||
[connection setRootObject:self];
|
||||
[connection setRequestTimeout:MMRequestTimeout];
|
||||
[connection setReplyTimeout:MMReplyTimeout];
|
||||
|
||||
// NOTE: When the user is resizing the window the AppKit puts the run
|
||||
// loop in event tracking mode. Unless the connection listens to
|
||||
// request in this mode, live resizing won't work.
|
||||
[connection addRequestMode:NSEventTrackingRunLoopMode];
|
||||
|
||||
// NOTE! If the name of the connection changes here it must also be
|
||||
// updated in MMBackend.m.
|
||||
NSConnection *connection = [NSConnection defaultConnection];
|
||||
NSString *name = [NSString stringWithFormat:@"%@-connection",
|
||||
[[NSBundle mainBundle] bundleIdentifier]];
|
||||
//NSLog(@"Registering connection with name '%@'", name);
|
||||
if ([connection registerName:name]) {
|
||||
[connection setRequestTimeout:MMRequestTimeout];
|
||||
[connection setReplyTimeout:MMReplyTimeout];
|
||||
[connection setRootObject:self];
|
||||
|
||||
// NOTE: When the user is resizing the window the AppKit puts the
|
||||
// run loop in event tracking mode. Unless the connection listens
|
||||
// to request in this mode, live resizing won't work.
|
||||
[connection addRequestMode:NSEventTrackingRunLoopMode];
|
||||
} else {
|
||||
NSLog(@"WARNING: Failed to register connection with name '%@'",
|
||||
if (![connection registerName:name]) {
|
||||
NSLog(@"FATAL ERROR: Failed to register connection with name '%@'",
|
||||
name);
|
||||
[connection release]; connection = nil;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,23 +175,49 @@ static int executeInLoginShell(NSString *path, NSArray *args);
|
||||
{
|
||||
//NSLog(@"MMAppController dealloc");
|
||||
|
||||
[connection release]; connection = nil;
|
||||
[pidArguments release]; pidArguments = nil;
|
||||
[vimControllers release]; vimControllers = nil;
|
||||
[openSelectionString release]; openSelectionString = nil;
|
||||
[recentFilesMenuItem release]; recentFilesMenuItem = nil;
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
#if MM_HANDLE_XCODE_MOD_EVENT
|
||||
- (void)applicationWillFinishLaunching:(NSNotification *)notification
|
||||
{
|
||||
// Create the "Open Recent" menu. See
|
||||
// http://lapcatsoftware.com/blog/2007/07/10/working-without-a-nib-part-5-open-recent-menu/
|
||||
// and http://www.cocoabuilder.com/archive/message/cocoa/2007/8/15/187793
|
||||
// for more information.
|
||||
//
|
||||
// The menu needs to be created and be added to a toplevel menu in
|
||||
// applicationWillFinishLaunching at the latest, otherwise it doesn't work.
|
||||
|
||||
recentFilesMenuItem = [[NSMenuItem alloc] initWithTitle:@"Open Recent"
|
||||
action:nil keyEquivalent:@""];
|
||||
|
||||
NSMenu *recentFilesMenu = [[NSMenu alloc] initWithTitle:@"Open Recent"];
|
||||
[recentFilesMenu performSelector:@selector(_setMenuName:)
|
||||
withObject:@"NSRecentDocumentsMenu"];
|
||||
|
||||
[recentFilesMenu addItemWithTitle:@"Clear Menu"
|
||||
action:@selector(clearRecentDocuments:)
|
||||
keyEquivalent:@""];
|
||||
[recentFilesMenuItem setSubmenu:recentFilesMenu];
|
||||
[recentFilesMenu release]; // the menu is retained by recentFilesMenuItem
|
||||
[recentFilesMenuItem setTag:-1]; // must not be 0
|
||||
|
||||
[[[[NSApp mainMenu] itemWithTitle:@"File"] submenu] addItem:recentFilesMenuItem];
|
||||
|
||||
#if MM_HANDLE_XCODE_MOD_EVENT
|
||||
[[NSAppleEventManager sharedAppleEventManager]
|
||||
setEventHandler:self
|
||||
andSelector:@selector(handleXcodeModEvent:replyEvent:)
|
||||
forEventClass:'KAHL'
|
||||
andEventID:'MOD '];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)notification
|
||||
{
|
||||
@@ -261,6 +294,16 @@ static int executeInLoginShell(NSString *path, NSArray *args);
|
||||
[arguments setObject:filenames forKey:@"filenames"];
|
||||
[arguments setObject:[NSNumber numberWithBool:YES] forKey:@"openFiles"];
|
||||
|
||||
// Add file names to "Recent Files" menu.
|
||||
int i, count = [filenames count];
|
||||
for (i = 0; i < count; ++i) {
|
||||
// Don't add files that are being edited remotely (using ODB).
|
||||
if ([arguments objectForKey:@"remoteID"]) continue;
|
||||
|
||||
[[NSDocumentController sharedDocumentController]
|
||||
noteNewRecentFilePath:[filenames objectAtIndex:i]];
|
||||
}
|
||||
|
||||
if ((openInTabs && (vc = [self topmostVimController]))
|
||||
|| (vc = [self findUntitledWindow])) {
|
||||
// Open files in an already open window.
|
||||
@@ -421,9 +464,9 @@ static int executeInLoginShell(NSString *path, NSArray *args);
|
||||
andEventID:'MOD '];
|
||||
#endif
|
||||
|
||||
// This will invalidate all connections (since they were spawned from the
|
||||
// default connection).
|
||||
[[NSConnection defaultConnection] invalidate];
|
||||
// This will invalidate all connections (since they were spawned from this
|
||||
// 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
|
||||
@@ -512,10 +555,17 @@ static int executeInLoginShell(NSString *path, NSArray *args);
|
||||
|
||||
- (IBAction)fileOpen:(id)sender
|
||||
{
|
||||
NSString *dir = nil;
|
||||
BOOL trackPwd = [[NSUserDefaults standardUserDefaults]
|
||||
boolForKey:MMDialogsTrackPwdKey];
|
||||
if (trackPwd) {
|
||||
MMVimController *vc = [self keyVimController];
|
||||
if (vc) dir = [[vc vimState] objectForKey:@"pwd"];
|
||||
}
|
||||
|
||||
NSOpenPanel *panel = [NSOpenPanel openPanel];
|
||||
[panel setAllowsMultipleSelection:YES];
|
||||
|
||||
int result = [panel runModalForTypes:nil];
|
||||
int result = [panel runModalForDirectory:dir file:nil types:nil];
|
||||
if (NSOKButton == result)
|
||||
[self application:NSApp openFiles:[panel filenames]];
|
||||
}
|
||||
@@ -599,7 +649,8 @@ static int executeInLoginShell(NSString *path, NSArray *args);
|
||||
setProtocolForProxy:@protocol(MMBackendProtocol)];
|
||||
|
||||
vc = [[[MMVimController alloc]
|
||||
initWithBackend:backend pid:pid] autorelease];
|
||||
initWithBackend:backend pid:pid recentFiles:recentFilesMenuItem]
|
||||
autorelease];
|
||||
|
||||
if (![vimControllers count]) {
|
||||
// The first window autosaves its position. (The autosaving
|
||||
@@ -741,9 +792,10 @@ static int executeInLoginShell(NSString *path, NSArray *args);
|
||||
|
||||
- (MMVimController *)topmostVimController
|
||||
{
|
||||
NSArray *windows = [NSApp orderedWindows];
|
||||
if ([windows count] > 0) {
|
||||
NSWindow *window = [windows objectAtIndex:0];
|
||||
// Find the topmost visible window which has an associated vim controller.
|
||||
NSEnumerator *e = [[NSApp orderedWindows] objectEnumerator];
|
||||
id window;
|
||||
while ((window = [e nextObject]) && [window isVisible]) {
|
||||
unsigned i, count = [vimControllers count];
|
||||
for (i = 0; i < count; ++i) {
|
||||
MMVimController *vc = [vimControllers objectAtIndex:i];
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#import "MMAtsuiTextView.h"
|
||||
#import "MMVimController.h"
|
||||
#import "MMWindowController.h"
|
||||
#import "MacVim.h"
|
||||
|
||||
|
||||
@@ -65,6 +66,7 @@ enum {
|
||||
- (void)updateAtsuStyles;
|
||||
- (void)dispatchKeyEvent:(NSEvent *)event;
|
||||
- (void)sendKeyDown:(const char *)chars length:(int)len modifiers:(int)flags;
|
||||
- (MMWindowController *)windowController;
|
||||
- (MMVimController *)vimController;
|
||||
@end
|
||||
|
||||
@@ -726,6 +728,42 @@ enum {
|
||||
[[self vimController] sendMessage:ScrollWheelMsgID data:data];
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// NOTE: The menu items cut/copy/paste/undo/redo/select all/... must be bound
|
||||
// to the same actions as in IB otherwise they will not work with dialogs. All
|
||||
// we do here is forward these actions to the Vim process.
|
||||
//
|
||||
- (IBAction)cut:(id)sender
|
||||
{
|
||||
[[self windowController] vimMenuItemAction:sender];
|
||||
}
|
||||
|
||||
- (IBAction)copy:(id)sender
|
||||
{
|
||||
[[self windowController] vimMenuItemAction:sender];
|
||||
}
|
||||
|
||||
- (IBAction)paste:(id)sender
|
||||
{
|
||||
[[self windowController] vimMenuItemAction:sender];
|
||||
}
|
||||
|
||||
- (IBAction)undo:(id)sender
|
||||
{
|
||||
[[self windowController] vimMenuItemAction:sender];
|
||||
}
|
||||
|
||||
- (IBAction)redo:(id)sender
|
||||
{
|
||||
[[self windowController] vimMenuItemAction:sender];
|
||||
}
|
||||
|
||||
- (IBAction)selectAll:(id)sender
|
||||
{
|
||||
[[self windowController] vimMenuItemAction:sender];
|
||||
}
|
||||
|
||||
@end // MMAtsuiTextView
|
||||
|
||||
|
||||
@@ -875,13 +913,17 @@ enum {
|
||||
}
|
||||
}
|
||||
|
||||
- (MMVimController *)vimController
|
||||
- (MMWindowController *)windowController
|
||||
{
|
||||
id windowController = [[self window] windowController];
|
||||
if ([windowController isKindOfClass:[MMWindowController class]])
|
||||
return (MMWindowController*)windowController;
|
||||
return nil;
|
||||
}
|
||||
|
||||
// TODO: Make sure 'windowController' is a MMWindowController before type
|
||||
// casting.
|
||||
return [(MMWindowController*)windowController vimController];
|
||||
- (MMVimController *)vimController
|
||||
{
|
||||
return [[self windowController] vimController];
|
||||
}
|
||||
|
||||
@end // MMAtsuiTextView (Private)
|
||||
|
||||
@@ -89,7 +89,8 @@
|
||||
- (void)addMenuItemWithTag:(int)tag parent:(int)parentTag name:(char *)name
|
||||
tip:(char *)tip icon:(char *)icon
|
||||
keyEquivalent:(int)key modifiers:(int)mods
|
||||
action:(NSString *)action atIndex:(int)index;
|
||||
action:(char *)action isAlternate:(int)isAlt
|
||||
atIndex:(int)index;
|
||||
- (void)removeMenuItemWithTag:(int)tag;
|
||||
- (void)enableMenuItemWithTag:(int)tag state:(int)enabled;
|
||||
- (void)showPopupMenuWithName:(char *)name atMouseLocation:(BOOL)mouse;
|
||||
@@ -114,7 +115,7 @@
|
||||
- (int)lookupColorWithKey:(NSString *)key;
|
||||
- (BOOL)hasSpecialKeyWithValue:(NSString *)value;
|
||||
|
||||
- (void)enterFullscreen:(int)fuoptions;
|
||||
- (void)enterFullscreen:(int)fuoptions background:(int)bg;
|
||||
- (void)leaveFullscreen;
|
||||
|
||||
- (void)setAntialias:(BOOL)antialias;
|
||||
|
||||
+34
-26
@@ -77,6 +77,7 @@ static NSString *MMSymlinkWarningString =
|
||||
|
||||
|
||||
@interface MMBackend (Private)
|
||||
- (void)queueVimStateMessage;
|
||||
- (void)processInputQueue;
|
||||
- (void)handleInputEvent:(int)msgid data:(NSData *)data;
|
||||
+ (NSDictionary *)specialKeys;
|
||||
@@ -439,9 +440,10 @@ static NSString *MMSymlinkWarningString =
|
||||
// NOTE! This method gets called a lot; if we were to flush every time it
|
||||
// got called MacVim would feel unresponsive. So there is a time out which
|
||||
// ensures that the queue isn't flushed too often.
|
||||
if (!force && lastFlushDate && -[lastFlushDate timeIntervalSinceNow]
|
||||
< MMFlushTimeoutInterval
|
||||
&& [drawData length] < MMFlushQueueLenHint)
|
||||
if (exiting ||
|
||||
(!force && lastFlushDate &&
|
||||
-[lastFlushDate timeIntervalSinceNow] < MMFlushTimeoutInterval &&
|
||||
[drawData length] < MMFlushQueueLenHint))
|
||||
return;
|
||||
|
||||
if ([drawData length] > 0) {
|
||||
@@ -461,7 +463,12 @@ static NSString *MMSymlinkWarningString =
|
||||
[drawData setLength:0];
|
||||
}
|
||||
|
||||
if ([outputQueue count] > 0) {
|
||||
if ([outputQueue count] > 0 || force) {
|
||||
// When 'force' is set we always update the Vim state to ensure that
|
||||
// MacVim has a copy of the latest state (since 'force' is typically
|
||||
// set just before Vim takes a nap whilst waiting for input).
|
||||
[self queueVimStateMessage];
|
||||
|
||||
@try {
|
||||
[frontendProxy processCommandQueue:outputQueue];
|
||||
}
|
||||
@@ -754,7 +761,8 @@ static NSString *MMSymlinkWarningString =
|
||||
- (void)addMenuItemWithTag:(int)tag parent:(int)parentTag name:(char *)name
|
||||
tip:(char *)tip icon:(char *)icon
|
||||
keyEquivalent:(int)key modifiers:(int)mods
|
||||
action:(NSString *)action atIndex:(int)index
|
||||
action:(char *)action isAlternate:(int)isAlt
|
||||
atIndex:(int)index
|
||||
{
|
||||
//NSLog(@"addMenuItemWithTag:%d parent:%d name:%s tip:%s atIndex:%d", tag,
|
||||
// parentTag, name, tip, index);
|
||||
@@ -763,7 +771,7 @@ static NSString *MMSymlinkWarningString =
|
||||
int tiplen = tip ? strlen(tip) : 0;
|
||||
int iconlen = icon ? strlen(icon) : 0;
|
||||
int eventFlags = vimModMaskToEventModifierFlags(mods);
|
||||
int actionlen = [action lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
|
||||
int actionlen = action ? strlen(action) : 0;
|
||||
NSMutableData *data = [NSMutableData data];
|
||||
|
||||
key = specialKeyToNSKey(key);
|
||||
@@ -777,10 +785,11 @@ static NSString *MMSymlinkWarningString =
|
||||
[data appendBytes:&iconlen length:sizeof(int)];
|
||||
if (iconlen > 0) [data appendBytes:icon length:iconlen];
|
||||
[data appendBytes:&actionlen length:sizeof(int)];
|
||||
if (actionlen > 0) [data appendBytes:[action UTF8String] length:actionlen];
|
||||
if (actionlen > 0) [data appendBytes:action length:actionlen];
|
||||
[data appendBytes:&index length:sizeof(int)];
|
||||
[data appendBytes:&key length:sizeof(int)];
|
||||
[data appendBytes:&eventFlags length:sizeof(int)];
|
||||
[data appendBytes:&isAlt length:sizeof(int)];
|
||||
|
||||
[self queueMessage:AddMenuItemMsgID data:data];
|
||||
}
|
||||
@@ -1065,10 +1074,12 @@ static NSString *MMSymlinkWarningString =
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)enterFullscreen:(int)fuoptions
|
||||
- (void)enterFullscreen:(int)fuoptions background:(int)bg
|
||||
{
|
||||
NSMutableData *data = [NSMutableData data];
|
||||
[data appendBytes:&fuoptions length:sizeof(int)];
|
||||
bg = MM_COLOR(bg);
|
||||
[data appendBytes:&bg length:sizeof(int)];
|
||||
[self queueMessage:EnterFullscreenMsgID data:data];
|
||||
}
|
||||
|
||||
@@ -1550,6 +1561,21 @@ static NSString *MMSymlinkWarningString =
|
||||
|
||||
@implementation MMBackend (Private)
|
||||
|
||||
- (void)queueVimStateMessage
|
||||
{
|
||||
// NOTE: This is the place to add Vim state that needs to be accessed from
|
||||
// MacVim. Do not add state that could potentially require lots of memory
|
||||
// since this message gets sent each time the output queue is forcibly
|
||||
// flushed (e.g. storing the currently selected text would be a bad idea).
|
||||
// We take this approach of "pushing" the state to MacVim to avoid having
|
||||
// to make synchronous calls from MacVim to Vim in order to get state.
|
||||
NSDictionary *vimState = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[[NSFileManager defaultManager] currentDirectoryPath], @"pwd",
|
||||
nil];
|
||||
|
||||
[self queueMessage:SetVimStateMsgID data:[vimState dictionaryAsData]];
|
||||
}
|
||||
|
||||
- (void)processInputQueue
|
||||
{
|
||||
// NOTE: One of the input events may cause this method to be called
|
||||
@@ -1660,24 +1686,6 @@ static NSString *MMSymlinkWarningString =
|
||||
[self handleOdbEdit:data];
|
||||
} else if (XcodeModMsgID == msgid) {
|
||||
[self handleXcodeMod:data];
|
||||
} else if (CloseMsgID == msgid) {
|
||||
// If in Ex mode, then simply exit Ex mode (^U:vi<CR>). Otherwise
|
||||
// try to close one (Vim-)window by going to Normal mode first
|
||||
// (CTRL-\_CTRL-N) and then sending ":q<CR>", but only if the
|
||||
// command-line window is not open. If the command-line window is open
|
||||
// then we just go back to normal mode (since CTRL-\_CTRL-N closes the
|
||||
// command-line window).
|
||||
if (exmode_active) {
|
||||
// Exit Ex mode
|
||||
add_to_input_buf((char_u*)"\x15:vi\n", 5);
|
||||
} else {
|
||||
// Go to normal mode
|
||||
add_to_input_buf((char_u*)"\x1c\xe", 2);
|
||||
if (0 == cmdwin_type) {
|
||||
// Command-line window was not open, so :q
|
||||
add_to_input_buf((char_u*)":q\n", 3);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
NSLog(@"WARNING: Unknown message received (msgid=%d)", msgid);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,8 @@
|
||||
int startFuFlags;
|
||||
}
|
||||
|
||||
- (MMFullscreenWindow *)initWithWindow:(NSWindow *)t view:(MMVimView *)v;
|
||||
- (MMFullscreenWindow *)initWithWindow:(NSWindow *)t view:(MMVimView *)v
|
||||
backgroundColor:(NSColor *)back;
|
||||
|
||||
- (void)enterFullscreen:(int)fuoptions;
|
||||
- (void)leaveFullscreen;
|
||||
|
||||
@@ -32,8 +32,9 @@
|
||||
#import <Carbon/Carbon.h>
|
||||
|
||||
// These have to be the same as in option.h
|
||||
#define FUOPT_MAXVERT 0x001
|
||||
#define FUOPT_MAXHORZ 0x002
|
||||
#define FUOPT_MAXVERT 0x001
|
||||
#define FUOPT_MAXHORZ 0x002
|
||||
#define FUOPT_BGCOLOR_HLGROUP 0x004
|
||||
|
||||
|
||||
static int numFullscreenWindows = 0;
|
||||
@@ -46,7 +47,8 @@ static int numFullscreenWindows = 0;
|
||||
|
||||
@implementation MMFullscreenWindow
|
||||
|
||||
- (MMFullscreenWindow *)initWithWindow:(NSWindow *)t view:(MMVimView *)v
|
||||
- (MMFullscreenWindow *)initWithWindow:(NSWindow *)t view:(MMVimView *)v
|
||||
backgroundColor:(NSColor *)back
|
||||
{
|
||||
NSScreen* screen = [t screen];
|
||||
|
||||
@@ -73,7 +75,7 @@ static int numFullscreenWindows = 0;
|
||||
|
||||
[self setHasShadow:NO];
|
||||
[self setShowsResizeIndicator:NO];
|
||||
[self setBackgroundColor:[NSColor blackColor]];
|
||||
[self setBackgroundColor:back];
|
||||
[self setReleasedWhenClosed:NO];
|
||||
|
||||
return self;
|
||||
|
||||
+45
-4
@@ -51,6 +51,7 @@ enum {
|
||||
- (BOOL)convertRow:(int)row column:(int)column toPoint:(NSPoint *)point;
|
||||
- (NSRect)trackingRect;
|
||||
- (void)dispatchKeyEvent:(NSEvent *)event;
|
||||
- (MMWindowController *)windowController;
|
||||
- (MMVimController *)vimController;
|
||||
- (void)startDragTimerWithInterval:(NSTimeInterval)t;
|
||||
- (void)dragTimerFired:(NSTimer *)timer;
|
||||
@@ -1119,6 +1120,42 @@ enum {
|
||||
// The font panel is updated whenever the font is set.
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// NOTE: The menu items cut/copy/paste/undo/redo/select all/... must be bound
|
||||
// to the same actions as in IB otherwise they will not work with dialogs. All
|
||||
// we do here is forward these actions to the Vim process.
|
||||
//
|
||||
- (IBAction)cut:(id)sender
|
||||
{
|
||||
[[self windowController] vimMenuItemAction:sender];
|
||||
}
|
||||
|
||||
- (IBAction)copy:(id)sender
|
||||
{
|
||||
[[self windowController] vimMenuItemAction:sender];
|
||||
}
|
||||
|
||||
- (IBAction)paste:(id)sender
|
||||
{
|
||||
[[self windowController] vimMenuItemAction:sender];
|
||||
}
|
||||
|
||||
- (IBAction)undo:(id)sender
|
||||
{
|
||||
[[self windowController] vimMenuItemAction:sender];
|
||||
}
|
||||
|
||||
- (IBAction)redo:(id)sender
|
||||
{
|
||||
[[self windowController] vimMenuItemAction:sender];
|
||||
}
|
||||
|
||||
- (IBAction)selectAll:(id)sender
|
||||
{
|
||||
[[self windowController] vimMenuItemAction:sender];
|
||||
}
|
||||
|
||||
@end // MMTextView
|
||||
|
||||
|
||||
@@ -1259,13 +1296,17 @@ enum {
|
||||
[self sendKeyDown:bytes length:len modifiers:mods];
|
||||
}
|
||||
|
||||
- (MMVimController *)vimController
|
||||
- (MMWindowController *)windowController
|
||||
{
|
||||
id windowController = [[self window] windowController];
|
||||
if ([windowController isKindOfClass:[MMWindowController class]])
|
||||
return (MMWindowController*)windowController;
|
||||
return nil;
|
||||
}
|
||||
|
||||
// TODO: Make sure 'windowController' is a MMWindowController before type
|
||||
// casting.
|
||||
return [(MMWindowController*)windowController vimController];
|
||||
- (MMVimController *)vimController
|
||||
{
|
||||
return [[self windowController] vimController];
|
||||
}
|
||||
|
||||
- (void)startDragTimerWithInterval:(NSTimeInterval)t
|
||||
|
||||
@@ -40,14 +40,19 @@
|
||||
NSData *resendData;
|
||||
#endif
|
||||
NSMenu *lastMenuSearched;
|
||||
NSMenuItem *recentFilesMenuItem;
|
||||
NSMenuItem *recentFilesDummy;
|
||||
NSDictionary *vimState;
|
||||
}
|
||||
|
||||
- (id)initWithBackend:(id)backend pid:(int)processIdentifier;
|
||||
- (id)initWithBackend:(id)backend pid:(int)processIdentifier
|
||||
recentFiles:(NSMenuItem*)menu;
|
||||
- (id)backendProxy;
|
||||
- (int)pid;
|
||||
- (void)setServerName:(NSString *)name;
|
||||
- (NSString *)serverName;
|
||||
- (MMWindowController *)windowController;
|
||||
- (NSDictionary *)vimState;
|
||||
- (void)cleanup;
|
||||
- (void)dropFiles:(NSArray *)filenames forceOpen:(BOOL)force;
|
||||
- (void)dropString:(NSString *)string;
|
||||
|
||||
@@ -70,7 +70,8 @@ static NSTimeInterval MMResendInterval = 0.5;
|
||||
- (void)addMenuItemWithTag:(int)tag parent:(NSMenu *)parent
|
||||
title:(NSString *)title tip:(NSString *)tip
|
||||
keyEquivalent:(int)key modifiers:(int)mask
|
||||
action:(NSString *)action atIndex:(int)idx;
|
||||
action:(NSString *)action isAlternate:(int)isAlt
|
||||
atIndex:(int)idx;
|
||||
- (NSToolbarItem *)toolbarItemForTag:(int)tag index:(int *)index;
|
||||
- (void)addToolbarItemToDictionaryWithTag:(int)tag label:(NSString *)title
|
||||
toolTip:(NSString *)tip icon:(NSString *)icon;
|
||||
@@ -81,6 +82,7 @@ static NSTimeInterval MMResendInterval = 0.5;
|
||||
#if MM_RESEND_LAST_FAILURE
|
||||
- (void)resendTimerFired:(NSTimer *)timer;
|
||||
#endif
|
||||
- (void)replaceMenuItem:(NSMenuItem*)old with:(NSMenuItem*)new;
|
||||
@end
|
||||
|
||||
|
||||
@@ -89,8 +91,12 @@ static NSTimeInterval MMResendInterval = 0.5;
|
||||
@implementation MMVimController
|
||||
|
||||
- (id)initWithBackend:(id)backend pid:(int)processIdentifier
|
||||
recentFiles:(NSMenuItem*)menu;
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
|
||||
recentFilesMenuItem = [menu retain];
|
||||
|
||||
windowController =
|
||||
[[MMWindowController alloc] initWithVimController:self];
|
||||
backendProxy = [backend retain];
|
||||
@@ -135,6 +141,9 @@ static NSTimeInterval MMResendInterval = 0.5;
|
||||
[mainMenuItems release]; mainMenuItems = nil;
|
||||
[windowController release]; windowController = nil;
|
||||
|
||||
[recentFilesMenuItem release]; recentFilesMenuItem = nil;
|
||||
[recentFilesDummy release]; recentFilesDummy = nil;
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@@ -143,6 +152,11 @@ static NSTimeInterval MMResendInterval = 0.5;
|
||||
return windowController;
|
||||
}
|
||||
|
||||
- (NSDictionary *)vimState
|
||||
{
|
||||
return vimState;
|
||||
}
|
||||
|
||||
- (void)setServerName:(NSString *)name
|
||||
{
|
||||
if (name != serverName) {
|
||||
@@ -382,6 +396,15 @@ static NSTimeInterval MMResendInterval = 0.5;
|
||||
{
|
||||
if (!isInitialized) return;
|
||||
|
||||
if (!dir) {
|
||||
// 'dir == nil' means: set dir to the pwd of the Vim process, or let
|
||||
// open dialog decide (depending on the below user default).
|
||||
BOOL trackPwd = [[NSUserDefaults standardUserDefaults]
|
||||
boolForKey:MMDialogsTrackPwdKey];
|
||||
if (trackPwd)
|
||||
dir = [vimState objectForKey:@"pwd"];
|
||||
}
|
||||
|
||||
if (saving) {
|
||||
[[NSSavePanel savePanel] beginSheetForDirectory:dir file:nil
|
||||
modalForWindow:[windowController window]
|
||||
@@ -574,6 +597,14 @@ static NSTimeInterval MMResendInterval = 0.5;
|
||||
[NSApp setWindowsMenu:windowMenu];
|
||||
}
|
||||
|
||||
// Replace real Recent Files menu in the old menu with the dummy, then
|
||||
// remove dummy from new menu and put Recent Files menu there
|
||||
NSMenuItem *oldItem = (NSMenuItem*)[recentFilesMenuItem representedObject];
|
||||
if (oldItem)
|
||||
[self replaceMenuItem:recentFilesMenuItem with:oldItem];
|
||||
[recentFilesMenuItem setRepresentedObject:recentFilesDummy];
|
||||
[self replaceMenuItem:recentFilesDummy with:recentFilesMenuItem];
|
||||
|
||||
shouldUpdateMainMenu = NO;
|
||||
}
|
||||
|
||||
@@ -689,6 +720,7 @@ static NSTimeInterval MMResendInterval = 0.5;
|
||||
if (idx < 0) idx = 0;
|
||||
int key = *((int*)bytes); bytes += sizeof(int);
|
||||
int mask = *((int*)bytes); bytes += sizeof(int);
|
||||
int isalt = *((int*)bytes); bytes += sizeof(int);
|
||||
|
||||
NSString *ident = [NSString stringWithFormat:@"%d.%d",
|
||||
(int)self, parentTag];
|
||||
@@ -699,7 +731,7 @@ static NSTimeInterval MMResendInterval = 0.5;
|
||||
NSMenu *parent = [self menuForTag:parentTag];
|
||||
[self addMenuItemWithTag:tag parent:parent title:title tip:tip
|
||||
keyEquivalent:key modifiers:mask action:action
|
||||
atIndex:idx];
|
||||
isAlternate:isalt atIndex:idx];
|
||||
}
|
||||
|
||||
[title release];
|
||||
@@ -878,8 +910,12 @@ static NSTimeInterval MMResendInterval = 0.5;
|
||||
[self setServerName:name];
|
||||
[name release];
|
||||
} else if (EnterFullscreenMsgID == msgid) {
|
||||
int fuoptions = *(int*)[data bytes];
|
||||
[windowController enterFullscreen:fuoptions];
|
||||
const void *bytes = [data bytes];
|
||||
int fuoptions = *((int*)bytes); bytes += sizeof(int);
|
||||
int bg = *((int*)bytes);
|
||||
NSColor *back = [NSColor colorWithArgbInt:bg];
|
||||
|
||||
[windowController enterFullscreen:fuoptions backgroundColor:back];
|
||||
} else if (LeaveFullscreenMsgID == msgid) {
|
||||
[windowController leaveFullscreen];
|
||||
} else if (BuffersNotModifiedMsgID == msgid) {
|
||||
@@ -894,6 +930,12 @@ static NSTimeInterval MMResendInterval = 0.5;
|
||||
[[[windowController vimView] textView] setAntialias:YES];
|
||||
} else if (DisableAntialiasMsgID == msgid) {
|
||||
[[[windowController vimView] textView] setAntialias:NO];
|
||||
} else if (SetVimStateMsgID == msgid) {
|
||||
NSDictionary *dict = [NSDictionary dictionaryWithData:data];
|
||||
if (dict) {
|
||||
[vimState release];
|
||||
vimState = [dict retain];
|
||||
}
|
||||
} else {
|
||||
NSLog(@"WARNING: Unknown message received (msgid=%d)", msgid);
|
||||
}
|
||||
@@ -902,9 +944,15 @@ static NSTimeInterval MMResendInterval = 0.5;
|
||||
- (void)savePanelDidEnd:(NSSavePanel *)panel code:(int)code
|
||||
context:(void *)context
|
||||
{
|
||||
NSString *string = (code == NSOKButton) ? [panel filename] : nil;
|
||||
NSString *path = (code == NSOKButton) ? [panel filename] : nil;
|
||||
@try {
|
||||
[backendProxy setDialogReturn:string];
|
||||
[backendProxy setDialogReturn:path];
|
||||
|
||||
// Add file to the "Recent Files" menu (this ensures that files that
|
||||
// are opened/saved from a :browse command are added to this menu).
|
||||
if (path)
|
||||
[[NSDocumentController sharedDocumentController]
|
||||
noteNewRecentFilePath:path];
|
||||
}
|
||||
@catch (NSException *e) {
|
||||
NSLog(@"Exception caught in %s %@", _cmd, e);
|
||||
@@ -1060,7 +1108,8 @@ static NSTimeInterval MMResendInterval = 0.5;
|
||||
- (void)addMenuItemWithTag:(int)tag parent:(NSMenu *)parent
|
||||
title:(NSString *)title tip:(NSString *)tip
|
||||
keyEquivalent:(int)key modifiers:(int)mask
|
||||
action:(NSString *)action atIndex:(int)idx
|
||||
action:(NSString *)action isAlternate:(int)isAlt
|
||||
atIndex:(int)idx
|
||||
{
|
||||
if (parent) {
|
||||
NSMenuItem *item = nil;
|
||||
@@ -1069,17 +1118,30 @@ static NSTimeInterval MMResendInterval = 0.5;
|
||||
} else {
|
||||
item = [[[NSMenuItem alloc] init] autorelease];
|
||||
[item setTitle:title];
|
||||
// TODO: Check that 'action' is a valid action (nothing will happen
|
||||
// if it isn't, but it would be nice with a warning).
|
||||
if (action) [item setAction:NSSelectorFromString(action)];
|
||||
else [item setAction:@selector(vimMenuItemAction:)];
|
||||
if (tip) [item setToolTip:tip];
|
||||
|
||||
if (key != 0) {
|
||||
NSString *keyString =
|
||||
[NSString stringWithFormat:@"%C", key];
|
||||
[item setKeyEquivalent:keyString];
|
||||
[item setKeyEquivalentModifierMask:mask];
|
||||
if ([action isEqualToString:@"recentFilesDummy:"]) {
|
||||
// Remove the recent files menu item from its current menu
|
||||
// and put it in the current file menu. See -[MMAppController
|
||||
// applicationWillFinishLaunching for more information.
|
||||
//[[recentFilesMenuItem menu] removeItem:recentFilesMenuItem];
|
||||
//item = recentFilesMenuItem;
|
||||
recentFilesDummy = [item retain];
|
||||
|
||||
} else {
|
||||
// TODO: Check that 'action' is a valid action (nothing will
|
||||
// happen if it isn't, but it would be nice with a warning).
|
||||
if (action) [item setAction:NSSelectorFromString(action)];
|
||||
else [item setAction:@selector(vimMenuItemAction:)];
|
||||
if (tip) [item setToolTip:tip];
|
||||
|
||||
if (key != 0) {
|
||||
NSString *keyString =
|
||||
[NSString stringWithFormat:@"%C", key];
|
||||
[item setKeyEquivalent:keyString];
|
||||
[item setKeyEquivalentModifierMask:mask];
|
||||
}
|
||||
|
||||
if (isAlt) [item setAlternate:YES];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1216,6 +1278,14 @@ static NSTimeInterval MMResendInterval = 0.5;
|
||||
}
|
||||
#endif
|
||||
|
||||
- (void)replaceMenuItem:(NSMenuItem*)old with:(NSMenuItem*)new
|
||||
{
|
||||
NSMenu *menu = [old menu];
|
||||
int index = [menu indexOfItem:old];
|
||||
[menu removeItemAtIndex:index];
|
||||
[menu insertItem:new atIndex:index];
|
||||
}
|
||||
|
||||
@end // MMVimController (Private)
|
||||
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
- (void)liveResizeWillStart;
|
||||
- (void)liveResizeDidEnd;
|
||||
|
||||
- (void)enterFullscreen:(int)fuoptions;
|
||||
- (void)enterFullscreen:(int)fuoptions backgroundColor:(NSColor *)back;
|
||||
- (void)leaveFullscreen;
|
||||
- (void)setBuffersModified:(BOOL)mod;
|
||||
|
||||
@@ -68,5 +68,6 @@
|
||||
- (IBAction)performClose:(id)sender;
|
||||
- (IBAction)findNext:(id)sender;
|
||||
- (IBAction)findPrevious:(id)sender;
|
||||
- (IBAction)vimMenuItemAction:(id)sender;
|
||||
|
||||
@end
|
||||
|
||||
@@ -76,7 +76,6 @@
|
||||
- (NSSize)constrainContentSizeToScreenSize:(NSSize)contentSize;
|
||||
- (void)updateResizeConstraints;
|
||||
- (NSTabViewItem *)addNewTabViewItem;
|
||||
- (IBAction)vimMenuItemAction:(id)sender;
|
||||
- (BOOL)askBackendForStarRegister:(NSPasteboard *)pb;
|
||||
- (void)hideTablineSeparator:(BOOL)hide;
|
||||
- (void)doFindNext:(BOOL)next;
|
||||
@@ -546,12 +545,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)enterFullscreen:(int)fuoptions
|
||||
- (void)enterFullscreen:(int)fuoptions backgroundColor:(NSColor *)back
|
||||
{
|
||||
if (fullscreenEnabled) return;
|
||||
|
||||
fullscreenWindow = [[MMFullscreenWindow alloc]
|
||||
initWithWindow:decoratedWindow view:vimView];
|
||||
initWithWindow:decoratedWindow view:vimView backgroundColor:back];
|
||||
[fullscreenWindow enterFullscreen:fuoptions];
|
||||
[fullscreenWindow setDelegate:self];
|
||||
fullscreenEnabled = YES;
|
||||
@@ -595,9 +594,12 @@
|
||||
|
||||
- (IBAction)performClose:(id)sender
|
||||
{
|
||||
// NOTE: File->Close is bound to this action message so that File->Close
|
||||
// also works for auxiliary windows such as the About dialog.
|
||||
[vimController sendMessage:CloseMsgID data:nil];
|
||||
// NOTE: With the introduction of :macmenu it is possible to bind
|
||||
// File.Close to ":conf q" but at the same time have it send off the
|
||||
// performClose: action. For this reason we no longer need the CloseMsgID
|
||||
// message. However, we still need File.Close to send performClose:
|
||||
// otherwise Cmd-w will not work on dialogs.
|
||||
[self vimMenuItemAction:sender];
|
||||
}
|
||||
|
||||
- (IBAction)findNext:(id)sender
|
||||
@@ -610,6 +612,16 @@
|
||||
[self doFindNext:NO];
|
||||
}
|
||||
|
||||
- (IBAction)vimMenuItemAction:(id)sender
|
||||
{
|
||||
int tag = [sender tag];
|
||||
|
||||
NSMutableData *data = [NSMutableData data];
|
||||
[data appendBytes:&tag length:sizeof(int)];
|
||||
|
||||
[vimController sendMessage:ExecuteMenuMsgID data:data];
|
||||
}
|
||||
|
||||
|
||||
// -- NSWindow delegate ------------------------------------------------------
|
||||
|
||||
@@ -678,12 +690,22 @@
|
||||
BOOL zoomBoth = [[NSUserDefaults standardUserDefaults]
|
||||
boolForKey:MMZoomBothKey];
|
||||
|
||||
if ((zoomBoth && !cmdLeftClick) || (!zoomBoth && cmdLeftClick))
|
||||
return frame;
|
||||
if (!((zoomBoth && !cmdLeftClick) || (!zoomBoth && cmdLeftClick))) {
|
||||
// Zoom in horizontal direction only.
|
||||
NSRect currentFrame = [win frame];
|
||||
frame.size.width = currentFrame.size.width;
|
||||
frame.origin.x = currentFrame.origin.x;
|
||||
}
|
||||
|
||||
NSRect currentFrame = [win frame];
|
||||
frame.size.width = currentFrame.size.width;
|
||||
frame.origin.x = currentFrame.origin.x;
|
||||
// HACK! The window frame is often higher than the 'defaultFrame' (the fact
|
||||
// that 'defaultFrame' doesn't cover the entire area up to the menu bar
|
||||
// seems like a Cocoa bug). To ensure that the window doesn't move
|
||||
// downwards when the zoom button is clicked we check for this situation
|
||||
// and return a frame whose max Y coordinate is no lower than the current
|
||||
// max Y coordinate.
|
||||
float delta = NSMaxY([win frame]) - NSMaxY(frame);
|
||||
if (delta > 0)
|
||||
frame.origin.y += delta;
|
||||
|
||||
return frame;
|
||||
}
|
||||
@@ -771,16 +793,6 @@
|
||||
return [vimView addNewTabViewItem];
|
||||
}
|
||||
|
||||
- (IBAction)vimMenuItemAction:(id)sender
|
||||
{
|
||||
int tag = [sender tag];
|
||||
|
||||
NSMutableData *data = [NSMutableData data];
|
||||
[data appendBytes:&tag length:sizeof(int)];
|
||||
|
||||
[vimController sendMessage:ExecuteMenuMsgID data:data];
|
||||
}
|
||||
|
||||
- (BOOL)askBackendForStarRegister:(NSPasteboard *)pb
|
||||
{
|
||||
// TODO: Can this be done with evaluateExpression: instead?
|
||||
|
||||
+17
-1
@@ -162,7 +162,7 @@ enum {
|
||||
LiveResizeMsgID,
|
||||
EnableAntialiasMsgID,
|
||||
DisableAntialiasMsgID,
|
||||
CloseMsgID,
|
||||
SetVimStateMsgID,
|
||||
};
|
||||
|
||||
|
||||
@@ -227,6 +227,7 @@ extern NSString *MMZoomBothKey;
|
||||
extern NSString *MMCurrentPreferencePaneKey;
|
||||
extern NSString *MMLoginShellCommandKey;
|
||||
extern NSString *MMLoginShellArgumentKey;
|
||||
extern NSString *MMDialogsTrackPwdKey;
|
||||
|
||||
// Enum for MMUntitledWindowKey
|
||||
enum {
|
||||
@@ -277,6 +278,21 @@ NSString *buildSearchTextCommand(NSString *searchText);
|
||||
|
||||
|
||||
|
||||
@interface NSDocumentController (MMExtras)
|
||||
- (void)noteNewRecentFilePath:(NSString *)path;
|
||||
@end
|
||||
|
||||
|
||||
|
||||
|
||||
@interface NSDictionary (MMExtras)
|
||||
+ (id)dictionaryWithData:(NSData *)data;
|
||||
- (NSData *)dictionaryAsData;
|
||||
@end
|
||||
|
||||
|
||||
|
||||
|
||||
// ODB Editor Suite Constants (taken from ODBEditorSuite.h)
|
||||
#define keyFileSender 'FSnd'
|
||||
#define keyFileSenderToken 'FTok'
|
||||
|
||||
+39
-1
@@ -75,7 +75,7 @@ char *MessageStrings[] =
|
||||
"LiveResizeMsgID",
|
||||
"EnableAntialiasMsgID",
|
||||
"DisableAntialiasMsgID",
|
||||
"CloseMsgID",
|
||||
"SetVimStateMsgID",
|
||||
};
|
||||
|
||||
|
||||
@@ -107,6 +107,7 @@ NSString *MMZoomBothKey = @"MMZoomBoth";
|
||||
NSString *MMCurrentPreferencePaneKey = @"MMCurrentPreferencePane";
|
||||
NSString *MMLoginShellCommandKey = @"MMLoginShellCommand";
|
||||
NSString *MMLoginShellArgumentKey = @"MMLoginShellArgument";
|
||||
NSString *MMDialogsTrackPwdKey = @"MMDialogsTrackPwd";
|
||||
|
||||
|
||||
|
||||
@@ -294,3 +295,40 @@ buildSearchTextCommand(NSString *searchText)
|
||||
|
||||
@end // NSColor (MMExtras)
|
||||
|
||||
|
||||
|
||||
|
||||
@implementation NSDocumentController (MMExtras)
|
||||
|
||||
- (void)noteNewRecentFilePath:(NSString *)path
|
||||
{
|
||||
NSURL *url = [NSURL fileURLWithPath:path];
|
||||
if (url)
|
||||
[self noteNewRecentDocumentURL:url];
|
||||
}
|
||||
|
||||
@end // NSDocumentController (MMExtras)
|
||||
|
||||
|
||||
|
||||
|
||||
@implementation NSDictionary (MMExtras)
|
||||
|
||||
+ (id)dictionaryWithData:(NSData *)data
|
||||
{
|
||||
id plist = [NSPropertyListSerialization
|
||||
propertyListFromData:data
|
||||
mutabilityOption:NSPropertyListImmutable
|
||||
format:NULL
|
||||
errorDescription:NULL];
|
||||
|
||||
return [plist isKindOfClass:[NSDictionary class]] ? plist : nil;
|
||||
}
|
||||
|
||||
- (NSData *)dictionaryAsData
|
||||
{
|
||||
return [NSPropertyListSerialization dataFromPropertyList:self
|
||||
format:NSPropertyListBinaryFormat_v1_0 errorDescription:NULL];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -698,7 +698,7 @@
|
||||
i386,
|
||||
);
|
||||
COPY_PHASE_STRIP = YES;
|
||||
CURRENT_PROJECT_VERSION = 25;
|
||||
CURRENT_PROJECT_VERSION = 28;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
|
||||
@@ -739,7 +739,7 @@
|
||||
buildSettings = {
|
||||
ARCHS = "$(NATIVE_ARCH)";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 25;
|
||||
CURRENT_PROJECT_VERSION = 28;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
|
||||
@@ -770,7 +770,7 @@
|
||||
buildSettings = {
|
||||
ARCHS = "$(NATIVE_ARCH)";
|
||||
COPY_PHASE_STRIP = YES;
|
||||
CURRENT_PROJECT_VERSION = 25;
|
||||
CURRENT_PROJECT_VERSION = 28;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
|
||||
|
||||
+30
-34
@@ -32,7 +32,6 @@ static float MMMaxFontSize = 100.0f;
|
||||
|
||||
|
||||
static NSFont *gui_macvim_font_with_name(char_u *name);
|
||||
static BOOL gui_macvim_is_valid_action(NSString *action);
|
||||
|
||||
|
||||
|
||||
@@ -655,33 +654,16 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx)
|
||||
char_u *tip = menu->strings[MENU_INDEX_TIP]
|
||||
? menu->strings[MENU_INDEX_TIP] : menu->actext;
|
||||
char_u *map_str = menu->strings[MENU_INDEX_NORMAL];
|
||||
char_u *mac_action = menu->mac_action;
|
||||
|
||||
#ifdef FEAT_MBYTE
|
||||
icon = CONVERT_TO_UTF8(icon);
|
||||
name = CONVERT_TO_UTF8(name);
|
||||
tip = CONVERT_TO_UTF8(tip);
|
||||
map_str = CONVERT_TO_UTF8(map_str);
|
||||
mac_action = CONVERT_TO_UTF8(mac_action);
|
||||
#endif
|
||||
|
||||
// HACK! Check if menu is mapped to ':macaction actionName:'; if so, pass
|
||||
// the action along so that MacVim can bind the menu item to this action.
|
||||
// This means that if a menu item maps to an action in normal mode, then
|
||||
// all other modes will also use the same action.
|
||||
NSString *action = nil;
|
||||
if (map_str) {
|
||||
NSString *mapping = [NSString stringWithCString:(char*)map_str
|
||||
encoding:NSUTF8StringEncoding];
|
||||
NSArray *parts = [mapping componentsSeparatedByString:@" "];
|
||||
if ([parts count] >=2
|
||||
&& [[parts objectAtIndex:0] hasPrefix:@":maca"]) {
|
||||
action = [parts objectAtIndex:1];
|
||||
action = [action stringByTrimmingCharactersInSet:
|
||||
[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
||||
if (!gui_macvim_is_valid_action(action))
|
||||
action = nil;
|
||||
}
|
||||
}
|
||||
|
||||
[[MMBackend sharedInstance]
|
||||
addMenuItemWithTag:(int)menu
|
||||
parent:(int)menu->parent
|
||||
@@ -690,7 +672,8 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx)
|
||||
icon:(char*)icon
|
||||
keyEquivalent:menu->mac_key
|
||||
modifiers:menu->mac_mods
|
||||
action:action
|
||||
action:(char*)mac_action
|
||||
isAlternate:menu->mac_alternate
|
||||
atIndex:idx];
|
||||
|
||||
#ifdef FEAT_MBYTE
|
||||
@@ -698,6 +681,7 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx)
|
||||
CONVERT_TO_UTF8_FREE(name);
|
||||
CONVERT_TO_UTF8_FREE(tip);
|
||||
CONVERT_TO_UTF8_FREE(map_str);
|
||||
CONVERT_TO_UTF8_FREE(mac_action);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1203,12 +1187,12 @@ ex_macaction(eap)
|
||||
arg = CONVERT_TO_UTF8(arg);
|
||||
#endif
|
||||
|
||||
NSString *name = [NSString stringWithCString:(char*)arg
|
||||
encoding:NSUTF8StringEncoding];
|
||||
if (gui_macvim_is_valid_action(name)) {
|
||||
NSDictionary *actionDict = [[MMBackend sharedInstance] actionDict];
|
||||
NSString *name = [NSString stringWithUTF8String:(char*)arg];
|
||||
if (actionDict && [actionDict objectForKey:name] != nil) {
|
||||
[[MMBackend sharedInstance] executeActionWithName:name];
|
||||
} else {
|
||||
EMSG2(_("E???: \"%s\" is not a valid action"), eap->arg);
|
||||
EMSG2(_("E???: Invalid action: %s"), eap->arg);
|
||||
}
|
||||
|
||||
#ifdef FEAT_MBYTE
|
||||
@@ -1513,18 +1497,11 @@ gui_mch_toggle_tearoffs(int enable)
|
||||
}
|
||||
|
||||
|
||||
static BOOL
|
||||
gui_macvim_is_valid_action(NSString *action)
|
||||
{
|
||||
NSDictionary *actionDict = [[MMBackend sharedInstance] actionDict];
|
||||
return actionDict && [actionDict objectForKey:action] != nil;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gui_mch_enter_fullscreen(int fuoptions_flags)
|
||||
gui_mch_enter_fullscreen(int fuoptions_flags, guicolor_T bg)
|
||||
{
|
||||
[[MMBackend sharedInstance] enterFullscreen:fuoptions_flags];
|
||||
[[MMBackend sharedInstance] enterFullscreen:fuoptions_flags background:bg];
|
||||
}
|
||||
|
||||
|
||||
@@ -1890,3 +1867,22 @@ get_macaction_name(expand_T *xp, int idx)
|
||||
return plainStr;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
is_valid_macaction(char_u *action)
|
||||
{
|
||||
int isValid = NO;
|
||||
NSDictionary *actionDict = [[MMBackend sharedInstance] actionDict];
|
||||
if (actionDict) {
|
||||
#ifdef FEAT_MBYTE
|
||||
action = CONVERT_TO_UTF8(action);
|
||||
#endif
|
||||
NSString *string = [NSString stringWithUTF8String:(char*)action];
|
||||
isValid = (nil != [actionDict objectForKey:string]);
|
||||
#ifdef FEAT_MBYTE
|
||||
CONVERT_TO_UTF8_FREE(action);
|
||||
#endif
|
||||
}
|
||||
|
||||
return isValid;
|
||||
}
|
||||
|
||||
+65
-59
@@ -1,7 +1,7 @@
|
||||
" System gvimrc file for MacVim
|
||||
"
|
||||
" Maintainer: Bjorn Winckler <bjorn.winckler@gmail.com>
|
||||
" Last Change: Fri Mar 21 2008
|
||||
" Last Change: Sun May 19 2008
|
||||
"
|
||||
" This is a work in progress. If you feel so inclined, please help me improve
|
||||
" this file.
|
||||
@@ -42,13 +42,15 @@ aunmenu File.-SEP4-
|
||||
aunmenu File.Exit
|
||||
aunmenu File.Save-Exit
|
||||
|
||||
an <silent> 10.290 File.New\ Window :maca newWindow:<CR>
|
||||
an <silent> 10.290 File.New\ Window <Nop>
|
||||
an 10.295 File.New\ Tab :tabnew<CR>
|
||||
an <silent> 10.310 File.&Open\.\.\. :maca fileOpen:<CR>
|
||||
an <silent> 10.310 File.Open\.\.\. <Nop>
|
||||
an <silent> 10.325 File.Open\ Recent <Nop>
|
||||
an 10.328 File.-SEP0- <Nop>
|
||||
an <silent> 10.330 File.Close\ Window<Tab>:qa :confirm qa<CR>
|
||||
an <silent> 10.331 File.Close :maca performClose:<CR>
|
||||
"an 10.331 File.Close\ Tab :tabclose<CR>
|
||||
an <silent> 10.330 File.Close\ Window<Tab>:qa :conf qa<CR>
|
||||
an <silent> 10.332 File.Close :conf q<CR>
|
||||
an <silent> 10.341 File.Save\ All :browse conf wa<CR>
|
||||
an 10.350 File.Save\ As\.\.\.<Tab>:sav :browse confirm saveas<CR>
|
||||
|
||||
|
||||
" Edit menu
|
||||
@@ -57,8 +59,8 @@ aunmenu Edit.Find
|
||||
aunmenu Edit.Find\ and\ Replace
|
||||
|
||||
an 20.410.10 Edit.Find.Find\.\.\.<Tab>/ /
|
||||
an 20.410.20 Edit.Find.Find\ Next :maca findNext:<CR>
|
||||
an 20.410.30 Edit.Find.Find\ Previous :maca findPrevious:<CR>
|
||||
an 20.410.20 Edit.Find.Find\ Next <Nop>
|
||||
an 20.410.30 Edit.Find.Find\ Previous <Nop>
|
||||
vmenu 20.410.35 Edit.Find.Use\ Selection\ for\ Find y:let @/=@"<CR>n
|
||||
an 20.410.40 Edit.Find.-SEP1- <Nop>
|
||||
an 20.410.50 Edit.Find.Find\ and\ Replace\.\.\.<Tab>:%s :%s/
|
||||
@@ -66,30 +68,30 @@ vunmenu Edit.Find.Find\ and\ Replace\.\.\.<Tab>:%s
|
||||
vnoremenu Edit.Find.Find\ and\ Replace\.\.\.<Tab>:s :s/
|
||||
|
||||
an 20.460 Edit.-SEP4- <Nop>
|
||||
an 20.465.10 Edit.Font.Show\ Fonts :maca orderFrontFontPanel:<CR>
|
||||
an 20.465.10 Edit.Font.Show\ Fonts <Nop>
|
||||
an 20.465.20 Edit.Font.-SEP5- <Nop>
|
||||
an 20.465.30 Edit.Font.Bigger :maca fontSizeUp:<CR>
|
||||
an 20.465.40 Edit.Font.Smaller :maca fontSizeDown:<CR>
|
||||
an 20.470 Edit.Special\ Characters\.\.\. :maca orderFrontCharacterPalette:<CR>
|
||||
an 20.465.30 Edit.Font.Bigger <Nop>
|
||||
an 20.465.40 Edit.Font.Smaller <Nop>
|
||||
an 20.470 Edit.Special\ Characters\.\.\. <Nop>
|
||||
|
||||
|
||||
" Window menu (should be next to Help so give it a high priority)
|
||||
aunmenu Window
|
||||
|
||||
an <silent> 9900.300 Window.Minimize :maca performMiniaturize:<CR>
|
||||
an <silent> 9900.310 Window.Zoom :maca performZoom:<CR>
|
||||
an <silent> 9900.300 Window.Minimize <Nop>
|
||||
an <silent> 9900.310 Window.Zoom <Nop>
|
||||
an <silent> 9900.320 Window.Toggle\ Full\ Screen\ Mode :set invfullscreen<CR>
|
||||
an 9900.330 Window.-SEP1- <Nop>
|
||||
" TODO! Grey out if no tabs are visible.
|
||||
an <silent> 9900.340 Window.Previous\ Tab :tabprevious<CR>
|
||||
an <silent> 9900.350 Window.Next\ Tab :tabnext<CR>
|
||||
an 9900.360 Window.-SEP2- <Nop>
|
||||
an <silent> 9900.370 Window.Bring\ All\ To\ Front :maca arrangeInFront:<CR>
|
||||
an <silent> 9900.370 Window.Bring\ All\ To\ Front <Nop>
|
||||
|
||||
|
||||
" Help menu
|
||||
an 9999.1 Help.MacVim\ Help :h gui_mac<CR>
|
||||
an <silent> 9999.2 Help.MacVim\ Website :maca openWebsite:<CR>
|
||||
an <silent> 9999.2 Help.MacVim\ Website <Nop>
|
||||
an 9999.3 Help.-sep0- <Nop>
|
||||
|
||||
|
||||
@@ -188,55 +190,59 @@ endif " exists("macvim_hig_shift_movement")
|
||||
|
||||
|
||||
"
|
||||
" Menu key equivalents (these should always have the 'D' modifier set)
|
||||
" Set up menu key equivalents (these should always have the 'D' modifier set),
|
||||
" action bindings, and alternate items.
|
||||
"
|
||||
" Note: menu items which should execute an action are bound to <Nop>; the
|
||||
" action message is specified here via the :macmenu command.
|
||||
"
|
||||
|
||||
macmenukey File.New\ Window <D-n>
|
||||
macmenukey File.New\ Tab <D-t>
|
||||
macm File.New\ Window key=<D-n> action=newWindow:
|
||||
macm File.New\ Tab key=<D-t>
|
||||
macm File.Open\.\.\. key=<D-o> action=fileOpen:
|
||||
macm File.Open\ Tab\.\.\. key=<D-T>
|
||||
macm File.Open\ Recent action=recentFilesDummy:
|
||||
macm File.Close\ Window key=<D-W>
|
||||
macm File.Close key=<D-w> action=performClose:
|
||||
macm File.Save key=<D-s>
|
||||
macm File.Save\ All key=<D-M-s> alt=YES
|
||||
macm File.Save\ As\.\.\. key=<D-S>
|
||||
macm File.Print key=<D-p>
|
||||
|
||||
macmenukey File.Open\.\.\. <D-o>
|
||||
macmenukey File.Open\ Tab\.\.\. <D-T>
|
||||
macmenukey File.Close\ Window <D-W>
|
||||
"macmenukey File.Close\ Tab <D-w>
|
||||
macmenukey File.Close <D-w>
|
||||
macmenukey File.Save <D-s>
|
||||
macmenukey File.Save\ As\.\.\. <D-S>
|
||||
macmenukey File.Print <D-p>
|
||||
macm Edit.Undo key=<D-z> action=undo:
|
||||
macm Edit.Redo key=<D-Z> action=redo:
|
||||
macm Edit.Cut key=<D-x> action=cut:
|
||||
macm Edit.Copy key=<D-c> action=copy:
|
||||
macm Edit.Paste key=<D-v> action=paste:
|
||||
macm Edit.Select\ All key=<D-a> action=selectAll:
|
||||
macm Edit.Find.Find\.\.\. key=<D-f>
|
||||
macm Edit.Find.Find\ Next key=<D-g> action=findNext:
|
||||
macm Edit.Find.Find\ Previous key=<D-G> action=findPrevious:
|
||||
macm Edit.Find.Use\ Selection\ for\ Find key=<D-e>
|
||||
macm Edit.Special\ Characters\.\.\. key=<D-M-t>
|
||||
macm Edit.Font.Show\ Fonts action=orderFrontFontPanel:
|
||||
macm Edit.Font.Bigger key=<D-=> action=fontSizeUp:
|
||||
macm Edit.Font.Smaller key=<D--> action=fontSizeDown:
|
||||
macm Edit.Special\ Characters\.\.\. action=orderFrontCharacterPalette:
|
||||
|
||||
macmenukey Edit.Undo <D-z>
|
||||
macmenukey Edit.Redo <D-Z>
|
||||
macmenukey Edit.Cut <D-x>
|
||||
macmenukey Edit.Copy <D-c>
|
||||
macmenukey Edit.Paste <D-v>
|
||||
macmenukey Edit.Select\ All <D-a>
|
||||
macmenukey Edit.Find.Find\.\.\. <D-f>
|
||||
macmenukey Edit.Find.Find\ Next <D-g>
|
||||
macmenukey Edit.Find.Find\ Previous <D-G>
|
||||
macmenukey Edit.Find.Use\ Selection\ for\ Find <D-e>
|
||||
macmenukey Edit.Special\ Characters\.\.\. <D-M-t>
|
||||
macmenukey Edit.Font.Bigger <D-=>
|
||||
macmenukey Edit.Font.Smaller <D-->
|
||||
macm Tools.Spelling.To\ Next\ error key=<D-;>
|
||||
macm Tools.Spelling.Suggest\ Corrections key=<D-:>
|
||||
macm Tools.Make key=<D-b>
|
||||
macm Tools.List\ Errors key=<D-l>
|
||||
macm Tools.List\ Messages key=<D-L>
|
||||
macm Tools.Next\ Error key=<D-C-Right>
|
||||
macm Tools.Previous\ Error key=<D-C-Left>
|
||||
macm Tools.Older\ List key=<D-C-Up>
|
||||
macm Tools.Newer\ List key=<D-C-Down>
|
||||
|
||||
macmenukey Tools.Spelling.To\ Next\ error <D-;>
|
||||
macmenukey Tools.Spelling.Suggest\ Corrections <D-:>
|
||||
macmenukey Tools.Make <D-b>
|
||||
macmenukey Tools.List\ Errors <D-l>
|
||||
macmenukey Tools.List\ Messages <D-L>
|
||||
macmenukey Tools.Next\ Error <D-C-Right>
|
||||
macmenukey Tools.Previous\ Error <D-C-Left>
|
||||
macmenukey Tools.Older\ List <D-C-Up>
|
||||
macmenukey Tools.Newer\ List <D-C-Down>
|
||||
|
||||
macmenukey Window.Minimize <D-m>
|
||||
macmenukey Window.Zoom <D-C-z>
|
||||
macmenukey Window.Toggle\ Full\ Screen\ Mode <D-F>
|
||||
macmenukey Window.Previous\ Tab <D-{>
|
||||
macmenukey Window.Next\ Tab <D-}>
|
||||
|
||||
" TODO: <D-?> seems to be reserved by the system on Leopard. Disable this key
|
||||
" equivalent until I can figure out what to do about it.
|
||||
"macmenukey Help.MacVim\ Help <D-?>
|
||||
macm Window.Minimize key=<D-m> action=performMiniaturize:
|
||||
macm Window.Zoom key=<D-C-z> action=performZoom:
|
||||
macm Window.Toggle\ Full\ Screen\ Mode key=<D-F>
|
||||
macm Window.Previous\ Tab key=<D-{>
|
||||
macm Window.Next\ Tab key=<D-}>
|
||||
macm Window.Bring\ All\ To\ Front action=arrangeInFront:
|
||||
|
||||
macm Help.MacVim\ Website action=openWebsite:
|
||||
|
||||
" Restore the previous value of 'cpoptions'.
|
||||
let &cpo = s:cpo_save
|
||||
|
||||
@@ -40,6 +40,91 @@
|
||||
Sparkle supports updates in zip, tar, tbz, tgz, or dmg format.
|
||||
-->
|
||||
|
||||
<item>
|
||||
<title>Snapshot 28 released</title>
|
||||
<description><![CDATA[
|
||||
<h1>MacVim snapshot 28 released</h1>
|
||||
<p><em>The ":macmenukey" command is now deprecated. Please update your .gvimrc
|
||||
file to use the ":macmenu" command instead (if you use ":macmenukey").</em></p>
|
||||
|
||||
<p> Changes since snapshot 27:
|
||||
<ul>
|
||||
<li> Added the ":macmenu" commmand (see ":h macmenu") and deprecated
|
||||
":macmenukey"</li>
|
||||
<li> Cmd-w now works even when mappings to <-\> are present </li>
|
||||
<li> Added "File.Save All" menu item (Cmd-Alt-s) </li>
|
||||
<li> The Logitech Control Center no longer causes any problems </li>
|
||||
<li> "Edit" menu items now work better with open and save dialogs </li>
|
||||
<li> The 'backspace' option now includes "indent,eol,start" by default </li>
|
||||
<li> Open and save dialogs track the present working directory </li>
|
||||
</ul>
|
||||
</p>
|
||||
]]></description>
|
||||
<pubDate>Sun, 25 May 2008 19:40 CET</pubDate>
|
||||
<enclosure type="application/octet-stream"
|
||||
url="http://macvim.googlecode.com/files/MacVim-snapshot-28.tbz"
|
||||
length="8124499"
|
||||
sparkle:version="28"
|
||||
sparkle:shortVersionString="7.1"
|
||||
/>
|
||||
</item>
|
||||
|
||||
|
||||
<item>
|
||||
<title>Snapshot 27 released</title>
|
||||
<description><![CDATA[
|
||||
<h1>MacVim snapshot 27 released</h1>
|
||||
<p> This is the first snapshot compiled on the new Mac I bought with money
|
||||
donated from MacVim users! There were problems with compiling universal
|
||||
binaries with Ruby and Perl support on PPC/Tiger so I was hoping to be able
|
||||
to include these now that I have Intel/Leopard. The good news is that Ruby
|
||||
support is now included, but Perl still is problematic and I had to drop
|
||||
TCL support. I will try to get these working in a future snapshot.
|
||||
</p>
|
||||
|
||||
<p> Here is the list of changes since snapshot 26:
|
||||
<ul>
|
||||
<li> 'fuoptions' now support setting the background color while in
|
||||
full-screen mode, check ":h 'fuopt'" (patch by Enno Lübbers) </li>
|
||||
<li> <D-w> shows confirmation dialog when buffer is modified </li>
|
||||
<li> setting 'antialias' from gvimrc now works </li>
|
||||
<li> zooming a window no longer causes it to move downwards </li>
|
||||
<li> the File menu now contains a "Recent Files" submenu; note that only
|
||||
files opened from Finder or with the ":browse" command are added to this
|
||||
list, and not files opened with e.g. ":e" (patch by Nico Weber) </li>
|
||||
<li> includes latest Vim patches and runtime files </li>
|
||||
</ul>
|
||||
</p>
|
||||
]]></description>
|
||||
<pubDate>Mon, 12 May 2008 22:05 CET</pubDate>
|
||||
<enclosure type="application/octet-stream"
|
||||
url="http://macvim.googlecode.com/files/MacVim-snapshot-27-fixed.tbz"
|
||||
length="8102568"
|
||||
sparkle:version="27"
|
||||
sparkle:shortVersionString="7.1"
|
||||
/>
|
||||
</item>
|
||||
|
||||
|
||||
<item>
|
||||
<title>Snapshot 26 released</title>
|
||||
<description><![CDATA[
|
||||
<h1>MacVim snapshot 26 released</h1>
|
||||
<p> This snapshot contains a fix to the bug which caused the first window to
|
||||
open in the wrong position as well as an initial version of the new MacVim
|
||||
icon. </p>
|
||||
|
||||
]]></description>
|
||||
<pubDate>Fri, 11 Apr 2008 20:37 CET</pubDate>
|
||||
<enclosure type="application/octet-stream"
|
||||
url="http://macvim.googlecode.com/files/MacVim-snapshot-26.tbz"
|
||||
length="8147362"
|
||||
sparkle:version="26"
|
||||
sparkle:shortVersionString="7.1"
|
||||
/>
|
||||
</item>
|
||||
|
||||
|
||||
<item>
|
||||
<title>Snapshot 25 released</title>
|
||||
<description><![CDATA[
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
export MACOSX_DEPLOYMENT_TARGET=10.4
|
||||
|
||||
# Increment build number
|
||||
/Developer/Tools/agvtool next-version -all > /dev/null
|
||||
/Developer/usr/bin/agvtool next-version -all > /dev/null
|
||||
|
||||
# Get current build number
|
||||
BUILDNUM=`/Developer/Tools/agvtool what-version -terse`
|
||||
BUILDNUM=`/Developer/usr/bin/agvtool what-version -terse`
|
||||
DEST=~/Desktop/MacVim-snapshot-$BUILDNUM
|
||||
|
||||
echo '****************************************************'
|
||||
@@ -16,8 +18,8 @@ echo ''
|
||||
echo 'BUILDING VIM BINARY'
|
||||
echo ' running configure...'
|
||||
cd .. && ./configure --enable-gui=macvim --with-mac-arch=both \
|
||||
--with-features=huge --enable-pythoninterp --enable-tclinterp \
|
||||
--enable-cscope \
|
||||
--with-features=huge --enable-pythoninterp \
|
||||
--enable-cscope --enable-rubyinterp \
|
||||
--with-compiledby="Bjorn Winckler <bjorn.winckler@gmail.com>" > /dev/null
|
||||
|
||||
echo ' cleaning...'
|
||||
|
||||
Binary file not shown.
+5
-1
@@ -1,6 +1,10 @@
|
||||
" System vimrc file for MacVim
|
||||
"
|
||||
" Maintainer: Bjorn Winckler <bjorn.winckler@gmail.com>
|
||||
" Last Change: Sat Aug 11 14:26:41 CEST 2007
|
||||
" Last Change: Sun May 25 2008
|
||||
|
||||
set nocompatible
|
||||
|
||||
" The default for 'backspace' is very confusing to new users, so change it to a
|
||||
" more sensible value. Add "set backspace&" to your ~/.vimrc to reset it.
|
||||
set backspace+=indent,eol,start
|
||||
|
||||
+4
-1
@@ -1883,6 +1883,8 @@ installmacros: $(DEST_VIM) $(DEST_RT) $(DEST_MACRO)
|
||||
installtutorbin: $(DEST_VIM)
|
||||
$(INSTALL_DATA) vimtutor $(DEST_BIN)/$(VIMNAME)tutor
|
||||
chmod $(SCRIPTMOD) $(DEST_BIN)/$(VIMNAME)tutor
|
||||
$(INSTALL_DATA) gvimtutor $(DEST_BIN)/$(GVIMNAME)tutor
|
||||
chmod $(SCRIPTMOD) $(DEST_BIN)/$(GVIMNAME)tutor
|
||||
|
||||
installtutor: $(DEST_RT) $(DEST_TUTOR)
|
||||
-$(INSTALL_DATA) $(TUTORSOURCE)/README* $(TUTORSOURCE)/tutor* $(DEST_TUTOR)
|
||||
@@ -2091,6 +2093,7 @@ installmanlinks:
|
||||
uninstall: uninstall_runtime
|
||||
-rm -f $(DEST_BIN)/$(VIMTARGET)
|
||||
-rm -f $(DEST_BIN)/vimtutor
|
||||
-rm -f $(DEST_BIN)/gvimtutor
|
||||
-rm -f $(DEST_BIN)/$(EXTARGET) $(DEST_BIN)/$(VIEWTARGET)
|
||||
-rm -f $(DEST_BIN)/$(GVIMTARGET) $(DEST_BIN)/$(GVIEWTARGET)
|
||||
-rm -f $(DEST_BIN)/$(RVIMTARGET) $(DEST_BIN)/$(RVIEWTARGET)
|
||||
@@ -2187,7 +2190,7 @@ SHADOWDIR = shadow
|
||||
|
||||
shadow: runtime pixmaps
|
||||
mkdir $(SHADOWDIR)
|
||||
cd $(SHADOWDIR); ln -s ../*.[ch] ../*.in ../*.sh ../*.xs ../*.xbm ../toolcheck ../proto ../vimtutor ../mkinstalldirs .
|
||||
cd $(SHADOWDIR); ln -s ../*.[ch] ../*.in ../*.sh ../*.xs ../*.xbm ../toolcheck ../proto ../vimtutor ../gvimtutor ../mkinstalldirs .
|
||||
mkdir $(SHADOWDIR)/auto
|
||||
cd $(SHADOWDIR)/auto; ln -s ../../auto/configure .
|
||||
cd $(SHADOWDIR); rm -f auto/link.sed
|
||||
|
||||
Vendored
+89
@@ -845,6 +845,7 @@ Optional Features:
|
||||
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
|
||||
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
|
||||
--disable-darwin Disable Darwin (Mac OS X) support.
|
||||
--disable-selinux Don't check for SELinux support.
|
||||
--disable-xsmp Disable XSMP session management
|
||||
--disable-xsmp-interact Disable XSMP interaction
|
||||
--enable-mzschemeinterp Include MzScheme interpreter.
|
||||
@@ -3611,6 +3612,94 @@ echo "${ECHO_T}no" >&6
|
||||
esac
|
||||
fi
|
||||
|
||||
echo "$as_me:$LINENO: checking --disable-selinux argument" >&5
|
||||
echo $ECHO_N "checking --disable-selinux argument... $ECHO_C" >&6
|
||||
# Check whether --enable-selinux or --disable-selinux was given.
|
||||
if test "${enable_selinux+set}" = set; then
|
||||
enableval="$enable_selinux"
|
||||
|
||||
else
|
||||
enable_selinux="yes"
|
||||
fi;
|
||||
if test "$enable_selinux" = "yes"; then
|
||||
echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6
|
||||
echo "$as_me:$LINENO: checking for is_selinux_enabled in -lselinux" >&5
|
||||
echo $ECHO_N "checking for is_selinux_enabled in -lselinux... $ECHO_C" >&6
|
||||
if test "${ac_cv_lib_selinux_is_selinux_enabled+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lselinux $LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
builtin and then its argument prototype would still apply. */
|
||||
char is_selinux_enabled ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
is_selinux_enabled ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
(eval $ac_link) 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; } &&
|
||||
{ ac_try='test -s conftest$ac_exeext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_cv_lib_selinux_is_selinux_enabled=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_lib_selinux_is_selinux_enabled=no
|
||||
fi
|
||||
rm -f conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_lib_selinux_is_selinux_enabled" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_selinux_is_selinux_enabled" >&6
|
||||
if test $ac_cv_lib_selinux_is_selinux_enabled = yes; then
|
||||
LIBS="$LIBS -lselinux"
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_SELINUX 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
else
|
||||
echo "$as_me:$LINENO: result: yes" >&5
|
||||
echo "${ECHO_T}yes" >&6
|
||||
fi
|
||||
|
||||
|
||||
echo "$as_me:$LINENO: checking --with-features argument" >&5
|
||||
|
||||
@@ -155,6 +155,7 @@
|
||||
#undef HAVE_READLINK
|
||||
#undef HAVE_RENAME
|
||||
#undef HAVE_SELECT
|
||||
#undef HAVE_SELINUX
|
||||
#undef HAVE_SETENV
|
||||
#undef HAVE_SETPGID
|
||||
#undef HAVE_SETSID
|
||||
|
||||
@@ -308,6 +308,19 @@ case `uname` in
|
||||
esac
|
||||
fi
|
||||
|
||||
dnl Link with -lselinux for SELinux stuff; if not found
|
||||
AC_MSG_CHECKING(--disable-selinux argument)
|
||||
AC_ARG_ENABLE(selinux,
|
||||
[ --disable-selinux Don't check for SELinux support.],
|
||||
, enable_selinux="yes")
|
||||
if test "$enable_selinux" = "yes"; then
|
||||
AC_MSG_RESULT(no)
|
||||
AC_CHECK_LIB(selinux, is_selinux_enabled,
|
||||
[LIBS="$LIBS -lselinux"
|
||||
AC_DEFINE(HAVE_SELINUX)])
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
fi
|
||||
|
||||
dnl Check user requested features.
|
||||
|
||||
|
||||
+5
-1
@@ -1160,6 +1160,7 @@ do_filter(line1, line2, eap, cmd, do_in, do_out)
|
||||
if (!do_out)
|
||||
msg_putchar('\n');
|
||||
|
||||
/* Create the shell command in allocated memory. */
|
||||
cmd_buf = make_filter_cmd(cmd, itmp, otmp);
|
||||
if (cmd_buf == NULL)
|
||||
goto filterend;
|
||||
@@ -1180,7 +1181,10 @@ do_filter(line1, line2, eap, cmd, do_in, do_out)
|
||||
if (do_out)
|
||||
{
|
||||
if (u_save((linenr_T)(line2), (linenr_T)(line2 + 1)) == FAIL)
|
||||
{
|
||||
vim_free(cmd_buf);
|
||||
goto error;
|
||||
}
|
||||
redraw_curbuf_later(VALID);
|
||||
}
|
||||
read_linecount = curbuf->b_ml.ml_line_count;
|
||||
@@ -4471,7 +4475,7 @@ do_sub(eap)
|
||||
/*
|
||||
* The new text is build up step by step, to avoid too much
|
||||
* copying. There are these pieces:
|
||||
* sub_firstline The old text, unmodifed.
|
||||
* sub_firstline The old text, unmodified.
|
||||
* copycol Column in the old text where we started
|
||||
* looking for a match; from here old text still
|
||||
* needs to be copied to the new text.
|
||||
|
||||
+2
-2
@@ -597,8 +597,8 @@ EX(CMD_match, "match", ex_match,
|
||||
RANGE|NOTADR|EXTRA|CMDWIN),
|
||||
EX(CMD_macaction, "macaction", ex_macaction,
|
||||
EXTRA|NOSPC|NEEDARG),
|
||||
EX(CMD_macmenukey, "macmenukey", ex_macmenukey,
|
||||
EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
|
||||
EX(CMD_macmenu, "macmenu", ex_macmenu,
|
||||
EXTRA|TRLBAR|CMDWIN),
|
||||
EX(CMD_menu, "menu", ex_menu,
|
||||
RANGE|NOTADR|ZEROR|BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
|
||||
EX(CMD_menutranslate, "menutranslate", ex_menutranslate,
|
||||
|
||||
+2
-2
@@ -466,7 +466,7 @@ static void ex_folddo __ARGS((exarg_T *eap));
|
||||
|
||||
#ifndef FEAT_GUI_MACVIM
|
||||
# define ex_macaction ex_ni
|
||||
# define ex_macmenukey ex_ni
|
||||
# define ex_macmenu ex_ni
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -3764,7 +3764,7 @@ set_one_cmd_context(xp, buff)
|
||||
case CMD_tmenu: case CMD_tunmenu:
|
||||
case CMD_popup: case CMD_tearoff: case CMD_emenu:
|
||||
#ifdef FEAT_GUI_MACVIM
|
||||
case CMD_macmenukey:
|
||||
case CMD_macmenu:
|
||||
#endif
|
||||
return set_context_in_menu_cmd(xp, cmd, arg, forceit);
|
||||
#endif
|
||||
|
||||
@@ -3651,6 +3651,9 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit,
|
||||
)
|
||||
mch_setperm(backup,
|
||||
(perm & 0707) | ((perm & 07) << 3));
|
||||
# ifdef HAVE_SELINUX
|
||||
mch_copy_sec(fname, backup);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -3686,6 +3689,9 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit,
|
||||
#endif
|
||||
#ifdef HAVE_ACL
|
||||
mch_set_acl(backup, acl);
|
||||
#endif
|
||||
#ifdef HAVE_SELINUX
|
||||
mch_copy_sec(fname, backup);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@@ -4309,6 +4315,12 @@ restore_backup:
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SELINUX
|
||||
/* Probably need to set the security context. */
|
||||
if (!backup_copy)
|
||||
mch_copy_sec(backup, wfname);
|
||||
#endif
|
||||
|
||||
#ifdef UNIX
|
||||
/* When creating a new file, set its owner/group to that of the original
|
||||
* file. Get the new device and inode number. */
|
||||
|
||||
@@ -4955,6 +4955,15 @@ gui_update_screen()
|
||||
{
|
||||
update_topline();
|
||||
validate_cursor();
|
||||
#ifdef FEAT_AUTOCMD
|
||||
/* Trigger CursorMoved if the cursor moved. */
|
||||
if (!finish_op && has_cursormoved()
|
||||
&& !equalpos(last_cursormoved, curwin->w_cursor))
|
||||
{
|
||||
apply_autocmds(EVENT_CURSORMOVED, NULL, NULL, FALSE, curbuf);
|
||||
last_cursormoved = curwin->w_cursor;
|
||||
}
|
||||
#endif
|
||||
update_screen(0); /* may need to update the screen */
|
||||
setcursor();
|
||||
out_flush(); /* make sure output has been written */
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Start GUI Vim on a copy of the tutor file.
|
||||
|
||||
# Usage: gvimtutor [xx]
|
||||
# See vimtutor for usage.
|
||||
|
||||
exec `dirname $0`/vimtutor -g "$@"
|
||||
@@ -1346,5 +1346,10 @@ mf_do_open(mfp, fname, flags)
|
||||
mfp->mf_ffname = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef HAVE_SELINUX
|
||||
mch_copy_sec(fname, mfp->mf_fname);
|
||||
#endif
|
||||
mch_hide(mfp->mf_fname); /* try setting the 'hidden' flag */
|
||||
}
|
||||
}
|
||||
|
||||
+354
-101
@@ -1038,6 +1038,9 @@ free_menu(menup)
|
||||
# ifdef FEAT_GUI_MOTIF
|
||||
vim_free(menu->xpm_fname);
|
||||
# endif
|
||||
#ifdef FEAT_GUI_MACVIM
|
||||
vim_free(menu->mac_action);
|
||||
#endif
|
||||
#endif
|
||||
for (i = 0; i < MENU_MODES; i++)
|
||||
free_menu_string(menu, i);
|
||||
@@ -2137,6 +2140,9 @@ ex_emenu(eap)
|
||||
char_u *p;
|
||||
int idx;
|
||||
char_u *mode;
|
||||
#ifdef FEAT_GUI_MACVIM
|
||||
char_u *old_arg;
|
||||
#endif
|
||||
|
||||
saved_name = vim_strsave(eap->arg);
|
||||
if (saved_name == NULL)
|
||||
@@ -2243,8 +2249,10 @@ ex_emenu(eap)
|
||||
idx = MENU_INDEX_NORMAL;
|
||||
}
|
||||
|
||||
if (idx != MENU_INDEX_INVALID && menu->strings[idx] != NULL)
|
||||
if (idx != MENU_INDEX_INVALID && menu->strings[idx] != NULL &&
|
||||
menu->strings[idx][0] != NUL)
|
||||
{
|
||||
|
||||
/* When executing a script or function execute the commands right now.
|
||||
* Otherwise put them in the typeahead buffer. */
|
||||
#ifdef FEAT_EVAL
|
||||
@@ -2256,6 +2264,19 @@ ex_emenu(eap)
|
||||
ins_typebuf(menu->strings[idx], menu->noremap[idx], 0,
|
||||
TRUE, menu->silent[idx]);
|
||||
}
|
||||
#ifdef FEAT_GUI_MACVIM
|
||||
else if (menu->mac_action != NULL && menu->strings[idx][0] == NUL)
|
||||
{
|
||||
/* This allows us to bind a menu to an action without mapping to
|
||||
* anything so that pressing the menu's key equivalent and typing
|
||||
* ":emenu ..." does the same thing. (HACK: We count on the fact that
|
||||
* ex_macaction() only looks at eap->arg.) */
|
||||
old_arg = eap->arg;
|
||||
eap->arg = menu->mac_action;
|
||||
ex_macaction(eap);
|
||||
eap->arg = old_arg;
|
||||
}
|
||||
#endif /* FEAT_GUI_MACVIM */
|
||||
else
|
||||
EMSG2(_("E335: Menu not defined for %s mode"), mode);
|
||||
}
|
||||
@@ -2473,32 +2494,145 @@ menutrans_lookup(name, len)
|
||||
|
||||
|
||||
#ifdef FEAT_GUI_MACVIM
|
||||
vimmenu_T *
|
||||
menu_for_path(char_u *menu_path)
|
||||
{
|
||||
vimmenu_T *menu;
|
||||
char_u *name;
|
||||
char_u *saved_name;
|
||||
char_u *p;
|
||||
|
||||
saved_name = vim_strsave(menu_path);
|
||||
if (saved_name == NULL)
|
||||
return NULL;
|
||||
|
||||
menu = root_menu;
|
||||
name = saved_name;
|
||||
while (*name)
|
||||
{
|
||||
/* Find in the menu hierarchy */
|
||||
p = menu_name_skip(name);
|
||||
|
||||
while (menu != NULL)
|
||||
{
|
||||
if (menu_name_equal(name, menu))
|
||||
{
|
||||
if (*p == NUL && menu->children != NULL)
|
||||
{
|
||||
EMSG(_("E333: Menu path must lead to a menu item"));
|
||||
menu = NULL;
|
||||
}
|
||||
else if (*p != NUL && menu->children == NULL)
|
||||
{
|
||||
EMSG(_(e_notsubmenu));
|
||||
menu = NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
menu = menu->next;
|
||||
}
|
||||
if (menu == NULL || *p == NUL)
|
||||
break;
|
||||
menu = menu->children;
|
||||
name = p;
|
||||
}
|
||||
|
||||
vim_free(saved_name);
|
||||
|
||||
if (menu == NULL)
|
||||
{
|
||||
EMSG2(_("E334: Menu not found: %s"), menu_path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle the ":macmenu" command.
|
||||
*/
|
||||
void
|
||||
ex_macmenukey(eap)
|
||||
ex_macmenu(eap)
|
||||
exarg_T *eap;
|
||||
{
|
||||
char_u *arg = eap->arg;
|
||||
char_u *keys, *name, *p;
|
||||
vimmenu_T *menu;
|
||||
vimmenu_T *menu = NULL;
|
||||
char_u *arg;
|
||||
char_u *menu_path;
|
||||
char_u *p;
|
||||
char_u *keys;
|
||||
int len;
|
||||
#ifdef FEAT_MULTI_LANG
|
||||
char_u *tofree = NULL;
|
||||
char_u *new_cmd;
|
||||
#endif
|
||||
char_u *linep;
|
||||
char_u *key_start;
|
||||
char_u *key = NULL;
|
||||
char_u *arg_start = NULL;
|
||||
int error = FALSE;
|
||||
char_u *action = NULL;
|
||||
int mac_key = 0;
|
||||
int mac_mods = 0;
|
||||
int mac_alternate = 0;
|
||||
char_u *last_dash;
|
||||
int modifiers;
|
||||
int bit;
|
||||
int key;
|
||||
int set_action = FALSE;
|
||||
int set_key = FALSE;
|
||||
int set_alt = FALSE;
|
||||
|
||||
arg = eap->arg;
|
||||
|
||||
#ifdef FEAT_MULTI_LANG
|
||||
/*
|
||||
* Translate menu names as specified with ":menutrans" commands.
|
||||
*/
|
||||
menu_path = arg;
|
||||
while (*menu_path)
|
||||
{
|
||||
/* find the end of one part and check if it should be translated */
|
||||
p = menu_skip_part(menu_path);
|
||||
keys = menutrans_lookup(menu_path, (int)(p - menu_path));
|
||||
if (keys != NULL)
|
||||
{
|
||||
/* found a match: replace with the translated part */
|
||||
len = (int)STRLEN(keys);
|
||||
new_cmd = alloc((unsigned)STRLEN(arg) + len + 1);
|
||||
if (new_cmd == NULL)
|
||||
break;
|
||||
mch_memmove(new_cmd, arg, menu_path - arg);
|
||||
mch_memmove(new_cmd + (menu_path - arg), keys, (size_t)len);
|
||||
STRCPY(new_cmd + (menu_path - arg) + len, p);
|
||||
p = new_cmd + (menu_path - arg) + len;
|
||||
vim_free(tofree);
|
||||
tofree = new_cmd;
|
||||
arg = new_cmd;
|
||||
}
|
||||
if (*p != '.')
|
||||
break;
|
||||
menu_path = p + 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Isolate the menu name.
|
||||
* Skip the menu name, and translate <Tab> into a real TAB.
|
||||
*/
|
||||
name = arg;
|
||||
if (*name == '.')
|
||||
menu_path = arg;
|
||||
if (*menu_path == '.')
|
||||
{
|
||||
EMSG2(_(e_invarg2), name);
|
||||
return;
|
||||
EMSG2(_(e_invarg2), menu_path);
|
||||
goto theend;
|
||||
}
|
||||
|
||||
while (*arg && !vim_iswhite(*arg))
|
||||
{
|
||||
if ((*arg == '\\' || *arg == Ctrl_V) && arg[1] != NUL)
|
||||
arg++;
|
||||
else if (STRNICMP(arg, "<TAB>", 5) == 0)
|
||||
{
|
||||
*arg = TAB;
|
||||
mch_memmove(arg + 1, arg + 5, STRLEN(arg + 4));
|
||||
}
|
||||
arg++;
|
||||
}
|
||||
if (*arg != NUL)
|
||||
@@ -2506,108 +2640,227 @@ ex_macmenukey(eap)
|
||||
arg = skipwhite(arg);
|
||||
keys = arg;
|
||||
|
||||
// TODO: move to gui_find_menu_item(path_name)
|
||||
menu = root_menu;
|
||||
while (*name)
|
||||
{
|
||||
/* find the end of one dot-separated name and put a NUL at the dot */
|
||||
p = menu_name_skip(name);
|
||||
menu = menu_for_path(menu_path);
|
||||
if (!menu) goto theend;
|
||||
|
||||
while (menu != NULL)
|
||||
/*
|
||||
* Parse all key=value arguments.
|
||||
*/
|
||||
arg = NULL;
|
||||
linep = keys;
|
||||
while (!ends_excmd(*linep))
|
||||
{
|
||||
key_start = linep;
|
||||
if (*linep == '=')
|
||||
{
|
||||
if (STRCMP(name, menu->name) == 0 || STRCMP(name, menu->dname) == 0)
|
||||
{
|
||||
if (*p == NUL)
|
||||
{
|
||||
if (menu->children != NULL)
|
||||
menu = NULL;
|
||||
goto search_end;
|
||||
}
|
||||
break;
|
||||
}
|
||||
menu = menu->next;
|
||||
}
|
||||
if (menu == NULL) /* didn't find it */
|
||||
EMSG2(_("E415: unexpected equal sign: %s"), key_start);
|
||||
error = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Found a match, search the sub-menu. */
|
||||
menu = menu->children;
|
||||
name = p;
|
||||
/*
|
||||
* Isolate the key ("action", "alt", or "key").
|
||||
*/
|
||||
while (*linep && !vim_iswhite(*linep) && *linep != '=')
|
||||
++linep;
|
||||
vim_free(key);
|
||||
key = vim_strnsave_up(key_start, (int)(linep - key_start));
|
||||
if (key == NULL)
|
||||
{
|
||||
error = TRUE;
|
||||
break;
|
||||
}
|
||||
linep = skipwhite(linep);
|
||||
|
||||
/*
|
||||
* Check for the equal sign.
|
||||
*/
|
||||
if (*linep != '=')
|
||||
{
|
||||
EMSG2(_("E416: missing equal sign: %s"), key_start);
|
||||
error = TRUE;
|
||||
break;
|
||||
}
|
||||
++linep;
|
||||
|
||||
/*
|
||||
* Isolate the argument.
|
||||
*/
|
||||
linep = skipwhite(linep);
|
||||
arg_start = linep;
|
||||
linep = skiptowhite(linep);
|
||||
|
||||
if (linep == arg_start)
|
||||
{
|
||||
EMSG2(_("E417: missing argument: %s"), key_start);
|
||||
error = TRUE;
|
||||
break;
|
||||
}
|
||||
vim_free(arg);
|
||||
arg = vim_strnsave(arg_start, (int)(linep - arg_start));
|
||||
if (arg == NULL)
|
||||
{
|
||||
error = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Store the argument.
|
||||
*/
|
||||
if (STRCMP(key, "ACTION") == 0)
|
||||
{
|
||||
action = vim_strsave(arg);
|
||||
if (action == NULL)
|
||||
{
|
||||
error = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!is_valid_macaction(action))
|
||||
{
|
||||
EMSG2(_("E???: Invalid action: %s"), arg);
|
||||
error = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
set_action = TRUE;
|
||||
}
|
||||
else if (STRCMP(key, "ALT") == 0)
|
||||
{
|
||||
len = (int)STRLEN(arg);
|
||||
if ( (len == 1 && (*arg == '0' || *arg == '1')) ||
|
||||
(STRICMP("no", arg) == 0 || STRICMP("yes", arg) == 0) )
|
||||
{
|
||||
mac_alternate = (*arg == '1' || STRICMP("yes", arg) == 0);
|
||||
set_alt = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
EMSG2(_(e_invarg2), arg);
|
||||
error = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (STRCMP(key, "KEY") == 0)
|
||||
{
|
||||
if (arg[0] != '<')
|
||||
{
|
||||
EMSG2(_(e_invarg2), arg);
|
||||
error = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (STRICMP("<nop>", arg) == 0)
|
||||
{
|
||||
/* This is to let the user unset a key equivalent, thereby
|
||||
* freeing up that key combination to be used for a :map
|
||||
* command (which would otherwise not be possible since key
|
||||
* equivalents take precedence over :map). */
|
||||
mac_key = 0;
|
||||
mac_mods = 0;
|
||||
set_key = TRUE;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Find end of modifier list */
|
||||
last_dash = arg;
|
||||
for (p = arg + 1; *p == '-' || vim_isIDc(*p); p++)
|
||||
{
|
||||
if (*p == '-')
|
||||
{
|
||||
last_dash = p;
|
||||
if (p[1] != NUL && p[2] == '>')
|
||||
++p; /* anything accepted, like <C-?> */
|
||||
}
|
||||
if (p[0] == 't' && p[1] == '_' && p[2] && p[3])
|
||||
p += 3; /* skip t_xx, xx may be '-' or '>' */
|
||||
}
|
||||
|
||||
if (*p == '>') /* found matching '>' */
|
||||
{
|
||||
/* Which modifiers are given? */
|
||||
mac_mods = 0x0;
|
||||
for (p = arg + 1; p < last_dash; p++)
|
||||
{
|
||||
if (*p != '-')
|
||||
{
|
||||
bit = name_to_mod_mask(*p);
|
||||
if (bit == 0x0)
|
||||
break; /* Illegal modifier name */
|
||||
mac_mods |= bit;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Legal modifier name.
|
||||
*/
|
||||
if (p >= last_dash)
|
||||
{
|
||||
/*
|
||||
* Modifier with single letter, or special key name.
|
||||
*/
|
||||
if (mac_mods != 0 && last_dash[2] == '>')
|
||||
mac_key = last_dash[1];
|
||||
else
|
||||
{
|
||||
mac_key = get_special_key_code(last_dash + 1);
|
||||
mac_key = handle_x_keys(mac_key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set_key = (mac_key != 0);
|
||||
|
||||
if (mac_key == 0)
|
||||
{
|
||||
EMSG2(_(e_invarg2), arg);
|
||||
error = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EMSG2(_(e_invarg2), key_start);
|
||||
error = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Continue with next argument.
|
||||
*/
|
||||
linep = skipwhite(linep);
|
||||
}
|
||||
|
||||
search_end:
|
||||
if (!menu) {
|
||||
EMSG(_("E337: Menu not found - check menu names"));
|
||||
return;
|
||||
}
|
||||
vim_free(key);
|
||||
vim_free(arg);
|
||||
|
||||
if (keys[0] == '<')
|
||||
/*
|
||||
* Store all the keys that were set in the menu item.
|
||||
*/
|
||||
if (!error)
|
||||
{
|
||||
key = 0;
|
||||
|
||||
/* Find end of modifier list */
|
||||
last_dash = keys;
|
||||
for (p = keys + 1; *p == '-' || vim_isIDc(*p); p++)
|
||||
{
|
||||
if (*p == '-')
|
||||
{
|
||||
last_dash = p;
|
||||
if (p[1] != NUL && p[2] == '>')
|
||||
++p; /* anything accepted, like <C-?> */
|
||||
}
|
||||
if (p[0] == 't' && p[1] == '_' && p[2] && p[3])
|
||||
p += 3; /* skip t_xx, xx may be '-' or '>' */
|
||||
}
|
||||
|
||||
if (*p == '>') /* found matching '>' */
|
||||
{
|
||||
/* Which modifiers are given? */
|
||||
modifiers = 0x0;
|
||||
for (p = keys + 1; p < last_dash; p++)
|
||||
{
|
||||
if (*p != '-')
|
||||
{
|
||||
bit = name_to_mod_mask(*p);
|
||||
if (bit == 0x0)
|
||||
break; /* Illegal modifier name */
|
||||
modifiers |= bit;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Legal modifier name.
|
||||
*/
|
||||
if (p >= last_dash)
|
||||
{
|
||||
/*
|
||||
* Modifier with single letter, or special key name.
|
||||
*/
|
||||
if (modifiers != 0 && last_dash[2] == '>')
|
||||
key = last_dash[1];
|
||||
else
|
||||
{
|
||||
key = get_special_key_code(last_dash + 1);
|
||||
key = handle_x_keys(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (key != 0)
|
||||
{
|
||||
menu->mac_key = key;
|
||||
menu->mac_mods = modifiers;
|
||||
}
|
||||
}
|
||||
else if (keys[0] == NUL)
|
||||
{
|
||||
/* Clear the key equivalent */
|
||||
menu->mac_key = 0;
|
||||
menu->mac_mods = 0;
|
||||
if (set_action)
|
||||
menu->mac_action = action;
|
||||
if (set_key)
|
||||
{
|
||||
menu->mac_key = mac_key;
|
||||
menu->mac_mods = mac_mods;
|
||||
}
|
||||
if (set_alt)
|
||||
menu->mac_alternate = mac_alternate;
|
||||
}
|
||||
else
|
||||
{
|
||||
EMSG(_(e_invarg));
|
||||
vim_free(action);
|
||||
}
|
||||
|
||||
theend:
|
||||
#ifdef FEAT_MULTI_LANG
|
||||
vim_free(tofree);
|
||||
#else
|
||||
;
|
||||
#endif
|
||||
|
||||
}
|
||||
#endif /* FEAT_GUI_MACVIM */
|
||||
|
||||
|
||||
+110
-8
@@ -2957,6 +2957,9 @@ static void fill_breakat_flags __ARGS((void));
|
||||
static int opt_strings_flags __ARGS((char_u *val, char **values, unsigned *flagp, int list));
|
||||
static int check_opt_strings __ARGS((char_u *val, char **values, int));
|
||||
static int check_opt_wim __ARGS((void));
|
||||
#ifdef FEAT_FULLSCREEN
|
||||
static int check_fuoptions __ARGS((char_u *, unsigned *, int *));
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialize the options, first part.
|
||||
@@ -5080,10 +5083,8 @@ didset_options()
|
||||
(void)opt_strings_flags(p_fdo, p_fdo_values, &fdo_flags, TRUE);
|
||||
#endif
|
||||
#ifdef FEAT_FULLSCREEN
|
||||
(void)opt_strings_flags(p_fuoptions, p_fuoptions_values, &fuoptions_flags,
|
||||
TRUE);
|
||||
|
||||
(void)opt_strings_flags(p_fdo, p_fdo_values, &fdo_flags, TRUE);
|
||||
(void)check_fuoptions(p_fuoptions, &fuoptions_flags,
|
||||
&fuoptions_bgcolor);
|
||||
#endif
|
||||
(void)opt_strings_flags(p_dy, p_dy_values, &dy_flags, TRUE);
|
||||
#ifdef FEAT_VIRTUALEDIT
|
||||
@@ -6611,8 +6612,8 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
|
||||
/* 'fuoptions' */
|
||||
else if (varp == &p_fuoptions)
|
||||
{
|
||||
if (opt_strings_flags(p_fuoptions, p_fuoptions_values,
|
||||
&fuoptions_flags, TRUE) != OK)
|
||||
if (check_fuoptions(p_fuoptions, &fuoptions_flags,
|
||||
&fuoptions_bgcolor) != OK)
|
||||
errmsg = e_invarg;
|
||||
}
|
||||
#endif
|
||||
@@ -7330,7 +7331,19 @@ set_bool_option(opt_idx, varp, value, opt_flags)
|
||||
{
|
||||
if (p_fullscreen && !old_value)
|
||||
{
|
||||
gui_mch_enter_fullscreen(fuoptions_flags);
|
||||
guicolor_T fg, bg;
|
||||
if (fuoptions_flags & FUOPT_BGCOLOR_HLGROUP)
|
||||
{
|
||||
/* Find out background color from colorscheme
|
||||
* via highlight group id */
|
||||
syn_id2colors(fuoptions_bgcolor, &fg, &bg);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* set explicit background color */
|
||||
bg = fuoptions_bgcolor;
|
||||
}
|
||||
gui_mch_enter_fullscreen(fuoptions_flags, bg);
|
||||
}
|
||||
else if (!p_fullscreen && old_value)
|
||||
{
|
||||
@@ -7340,7 +7353,7 @@ set_bool_option(opt_idx, varp, value, opt_flags)
|
||||
#endif
|
||||
|
||||
#if defined(FEAT_ANTIALIAS) && defined(FEAT_GUI_MACVIM)
|
||||
else if ((int *)varp == &p_antialias && gui.in_use)
|
||||
else if ((int *)varp == &p_antialias)
|
||||
{
|
||||
gui_macvim_set_antialias(p_antialias);
|
||||
}
|
||||
@@ -10789,3 +10802,92 @@ check_ff_value(p)
|
||||
{
|
||||
return check_opt_strings(p, p_ff_values, FALSE);
|
||||
}
|
||||
|
||||
#ifdef FEAT_FULLSCREEN
|
||||
/*
|
||||
* Read the 'fuoptions' option, set fuoptions_flags and
|
||||
* fuoptions_bgcolor.
|
||||
*/
|
||||
static int
|
||||
check_fuoptions(p_fuoptions, flags, bgcolor)
|
||||
char_u *p_fuoptions; /* fuoptions string */
|
||||
unsigned *flags; /* fuoptions flags */
|
||||
int *bgcolor; /* background highlight group id */
|
||||
{
|
||||
unsigned new_fuoptions_flags;
|
||||
int new_fuoptions_bgcolor;
|
||||
char_u *p;
|
||||
char_u hg_term; /* character terminating
|
||||
highlight group string in
|
||||
'background' option' */
|
||||
int i,j,k;
|
||||
|
||||
new_fuoptions_flags = 0;
|
||||
new_fuoptions_bgcolor = 0xFF000000;
|
||||
|
||||
for (p = p_fuoptions; *p; ++p)
|
||||
{
|
||||
for (i = 0; ASCII_ISALPHA(p[i]); ++i)
|
||||
;
|
||||
if (p[i] != NUL && p[i] != ',' && p[i] != ':')
|
||||
return FAIL;
|
||||
if (i == 10 && STRNCMP(p, "background", 10) == 0)
|
||||
{
|
||||
if (p[i] != ':') return FAIL;
|
||||
i++;
|
||||
if (p[i] == NUL) return FAIL;
|
||||
if (p[i] == '#')
|
||||
{
|
||||
/* explicit color (#aarrggbb) */
|
||||
i++;
|
||||
for (j = i; j < i+8 && vim_isxdigit(p[j]); ++j)
|
||||
;
|
||||
if (j < i+8)
|
||||
return FAIL; /* less than 8 digits */
|
||||
if (p[j] != NUL && p[j] != ',')
|
||||
return FAIL;
|
||||
new_fuoptions_bgcolor = 0;
|
||||
for (k = 0; k < 8; k++)
|
||||
new_fuoptions_bgcolor = new_fuoptions_bgcolor * 16 +
|
||||
hex2nr(p[i+k]);
|
||||
i = j;
|
||||
/* mark bgcolor as an explicit argb color */
|
||||
new_fuoptions_flags &= ~FUOPT_BGCOLOR_HLGROUP;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* highlight group name */
|
||||
for (j = i; ASCII_ISALPHA(p[j]); ++j)
|
||||
;
|
||||
if (p[j] != NUL && p[j] != ',')
|
||||
return FAIL;
|
||||
hg_term = p[j];
|
||||
p[j] = NUL; /* temporarily terminate string */
|
||||
new_fuoptions_bgcolor = syn_name2id((char_u*)(p+i));
|
||||
p[j] = hg_term; /* restore string */
|
||||
if (! new_fuoptions_bgcolor)
|
||||
return FAIL;
|
||||
i = j;
|
||||
/* mark bgcolor as highlight group id */
|
||||
new_fuoptions_flags |= FUOPT_BGCOLOR_HLGROUP;
|
||||
}
|
||||
}
|
||||
else if (i == 7 && STRNCMP(p, "maxhorz", 7) == 0)
|
||||
new_fuoptions_flags |= FUOPT_MAXHORZ;
|
||||
else if (i == 7 && STRNCMP(p, "maxvert", 7) == 0)
|
||||
new_fuoptions_flags |= FUOPT_MAXVERT;
|
||||
else
|
||||
return FAIL;
|
||||
p += i;
|
||||
if (*p == NUL)
|
||||
break;
|
||||
if (*p == ':')
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
*flags = new_fuoptions_flags;
|
||||
*bgcolor = new_fuoptions_bgcolor;
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+7
-5
@@ -472,11 +472,13 @@ EXTERN int p_fs; /* 'fsync' */
|
||||
EXTERN int p_fullscreen;
|
||||
EXTERN char_u *p_fuoptions;
|
||||
EXTERN unsigned fuoptions_flags;
|
||||
#ifdef IN_OPTION_C
|
||||
static char *(p_fuoptions_values[]) = {"maxvert", "maxhorz", NULL};
|
||||
#endif
|
||||
#define FUOPT_MAXVERT 0x001
|
||||
#define FUOPT_MAXHORZ 0x002
|
||||
EXTERN int fuoptions_bgcolor;
|
||||
#define FUOPT_MAXVERT 0x001
|
||||
#define FUOPT_MAXHORZ 0x002
|
||||
#define FUOPT_BGCOLOR_HLGROUP 0x004 /* if set, fuoptions_bgcolor
|
||||
is a highlight group
|
||||
id. Else, it's an explicit
|
||||
argb color. */
|
||||
#endif
|
||||
EXTERN int p_gd; /* 'gdefault' */
|
||||
#ifdef FEAT_PRINTER
|
||||
|
||||
@@ -45,6 +45,11 @@
|
||||
# include <X11/SM/SMlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SELINUX
|
||||
# include <selinux/selinux.h>
|
||||
static int selinux_enabled = -1;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Use this prototype for select, some include files have a wrong prototype
|
||||
*/
|
||||
@@ -2559,6 +2564,62 @@ typedef struct vim_acl_solaris_T {
|
||||
} vim_acl_solaris_T;
|
||||
# endif
|
||||
|
||||
#if defined(HAVE_SELINUX) || defined(PROTO)
|
||||
/*
|
||||
* Copy security info from "from_file" to "to_file".
|
||||
*/
|
||||
void
|
||||
mch_copy_sec(from_file, to_file)
|
||||
char_u *from_file;
|
||||
char_u *to_file;
|
||||
{
|
||||
if (from_file == NULL)
|
||||
return;
|
||||
|
||||
if (selinux_enabled == -1)
|
||||
selinux_enabled = is_selinux_enabled();
|
||||
|
||||
if (selinux_enabled > 0)
|
||||
{
|
||||
security_context_t from_context = NULL;
|
||||
security_context_t to_context = NULL;
|
||||
|
||||
if (getfilecon((char *)from_file, &from_context) < 0)
|
||||
{
|
||||
/* If the filesystem doesn't support extended attributes,
|
||||
the original had no special security context and the
|
||||
target cannot have one either. */
|
||||
if (errno == EOPNOTSUPP)
|
||||
return;
|
||||
|
||||
MSG_PUTS(_("\nCould not get security context for "));
|
||||
msg_outtrans(from_file);
|
||||
msg_putchar('\n');
|
||||
return;
|
||||
}
|
||||
if (getfilecon((char *)to_file, &to_context) < 0)
|
||||
{
|
||||
MSG_PUTS(_("\nCould not get security context for "));
|
||||
msg_outtrans(to_file);
|
||||
msg_putchar('\n');
|
||||
freecon (from_context);
|
||||
return ;
|
||||
}
|
||||
if (strcmp(from_context, to_context) != 0)
|
||||
{
|
||||
if (setfilecon((char *)to_file, from_context) < 0)
|
||||
{
|
||||
MSG_PUTS(_("\nCould not set security context for "));
|
||||
msg_outtrans(to_file);
|
||||
msg_putchar('\n');
|
||||
}
|
||||
}
|
||||
freecon(to_context);
|
||||
freecon(from_context);
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_SELINUX */
|
||||
|
||||
/*
|
||||
* Return a pointer to the ACL of file "fname" in allocated memory.
|
||||
* Return NULL if the ACL is not available for whatever reason.
|
||||
|
||||
@@ -190,7 +190,7 @@ int serverPeekReply(int port, char_u **str);
|
||||
int serverReadReply(int port, char_u **str);
|
||||
int serverSendReply(char_u *serverid, char_u *str);
|
||||
|
||||
void gui_mch_enter_fullscreen(int fuoptions_flags);
|
||||
void gui_mch_enter_fullscreen(int fuoptions_flags, guicolor_T bg);
|
||||
void gui_mch_leave_fullscreen(void);
|
||||
|
||||
void gui_macvim_update_modified_flag();
|
||||
@@ -202,3 +202,4 @@ OSErr odb_post_buffer_write(buf_T *buf);
|
||||
void odb_end(void);
|
||||
|
||||
char_u *get_macaction_name(expand_T *xp, int idx);
|
||||
int is_valid_macaction(char_u *action);
|
||||
|
||||
@@ -20,6 +20,7 @@ void ex_emenu __ARGS((exarg_T *eap));
|
||||
vimmenu_T *gui_find_menu __ARGS((char_u *path_name));
|
||||
void ex_menutranslate __ARGS((exarg_T *eap));
|
||||
#ifdef FEAT_GUI_MACVIM
|
||||
void ex_macmenu __ARGS((exarg_T *eap));
|
||||
void ex_macmenukey __ARGS((exarg_T *eap));
|
||||
#endif
|
||||
/* vim: set ft=c : */
|
||||
|
||||
@@ -34,6 +34,7 @@ int mch_isFullName __ARGS((char_u *fname));
|
||||
void fname_case __ARGS((char_u *name, int len));
|
||||
long mch_getperm __ARGS((char_u *name));
|
||||
int mch_setperm __ARGS((char_u *name, long perm));
|
||||
void mch_copy_sec __ARGS((char_u *from_file, char_u *to_file));
|
||||
vim_acl_T mch_get_acl __ARGS((char_u *fname));
|
||||
void mch_set_acl __ARGS((char_u *fname, vim_acl_T aclent));
|
||||
void mch_free_acl __ARGS((vim_acl_T aclent));
|
||||
|
||||
+90
-12
@@ -3039,6 +3039,15 @@ typedef struct
|
||||
} se_u;
|
||||
} save_se_T;
|
||||
|
||||
/* used for BEHIND and NOBEHIND matching */
|
||||
typedef struct regbehind_S
|
||||
{
|
||||
regsave_T save_after;
|
||||
regsave_T save_behind;
|
||||
save_se_T save_start[NSUBEXP];
|
||||
save_se_T save_end[NSUBEXP];
|
||||
} regbehind_T;
|
||||
|
||||
static char_u *reg_getline __ARGS((linenr_T lnum));
|
||||
static long vim_regexec_both __ARGS((char_u *line, colnr_T col, proftime_T *tm));
|
||||
static long regtry __ARGS((regprog_T *prog, colnr_T col));
|
||||
@@ -3046,6 +3055,8 @@ static void cleanup_subexpr __ARGS((void));
|
||||
#ifdef FEAT_SYN_HL
|
||||
static void cleanup_zsubexpr __ARGS((void));
|
||||
#endif
|
||||
static void save_subexpr __ARGS((regbehind_T *bp));
|
||||
static void restore_subexpr __ARGS((regbehind_T *bp));
|
||||
static void reg_nextline __ARGS((void));
|
||||
static void reg_save __ARGS((regsave_T *save, garray_T *gap));
|
||||
static void reg_restore __ARGS((regsave_T *save, garray_T *gap));
|
||||
@@ -3166,19 +3177,12 @@ typedef struct regitem_S
|
||||
save_se_T sesave;
|
||||
regsave_T regsave;
|
||||
} rs_un; /* room for saving reginput */
|
||||
short rs_no; /* submatch nr */
|
||||
short rs_no; /* submatch nr or BEHIND/NOBEHIND */
|
||||
} regitem_T;
|
||||
|
||||
static regitem_T *regstack_push __ARGS((regstate_T state, char_u *scan));
|
||||
static void regstack_pop __ARGS((char_u **scan));
|
||||
|
||||
/* used for BEHIND and NOBEHIND matching */
|
||||
typedef struct regbehind_S
|
||||
{
|
||||
regsave_T save_after;
|
||||
regsave_T save_behind;
|
||||
} regbehind_T;
|
||||
|
||||
/* used for STAR, PLUS and BRACE_SIMPLE matching */
|
||||
typedef struct regstar_S
|
||||
{
|
||||
@@ -4888,6 +4892,10 @@ regmatch(scan)
|
||||
status = RA_FAIL;
|
||||
else
|
||||
{
|
||||
/* Need to save the subexpr to be able to restore them
|
||||
* when there is a match but we don't use it. */
|
||||
save_subexpr(((regbehind_T *)rp) - 1);
|
||||
|
||||
rp->rs_no = op;
|
||||
reg_save(&rp->rs_un.regsave, &backpos);
|
||||
/* First try if what follows matches. If it does then we
|
||||
@@ -5118,15 +5126,20 @@ regmatch(scan)
|
||||
reg_restore(&(((regbehind_T *)rp) - 1)->save_after,
|
||||
&backpos);
|
||||
else
|
||||
/* But we didn't want a match. */
|
||||
{
|
||||
/* But we didn't want a match. Need to restore the
|
||||
* subexpr, because what follows matched, so they have
|
||||
* been set. */
|
||||
status = RA_NOMATCH;
|
||||
restore_subexpr(((regbehind_T *)rp) - 1);
|
||||
}
|
||||
regstack_pop(&scan);
|
||||
regstack.ga_len -= sizeof(regbehind_T);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No match: Go back one character. May go to previous
|
||||
* line once. */
|
||||
/* No match or a match that doesn't end where we want it: Go
|
||||
* back one character. May go to previous line once. */
|
||||
no = OK;
|
||||
if (REG_MULTI)
|
||||
{
|
||||
@@ -5160,6 +5173,13 @@ regmatch(scan)
|
||||
/* Advanced, prepare for finding match again. */
|
||||
reg_restore(&rp->rs_un.regsave, &backpos);
|
||||
scan = OPERAND(rp->rs_scan);
|
||||
if (status == RA_MATCH)
|
||||
{
|
||||
/* We did match, so subexpr may have been changed,
|
||||
* need to restore them for the next try. */
|
||||
status = RA_NOMATCH;
|
||||
restore_subexpr(((regbehind_T *)rp) - 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -5172,7 +5192,16 @@ regmatch(scan)
|
||||
status = RA_MATCH;
|
||||
}
|
||||
else
|
||||
status = RA_NOMATCH;
|
||||
{
|
||||
/* We do want a proper match. Need to restore the
|
||||
* subexpr if we had a match, because they may have
|
||||
* been set. */
|
||||
if (status == RA_MATCH)
|
||||
{
|
||||
status = RA_NOMATCH;
|
||||
restore_subexpr(((regbehind_T *)rp) - 1);
|
||||
}
|
||||
}
|
||||
regstack_pop(&scan);
|
||||
regstack.ga_len -= sizeof(regbehind_T);
|
||||
}
|
||||
@@ -5819,6 +5848,55 @@ cleanup_zsubexpr()
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Save the current subexpr to "bp", so that they can be restored
|
||||
* later by restore_subexpr().
|
||||
*/
|
||||
static void
|
||||
save_subexpr(bp)
|
||||
regbehind_T *bp;
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NSUBEXP; ++i)
|
||||
{
|
||||
if (REG_MULTI)
|
||||
{
|
||||
bp->save_start[i].se_u.pos = reg_startpos[i];
|
||||
bp->save_end[i].se_u.pos = reg_endpos[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
bp->save_start[i].se_u.ptr = reg_startp[i];
|
||||
bp->save_end[i].se_u.ptr = reg_endp[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Restore the subexpr from "bp".
|
||||
*/
|
||||
static void
|
||||
restore_subexpr(bp)
|
||||
regbehind_T *bp;
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NSUBEXP; ++i)
|
||||
{
|
||||
if (REG_MULTI)
|
||||
{
|
||||
reg_startpos[i] = bp->save_start[i].se_u.pos;
|
||||
reg_endpos[i] = bp->save_end[i].se_u.pos;
|
||||
}
|
||||
else
|
||||
{
|
||||
reg_startp[i] = bp->save_start[i].se_u.ptr;
|
||||
reg_endp[i] = bp->save_end[i].se_u.ptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Advance reglnum, regline and reginput to the next line.
|
||||
*/
|
||||
|
||||
+16
-3
@@ -753,6 +753,7 @@ static int set_spell_finish __ARGS((spelltab_T *new_st));
|
||||
static int spell_iswordp __ARGS((char_u *p, buf_T *buf));
|
||||
static int spell_iswordp_nmw __ARGS((char_u *p));
|
||||
#ifdef FEAT_MBYTE
|
||||
static int spell_mb_isword_class __ARGS((int cl));
|
||||
static int spell_iswordp_w __ARGS((int *p, buf_T *buf));
|
||||
#endif
|
||||
static int write_spell_prefcond __ARGS((FILE *fd, garray_T *gap));
|
||||
@@ -9789,7 +9790,7 @@ spell_iswordp(p, buf)
|
||||
|
||||
c = mb_ptr2char(s);
|
||||
if (c > 255)
|
||||
return mb_get_class(s) >= 2;
|
||||
return spell_mb_isword_class(mb_get_class(s));
|
||||
return spelltab.st_isw[c];
|
||||
}
|
||||
#endif
|
||||
@@ -9812,7 +9813,7 @@ spell_iswordp_nmw(p)
|
||||
{
|
||||
c = mb_ptr2char(p);
|
||||
if (c > 255)
|
||||
return mb_get_class(p) >= 2;
|
||||
return spell_mb_isword_class(mb_get_class(p));
|
||||
return spelltab.st_isw[c];
|
||||
}
|
||||
#endif
|
||||
@@ -9820,6 +9821,18 @@ spell_iswordp_nmw(p)
|
||||
}
|
||||
|
||||
#ifdef FEAT_MBYTE
|
||||
/*
|
||||
* Return TRUE if word class indicates a word character.
|
||||
* Only for characters above 255.
|
||||
* Unicode subscript and superscript are not considered word characters.
|
||||
*/
|
||||
static int
|
||||
spell_mb_isword_class(cl)
|
||||
int cl;
|
||||
{
|
||||
return cl >= 2 && cl != 0x2070 && cl != 0x2080;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return TRUE if "p" points to a word character.
|
||||
* Wide version of spell_iswordp().
|
||||
@@ -9841,7 +9854,7 @@ spell_iswordp_w(p, buf)
|
||||
if (*s > 255)
|
||||
{
|
||||
if (enc_utf8)
|
||||
return utf_class(*s) >= 2;
|
||||
return spell_mb_isword_class(utf_class(*s));
|
||||
if (enc_dbcs)
|
||||
return dbcs_class((unsigned)*s >> 8, *s & 0xff) >= 2;
|
||||
return 0;
|
||||
|
||||
+5
-3
@@ -2254,9 +2254,11 @@ struct VimMenu
|
||||
PtWidget_t *submenu_id;
|
||||
#endif
|
||||
#ifdef FEAT_GUI_MACVIM
|
||||
int mac_key; /* Key equivalent */
|
||||
int mac_mods; /* Modifier flags for the above */
|
||||
int was_grey; /* Remember last 'grey' state */
|
||||
char_u *mac_action; /* Action this menu sends */
|
||||
int mac_key; /* Key equivalent */
|
||||
int mac_mods; /* Modifier flags for the above */
|
||||
int mac_alternate; /* Item is alternate of previous item */
|
||||
int was_grey; /* Remember last 'grey' state */
|
||||
#endif
|
||||
};
|
||||
#else
|
||||
|
||||
@@ -681,6 +681,20 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
298,
|
||||
/**/
|
||||
297,
|
||||
/**/
|
||||
296,
|
||||
/**/
|
||||
295,
|
||||
/**/
|
||||
294,
|
||||
/**/
|
||||
293,
|
||||
/**/
|
||||
292,
|
||||
/**/
|
||||
291,
|
||||
/**/
|
||||
|
||||
+16
-7
@@ -2,11 +2,24 @@
|
||||
|
||||
# Start Vim on a copy of the tutor file.
|
||||
|
||||
# Usage: vimtutor [xx], where xx is a language code like "es" or "nl".
|
||||
# Usage: vimtutor [-g] [xx]
|
||||
# Where optional argument -g starts vimtutor in gvim (GUI) instead of vim.
|
||||
# and xx is a language code like "es" or "nl".
|
||||
# When an argument is given, it tries loading that tutor.
|
||||
# When this fails or no argument was given, it tries using 'v:lang'
|
||||
# When that also fails, it uses the English version.
|
||||
|
||||
# Vim could be called "vim" or "vi". Also check for "vimN", for people who
|
||||
# have Vim installed with its version number.
|
||||
# We anticipate up to a future Vim 8 version :-).
|
||||
seq="vim vim8 vim75 vim74 vim73 vim72 vim71 vim70 vim7 vim6 vi"
|
||||
if test "$1" = "-g"; then
|
||||
# Try to use the GUI version of Vim if possible, it will fall back
|
||||
# on Vim if Gvim is not installed.
|
||||
seq="gvim gvim8 gvim75 gvim74 gvim73 gvim72 gvim71 gvim70 gvim7 gvim6 $seq"
|
||||
shift
|
||||
fi
|
||||
|
||||
xx=$1
|
||||
export xx
|
||||
|
||||
@@ -39,10 +52,6 @@ export TUTORCOPY
|
||||
# remove the copy of the tutor on exit
|
||||
trap "rm -rf $TODELETE" 0 1 2 3 9 11 13 15
|
||||
|
||||
# Vim could be called "vim" or "vi". Also check for "vimN", for people who
|
||||
# have Vim installed with its version number.
|
||||
# We anticipate up to a future Vim 8 version :-).
|
||||
seq="vim vim8 vim75 vim74 vim73 vim72 vim71 vim70 vim7 vim6 vi"
|
||||
for i in $seq; do
|
||||
testvim=`which $i 2>/dev/null`
|
||||
if test -f "$testvim"; then
|
||||
@@ -59,7 +68,7 @@ fi
|
||||
|
||||
# Use Vim to copy the tutor, it knows the value of $VIMRUNTIME
|
||||
# The script tutor.vim tells Vim which file to copy
|
||||
$VIM -u NONE -c 'so $VIMRUNTIME/tutor/tutor.vim'
|
||||
$VIM -f -u NONE -c 'so $VIMRUNTIME/tutor/tutor.vim'
|
||||
|
||||
# Start vim without any .vimrc, set 'nocompatible'
|
||||
$VIM -u NONE -c "set nocp" $TUTORCOPY
|
||||
$VIM -f -u NONE -c "set nocp" $TUTORCOPY
|
||||
|
||||
Reference in New Issue
Block a user