Compare commits

...

75 Commits

Author SHA1 Message Date
Bjorn Winckler 213d223679 Snapshot 39 2008-11-23 19:53:20 +01:00
Bjorn Winckler f00a001406 Update README 2008-11-22 14:50:25 +01:00
Ben Schmidt 7ae32a1bef Avoid "Stray process..." warning messages 2008-11-22 14:32:12 +01:00
Nico Weber 62b5aae721 Add <D-BS> and <M-BS> insert mode mappings
These are standard shortcuts in Mac OS X.  <D-BS> deletes a whole line,
<M-BS> deletes the previous word.
2008-11-21 20:32:41 +01:00
Bjorn Winckler 1741da563b Merge upstream 2008-11-21 20:20:00 +01:00
Bjorn Winckler c3239dd5e5 Snapshot 38 2008-11-21 20:11:51 +01:00
vimboss 09eb973f44 updated for version 7.2-049 2008-11-20 16:10:17 +00:00
vimboss 1dfdf3ebaa updated for version 7.2-048 2008-11-20 15:12:02 +00:00
vimboss d50de2f2f0 updated for version 7.2-047 2008-11-20 13:12:36 +00:00
vimboss 233164a7d2 updated for version 7.2-046 2008-11-20 10:56:33 +00:00
vimboss ae96eb8469 updated for version 7.2-045 2008-11-20 10:04:53 +00:00
vimboss d676af07ec updated for version 7.2-044 2008-11-20 09:37:01 +00:00
vimboss 73827e6e15 updated for version 7.2-043 2008-11-20 09:27:32 +00:00
Bjorn Winckler 8420566635 Exit if connection becomes invalid
This is only a temporary measure until a proper fix is found.
2008-11-19 19:30:46 +01:00
Ben Schmidt e4c49238bd Use default SIGCHLD handler in Vim processes 2008-11-17 21:36:36 +01:00
Bjorn Winckler 616f845128 No error message when dropping files (Issue 135) 2008-11-16 17:05:14 +01:00
vimboss 09c7a21e4f fix truncation 2008-11-15 15:16:46 +00:00
vimboss 9e75f31ff2 updated for version 7.2-042 2008-11-15 15:06:17 +00:00
vimboss 950ef8ff2f updated for version 7.2-041 2008-11-15 13:12:07 +00:00
Bjorn Winckler 915d2e30ac Snapshot 37 2008-11-15 14:02:15 +01:00
Bjorn Winckler 6319b9c517 Add Reload/Ignore All buttons to file changed dialog 2008-11-14 20:06:53 +01:00
Bjorn Winckler 0dde2b7232 Explicitly ignore SIGCHLD to avoid zombies 2008-11-14 15:43:54 +01:00
vimboss 5d900f6f7e updated for version 7.2-040 2008-11-12 15:05:21 +00:00
vimboss 6907698f60 updated for version 7.2-039 2008-11-12 14:29:28 +00:00
vimboss ce49edcc1e updated for version 7.2-038 2008-11-12 13:52:46 +00:00
vimboss 911a34fed0 updated for version 7.2-037 2008-11-12 13:10:15 +00:00
vimboss a57ecd4e2e updated for version 7.2-036 2008-11-12 12:36:30 +00:00
vimboss 81a5c6dd4e updated for version 7.2-035 2008-11-12 12:08:45 +00:00
vimboss a53e7167fc updated for version 7.2-034 2008-11-12 11:52:19 +00:00
vimboss 6cf044c8fc updated for version 7.2-033 2008-11-11 20:57:11 +00:00
Bjorn Winckler d0645670b5 Merge upstream
Conflicts:
	src/feature.h
2008-11-09 17:23:00 +01:00
vimboss 3157d8636c updated for version 7.2-032 2008-11-09 16:22:01 +00:00
vimboss 8bb0169bd0 updated for version 7.2-031 2008-11-09 12:46:09 +00:00
vimboss 00d911af72 updated for version 7.2-030 2008-11-06 19:47:51 +00:00
vimboss 1111099ec1 updated for version 7.2-029 2008-11-06 16:16:44 +00:00
vimboss 9b4580c4dc updated for version 7.2-028 2008-11-06 10:05:42 +00:00
vimboss e63ff36e87 updated for version 7.2-027 2008-11-06 09:23:57 +00:00
Bjorn Winckler 198610ad25 Data received from system services replaces selection
When data is received from system services it replaces the current
selection.  The current implementation is a bit naive in that it assumes
that Vim is in Visual mode (it doesn't even work in Select mode).  (To
test this functionality: enter "2+3", select it, then hit Cmd-* and the
selection is replaced with "5".)
2008-11-01 19:21:02 +01:00
vimboss a57332a176 updated for version 7.2-026 2008-11-01 12:52:38 +00:00
Bjorn Winckler 9bd6777571 Support "mvim" script symlinks to [m|g]ex, rmvim
Symlinks to "mex" or "gex" starts MacVim in ex mode.  Symlinks to "ex"
starts Vim in ex mode (no GUI).  Symlinks to "rmvim" (or "rgvim" which
was already supported previous to this patch) starts MacVim in
restricted mode.
2008-10-29 17:21:13 +01:00
Bjorn Winckler aee4e6d6ca Add help on symlinks to "mvim" script 2008-10-29 17:04:01 +01:00
Bjorn Winckler 7112e2b5f7 Update help on 'runtimepath' 2008-10-29 16:46:15 +01:00
Bjorn Winckler f9064e4c16 Fix typo in a comment 2008-10-26 22:57:32 +01:00
Bjorn Winckler 69c156faf4 Speed up live resize 2008-10-25 21:10:52 +02:00
Bjorn Winckler dd74c0b520 Connection not in event tracking mode by default
Only add backend connection to event tracking mode when it is absolutely
needed.  At the moment this happens when the window is in "live resize"
or when the mouse button is held on some part of a scroller.
2008-10-25 20:31:17 +02:00
Bjorn Winckler f6ecb9aae9 Help cleanup 2008-10-25 18:38:38 +02:00
Bjorn Winckler bc82e6d58e More help on menu key equivalents 2008-10-25 18:22:12 +02:00
Bjorn Winckler 667279dbca Add help on how to remap Caps Lock to Esc 2008-10-25 18:03:39 +02:00
Bjorn Winckler 331a21d0bd Revert "Modifier key sends Esc" related commits
This reverts the following three commits:
  3ae360ddb38dd49e9392aad7a70f0f31a30849ee
  007bb96eb3ec035169510caa4e206ab901e4b6d0
  b6c06f31be1e8124ed12cc2ff5361752df1e4634
2008-10-25 16:34:16 +02:00
Bjorn Winckler 2cccddd458 Fix "Special Characters" palette bug
It is again possible to insert text from the "Special Characters"
palette (broken by commit 8fbb13da74a1912839e9302ebc725df67619c9c0).
2008-10-18 18:45:50 +02:00
Bjorn Winckler 49a52f9eff Keep whole window visible on ":set lines=X columns=Y" 2008-10-18 17:34:54 +02:00
Bjorn Winckler f231eff6c2 Fix "set lines=999" in .gvimrc
Ensure that the window fits on screen when the window is resized to fit
the content.  This should fix a problem where the window would not be
flush with the menu bar when "set lines=999" was added to .gvimrc.
2008-10-18 15:38:08 +02:00
Bjorn Winckler 3a8ce4e72c Constrain window size during live resize
Ensure that the window size isn't larger than the visible frame of the
current screen.  This avoids problems where the window would "snap back"
immediately after being resized manually.
2008-10-18 14:28:25 +02:00
Bjorn Winckler 52f08cc6aa Delay flushing send queue
Ensure that the send queue is flushed after processCommandQueueDidFinish
since that method may add messages to the send queue.
2008-10-18 14:24:59 +02:00
Bjorn Winckler 1a91b2a5c9 Fix computation of zoomed window frame
When computing the zoomed window frame ensure that it is constrained to
hold an even number of rows and columns.  This fixes a problem where the
window would not "un-zoom" after being zoomed.
2008-10-18 13:23:24 +02:00
Bjorn Winckler 467b890d13 Top of window flush with menu bar after zoom 2008-10-12 17:57:39 +02:00
Jason Foreman fa6eedf24f Enable basic AppleScript support
Putting this key into the Info.plist file turns on the basic AppleScript
support Cocoa provides.  Doing so allows MacVim to receive some basic
events.  This gives MacVim a bit better integration into Mac OS X.

Below is an example which, when placed in one's .vimrc file,  causes the
window to be zoomed during startup.

let script='osascript -e "tell application \"MacVim\""'
       \ . ' -e "set zoomed of first window to true"'
       \ . ' -e "end tell"'
au VIMEnter * call system(script)
2008-10-12 14:36:22 +02:00
Bjorn Winckler 0b546f60b1 Move window to top of screen if bottom is obscured 2008-10-12 14:34:22 +02:00
Bjorn Winckler 1957b370bb Use option as meta key
Added a buffer local option called 'macmeta' which when set causes
MacVim not to interpret option+key presses thus enabling the user to
bind to <M-..>.  Also updated the documentation and added 'macmeta' to
the .vim syntax file.
2008-10-12 14:05:42 +02:00
Bjorn Winckler 275fc44523 Avoid crash when resizing window
Sanity check input to gui_macvim_draw_string(); it can happen that 'len'
is non-zero even though first byte of 's' is NUL (test case with file
containing Chinese characters).
2008-10-11 20:03:23 +02:00
Bjorn Winckler ee1fd606dd Snapshot 36 2008-10-04 19:26:05 +02:00
Bjorn Winckler ac3900639d Update credits 2008-10-04 17:27:58 +02:00
Bjorn Winckler aa3ac2d303 Add Find & Replace dialog box 2008-10-04 17:25:07 +02:00
Bjorn Winckler e84420f7d1 Remove TODO 2008-10-03 16:26:33 +02:00
vimboss 678ceed917 updated for version 7.2-025 2008-10-02 20:55:54 +00:00
Bjorn Winckler f3c411fafe Add help on "modifier key as Esc" 2008-10-02 22:53:17 +02:00
vimboss 1506bb79d9 updated for version 7.2-024 2008-10-02 20:48:41 +00:00
Bjorn Winckler d366864ff5 Add preference to change fake Esc modifier key 2008-10-02 22:28:52 +02:00
vimboss 69742a596f updated for version 7.2-023 2008-10-02 16:04:05 +00:00
Bjorn Winckler 3d2d6a810e Modifier key sends Esc
Adds possibility to make the left Ctrl, Alt, or Cmd key function as a
second Esc key.  The key will still function as a modifier if held down
in conjunction with another key.  Enable by setting the user default
"MMFakeEscModifier" to:
    1 = Left Ctrl
    2 = Left Alt
    3 = Left Cmd
    any other number disables this functionality

By remapping Caps-Lock to one of the above modifier keys this enables
the use of Caps-Lock as a second (and easy to reach) Esc key.  Caps-Lock
can be remapped inside "System Preferences -> Keyboard & Mouse ->
Modifier Keys...".

The Esc event is sent when the modifier key is released.  If the key is
not released within a predefined timeout, then no Esc event is
generated.  The timeout can be changed by setting the user default
MMFakeEscTimeout (a float, specifying the timeout in seconds).

The fact that the Esc event is sent on release makes it feel somewhat
sluggish.  It is possible to have the event sent when the modifier key
is pressed by setting the user default "MMFakeEscOnKeyDown" but then the
left modifier key can only be used as an Esc key.
2008-09-30 22:06:30 +02:00
Jonathon Mah 6fb7a6f38b Added dragging to tab bar
Dragging a file to a tab will open it in that tab.
Dragging files to the end of the tab bar will open them in new tabs.
2008-09-30 02:09:17 +09:30
Jonathon Mah cf7a0a71bd Added tool tips for tabs when tab labels are truncated 2008-09-29 22:06:54 +09:30
Jonathon Mah 6e1e046cbb Fixed memory leak in -[MMAppController openFiles:withArguments:] 2008-09-29 21:20:28 +09:30
Bjorn Winckler 2d1fc65b0e Don't drop non-repeating keyboard input
Keyboard input is not dropped, unless the input was received due to a
key being automatically repeated (as a consequence of the key being held
down).  This way characters are never dropped while typing, but it also
avoids situations where the screen doesn't stop scrolling immediately
when "j" is released after being held.
2008-09-28 23:50:39 +02:00
Bjorn Winckler e378d7332b Add keyboard shortcuts to help file 2008-09-28 22:07:07 +02:00
87 changed files with 1959 additions and 649 deletions
+2 -2
View File
@@ -806,13 +806,13 @@ This replaces each 'E' character with a euro sign. Read more in |<Char->|.
:promptf[ind] [string]
Put up a Search dialog. When [string] is given, it is
used as the initial search string.
{only for Win32, Motif and GTK GUI}
{only for Win32, Motif, GTK and MacVim GUI}
*:promptr* *:promptrepl*
:promptr[epl] [string]
Put up a Search/Replace dialog. When [string] is
given, it is used as the initial search string.
{only for Win32, Motif and GTK GUI}
{only for Win32, Motif, GTK and MacVim GUI}
4.4 Changing tabs *change-tabs*
+24 -9
View File
@@ -1,4 +1,4 @@
*cmdline.txt* For Vim version 7.2. Last change: 2008 Jul 29
*cmdline.txt* For Vim version 7.2. Last change: 2008 Sep 18
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -157,6 +157,11 @@ CTRL-R {0-9a-z"%#:-=.} *c_CTRL-R* *c_<C-R>*
(doesn't work at the expression prompt; some
things such as changing the buffer or current
window are not allowed to avoid side effects)
When the result is a |List| the items are used
as lines. They can have line breaks inside
too.
When the result is a Float it's automatically
converted to a String.
See |registers| about registers. {not in Vi}
Implementation detail: When using the |expression| register
and invoking setcmdpos(), this sets the position before
@@ -730,19 +735,29 @@ to use |fnameescape()|.
In Ex commands, at places where a file name can be used, the following
characters have a special meaning. These can also be used in the expression
function expand() |expand()|.
% is replaced with the current file name *:_%*
# is replaced with the alternate file name *:_#*
% Is replaced with the current file name. *:_%* *c_%*
# Is replaced with the alternate file name. *:_#* *c_#*
#n (where n is a number) is replaced with the file name of
buffer n. "#0" is the same as "#"
## is replaced with all names in the argument list *:_##*
buffer n. "#0" is the same as "#".
## Is replaced with all names in the argument list *:_##* *c_##*
concatenated, separated by spaces. Each space in a name
is preceded with a backslash.
Note that these give the file name as it was typed. If an absolute path is
needed (when using the file name from a different directory), you need to add
":p". See |filename-modifiers|.
#<n (where n is a number > 0) is replaced with old *:_#<* *c_#<*
file name n. See |:oldfiles| or |v:oldfiles| to get the
number. *E809*
{only when compiled with the +eval and +viminfo features}
Note that these, except "#<n", give the file name as it was typed. If an
absolute path is needed (when using the file name from a different directory),
you need to add ":p". See |filename-modifiers|.
The "#<n" item returns an absolute path, but it will start with "~/" for files
below your home directory.
Note that backslashes are inserted before spaces, so that the command will
correctly interpret the file name. But this doesn't happen for shell
commands. For those you probably have to use quotes: >
commands. For those you probably have to use quotes (this fails for files
that contain a quote and wildcards): >
:!ls "%"
:r !spell "%"
+12 -1
View File
@@ -1,4 +1,4 @@
*eval.txt* For Vim version 7.2. Last change: 2008 Aug 09
*eval.txt* For Vim version 7.2. Last change: 2008 Nov 02
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1484,6 +1484,17 @@ v:mouse_col Column number for a mouse click obtained with |getchar()|.
This is the screen column number, like with |virtcol()|. The
value is zero when there was no mouse button click.
*v:oldfiles* *oldfiles-variable*
v:oldfiles List of file names that is loaded from the |viminfo| file on
startup. These are the files that Vim remembers marks for.
The length of the List is limited by the ' argument of the
'viminfo' option (default is 100).
Also see |:oldfiles| and |c_#<|.
The List can be modified, but this has no effect on what is
stored in the |viminfo| file later. If you use values other
than String this will cause trouble.
{only when compiled with the +viminfo feature}
*v:operator* *operator-variable*
v:operator The last operator given in Normal mode. This is a single
character except for commands starting with <g> or <z>,
+126 -45
View File
@@ -1,4 +1,4 @@
*gui_mac.txt* For Vim version 7.2. Last change: 2008 Jul 12
*gui_mac.txt* For Vim version 7.2. Last change: 2008 Oct 25
VIM REFERENCE MANUAL by Bjorn Winckler
@@ -16,8 +16,9 @@ The MacVim Graphical User Interface *macvim* *gui-macvim*
7. Dialogs |macvim-dialogs|
8. System services |macvim-services|
9. mvim:// URL handler |macvim-url-handler|
10. Known bugs/missing features |macvim-todo|
11. Hints |macvim-hints|
10. Keyboard shortcuts |macvim-shortcuts|
11. Known bugs/missing features |macvim-todo|
12. Hints |macvim-hints|
Other relevant documentation:
|gui.txt| For generic items of the GUI.
@@ -76,16 +77,6 @@ file at all. In this situation, you will need to set both 'encoding' and
'fileencodings' to a simple single-byte encoding such as Latin1 so that when
the file is read into memory, the original bytes are left untouched.
*macvim-movement*
Some Mac OS X standard key mappings involving Cmd or Option and an arrow key
are set up by default in "$VIM/gvimrc". You can quickly disable all of these
by adding the following lines to your "~/.vimrc" (not .gvimrc) file: >
if has("gui_macvim")
let macvim_skip_cmd_opt_movement = 1
endif
Note: These are the only key mappings that MacVim makes (not counting menu key
equivalents which are not set up with :map).
*macvim-shift-movement*
Text editors on Mac OS X lets the user hold down shift+movement key to extend
the selection. Also, pressing a printable key whilst selecting replaces the
@@ -180,14 +171,16 @@ The advantage of using the latter method is that the settings relating to file
opening in the preferences panel are respected, and files open instantly if
|Quickstart| is enabled.
*mvim*
To save yourself from having to type the entire path to the Vim binary each
time you start MacVim, you could create an alias such as >
alias gvim='/Applications/MacVim.app/Contents/MacOS/Vim -g'
and add that to "~/.profile". A more flexible way to start MacVim is to use
the shell script "mvim" which comes bundled with MacVim. Put this script in a
folder in your path and then simply type "mvim" to start MacVim. This script
will try to find MacVim.app in various typical folders such as >
and add that to "~/.profile".
*mvim*
A more flexible way to start MacVim is to use the shell script "mvim" which
comes bundled with MacVim. Put this script in a folder in your path and then
simply type "mvim" to start MacVim. This script will try to find MacVim.app
in various typical folders such as >
~/Applications ~/Applications/vim
/Applications /Applications/vim
/Applications/Utilities /Applications/Utilities/vim
@@ -195,6 +188,17 @@ If you would rather put MacVim.app in some other directory then that is also
possible, simply set the environment variable VIM_APP_DIR to whatever folder
you have placed MacVim.app in.
The "mvim" script can be symlinked to in order to start up MacVim in different
modes as follows (assuming you placed "mvim" in "/usr/local/bin"): >
* Diff: ln -s /usr/local/bin/mvim mvimdiff
* Read-only: ln -s /usr/local/bin/mvim mview
* Ex: ln -s /usr/local/bin/mvim mex
* Restricted: ln -s /usr/local/bin/mvim rmvim
If the symlink destination starts with "m" (or "g"), Vim will start in GUI
mode. Removing the initial "m" from the above destination names makes Vim
start without the GUI. (In the last case, the destination name can be
"rmvim", "rgvim" or "rvim".)
Note: Starting MacVim by creating a symlink to >
.../MacVim.app/Contents/MacOS/Vim
with 'ln -s' does not work.
@@ -386,9 +390,11 @@ can be used to send action messages.
":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.
syntax. This is case-sensitive, so <D-a> means Cmd-a
whereas <D-A> means Cmd-Shift-a.
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
@@ -412,7 +418,12 @@ equivalent Cmd-n, which opens a new window when selected: >
: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>
>
4. Free up Cmd-t and remap it to open a file browser in a split view: >
macm File.New\ Tab key=<nop>
nmap <D-t> :sp .<CR>
Note: These two lines must be added to .gvimrc else the first line will fail.
The second line is case sensitive, so <D-T> (Cmd-Shift-t) is not the same as
<D-t> (Cmd-t)!
The standard Vim menus are modified in "$VIM/gvimrc". Take a look at that
file for more examples on how to set up menus. Note: When no window is open a
@@ -503,13 +514,14 @@ located in the /Applications folder. (You might have to logout and then login
again before Mac OS X detects the MacVim services.)
These are the currently supported services:
* New Document Here: Open a new window and set the current directory to that
of the selected text. This is intended to be used from a Finder window to
open an empty document in the currently selected folder.
* New Document Containing Selection: Open a new window and paste the currently
selected text.
* Open Selected File: If the selected text represents a file name, then the
corresponding file is opened in a new window.
* New Document Containing Selection: Open a new window and paste the
currently selected text.
* New Document Here: Open a new window and set the current directory
to that of the selected text. This is intended to be used from a
Finder window to open an empty document in the currently selected
folder.
* Open Selected File: If the selected text represents a file name,
then the corresponding file is opened in a new window.
If new files are set to open in the current window (in the General preference
pane) then the above services will also reuse the topmost window, instead of
@@ -520,28 +532,86 @@ opening a new window.
MacVim supports a custom URL handler for "mvim://" URLs. The handler is
supposed to be compatible to TextMate's URL scheme as documented at
http://blog.macromates.com/2007/the-textmate-url-scheme/.
http://blog.macromates.com/2007/the-textmate-url-scheme/.
Currently, this means that the format is >
mvim://open?<arguments>
< where arguments can be:
* url — the actual file to open (i.e. a file://... URL), if you leave
out this argument, the frontmost document is implied.
* line — line number to go to (one based).
* column — column number to go to (one based).
where "arguments" can be:
* url — the actual file to open (i.e. a file://... URL), if you leave
out this argument, the frontmost document is implied
* line — line number to go to (one based)
* column — column number to go to (one based)
For example, the link >
mvim://open?url=file:///etc/profile&line=20
< will open the file /etc/profile on line 20 when clicked in a web browser.
will open the file /etc/profile on line 20 when clicked in a web browser.
Note that url has to be a file:// url pointing to an existing local file.
==============================================================================
10. Known bugs/missing features *macvim-todo*
10. Keyboard shortcuts *macvim-shortcuts*
Here are some of the bigger bugs in MacVim. Of course there are others, but
these are ones that are know and/or which were judged major.
Most keyboard shortcuts in MacVim are bound to menu items and can be
discovered by looking through the menus (see |macvim-menus| on how to create
your own menu shortcuts). The remaining shortcuts are listed here:
*Cmd-.* *<D-.>*
Cmd-. Interrupt Vim. This is synonymous with CTRL-C and can
hence be used instead of Esc to exit insert mode (in
case you find Esc a bit hard to reach).
*Cmd-`* *<D-`>*
Cmd-` Cycle to the next window. On an American keyboard the
`-key is located under the Esc-key. On European
keyboards this key is often adjacent to the left
Shift-key and it may be not even be marked with "`".
*Cmd-Left* *<D-Left>*
Cmd-Left Move cursor to the beginning of the line
(see |cmd-movement|).
*Cmd-Right* *<D-Right>*
Cmd-Right Move cursor to the end of the line (see |cmd-movement|).
*Cmd-Up* *<D-Up>*
Cmd-Up Move cursor to the first line (see |cmd-movement|).
*Cmd-Down* *<D-Down>*
Cmd-Down Move cursor to the last line (see |cmd-movement|).
*Alt-Left* *<M-Left>*
Alt-Left Move cursor to the beginning of the previous word
(see |alt-movement|).
*Alt-Right* *<M-Right>*
Alt-Right Move cursor to the beginning of the next word
(see |alt-movement|).
*Alt-Up* *<M-Up>*
Alt-Up Move cursor one paragraph forward (see |alt-movement|).
*Alt-Down* *<M-Down>*
Alt-Down Move cursor to the previous paragraph
(see |alt-movement|).
*cmd-movement* *alt-movement*
The above mappings involving Cmd/Alt + arrow key are enabled by default in the
system gvimrc file "$VIM/gvimrc". You can quickly disable all of these by
adding the following lines to your "~/.vimrc" (not .gvimrc) file: >
if has("gui_macvim")
let macvim_skip_cmd_opt_movement = 1
endif
Note: These are the only key mappings that MacVim makes (not counting menu key
equivalents which are not set up with :map).
See |macvim-shift-movement| if you want Shift to select text when used in
conjunction with the above Cmd/Alt movement shortcuts.
==============================================================================
11. Known bugs/missing features *macvim-todo*
This list is by no means exhaustive, it only enumerates some of the more
prominent bugs/missing features.
- Localized menus are not supported. Choosing anything but "English" in the
"International" pane of "System Prefences" may break the menus (and
@@ -552,7 +622,7 @@ these are ones that are know and/or which were judged major.
automatic font substitution by setting 'guifontwide' manually.
- Printing. As a temporary solution <D-p> creates a PostScript file which is
then opened in Preview where it may be printed.
- No find/replace dialog
- The toolbar looks ugly and is not very useful.
If you find new bugs then add a new issue at http://code.google.com/p/macvim/
or post your findings to the |vim_mac| mailing list. If you are missing
@@ -561,7 +631,7 @@ might be simple to implement, but unless somebody asks for a particular
feature then there is little incentive to add it.
==============================================================================
11. Hints *macvim-hints*
12. Hints *macvim-hints*
In this section some general (not necessarily MacVim specific) hints are
given.
@@ -595,7 +665,7 @@ See |macvim-shift-movement|.
Scenario: ~
You do not want MacVim to set up any key mappings.
Solution: ~
See |macvim-movement|.
See |cmd-movement|.
Scenario: ~
Enabling localized menus breaks the toolbar and the menus as well.
@@ -652,8 +722,19 @@ Use the VimLeave autocommand to hide MacVim when the window closes: >
au VimLeave * maca hide:
Assuming your external program has a setting for which command to execute to
bring up an editor, you would set that option to something like: >
mvim -c "au VimLeave * maca hide:"
(You may need to add the "-f" switch before the "-c", see the Scenario above.)
mvim -f -c "au VimLeave * maca hide:"
(See the above Scenario for an explanation of the "-f" switch.)
Scenario: ~
You would like to remap Caps Lock to Esc.
Solution: ~
The free app "PCKeyboardHack" can be used to remap Caps Lock. It is available
as a free download from:
http://www.pqrs.org/tekezo/macosx/keyremap4macbook/extra.html
On some Apple keyboards the Caps Lock key doesn't immediately register and
this makes Caps Lock "drop" key presses. To work around this problem go into
the "Keyboard & Mouse" System Preference and remap Caps Lock to Ctrl first
(click the "Modifier Keys..." button).
Scenario: ~
You can't find the information on MacVim you thought should be in this manual
+14 -2
View File
@@ -4493,6 +4493,18 @@ A jump table for the options with a short description can be found at |Q_op|.
'termencoding'.
Note: MacVim does not use this option.
*'macmeta'* *'mmta'* *'nomacmeta'* *'nommta'*
'macmeta' boolean (default off)
local to buffer
{only available in MacVim GUI}
Use option (alt) as meta key. When on, option-key presses are not
interpreted, thus enabling bindings to <M-..>. When off, option-key
presses are interpreted by the selected input method and inserted as
text.
Note: Some keys (e.g. <M-F1>, <M-Tab>, <M-Return>, <M-Left>) can be
bound with the Meta flag even when this option is disabled, but this
is not the case for the majority of keys (e.g. <M-a>, <M-`>).
*'magic'* *'nomagic'*
'magic' boolean (default on)
global
@@ -5439,7 +5451,7 @@ A jump table for the options with a short description can be found at |Q_op|.
<
*'runtimepath'* *'rtp'* *vimfiles*
'runtimepath' 'rtp' string (default:
Unix: "$HOME/.vim,
Unix, Mac OS X: "$HOME/.vim,
$VIM/vimfiles,
$VIMRUNTIME,
$VIM/vimfiles/after,
@@ -5454,7 +5466,7 @@ A jump table for the options with a short description can be found at |Q_op|.
$VIMRUNTIME,
$VIM/vimfiles/after,
$HOME/vimfiles/after"
Macintosh: "$VIM:vimfiles,
Macintosh (pre-OS X): "$VIM:vimfiles,
$VIMRUNTIME,
$VIM:vimfiles:after"
RISC-OS: "Choices:vimfiles,
+1
View File
@@ -767,6 +767,7 @@ Short explanation of each option: *option-list*
'listchars' 'lcs' characters for displaying in list mode
'loadplugins' 'lpl' load plugin scripts when starting up
'macatsui' Mac GUI: use ATSUI text drawing
'macmeta' 'mmta' use option as meta key (MacVim GUI only)
'magic' changes special characters in search patterns
'makeef' 'mef' name of the errorfile for ":make"
'makeprg' 'mp' program to use for the ":make" command
+24 -5
View File
@@ -1,4 +1,4 @@
*starting.txt* For Vim version 7.2. Last change: 2008 Jun 21
*starting.txt* For Vim version 7.2. Last change: 2008 Nov 09
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1338,8 +1338,9 @@ enter Vim and directly start working in your desired setup. |session-file|
*viminfo-read*
When Vim is started and the 'viminfo' option is non-empty, the contents of
the viminfo file are read and the info can be used in the appropriate places.
The marks are not read in at startup (but file marks are). See
|initialization| for how to set the 'viminfo' option upon startup.
The |v:oldfiles| variable is filled. The marks are not read in at startup
(but file marks are). See |initialization| for how to set the 'viminfo'
option upon startup.
*viminfo-write*
When Vim exits and 'viminfo' is non-empty, the info is stored in the viminfo
@@ -1373,6 +1374,8 @@ cursor position when the file was last exited. No marks are saved for files
that start with any string given with the "r" flag in 'viminfo'. This can be
used to avoid saving marks for files on removable media (for MS-DOS you would
use "ra:,rb:", for Amiga "rdf0:,rdf1:,rdf2:").
The |v:oldfiles| variable is filled with the file names that the viminfo file
has marks for.
*viminfo-file-marks*
Uppercase marks ('A to 'Z) are stored when writing the viminfo file. The
@@ -1464,8 +1467,8 @@ most of the information will be restored).
*:rv* *:rviminfo* *E195*
:rv[iminfo][!] [file] Read from viminfo file [file] (default: see above).
If [!] is given, then any information that is
already set (registers, marks, etc.) will be
overwritten. {not in Vi}
already set (registers, marks, |v:oldfiles|, etc.)
will be overwritten {not in Vi}
*:wv* *:wviminfo* *E137* *E138* *E574*
:wv[iminfo][!] [file] Write to viminfo file [file] (default: see above).
@@ -1480,4 +1483,20 @@ most of the information will be restored).
the .viminfo file.
{not in Vi}
*:ol* *:oldfiles*
:ol[dfiles] List the files that have marks stored in the viminfo
file. This list is read on startup and only changes
afterwards with ":rviminfo!". Also see |v:oldfiles|.
The number can be used with |c_#<|.
{not in Vi, only when compiled with the +eval feature}
:bro[wse] ol[dfiles][!]
List file names as with |:oldfiles|, and then prompt
for a number. When the number is valid that file from
the list is edited.
If you get the |press-enter| prompt you can press "q"
and still get the prompt to enter a file number.
Use ! to abondon a modified buffer. |abandon|
{not when compiled with tiny or small features}
vim:tw=78:ts=8:ft=help:norl:
+44 -2
View File
@@ -1,4 +1,4 @@
*usr_21.txt* For Vim version 7.2. Last change: 2007 May 01
*usr_21.txt* For Vim version 7.2. Last change: 2008 Nov 09
VIM USER MANUAL - by Bram Moolenaar
@@ -153,7 +153,7 @@ information. This may cause information that previously exiting Vims stored
to be lost. Each item can be remembered only once.
GETTING BACK TO WHERE YOU WERE
GETTING BACK TO WHERE YOU STOPPED VIM
You are halfway editing a file and it's time to leave for holidays. You exit
Vim and go enjoy yourselves, forgetting all about your work. After a couple
@@ -168,6 +168,48 @@ Mark '9 is lost.
The |:marks| command is useful to find out where '0 to '9 will take you.
GETTING BACK TO SOME FILE
If you want to go back to a file that you edited recently, but not when
exiting Vim, there is a slightly more complicated way. You can see a list of
files by typing the command: >
:oldfiles
< 1: ~/.viminfo ~
2: ~/text/resume.txt ~
3: /tmp/draft ~
Now you would like to edit the second file, which is in the list preceded by
"2:". You type: >
:e #<2
Instead of ":e" you can use any command that has a file name argument, the
"#<2" item works in the same place as "%" (current file name) and "#"
(alternate file name). So you can also split the window to edit the third
file: >
:split #<3
That #<123 thing is a bit complicated when you just want to edit a file.
Fortunately there is a simpler way: >
:browse oldfiles
< 1: ~/.viminfo ~
2: ~/text/resume.txt ~
3: /tmp/draft ~
-- More --
You get the same list of files as with |:oldfiles|. If you want to edit
"resume.txt" first press "q" to stop the listing. You will get a prompt:
Type number and <Enter> (empty cancels): ~
Type "2" and press <Enter> to edit the second file.
More info at |:oldfiles|, |v:oldfiles| and |c_#<|.
MOVE INFO FROM ONE VIM TO ANOTHER
You can use the ":wviminfo" and ":rviminfo" commands to save and restore the
+3
View File
@@ -623,6 +623,9 @@ if has("gui")
call <SID>BinOptionG("fullscreen", &fullscreen)
call append("$", "fuoptions\tcontrol how fullscreen mode should behave")
call <SID>OptionG("fuoptions", &fuoptions)
call append("$", "macmeta\tuse option as meta key")
call append("$", "\t(local to buffer)")
call <SID>BinOptionL("mmta")
endif
endif
+2 -1
View File
@@ -1,4 +1,4 @@
{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf330
{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf350
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\vieww9000\viewh8400\viewkind0
@@ -30,6 +30,7 @@ Kyle Lippincott\
Matt Tolton\
Kaoru Yoshida\
Ron Olson\
Jonathon Mah\
\i0 \
...and many others who have helped by reporting bugs etc.\
+87
View File
@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBClasses</key>
<array>
<dict>
<key>CLASS</key>
<string>RBSplitView</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>OUTLETS</key>
<dict>
<key>delegate</key>
<string>id</string>
</dict>
<key>SUPERCLASS</key>
<string>RBSplitSubview</string>
</dict>
<dict>
<key>CLASS</key>
<string>RBSplitSubview</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
<string>NSView</string>
</dict>
<dict>
<key>ACTIONS</key>
<dict>
<key>findAndReplace</key>
<string>id</string>
</dict>
<key>CLASS</key>
<string>FirstResponder</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
<string>NSObject</string>
</dict>
<dict>
<key>CLASS</key>
<string>NSMenu</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
<string>NSObject</string>
</dict>
<dict>
<key>ACTIONS</key>
<dict>
<key>didAdjustSubviews</key>
<string>RBSplitView</string>
<key>willAdjustSubviews</key>
<string>RBSplitView</string>
</dict>
<key>CLASS</key>
<string>NSObject</string>
<key>LANGUAGE</key>
<string>ObjC</string>
</dict>
<dict>
<key>CLASS</key>
<string>MMFindReplaceController</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>OUTLETS</key>
<dict>
<key>backwardButton</key>
<string>NSButton</string>
<key>findBox</key>
<string>NSTextField</string>
<key>ignoreCaseButton</key>
<string>NSButton</string>
<key>matchWordButton</key>
<string>NSButton</string>
<key>replaceBox</key>
<string>NSTextField</string>
</dict>
<key>SUPERCLASS</key>
<string>NSWindowController</string>
</dict>
</array>
<key>IBVersion</key>
<string>1</string>
</dict>
</plist>
+20
View File
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBFramework Version</key>
<string>629</string>
<key>IBLastKnownRelativeProjectPath</key>
<string>../MacVim.xcodeproj</string>
<key>IBOldestOS</key>
<integer>5</integer>
<key>IBOpenObjects</key>
<array>
<integer>7</integer>
</array>
<key>IBSystem Version</key>
<string>9F33</string>
<key>targetFramework</key>
<string>IBCocoaFramework</string>
</dict>
</plist>
Binary file not shown.
+3 -1
View File
@@ -558,7 +558,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>35</string>
<string>39</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
@@ -617,6 +617,8 @@
</array>
<key>SUFeedURL</key>
<string>http://bjorn.winckler.googlepages.com/macvim_latest.xml</string>
<key>NSAppleScriptEnabled</key>
<true/>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
+24 -7
View File
@@ -154,6 +154,9 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
+ (void)initialize
{
// Avoid zombies (we fork Vim processes which we don't want to wait for).
signal(SIGCHLD, SIG_IGN);
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:NO], MMNoWindowKey,
[NSNumber numberWithInt:64], MMTabMinWidthKey,
@@ -231,11 +234,6 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
[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.
NSString *name = [NSString stringWithFormat:@"%@-connection",
@@ -638,7 +636,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
[win setFrameTopLeftPoint:topLeft];
if ([win frame].origin.y < [[win screen] frame].origin.y) {
NSPoint screenOrigin = [[win screen] frame].origin;
if ([win frame].origin.y < screenOrigin.y) {
// Try to avoid shifting the new window downwards if it means that
// the bottom of the window will be off the screen. E.g. if the
// user has set windows to open maximized in the vertical direction
@@ -646,6 +645,13 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
topLeft.y = oldTopLeft.y;
[win setFrameTopLeftPoint:topLeft];
}
if ([win frame].origin.y < screenOrigin.y) {
// Move the window to the top of the screen if the bottom of the
// window is still obscured.
topLeft.y = NSMaxY([[win screen] frame]);
[win setFrameTopLeftPoint:topLeft];
}
}
if (1 == [vimControllers count]) {
@@ -761,7 +767,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
// arguments for each launching process can be looked up by its PID (in the
// pidArguments dictionary).
NSMutableDictionary *arguments = (args ? [args mutableCopy]
NSMutableDictionary *arguments = (args ? [[args mutableCopy] autorelease]
: [NSMutableDictionary dictionary]);
//
@@ -1948,9 +1954,20 @@ executeInLoginShell(NSString *path, NSArray *args)
return -1;
} else if (pid == 0) {
// Child process
// We need to undo our zombie avoidance as Vim waits for and needs
// the exit statuses of processes it spawns.
signal(SIGCHLD, SIG_DFL);
if (close(ds[1]) == -1) exit(255);
if (dup2(ds[0], 0) == -1) exit(255);
// Without the following call warning messages like this appear on the
// console:
// com.apple.launchd[69] : Stray process with PGID equal to this
// dead job: PID 1589 PPID 1 Vim
setsid();
execv(shellPath, shellArgv);
// Never reached unless execv fails
+4 -2
View File
@@ -710,10 +710,12 @@ defaultLineHeightForFont(NSFont *font)
[self endDrawing];
[self setNeedsDisplay:YES];
// NOTE: During resizing, Cocoa only sends draw messages before Vim's rows
// and columns are changed (due to ipc delays). Force a redraw here.
[self setNeedsDisplay:YES];
// [self displayIfNeeded];
if ([self inLiveResize])
[self display];
#if MM_DEBUG_DRAWING
NSLog(@"<==== END %s", _cmd);
+140 -44
View File
@@ -91,7 +91,7 @@ static NSString *MMSymlinkWarningString =
- (void)processInputQueue;
- (void)handleInputEvent:(int)msgid data:(NSData *)data;
+ (NSDictionary *)specialKeys;
- (void)handleInsertText:(NSData *)data;
- (void)handleInsertText:(NSString *)text;
- (void)handleKeyDown:(NSString *)key modifiers:(int)mods;
- (void)queueMessage:(int)msgid data:(NSData *)data;
- (void)connectionDidDie:(NSNotification *)notification;
@@ -109,6 +109,7 @@ static NSString *MMSymlinkWarningString =
- (void)addInput:(NSString *)input;
- (BOOL)unusedEditor;
- (void)redrawScreen;
- (void)handleFindReplace:(NSDictionary *)args;
@end
@@ -507,6 +508,14 @@ static NSString *MMSymlinkWarningString =
}
@catch (NSException *e) {
NSLog(@"Exception caught when processing command queue: \"%@\"", e);
NSLog(@"outputQueue(len:%d)=%@", [outputQueue count]/2,
outputQueue);
if (![connection isValid]) {
NSLog(@"WARNING! Connection is invalid, exit now!");
NSLog(@"waitForAck=%d got_int=%d isTerminating=%d",
waitForAck, got_int, isTerminating);
mch_exit(-1);
}
}
[outputQueue removeAllObjects];
@@ -1048,11 +1057,16 @@ static NSString *MMSymlinkWarningString =
BOOL interrupt = NO;
if (msgid == InterruptMsgID) {
interrupt = YES;
} else if (InsertTextMsgID == msgid && data != nil && [data length] == 1) {
char_u *str = (char_u*)[data bytes];
if ((str[0] == Ctrl_C && ctrl_c_interrupts) ||
(str[0] == intr_char && intr_char != Ctrl_C))
interrupt = YES;
} else if (InsertTextMsgID == msgid && data != nil) {
const void *bytes = [data bytes];
bytes += sizeof(int);
int len = *((int*)bytes); bytes += sizeof(int);
if (1 == len) {
char_u *str = (char_u*)bytes;
if ((str[0] == Ctrl_C && ctrl_c_interrupts) ||
(str[0] == intr_char && intr_char != Ctrl_C))
interrupt = YES;
}
}
if (interrupt) {
@@ -1063,18 +1077,36 @@ static NSString *MMSymlinkWarningString =
// Remove all previous instances of this message from the input queue, else
// the input queue may fill up as a result of Vim not being able to keep up
// with the speed at which new messages are received. This avoids annoying
// situations such as when the keyboard repeat rate is higher than what Vim
// can cope with (which would cause a 'stutter' when scrolling by holding
// down 'j' and then when 'j' was released the screen kept scrolling for a
// little while).
// with the speed at which new messages are received.
// Keyboard input is never dropped, unless the input represents and
// auto-repeated key.
int i, count = [inputQueue count];
for (i = 1; i < count; i+=2) {
if ([[inputQueue objectAtIndex:i-1] intValue] == msgid) {
[inputQueue removeObjectAtIndex:i];
[inputQueue removeObjectAtIndex:i-1];
break;
BOOL isKeyRepeat = NO;
BOOL isKeyboardInput = NO;
if (data && (InsertTextMsgID == msgid || KeyDownMsgID == msgid ||
CmdKeyMsgID == msgid)) {
isKeyboardInput = YES;
// The lowest bit of the first int is set if this key is a repeat.
int flags = *((int*)[data bytes]);
if (flags & 1)
isKeyRepeat = YES;
}
// Keyboard input is not removed from the queue; repeats are ignored if
// there already is keyboard input on the input queue.
if (isKeyRepeat || !isKeyboardInput) {
int i, count = [inputQueue count];
for (i = 1; i < count; i+=2) {
if ([[inputQueue objectAtIndex:i-1] intValue] == msgid) {
if (isKeyRepeat)
return;
[inputQueue removeObjectAtIndex:i];
[inputQueue removeObjectAtIndex:i-1];
break;
}
}
}
@@ -1497,10 +1529,13 @@ static NSString *MMSymlinkWarningString =
// 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.
BOOL mmta = curbuf ? curbuf->b_p_mmta : NO;
NSDictionary *vimState = [NSDictionary dictionaryWithObjectsAndKeys:
[[NSFileManager defaultManager] currentDirectoryPath], @"pwd",
[NSNumber numberWithInt:p_mh], @"p_mh",
[NSNumber numberWithBool:[self unusedEditor]], @"unusedEditor",
[NSNumber numberWithBool:mmta], @"p_mmta",
nil];
// Put the state before all other messages.
@@ -1539,18 +1574,21 @@ static NSString *MMSymlinkWarningString =
- (void)handleInputEvent:(int)msgid data:(NSData *)data
{
if (InsertTextMsgID == msgid) {
[self handleInsertText:data];
} else if (KeyDownMsgID == msgid || CmdKeyMsgID == msgid) {
if (InsertTextMsgID == msgid || KeyDownMsgID == msgid ||
CmdKeyMsgID == msgid) {
if (!data) return;
const void *bytes = [data bytes];
int mods = *((int*)bytes); bytes += sizeof(int);
int len = *((int*)bytes); bytes += sizeof(int);
NSString *key = [[NSString alloc] initWithBytes:bytes length:len
encoding:NSUTF8StringEncoding];
NSString *key = [[NSString alloc] initWithBytes:bytes
length:len
encoding:NSUTF8StringEncoding];
mods = eventModifierFlagsToVimModMask(mods);
[self handleKeyDown:key modifiers:mods];
if (InsertTextMsgID == msgid)
[self handleInsertText:key];
else
[self handleKeyDown:key modifiers:mods];
[key release];
} else if (ScrollWheelMsgID == msgid) {
@@ -1668,13 +1706,18 @@ static NSString *MMSymlinkWarningString =
if (SetTextRowsMsgID == msgid || SetTextColumnsMsgID == msgid) {
int dim[2] = { rows, cols };
d = [NSData dataWithBytes:dim length:2*sizeof(int)];
msgid = SetTextDimensionsMsgID;
msgid = SetTextDimensionsReplyMsgID;
}
if (SetTextDimensionsMsgID == msgid)
msgid = SetTextDimensionsReplyMsgID;
// NOTE! Vim doesn't call gui_mch_set_shellsize() after
// gui_resize_shell(), so we have to manually set the rows and columns
// here. (MacVim doesn't change the rows and columns to avoid
// inconsistent states between Vim and MacVim.)
// here since MacVim doesn't change the rows and columns to avoid
// inconsistent states between Vim and MacVim. The message sent back
// indicates that it is a reply to a message that originated in MacVim
// since we need to be able to determine where a message originated.
[self queueMessage:msgid data:d];
//NSLog(@"[VimTask] Resizing shell to %dx%d.", cols, rows);
@@ -1713,6 +1756,8 @@ static NSString *MMSymlinkWarningString =
[self handleXcodeMod:data];
} else if (OpenWithArgumentsMsgID == msgid) {
[self handleOpenWithArguments:[NSDictionary dictionaryWithData:data]];
} else if (FindReplaceMsgID == msgid) {
[self handleFindReplace:[NSDictionary dictionaryWithData:data]];
} else {
NSLog(@"WARNING: Unknown message received (msgid=%d)", msgid);
}
@@ -1732,14 +1777,12 @@ static NSString *MMSymlinkWarningString =
return specialKeys;
}
- (void)handleInsertText:(NSData *)data
- (void)handleInsertText:(NSString *)text
{
if (!data) return;
if (!text) return;
NSString *key = [[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding];
char_u *str = (char_u*)[key UTF8String];
int i, len = [key lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
char_u *str = (char_u*)[text UTF8String];
int i, len = [text lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
#ifdef FEAT_MBYTE
char_u *conv_str = NULL;
@@ -1765,11 +1808,11 @@ static NSString *MMSymlinkWarningString =
if (conv_str)
vim_free(conv_str);
#endif
[key release];
}
- (void)handleKeyDown:(NSString *)key modifiers:(int)mods
{
// TODO: This code is a horrible mess -- clean up!
char_u special[3];
char_u modChars[3];
char_u *chars = (char_u*)[key UTF8String];
@@ -1832,9 +1875,52 @@ static NSString *MMSymlinkWarningString =
}
mods &= ~MOD_MASK_ALT;
}
} else if (1 == length && chars[0] < 0x80 && (mods & MOD_MASK_ALT)) {
// META key is treated separately. This code was taken from gui_w48.c
// and gui_gtk_x11.c.
char_u string[7];
int ch = simplify_key(chars[0], &mods);
// Remove the SHIFT modifier for keys where it's already included,
// e.g., '(' and '*'
if (ch < 0x100 && !isalpha(ch) && isprint(ch))
mods &= ~MOD_MASK_SHIFT;
// Interpret the ALT key as making the key META, include SHIFT, etc.
ch = extract_modifiers(ch, &mods);
if (ch == CSI)
ch = K_CSI;
int len = 0;
if (mods) {
string[len++] = CSI;
string[len++] = KS_MODIFIER;
string[len++] = mods;
}
if (IS_SPECIAL(ch)) {
string[len++] = CSI;
string[len++] = K_SECOND(ch);
string[len++] = K_THIRD(ch);
} else {
string[len++] = ch;
#ifdef FEAT_MBYTE
// TODO: What if 'enc' is not "utf-8"?
if (enc_utf8 && (ch & 0x80)) { // convert to utf-8
string[len++] = ch & 0xbf;
string[len-2] = ((unsigned)ch >> 6) + 0xc0;
if (string[len-1] == CSI) {
string[len++] = KS_EXTRA;
string[len++] = (int)KE_CSI;
}
}
#endif
}
add_to_input_buf(string, len);
return;
} else if (length > 0) {
unichar c = [key characterAtIndex:0];
//NSLog(@"non-special: %@ (hex=%x, mods=%d)", key,
// [key characterAtIndex:0], mods);
@@ -1849,14 +1935,6 @@ static NSString *MMSymlinkWarningString =
//NSLog(@"clear shift ctrl");
}
// HACK! All Option+key presses go via 'insert text' messages, except
// for <M-Space>. If the Alt flag is not cleared for <M-Space> it does
// not work to map to it.
if (0xa0 == c && !(mods & MOD_MASK_CMD)) {
//NSLog(@"clear alt");
mods &= ~MOD_MASK_ALT;
}
#ifdef FEAT_MBYTE
if (input_conv.vc_type != CONV_NONE) {
conv_str = string_convert(&input_conv, chars, &length);
@@ -2320,7 +2398,7 @@ static NSString *MMSymlinkWarningString =
// Temporarily clear 'suffixes' so that the files are opened in
// the same order as they appear in the "filenames" array.
[self addInput:@":let t:mvim_oldsu=&su|set su=<CR>"];
[self addInput:@":let mvim_oldsu=&su|set su=<CR>"];
[self addInput:cmd];
@@ -2331,7 +2409,7 @@ static NSString *MMSymlinkWarningString =
[self addInput:@"|vert sall"];
// Restore the old value of 'suffixes'.
[self addInput:@"|let &su=t:mvim_oldsu|unlet t:mvim_oldsu"];
[self addInput:@"|let &su=mvim_oldsu|unlet mvim_oldsu"];
// Adding "|redr|f" ensures a "Hit ENTER" prompt is not shown.
[self addInput:@"|redr|f<CR>"];
@@ -2486,6 +2564,24 @@ static NSString *MMSymlinkWarningString =
redrawcmdline();
}
- (void)handleFindReplace:(NSDictionary *)args
{
if (!args) return;
NSString *findString = [args objectForKey:@"find"];
if (!findString) return;
char_u *find = [findString vimStringSave];
char_u *replace = [[args objectForKey:@"replace"] vimStringSave];
int flags = [[args objectForKey:@"flags"] intValue];
// NOTE: The flag 0x100 is used to indicate a backward search.
gui_do_findrepl(flags, find, replace, (flags & 0x100) == 0);
vim_free(find);
vim_free(replace);
}
@end // MMBackend (Private)
+29
View File
@@ -0,0 +1,29 @@
/* vi:set ts=8 sts=4 sw=4 ft=objc:
*
* VIM - Vi IMproved by Bram Moolenaar
* MacVim GUI port by Bjorn Winckler
*
* Do ":help uganda" in Vim to read copying and usage conditions.
* Do ":help credits" in Vim to see a list of people who contributed.
* See README.txt for an overview of the Vim source code.
*/
#import <Cocoa/Cocoa.h>
@interface MMFindReplaceController : NSWindowController {
IBOutlet NSTextField *findBox;
IBOutlet NSTextField *replaceBox;
IBOutlet NSButton *ignoreCaseButton;
IBOutlet NSButton *matchWordButton;
}
+ (MMFindReplaceController *)sharedInstance;
- (void)showWithText:(NSString *)text flags:(int)flags;
- (NSString *)findString;
- (NSString *)replaceString;
- (BOOL)ignoreCase;
- (BOOL)matchWord;
@end
+63
View File
@@ -0,0 +1,63 @@
/* vi:set ts=8 sts=4 sw=4 ft=objc:
*
* VIM - Vi IMproved by Bram Moolenaar
* MacVim GUI port by Bjorn Winckler
*
* Do ":help uganda" in Vim to read copying and usage conditions.
* Do ":help credits" in Vim to see a list of people who contributed.
* See README.txt for an overview of the Vim source code.
*/
#import "MMFindReplaceController.h"
@implementation MMFindReplaceController
+ (MMFindReplaceController *)sharedInstance
{
static MMFindReplaceController *singleton = nil;
if (!singleton) {
singleton = [[MMFindReplaceController alloc]
initWithWindowNibName:@"FindAndReplace"];
[singleton setWindowFrameAutosaveName:@"FindAndReplace"];
}
return singleton;
}
- (void)showWithText:(NSString *)text flags:(int)flags
{
// Ensure that the window has been loaded by calling this first.
NSWindow *window = [self window];
if (text && [text length] > 0)
[findBox setStringValue:text];
// NOTE: The 'flags' values must match the FRD_ defines in gui.h.
[matchWordButton setState:(flags & 0x08 ? NSOnState : NSOffState)];
[ignoreCaseButton setState:(flags & 0x10 ? NSOffState : NSOnState)];
[window makeKeyAndOrderFront:self];
}
- (NSString *)findString
{
return [findBox stringValue];
}
- (NSString *)replaceString
{
return [replaceBox stringValue];
}
- (BOOL)ignoreCase
{
return [ignoreCaseButton state] == NSOnState;
}
- (BOOL)matchWord
{
return [matchWordButton state] == NSOnState;
}
@end // MMFindReplaceController
+2 -1
View File
@@ -287,7 +287,8 @@
// NOTE: During resizing, Cocoa only sends draw messages before Vim's rows
// and columns are changed (due to ipc delays). Force a redraw here.
[self displayIfNeeded];
if ([self inLiveResize])
[self display];
#if MM_DEBUG_DRAWING
NSLog(@"<==== END %s", _cmd);
+39 -6
View File
@@ -38,7 +38,8 @@ static float MMDragAreaSize = 73.0f;
- (MMWindowController *)windowController;
- (MMVimController *)vimController;
- (void)dispatchKeyEvent:(NSEvent *)event;
- (void)sendKeyDown:(const char *)chars length:(int)len modifiers:(int)flags;
- (void)sendKeyDown:(const char *)chars length:(int)len modifiers:(int)flags
isARepeat:(BOOL)isARepeat;
- (void)hideMouseCursor;
- (void)startDragTimerWithInterval:(NSTimeInterval)t;
- (void)dragTimerFired:(NSTimer *)timer;
@@ -110,6 +111,17 @@ static float MMDragAreaSize = 73.0f;
} else {
[self dispatchKeyEvent:event];
}
} else if ((flags & NSAlternateKeyMask) &&
[[[[self vimController] vimState] objectForKey:@"p_mmta"]
boolValue]) {
// If the 'macmeta' option is set, then send Alt+key presses directly
// to Vim without interpreting the key press.
NSString *unmod = [event charactersIgnoringModifiers];
int len = [unmod lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
const char *bytes = [unmod UTF8String];
[self sendKeyDown:bytes length:len modifiers:flags
isARepeat:[event isARepeat]];
} else {
[textView interpretKeyEvents:[NSArray arrayWithObject:event]];
}
@@ -157,8 +169,17 @@ static float MMDragAreaSize = 73.0f;
//NSLog(@"send InsertTextMsgID: %@", string);
[[self vimController] sendMessage:InsertTextMsgID
data:[string dataUsingEncoding:NSUTF8StringEncoding]];
NSMutableData *data = [NSMutableData data];
int len = [string lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
int flags = [event modifierFlags] & 0xffff0000U;
if ([event type] == NSKeyDown && [event isARepeat])
flags |= 1;
[data appendBytes:&flags length:sizeof(int)];
[data appendBytes:&len length:sizeof(int)];
[data appendBytes:[string UTF8String] length:len];
[[self vimController] sendMessage:InsertTextMsgID data:data];
}
- (void)doCommandBySelector:(SEL)selector
@@ -193,7 +214,8 @@ static float MMDragAreaSize = 73.0f;
chars = MMKeypadEnter;
}
[self sendKeyDown:chars length:len modifiers:[event modifierFlags]];
[self sendKeyDown:chars length:len modifiers:[event modifierFlags]
isARepeat:[event isARepeat]];
} else {
[self dispatchKeyEvent:event];
}
@@ -214,7 +236,7 @@ static float MMDragAreaSize = 73.0f;
// stroke (some input methods use e.g. arrow keys). The function key down
// event will still reach Vim though (via keyDown:). The exceptions to
// this rule are: PageUp/PageDown (keycode 116/121).
int flags = [event modifierFlags];
int flags = [event modifierFlags] & 0xffff0000U;
if ([event type] != NSKeyDown || flags & NSFunctionKeyMask
&& !(116 == [event keyCode] || 121 == [event keyCode]))
return NO;
@@ -272,6 +294,9 @@ static float MMDragAreaSize = 73.0f;
len = [unmodchars lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
}
if ([event isARepeat])
flags |= 1;
[data appendBytes:&flags length:sizeof(int)];
[data appendBytes:&len length:sizeof(int)];
[data appendBytes:[unmodchars UTF8String] length:len];
@@ -748,14 +773,22 @@ static float MMDragAreaSize = 73.0f;
bytes = [chars UTF8String];
}
[self sendKeyDown:bytes length:len modifiers:mods];
[self sendKeyDown:bytes length:len modifiers:mods
isARepeat:[event isARepeat]];
}
- (void)sendKeyDown:(const char *)chars length:(int)len modifiers:(int)flags
isARepeat:(BOOL)isARepeat
{
if (chars && len > 0) {
NSMutableData *data = [NSMutableData data];
// The low 16 bits are not used for modifier flags by NSEvent. Use
// these bits for custom flags.
flags &= 0xffff0000;
if (isARepeat)
flags |= 1;
[data appendBytes:&flags length:sizeof(int)];
[data appendBytes:&len length:sizeof(int)];
[data appendBytes:chars length:len];
+2
View File
@@ -55,6 +55,8 @@
- (NSDate *)creationDate;
- (void)cleanup;
- (void)dropFiles:(NSArray *)filenames forceOpen:(BOOL)force;
- (void)file:(NSString *)filename draggedToTabAtIndex:(NSUInteger)tabIndex;
- (void)filesDraggedToTabBar:(NSArray *)filenames;
- (void)dropString:(NSString *)string;
- (void)passArguments:(NSDictionary *)args;
- (void)sendMessage:(int)msgid data:(NSData *)data;
+51 -11
View File
@@ -18,13 +18,14 @@
*
* Output from the backend is received in processCommandQueue:. Input is sent
* to the backend via sendMessage:data: or addVimInput:. The latter allows
* execution of arbitrary stings in the Vim process, much like the Vim script
* execution of arbitrary strings in the Vim process, much like the Vim script
* function remote_send() does. The messages that may be passed between
* frontend and backend are defined in an enum in MacVim.h.
*/
#import "MMAppController.h"
#import "MMAtsuiTextView.h"
#import "MMFindReplaceController.h"
#import "MMTextView.h"
#import "MMVimController.h"
#import "MMVimView.h"
@@ -255,6 +256,29 @@ static BOOL isUnsafeMessage(int msgid);
[self sendMessage:DropFilesMsgID data:[args dictionaryAsData]];
}
- (void)file:(NSString *)filename draggedToTabAtIndex:(NSUInteger)tabIndex
{
NSString *fnEsc = [filename stringByEscapingSpecialFilenameCharacters];
NSString *input = [NSString stringWithFormat:@"<C-\\><C-N>:silent "
"tabnext %d |"
"edit! %@<CR>", tabIndex + 1, fnEsc];
[self addVimInput:input];
}
- (void)filesDraggedToTabBar:(NSArray *)filenames
{
NSUInteger i, count = [filenames count];
NSMutableString *input = [NSMutableString stringWithString:@"<C-\\><C-N>"
":silent! tabnext 9999"];
for (i = 0; i < count; i++) {
NSString *fn = [filenames objectAtIndex:i];
NSString *fnEsc = [fn stringByEscapingSpecialFilenameCharacters];
[input appendFormat:@"|tabedit %@", fnEsc];
}
[input appendString:@"<CR>"];
[self addVimInput:input];
}
- (void)dropString:(NSString *)string
{
int len = [string lengthOfBytesUsingEncoding:NSUTF8StringEncoding] + 1;
@@ -575,6 +599,13 @@ static BOOL isUnsafeMessage(int msgid);
// that did happen anyway, the command queue could get processed out of
// order.
// See comment below why this is called here and not later.
[windowController processCommandQueueDidFinish];
// NOTE: Ensure that no calls are made after this "if" clause that may call
// sendMessage::. If this happens anyway, such messages will be put on the
// send queue and then the queue will not be flushed until the next time
// this method is called.
if ([sendQueue count] > 0) {
@try {
[backendProxy processInputAndData:sendQueue];
@@ -587,7 +618,6 @@ static BOOL isUnsafeMessage(int msgid);
[sendQueue removeAllObjects];
}
[windowController processCommandQueueDidFinish];
[receiveQueue removeAllObjects];
inProcessCommandQueue = NO;
}
@@ -643,12 +673,12 @@ static BOOL isUnsafeMessage(int msgid);
BOOL inDefaultMode = [[[NSRunLoop currentRunLoop] currentMode]
isEqual:NSDefaultRunLoopMode];
if (!inDefaultMode && isUnsafeMessage(msgid)) {
// NOTE: Because we listen to DO messages in 'event tracking'
// mode we have to take extra care when doing things like
// releasing view items (and other Cocoa objects). Messages
// that may be potentially "unsafe" are delayed until the run
// loop is back to default mode at which time they are safe to
// call again.
// NOTE: Because we may be listening to DO messages in "event
// tracking mode" we have to take extra care when doing things
// like releasing view items (and other Cocoa objects).
// Messages that may be potentially "unsafe" are delayed until
// the run loop is back to default mode at which time they are
// safe to call again.
// A problem with this approach is that it is hard to
// classify which messages are unsafe. As a rule of thumb, if
// a message may release an object used by the Cocoa framework
@@ -712,13 +742,16 @@ static BOOL isUnsafeMessage(int msgid);
[windowController showTabBar:YES];
} else if (HideTabBarMsgID == msgid) {
[windowController showTabBar:NO];
} else if (SetTextDimensionsMsgID == msgid || LiveResizeMsgID == msgid) {
} else if (SetTextDimensionsMsgID == msgid || LiveResizeMsgID == msgid ||
SetTextDimensionsReplyMsgID == msgid) {
const void *bytes = [data bytes];
int rows = *((int*)bytes); bytes += sizeof(int);
int cols = *((int*)bytes); bytes += sizeof(int);
[windowController setTextDimensionsWithRows:rows columns:cols
live:(LiveResizeMsgID==msgid)];
[windowController setTextDimensionsWithRows:rows
columns:cols
isLive:(LiveResizeMsgID==msgid)
isReply:(SetTextDimensionsReplyMsgID==msgid)];
} else if (SetWindowTitleMsgID == msgid) {
const void *bytes = [data bytes];
int len = *((int*)bytes); bytes += sizeof(int);
@@ -928,6 +961,13 @@ static BOOL isUnsafeMessage(int msgid);
NSColor *color = [NSColor colorWithRgbInt:*bg];
[windowController setFullscreenBackgroundColor:color];
} else if (ShowFindReplaceDialogMsgID == msgid) {
NSDictionary *dict = [NSDictionary dictionaryWithData:data];
if (dict) {
[[MMFindReplaceController sharedInstance]
showWithText:[dict objectForKey:@"text"]
flags:[[dict objectForKey:@"flags"] intValue]];
}
// IMPORTANT: When adding a new message, make sure to update
// isUnsafeMessage() if necessary!
} else {
+57
View File
@@ -22,6 +22,7 @@
#import "MMTextView.h"
#import "MMVimController.h"
#import "MMVimView.h"
#import "MMWindowController.h"
#import "Miscellaneous.h"
#import <PSMTabBarControl.h>
@@ -132,6 +133,8 @@ enum {
[[tabBarControl addTabButton] setTarget:self];
[[tabBarControl addTabButton] setAction:@selector(addNewTab:)];
[tabBarControl setAllowsDragBetweenWindows:NO];
[tabBarControl registerForDraggedTypes:
[NSArray arrayWithObject:NSFilenamesPboardType]];
[tabBarControl setAutoresizingMask:NSViewWidthSizable|NSViewMinYMargin];
@@ -498,6 +501,40 @@ enum {
[vimController sendMessage:DraggedTabMsgID data:data];
}
- (NSDragOperation)tabBarControl:(PSMTabBarControl *)theTabBarControl
draggingEntered:(id <NSDraggingInfo>)sender
forTabAtIndex:(unsigned)tabIndex
{
NSPasteboard *pb = [sender draggingPasteboard];
return [[pb types] containsObject:NSFilenamesPboardType]
? NSDragOperationCopy
: NSDragOperationNone;
}
- (BOOL)tabBarControl:(PSMTabBarControl *)theTabBarControl
performDragOperation:(id <NSDraggingInfo>)sender
forTabAtIndex:(unsigned)tabIndex
{
NSPasteboard *pb = [sender draggingPasteboard];
if ([[pb types] containsObject:NSFilenamesPboardType]) {
NSArray *filenames = [pb propertyListForType:NSFilenamesPboardType];
if ([filenames count] == 0)
return NO;
if (tabIndex != NSNotFound) {
// If dropping on a specific tab, only open one file
[vimController file:[filenames objectAtIndex:0]
draggedToTabAtIndex:tabIndex];
} else {
// Files were dropped on empty part of tab bar; open them all
[vimController filesDraggedToTabBar:filenames];
}
return YES;
} else {
return NO;
}
}
// -- NSView customization ---------------------------------------------------
@@ -873,4 +910,24 @@ enum {
[[(MMVimView*)vimView textView] scrollWheel:event];
}
- (void)mouseDown:(NSEvent *)event
{
// TODO: This is an ugly way of getting the connection to the backend.
NSConnection *connection = nil;
id wc = [[self window] windowController];
if ([wc isKindOfClass:[MMWindowController class]]) {
MMVimController *vc = [(MMWindowController*)wc vimController];
id proxy = [vc backendProxy];
connection = [(NSDistantObject*)proxy connectionForProxy];
}
// NOTE: The scroller goes into "event tracking mode" when the user clicks
// (and holds) the mouse button. We have to manually add the backend
// connection to this mode while the mouse button is held, else DO messages
// from Vim will not be processed until the mouse button is released.
[connection addRequestMode:NSEventTrackingRunLoopMode];
[super mouseDown:event];
[connection removeRequestMode:NSEventTrackingRunLoopMode];
}
@end // MMScroller
+1
View File
@@ -14,6 +14,7 @@
@interface MMWindow : NSWindow {
NSBox *tablineSeparator;
NSRect userFrame;
}
- (id)initWithContentRect:(NSRect)rect
+21
View File
@@ -140,4 +140,25 @@
return YES;
}
- (IBAction)zoom:(id)sender
{
NSRect frame = [self frame];
NSRect defaultFrame = [[self screen] visibleFrame];
defaultFrame = [[self delegate] windowWillUseStandardFrame:self
defaultFrame:defaultFrame];
// TODO: Check if width & height differs by cellSize or more.
BOOL isZoomed = ((abs(frame.size.width - defaultFrame.size.width) < 8) &&
(abs(frame.size.height - defaultFrame.size.height) < 8));
if (isZoomed) {
if (userFrame.size.width > 0 && userFrame.size.height > 0)
defaultFrame = userFrame;
} else {
userFrame = frame;
}
[self setFrame:defaultFrame display:YES];
}
@end // MMWindow
+4 -1
View File
@@ -22,6 +22,7 @@
MMVimView *vimView;
BOOL setupDone;
BOOL shouldResizeVimView;
BOOL keepOnScreen;
BOOL fullscreenEnabled;
NSString *windowAutosaveKey;
MMFullscreenWindow *fullscreenWindow;
@@ -39,7 +40,8 @@
- (void)showWindow;
- (void)updateTabsWithData:(NSData *)data;
- (void)selectTabWithIndex:(int)idx;
- (void)setTextDimensionsWithRows:(int)rows columns:(int)cols live:(BOOL)live;
- (void)setTextDimensionsWithRows:(int)rows columns:(int)cols isLive:(BOOL)live
isReply:(BOOL)reply;
- (void)setTitle:(NSString *)title;
- (void)setDocumentFilename:(NSString *)filename;
- (void)setToolbar:(NSToolbar *)toolbar;
@@ -75,5 +77,6 @@
- (IBAction)vimToolbarItemAction:(id)sender;
- (IBAction)fontSizeUp:(id)sender;
- (IBAction)fontSizeDown:(id)sender;
- (IBAction)findAndReplace:(id)sender;
@end
+144 -20
View File
@@ -57,6 +57,7 @@
#import "MMAppController.h"
#import "MMAtsuiTextView.h"
#import "MMFindReplaceController.h"
#import "MMFullscreenWindow.h"
#import "MMTextView.h"
#import "MMTypesetter.h"
@@ -71,8 +72,10 @@
@interface MMWindowController (Private)
- (NSSize)contentSize;
- (void)resizeWindowToFitContentSize:(NSSize)contentSize;
- (void)resizeWindowToFitContentSize:(NSSize)contentSize
keepOnScreen:(BOOL)onScreen;
- (NSSize)constrainContentSizeToScreenSize:(NSSize)contentSize;
- (NSRect)constrainFrame:(NSRect)frame;
- (void)updateResizeConstraints;
- (NSTabViewItem *)addNewTabViewItem;
- (BOOL)askBackendForStarRegister:(NSPasteboard *)pb;
@@ -270,7 +273,8 @@
setupDone = YES;
[self updateResizeConstraints];
[self resizeWindowToFitContentSize:[vimView desiredSize]];
[self resizeWindowToFitContentSize:[vimView desiredSize]
keepOnScreen:YES];
}
- (void)showWindow
@@ -294,10 +298,11 @@
[vimView selectTabWithIndex:idx];
}
- (void)setTextDimensionsWithRows:(int)rows columns:(int)cols live:(BOOL)live
- (void)setTextDimensionsWithRows:(int)rows columns:(int)cols isLive:(BOOL)live
isReply:(BOOL)reply
{
//NSLog(@"setTextDimensionsWithRows:%d columns:%d live:%s", rows, cols,
// live ? "YES" : "NO");
//NSLog(@"setTextDimensionsWithRows:%d columns:%d isLive:%d isReply:%d",
// rows, cols, live, reply);
// NOTE: The only place where the (rows,columns) of the vim view are
// modified is here and when entering/leaving full-screen. Setting these
@@ -309,11 +314,17 @@
// resize when this message is received. We refrain from changing the view
// size when this flag is set, otherwise the window might jitter when the
// user drags to resize the window.
//
// The 'reply' flag indicates that this resize originated in MacVim and
// that Vim is now replying to that resize to make sure that it comes into
// effect.
[vimView setDesiredRows:rows columns:cols];
if (setupDone && !live)
if (setupDone && !live) {
shouldResizeVimView = YES;
keepOnScreen = !reply;
}
}
- (void)setTitle:(NSString *)title
@@ -431,8 +442,11 @@
[[fullscreenWindow contentView] setNeedsDisplay:YES];
[fullscreenWindow centerView];
} else {
[self resizeWindowToFitContentSize:contentSize];
[self resizeWindowToFitContentSize:contentSize
keepOnScreen:keepOnScreen];
}
keepOnScreen = NO;
}
}
@@ -499,16 +513,33 @@
- (void)liveResizeWillStart
{
if (!setupDone) return;
// Save the original title, if we haven't already.
if (lastSetTitle == nil) {
lastSetTitle = [[decoratedWindow title] retain];
}
// NOTE: During live resize Cocoa goes into "event tracking mode". We have
// to add the backend connection to this mode in order for resize messages
// from Vim to reach MacVim. We do not wish to always listen to requests
// in event tracking mode since then MacVim could receive DO messages at
// unexpected times (e.g. when a key equivalent is pressed and the menu bar
// momentarily lights up).
id proxy = [vimController backendProxy];
NSConnection *connection = [(NSDistantObject*)proxy connectionForProxy];
[connection addRequestMode:NSEventTrackingRunLoopMode];
}
- (void)liveResizeDidEnd
{
if (!setupDone) return;
// See comment above regarding event tracking mode.
id proxy = [vimController backendProxy];
NSConnection *connection = [(NSDistantObject*)proxy connectionForProxy];
[connection removeRequestMode:NSEventTrackingRunLoopMode];
// NOTE: During live resize messages from MacVim to Vim are often dropped
// (because too many messages are sent at once). This may lead to
// inconsistent states between Vim and MacVim; to avoid this we send a
@@ -532,7 +563,8 @@
// Sending of synchronous message failed. Force the window size to
// match the last dimensions received from Vim, otherwise we end up
// with inconsistent states.
[self resizeWindowToFitContentSize:[vimView desiredSize]];
[self resizeWindowToFitContentSize:[vimView desiredSize]
keepOnScreen:NO];
}
// If we saved the original title while resizing, restore it.
@@ -660,6 +692,34 @@
[NSNumber numberWithInt:NSSizeDownFontAction]];
}
- (IBAction)findAndReplace:(id)sender
{
int tag = [sender tag];
MMFindReplaceController *fr = [MMFindReplaceController sharedInstance];
int flags = 0;
// NOTE: The 'flags' values must match the FRD_ defines in gui.h (except
// for 0x100 which we use to indicate a backward search).
switch (tag) {
case 1: flags = 0x100; break;
case 2: flags = 3; break;
case 3: flags = 4; break;
}
if ([fr matchWord])
flags |= 0x08;
if (![fr ignoreCase])
flags |= 0x10;
NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:
[fr findString], @"find",
[fr replaceString], @"replace",
[NSNumber numberWithInt:flags], @"flags",
nil];
[vimController sendMessage:FindReplaceMsgID data:[args dictionaryAsData]];
}
- (BOOL)validateMenuItem:(NSMenuItem *)item
{
if ([item action] == @selector(vimMenuItemAction:)
@@ -707,6 +767,24 @@
}
}
- (NSSize)windowWillResize:(NSWindow *)win toSize:(NSSize)proposedFrameSize
{
// Make sure the window isn't resized to be larger than the "visible frame"
// for the current screen. Do this here instead of setting the window max
// size in updateResizeConstraints since the screen's visible frame may
// change at any time (dock could move, resolution could change, window
// could be moved to another screen, ...).
NSRect maxFrame = [self constrainFrame:[[win screen] visibleFrame]];
if (proposedFrameSize.width > maxFrame.size.width)
proposedFrameSize.width = maxFrame.size.width;
if (proposedFrameSize.height > maxFrame.size.height)
proposedFrameSize.height = maxFrame.size.height;
return proposedFrameSize;
}
- (void)windowDidResize:(id)sender
{
if (!setupDone || fullscreenEnabled) return;
@@ -733,6 +811,11 @@
BOOL zoomBoth = [[NSUserDefaults standardUserDefaults]
boolForKey:MMZoomBothKey];
// The "default frame" represents the maximal size of a zoomed window.
// Constrain this frame so that the content fits an even number of rows and
// columns.
frame = [self constrainFrame:frame];
if (!((zoomBoth && !cmdLeftClick) || (!zoomBoth && cmdLeftClick))) {
// Zoom in horizontal direction only.
NSRect currentFrame = [win frame];
@@ -740,16 +823,6 @@
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;
}
@@ -777,6 +850,20 @@
return [self askBackendForStarRegister:pboard];
}
- (BOOL)readSelectionFromPasteboard:(NSPasteboard *)pboard
{
// Replace the current selection with the text on the pasteboard.
NSArray *types = [pboard types];
if ([types containsObject:NSStringPboardType]) {
NSString *input = [NSString stringWithFormat:@"s%@",
[pboard stringForType:NSStringPboardType]];
[vimController addVimInput:input];
return YES;
}
return NO;
}
@end // MMWindowController
@@ -793,6 +880,7 @@
}
- (void)resizeWindowToFitContentSize:(NSSize)contentSize
keepOnScreen:(BOOL)onScreen
{
NSRect frame = [decoratedWindow frame];
NSRect contentRect = [decoratedWindow contentRectForFrameRect:frame];
@@ -801,8 +889,29 @@
contentRect.origin.y -= contentSize.height - contentRect.size.height;
contentRect.size = contentSize;
frame = [decoratedWindow frameRectForContentRect:contentRect];
[decoratedWindow setFrame:frame display:YES];
NSRect newFrame = [decoratedWindow frameRectForContentRect:contentRect];
// Ensure that the window fits inside the visible part of the screen.
NSRect maxFrame = [[decoratedWindow screen] visibleFrame];
maxFrame = [self constrainFrame:maxFrame];
if (newFrame.size.width > maxFrame.size.width) {
newFrame.size.width = maxFrame.size.width;
newFrame.origin.x = maxFrame.origin.x;
}
if (newFrame.size.height > maxFrame.size.height) {
newFrame.size.height = maxFrame.size.height;
newFrame.origin.y = maxFrame.origin.y;
}
if (onScreen) {
if (newFrame.origin.y < maxFrame.origin.y)
newFrame.origin.y = maxFrame.origin.y;
if (NSMaxX(newFrame) > NSMaxX(maxFrame))
newFrame.origin.x = NSMaxX(maxFrame) - newFrame.size.width;
}
[decoratedWindow setFrame:newFrame display:YES];
}
- (NSSize)constrainContentSizeToScreenSize:(NSSize)contentSize
@@ -818,6 +927,21 @@
return contentSize;
}
- (NSRect)constrainFrame:(NSRect)frame
{
// Constrain the given (window) frame so that it fits an even number of
// rows and columns.
NSRect contentRect = [decoratedWindow contentRectForFrameRect:frame];
NSSize constrainedSize = [vimView constrainRows:NULL
columns:NULL
toSize:contentRect.size];
contentRect.origin.y += contentRect.size.height - constrainedSize.height;
contentRect.size = constrainedSize;
return [decoratedWindow frameRectForContentRect:contentRect];
}
- (void)updateResizeConstraints
{
if (!setupDone) return;
+4 -1
View File
@@ -124,6 +124,8 @@ enum {
SetTextRowsMsgID,
SetTextColumnsMsgID,
SetTextDimensionsMsgID,
LiveResizeMsgID,
SetTextDimensionsReplyMsgID,
SetWindowTitleMsgID,
ScrollWheelMsgID,
MouseDownMsgID,
@@ -166,7 +168,6 @@ enum {
SetPreEditPositionMsgID,
TerminateNowMsgID,
XcodeModMsgID,
LiveResizeMsgID,
EnableAntialiasMsgID,
DisableAntialiasMsgID,
SetVimStateMsgID,
@@ -175,6 +176,8 @@ enum {
CloseWindowMsgID,
InterruptMsgID,
SetFullscreenColorMsgID,
ShowFindReplaceDialogMsgID,
FindReplaceMsgID,
};
+4 -1
View File
@@ -31,6 +31,8 @@ char *MessageStrings[] =
"SetTextRowsMsgID",
"SetTextColumsMsgID",
"SetTextDimensionsMsgID",
"LiveResizeMsgID",
"SetTextDimensionsReplyMsgID",
"SetWindowTitleMsgID",
"ScrollWheelMsgID",
"MouseDownMsgID",
@@ -73,7 +75,6 @@ char *MessageStrings[] =
"SetPreEditPositionMsgID",
"TerminateNowMsgID",
"XcodeModMsgID",
"LiveResizeMsgID",
"EnableAntialiasMsgID",
"DisableAntialiasMsgID",
"SetVimStateMsgID",
@@ -82,6 +83,8 @@ char *MessageStrings[] =
"CloseWindowMsgID",
"InterruptMsgID",
"SetFullscreenColorMsgID",
"ShowFindReplaceDialogMsgID",
"FindReplaceMsgID",
};
+17 -7
View File
@@ -30,6 +30,8 @@
1D3D19140CA690FF0004A0A5 /* DejaVuSansMono.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 1D3D19100CA690FF0004A0A5 /* DejaVuSansMono.ttf */; };
1D493D580C5247BF00AB718C /* Vim in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1D493D570C5247BF00AB718C /* Vim */; };
1D493DBA0C52534300AB718C /* PSMTabBarControl.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1D493DB90C52533B00AB718C /* PSMTabBarControl.framework */; };
1D6008830E96886D003763F0 /* FindAndReplace.nib in Resources */ = {isa = PBXBuildFile; fileRef = 1D6008820E96886D003763F0 /* FindAndReplace.nib */; };
1D60088B0E96A0B2003763F0 /* MMFindReplaceController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D60088A0E96A0B2003763F0 /* MMFindReplaceController.m */; };
1D71ACB40BC702AB002F2B60 /* doc-bm-c.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D71ACA90BC702AB002F2B60 /* doc-bm-c.icns */; };
1D71ACB50BC702AC002F2B60 /* doc-bm-h.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D71ACAA0BC702AB002F2B60 /* doc-bm-h.icns */; };
1D71ACB60BC702AC002F2B60 /* doc-bm-html.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D71ACAB0BC702AB002F2B60 /* doc-bm-html.icns */; };
@@ -188,7 +190,7 @@
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
1D09AB3F0C6A4D520045497E /* MMTypesetter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MMTypesetter.h; sourceTree = "<group>"; };
1D09AB400C6A4D520045497E /* MMTypesetter.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MMTypesetter.m; sourceTree = "<group>"; };
1D0E051B0BA5F83800B6049E /* Colors.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Colors.plist; sourceTree = "<group>"; };
1D0E051B0BA5F83800B6049E /* Colors.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Colors.plist; sourceTree = "<group>"; };
1D145C7D0E5227CE00691AA0 /* MMTextViewHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMTextViewHelper.h; sourceTree = "<group>"; };
1D145C7E0E5227CE00691AA0 /* MMTextViewHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMTextViewHelper.m; sourceTree = "<group>"; };
1D1474950C56703C0038FA2B /* MacVim.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MacVim.h; sourceTree = "<group>"; };
@@ -210,6 +212,9 @@
1D3D19100CA690FF0004A0A5 /* DejaVuSansMono.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = DejaVuSansMono.ttf; path = "dejavu-ttf/DejaVuSansMono.ttf"; sourceTree = "<group>"; };
1D493D570C5247BF00AB718C /* Vim */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; name = Vim; path = ../Vim; sourceTree = SOURCE_ROOT; };
1D493DB30C52533B00AB718C /* PSMTabBarControl.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = PSMTabBarControl.xcodeproj; path = PSMTabBarControl/PSMTabBarControl.xcodeproj; sourceTree = "<group>"; };
1D6008820E96886D003763F0 /* FindAndReplace.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; path = FindAndReplace.nib; sourceTree = "<group>"; };
1D6008890E96A0B2003763F0 /* MMFindReplaceController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMFindReplaceController.h; sourceTree = "<group>"; };
1D60088A0E96A0B2003763F0 /* MMFindReplaceController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMFindReplaceController.m; sourceTree = "<group>"; };
1D71ACA90BC702AB002F2B60 /* doc-bm-c.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "doc-bm-c.icns"; sourceTree = "<group>"; };
1D71ACAA0BC702AB002F2B60 /* doc-bm-h.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "doc-bm-h.icns"; sourceTree = "<group>"; };
1D71ACAB0BC702AB002F2B60 /* doc-bm-html.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "doc-bm-html.icns"; sourceTree = "<group>"; };
@@ -258,13 +263,13 @@
1DD66ECB0C803D3600EBDAB3 /* MMApplication.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MMApplication.h; sourceTree = "<group>"; };
1DD66ECC0C803D3600EBDAB3 /* MMApplication.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MMApplication.m; sourceTree = "<group>"; };
1DD703B80BA9D15D008679E9 /* vim_gloss.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = vim_gloss.icns; sourceTree = "<group>"; };
1DD704300BA9F9C2008679E9 /* SpecialKeys.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = SpecialKeys.plist; sourceTree = "<group>"; };
1DD9F5E40C85D60500E8D5A5 /* SystemColors.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = SystemColors.plist; sourceTree = "<group>"; };
1DD704300BA9F9C2008679E9 /* SpecialKeys.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = SpecialKeys.plist; sourceTree = "<group>"; };
1DD9F5E40C85D60500E8D5A5 /* SystemColors.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = SystemColors.plist; sourceTree = "<group>"; };
1DE3F8E60D50F80500052B9E /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/Preferences.nib; sourceTree = "<group>"; };
1DE3F8E80D50F84600052B9E /* MMPreferenceController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MMPreferenceController.h; sourceTree = "<group>"; };
1DE3F8E90D50F84600052B9E /* MMPreferenceController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MMPreferenceController.m; sourceTree = "<group>"; };
1DE602470C587FD10055263D /* runtime */ = {isa = PBXFileReference; lastKnownFileType = folder; name = runtime; path = ../../runtime; sourceTree = SOURCE_ROOT; };
1DE8CC610C5E2AAD003F56E3 /* Actions.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Actions.plist; sourceTree = "<group>"; };
1DE8CC610C5E2AAD003F56E3 /* Actions.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Actions.plist; sourceTree = "<group>"; };
1DE9B94D0D341AB8008FEDD4 /* MMWindow.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MMWindow.h; sourceTree = "<group>"; };
1DE9B94E0D341AB8008FEDD4 /* MMWindow.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MMWindow.m; sourceTree = "<group>"; };
1DED785F0C6DE43D0079945F /* vimrc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = vimrc; sourceTree = "<group>"; };
@@ -328,6 +333,8 @@
080E96DDFE201D6D7F000001 /* MacVim Source */ = {
isa = PBXGroup;
children = (
1D6008890E96A0B2003763F0 /* MMFindReplaceController.h */,
1D60088A0E96A0B2003763F0 /* MMFindReplaceController.m */,
1D145C7D0E5227CE00691AA0 /* MMTextViewHelper.h */,
1D145C7E0E5227CE00691AA0 /* MMTextViewHelper.m */,
1D8059220E118663001699D1 /* Miscellaneous.h */,
@@ -510,6 +517,7 @@
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
1D6008820E96886D003763F0 /* FindAndReplace.nib */,
1D22374A0E45DF4800E6FFFF /* Advanced.png */,
BD9DF09F0DB2BA020025C97C /* PlugInView.nib */,
1DD3D51D0D82D4C9006E4320 /* ibeam.png */,
@@ -668,6 +676,7 @@
1DCD00D10E50B2B700460166 /* SaveSesn.png in Resources */,
1DCD00D20E50B2B700460166 /* TagJump.png in Resources */,
1DCD00D30E50B2B700460166 /* Undo.png in Resources */,
1D6008830E96886D003763F0 /* FindAndReplace.nib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -702,6 +711,7 @@
BD9DF0B00DB41E780025C97C /* PlugInGUI.m in Sources */,
BD9DF0FB0DB48C860025C97C /* CTGradient.m in Sources */,
1D145C7F0E5227CE00691AA0 /* MMTextViewHelper.m in Sources */,
1D60088B0E96A0B2003763F0 /* MMFindReplaceController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -756,7 +766,7 @@
i386,
);
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 35;
CURRENT_PROJECT_VERSION = 39;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
@@ -797,7 +807,7 @@
buildSettings = {
ARCHS = "$(NATIVE_ARCH)";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 35;
CURRENT_PROJECT_VERSION = 39;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
@@ -829,7 +839,7 @@
buildSettings = {
ARCHS = "$(NATIVE_ARCH)";
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 35;
CURRENT_PROJECT_VERSION = 39;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
@@ -68,7 +68,9 @@ enum {
// drag and drop
NSEvent *_lastMouseDownEvent; // keep this for dragging reference
BOOL _allowsDragBetweenWindows;
BOOL _allowsDragBetweenWindows;
BOOL _delegateHandlingDrag;
NSDragOperation _delegateInitialDragOperation;
// MVC help
IBOutlet id delegate;
@@ -121,4 +123,11 @@ enum {
- (void)tabView:(NSTabView *)aTabView willCloseTabViewItem:(NSTabViewItem *)tabViewItem;
- (void)tabView:(NSTabView *)aTabView didCloseTabViewItem:(NSTabViewItem *)tabViewItem;
- (void)tabView:(NSTabView *)aTabView didDragTabViewItem:(NSTabViewItem *)tabViewItem toIndex:(int)idx;
- (NSDragOperation)tabBarControl:(PSMTabBarControl *)theTabBarControl draggingEntered:(id <NSDraggingInfo>)sender forTabAtIndex:(unsigned)tabIndex;
- (NSDragOperation)tabBarControl:(PSMTabBarControl *)theTabBarControl draggingUpdated:(id <NSDraggingInfo>)sender forTabAtIndex:(unsigned)tabIndex;
- (void)tabBarControl:(PSMTabBarControl *)theTabBarControl draggingExited:(id <NSDraggingInfo>)sender forTabAtIndex:(unsigned)tabIndex;
- (BOOL)tabBarControl:(PSMTabBarControl *)theTabBarControl prepareForDragOperation:(id <NSDraggingInfo>)sender forTabAtIndex:(unsigned)tabIndex;
- (BOOL)tabBarControl:(PSMTabBarControl *)theTabBarControl performDragOperation:(id <NSDraggingInfo>)sender forTabAtIndex:(unsigned)tabIndex;
- (void)tabBarControl:(PSMTabBarControl *)theTabBarControl concludeDragOperation:(id <NSDraggingInfo>)sender forTabAtIndex:(unsigned)tabIndex;
@end
@@ -57,6 +57,8 @@
// convenience
- (id)cellForPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame;
- (unsigned)indexOfCellAtPoint:(NSPoint)point;
- (unsigned)indexOfCellAtPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame;
- (PSMTabBarCell *)lastVisibleTab;
- (int)numberOfVisibleTabs;
@@ -98,6 +100,7 @@
// default config
_allowsDragBetweenWindows = YES;
_delegateHandlingDrag = NO;
_canCloseOnlyTab = NO;
_showAddTabButton = NO;
_hideForSingleTab = NO;
@@ -644,7 +647,10 @@
[self removeTrackingRect:[cell cellTrackingTag]];
}
}
// nuke old tool tips
[self removeAllToolTips];
// calculate number of cells to fit in control and cell widths
float availableWidth = [self availableCellWidth];
NSMutableArray *newWidths = [NSMutableArray arrayWithCapacity:cellCount];
@@ -757,7 +763,11 @@
tag = [self addTrackingRect:cellRect owner:cell userData:nil assumeInside:NO];
[cell setCellTrackingTag:tag];
[cell setEnabled:YES];
// add tool tip if label will be truncated
if ([cell desiredWidthOfCell] > NSWidth([cell frame]))
[self addToolTipRect:cellRect owner:[cell stringValue] userData:NULL];
// selected? set tab states...
if([[cell representedObject] isEqualTo:[tabView selectedTabViewItem]]){
[cell setState:NSOnState];
@@ -975,16 +985,28 @@
return YES;
}
- (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation
{
[[PSMTabDragAssistant sharedDragAssistant] draggedImageEndedAt:aPoint operation:operation];
}
// NSDraggingDestination
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
{
NSPoint point = [self convertPoint:[sender draggingLocation] fromView:nil];
_delegateHandlingDrag = NO;
if([[[sender draggingPasteboard] types] indexOfObject:@"PSMTabBarControlItemPBType"] != NSNotFound) {
if ([sender draggingSource] != self && ![self allowsDragBetweenWindows])
return NSDragOperationNone;
[[PSMTabDragAssistant sharedDragAssistant] draggingEnteredTabBar:self atPoint:[self convertPoint:[sender draggingLocation] fromView:nil]];
[[PSMTabDragAssistant sharedDragAssistant] draggingEnteredTabBar:self atPoint:point];
return NSDragOperationMove;
} else if (delegate && [delegate respondsToSelector:@selector(tabBarControl:draggingEntered:forTabAtIndex:)]) {
NSDragOperation op = [delegate tabBarControl:self draggingEntered:sender forTabAtIndex:[self indexOfCellAtPoint:point]];
_delegateHandlingDrag = (op != NSDragOperationNone);
_delegateInitialDragOperation = op;
return op;
}
return NSDragOperationNone;
@@ -992,13 +1014,19 @@
- (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender
{
NSPoint point = [self convertPoint:[sender draggingLocation] fromView:nil];
if ([[[sender draggingPasteboard] types] indexOfObject:@"PSMTabBarControlItemPBType"] != NSNotFound) {
if ([sender draggingSource] != self && ![self allowsDragBetweenWindows])
return NSDragOperationNone;
[[PSMTabDragAssistant sharedDragAssistant] draggingUpdatedInTabBar:self atPoint:[self convertPoint:[sender draggingLocation] fromView:nil]];
[[PSMTabDragAssistant sharedDragAssistant] draggingUpdatedInTabBar:self atPoint:point];
return NSDragOperationMove;
} else if (_delegateHandlingDrag) {
if ([delegate respondsToSelector:@selector(tabBarControl:draggingUpdated:forTabAtIndex:)])
return [delegate tabBarControl:self draggingUpdated:sender forTabAtIndex:[self indexOfCellAtPoint:point]];
else
return _delegateInitialDragOperation;
}
return NSDragOperationNone;
@@ -1006,44 +1034,61 @@
- (void)draggingExited:(id <NSDraggingInfo>)sender
{
[[PSMTabDragAssistant sharedDragAssistant] draggingExitedTabBar:self];
if (!_delegateHandlingDrag) {
[[PSMTabDragAssistant sharedDragAssistant] draggingExitedTabBar:self];
} else if ([delegate respondsToSelector:@selector(tabBarControl:draggingExited:forTabAtIndex:)]) {
NSPoint point = [self convertPoint:[sender draggingLocation] fromView:nil];
[delegate tabBarControl:self draggingExited:sender forTabAtIndex:[self indexOfCellAtPoint:point]];
}
}
- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender
{
if (_delegateHandlingDrag && [delegate respondsToSelector:@selector(tabBarControl:prepareForDragOperation:forTabAtIndex:)]) {
NSPoint point = [self convertPoint:[sender draggingLocation] fromView:nil];
return [delegate tabBarControl:self prepareForDragOperation:sender forTabAtIndex:[self indexOfCellAtPoint:point]];
}
return YES;
}
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
if (!_delegateHandlingDrag) {
#if 1
// HACK! Used below.
NSTabViewItem *tvi = [[[PSMTabDragAssistant sharedDragAssistant] draggedCell] representedObject];
// HACK! Used below.
NSTabViewItem *tvi = [[[PSMTabDragAssistant sharedDragAssistant] draggedCell] representedObject];
#endif
[[PSMTabDragAssistant sharedDragAssistant] performDragOperation];
[[PSMTabDragAssistant sharedDragAssistant] performDragOperation];
#if 1
// HACK! Notify the delegate that a tab was dragged to a new position.
if (delegate && [delegate respondsToSelector:@selector(tabView:didDragTabViewItem:toIndex:)]) {
int idx = [[self representedTabViewItems] indexOfObject:tvi];
if (NSNotFound != idx) {
[delegate tabView:[self tabView] didDragTabViewItem:tvi toIndex:idx];
// HACK! Notify the delegate that a tab was dragged to a new position.
if (delegate && [delegate respondsToSelector:@selector(tabView:didDragTabViewItem:toIndex:)]) {
int idx = [[self representedTabViewItems] indexOfObject:tvi];
if (NSNotFound != idx) {
[delegate tabView:[self tabView] didDragTabViewItem:tvi toIndex:idx];
}
}
#endif
} else {
if ([delegate respondsToSelector:@selector(tabBarControl:performDragOperation:forTabAtIndex:)]) {
NSPoint point = [self convertPoint:[sender draggingLocation] fromView:nil];
return [delegate tabBarControl:self performDragOperation:sender forTabAtIndex:[self indexOfCellAtPoint:point]];
} else {
return NO;
}
}
#endif
return YES;
}
- (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation
{
[[PSMTabDragAssistant sharedDragAssistant] draggedImageEndedAt:aPoint operation:operation];
}
- (void)concludeDragOperation:(id <NSDraggingInfo>)sender
{
if (_delegateHandlingDrag && [delegate respondsToSelector:@selector(tabBarControl:concludeDragOperation:forTabAtIndex:)]) {
NSPoint point = [self convertPoint:[sender draggingLocation] fromView:nil];
[delegate tabBarControl:self concludeDragOperation:sender forTabAtIndex:[self indexOfCellAtPoint:point]];
}
}
#pragma mark -
@@ -1350,11 +1395,25 @@
}
- (id)cellForPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame
{
unsigned i = [self indexOfCellAtPoint:point cellFrame:outFrame];
if (i == NSNotFound)
return nil;
PSMTabBarCell *cell = [_cells objectAtIndex:i];
return cell;
}
- (unsigned)indexOfCellAtPoint:(NSPoint)point
{
return [self indexOfCellAtPoint:point cellFrame:NULL];
}
- (unsigned)indexOfCellAtPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame
{
NSRect aRect = [self genericCellRect];
if(!NSPointInRect(point,aRect)){
return nil;
return NSNotFound;
}
int i, cnt = [_cells count];
@@ -1367,11 +1426,11 @@
if(outFrame){
*outFrame = aRect;
}
return cell;
return i;
}
aRect.origin.x += width;
}
return nil;
return NSNotFound;
}
- (PSMTabBarCell *)lastVisibleTab
+6 -6
View File
@@ -70,14 +70,14 @@ MacVim:
The main nib of MacVim.app is MainMenu.nib which contains the default menu and
an instance of MMAppController, which is connected as the delegate of
NSApplication. That mens, when MacVim starts it will load this nib file and
NSApplication. That means, when MacVim starts it will load this nib file and
automatically create an instance of the MMAppController singleton.
A new editor window is opened by calling
-[MMAppController launchVimProcessWithArguments:]. This functions starts a
new Vim process (by executing the Vim binary). The Vim process lets MacVim
know when it has launched by calling -[MMAppController connectBackend:pid:]
and MacVim responds to this message by calling a new frontend object
and MacVim responds to this message by creating a new frontend object
(MMVimController) and returns a proxy to this object back to the Vim process.
From this point onward the Vim process communicates directly with the
MMVimController.
@@ -87,8 +87,8 @@ It coordinates all communication with the Vim process and delegates output
that affects visual presentation to a MMWindowController object. Read the
Cocoa documentation on the responsibilities of a window controller.
Input (keyboard & mouse) handling and drawing is handled by a MMTextView
object.
Input (keyboard & mouse) handling and drawing is handled by a helper object
(MMTextViewHelper) to the current text view (MMTextView, MMAtsuiTextView).
Distributed Object dangers:
@@ -149,7 +149,7 @@ Steps to build MacVim.app (the text before the '$' shows the folder you should
be in when executing these commands):
1. Configure Vim
src/$ configure --enable-gui=macvim
src/$ ./configure --enable-gui=macvim
2. Build Vim executable
src/$ make
@@ -161,4 +161,4 @@ The application bundle can be found inside "src/MacVim/build/Release".
Bjorn Winckler <bjorn.winckler@gmail.com>
June 22, 2008
November 22, 2008
-185
View File
@@ -1,185 +0,0 @@
Active:
- transparent text view
- Listen to NSSystemColorsDidChangeNotification and update highlighting
- Add support for 'mousehide' (needs to check p_mh)
- Build Vim (make) from Xcode project
- Cmd-W in about box sends vimMenuAction: instead of performClose:
- Terminal support. :!bash -> no cursor, arrow keys mucks up display
- Press Cmd-n multiple times and quickly press Cmd-q; sometimes two or more
instances of MacVim opens up
- hide toolbar, open new tab, show toolbar: baseline sepearator still visible
(seems like a drawing bug in PSMTabBarControl)
- file modified outside vim dialog sometimes only appear after pressing a key
- let user choose file encoding and format in open/save dialogs
- autosave settings ?
- encoding -- convert strings from vim to utf-8
- main menu (buffers menu, window menu)
- standardize NSString usage (initialization & how it is passed in messages)
- autosave window rows&columns?
- improve drag and drop support (modifier keys are ignored)
- grey out menus which can't be used: Tab Next/Prev/Close, Undo/Redo, etc.
- find/replace toolbar item (FIND_REPLACE_DIALOG)
- drag-to-resize, delay if mouse button held down
- ability to modify key equivalents at any time (?)
- validate menu actions for when no windows are open (e.g. selectNextWindow:)
- need E??? numbers for vim errors
- tab-completion for :action command?
- proper font handling
- check for memory leaks
- i8n
- change building procedure so that the Makefile compiles and links VimTask and
then calls pbxbuild to build MacVim (and put MacVim.app) in the src folder
- icons for all built in toolbar items
- window title is never set when starting with terminal vim and typing :gui
- forking doesn't work with :gui (i think)
- make sure [NSMutableData appendByte:length:] is never called with 0 length
(this will lead to a crash)
- update speed whilst resizing with mouse is excruciatingly slow
- window count should be typeset nicely in tab ?
- track pad scrolling is jerky
- sanity check all input in handlePortMessage: etc.
- nice looking cursors (both the block and in insert mode) ?
- support project builder external editor
http://www.codingmonkeys.de/techpubs/externaleditor/pbxexternaleditor.html
- dock icon menu
- horizontal scrolling with trackpad does not work
- got this error when clicking to close second last tab:
2007-07-23 08:19:29.398 MacVim[335] *** Assertion failure in -[PSMTabBarControl lockFocus], AppKit.subproj/NSView.m:3248
2007-07-23 08:19:29.410 MacVim[335] lockFocus sent to a view whose window is deferred and does not yet have a corresponding platform window
Pending:
- marked text
- set gfn=*
- improve drag and drop support (drop in command line mode not working)
- System colors don't come out the same as in other apps (as measure with
Digital Color Meter)
- Select-mode for <S-Key>
- Insertion point blinking
- Hollow insertion point drawing does not always work
- cursor in replace mode
- should ignore action message if is called too often (e.g. in addNewTab:)
- application:openFiles: should open in tabs in current window instead of in a
new window, only if user default is set
- Mouse cursor changes depeding on context
- Ctrl-C does not update screen until another key press (in command window)
- Underline color is never set properly (sp_color)
- Lock up when opening large session files (increasing MMFlushTimeoutInterval
alleviates this problem)
- Respond to "should change" instead of "will change" tab messages
- scrolling when mouse is over scrollbar doesn't work
- gui dialogs (FEAT_GUI_DIALOG)
- no warning when buffer modified outside vim (implement gui_mch_dialog())
- call gui_focus_change() when appropriate
- ability to interrupt vim (needs to check the run-loop for interrupts)
- got this error on Cmd-N with no other windows open:
2007-07-27 22:00:17.680 MacVim[454] *** -[NSToolbarView frameDidChange:]: selector not recognized [self = 0x39ba80]
2007-07-27 22:00:17.690 MacVim[454] Exception raised during posting of notification. Ignored. exception: *** -[NSToolbarView frameDidChange:]: selector not recognized [self = 0x39ba80]
- got this error when opening MacVim from terminal (with 'gvim gvimrc&'):
Frost:~/Projects/vim7/src/MacVim winckler$ 2007-08-05 13:25:01.151 MacVim[223] *** -[NSThemeFrame frameDidChange:]: selector not recognized [self = 0x3baa30]
2007-08-05 13:25:01.152 MacVim[223] Exception raised during posting of notification. Ignored. exception: *** -[NSThemeFrame frameDidChange:]: selector not recognized [self = 0x3baa30]
2007-08-05 13:25:01.155 MacVim[223] *** -[NSThemeFrame frameDidChange:]: selector not recognized [self = 0x3baa30]
2007-08-05 13:25:01.156 MacVim[223] Exception raised during posting of notification. Ignored. exception: *** -[NSThemeFrame frameDidChange:]: selector not recognized [self = 0x3baa30]
2007-08-05 13:25:01.246 MacVim[223] *** -[NSThemeFrame frameDidChange:]: selector not recognized [self = 0x3baa30]
2007-08-05 13:25:01.247 MacVim[223] Exception raised during posting of notification. Ignored. exception: *** -[NSThemeFrame frameDidChange:]: selector not recognized [self = 0x3baa30]
- toogle toolbar off, maximize window, toolbar on -> text view under toolbar
- clicking pill button does not update 'guioptions'
- detect Cmd-. (and Ctrl-C) for interrupt
Done:
- :popup
- popup menus
- when only one tab open make <D-w> close window
- cscope, ctags
- Ctrl-O in insert mode
- remember window position
- font selection dialog (:set gfn=*)
- services menu
- wide characters are badly supported: they render as too wide
- dropping directories does not work
- memory leak with text view? (need to release text storage)
- drag and drop inside view (FEAT_GUI_DND, gui_handle_drop())
- hide baseline separator when tabbar is visible (and make sure clicking the
hide/show toolbar button in the top right of the corner does not show it
again)
- toolbar drawing bug
- Cmd-zoom -> no input received, drawing broken
- scrollbars not positioned over resize box
- offset text away from left edge
- add menu options with key equiv:
Cmd+Option+Left/Right to change tab, Cmd+x/c/v cut/copy/paste,
Cmd+z/Z undo/redo, Cmd+o open, Cmd+w/W close tab/window,
Cmd+Option+T special characters,
etc.
- menu key equivalents
- startup is a bit flakey (up until openWindowWithRows:columns:)
- background color of text view doesn't get set if :colorscheme is in .gvimrc,
since textView=nil when setDefaultColorsBackground:foreground: is called
- resize window on font change
- don't clear the text storage on setMaxRows:: so that display does not go
blank when dragging to resize
- zoom&resize broken
- add user default for min/max tab size
- :colorscheme elflord, :set lines+=3 --> colors are not updated properly
- use DO to communicate between GUI and Vim (only for two-way communication,
one-way communication should still use mach ports)
- make scrollbar inactive if it is too small to display properly
- make vertical scrollbars cover command line as well
- setting font in .gvimrc has no effect since textStorage has not been init'ed
- fonts
- scroll bars
- Make MacVim project depend on PSMTabBarControl project
- Change Makefile so that it builds a vim executable and copy this into the
MacVim.app from the MacVim project
- warning before closing modified buffer
- On quitting, warn user if modified files are open
- An untitled window should not open when the GUI is started from the terminal
(figure out how to pass '-nowindow yes' option when launching GUI)
- support using VimTask as a standalone terminal app, with support for :gui
- path is set to / when not starting from command line, set it to $HOME instead
- input of wide characters does not work
- tab completion doesn't work on iMac
- close icons on tabs don't appear on iMac
- toolbar
- copy runtime files to bundle properly (only works for debug at the moment)
- don't resize to make window bigger than what can fit on screen
- window resizing using mouse & zoom
- cmd-click to maximize window, :tabnew...the text view overlaps the tabline
- colorscheme changes are buggy (open two tabs, change colorscheme, open new
tab; the new tab has wrong color on first and last lines.)
- tab selection bug: open three tabs, selct middle, drag last tab so it becomes
middle without selecting it, select middle tab...selects middle, then last
- tab selection bug #2: :tabnew, drag tab #2 to pos #1, press enter. tab #2 is
selected.
- this stuffs up the display: set go-=e; :tabnew
- with 2 tabs: closing one tab using mouse makes screen flash (does not happen
if tab is closed using :q)
- resize to fit every draw update
- insertion point
- copy/paste
- compute text storage size based on actual content
- color changes (:colorscheme)
- set text storage dimensions properly when creating text view
- text dimension changes
- notify vim task when user closes/selects tabs
- mouse handling in text view
- file type associations (Info.plist)
- drag and drop onto app icon
- remove tab update hack when flushing (edit vim code to call update)
- crash when typing :browse e $vim (but not :browse e $vim/)
- maintain queue of messages to send from task (to ensure they are passed in
the same order they arrive)
- do not include shift flag in chars that are already shifted (%, A, etc.)
- open file(s) in tab(s) (never open in new window?)
- key handling:
<M-Space> works, <M-S-Space> does not
clean up dispatchKeyEvent
- reordering tab pages (gui tabs must have same order as vim tabs)
- make sure tab is wide enough to fit label
- encoding (did_set_string_option, option.c, line 5675)
in init:
set_option_value((char_u *)"termencoding", 0L, (char_u *)"utf-8", 0);
+45 -1
View File
@@ -323,8 +323,10 @@ gui_macvim_draw_string(int row, int col, char_u *s, int len, int flags)
// wide and vice versa.
for (i = 0; i < len; i += cl) {
c = utf_ptr2char(s + i);
cl = utf_ptr2len(s + i);
cn = utf_char2cells(c);
cl = utf_ptr2len(s + i);
if (0 == cl)
len = i; // len must be wrong (shouldn't happen)
if (!utf_iscomposing(c)) {
if ((cn > 1 && !wide) || (cn <= 1 && wide)) {
@@ -1231,6 +1233,48 @@ im_get_status(void)
// -- Find & Replace dialog -------------------------------------------------
#ifdef FIND_REPLACE_DIALOG
static void
macvim_find_and_replace(char_u *arg, BOOL replace)
{
// TODO: Specialized dialog for find without replace?
int wholeWord = FALSE;
int matchCase = !p_ic;
char_u *text = get_find_dialog_text(arg, &wholeWord, &matchCase);
int flags = 0;
if (wholeWord) flags |= FRD_WHOLE_WORD;
if (matchCase) flags |= FRD_MATCH_CASE;
NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:
[NSString stringWithVimString:text], @"text",
[NSNumber numberWithInt:flags], @"flags",
nil];
[[MMBackend sharedInstance] queueMessage:ShowFindReplaceDialogMsgID
properties:args];
}
void
gui_mch_find_dialog(exarg_T *eap)
{
macvim_find_and_replace(eap->arg, NO);
}
void
gui_mch_replace_dialog(exarg_T *eap)
{
macvim_find_and_replace(eap->arg, YES);
}
#endif // FIND_REPLACE_DIALOG
// -- Unsorted --------------------------------------------------------------
+13 -6
View File
@@ -1,7 +1,7 @@
" System gvimrc file for MacVim
"
" Maintainer: Bjorn Winckler <bjorn.winckler@gmail.com>
" Last Change: Sun Aug 03 2008
" Last Change: Sun Oct 04 2008
"
" This is a work in progress. If you feel so inclined, please help me improve
" this file.
@@ -60,17 +60,21 @@ an 10.350 File.Save\ As\.\.\.<Tab>:sav :browse confirm saveas<CR>
" Edit menu
" The following function is aken from menu.vim
fun! s:FixFText()
" Fix text in nameless register to be used with :promptfind.
return substitute(@", "[\r\n]", '\\n', 'g')
endfun
aunmenu Edit.Find
aunmenu Edit.Find\ and\ Replace
an 20.410.10 Edit.Find.Find\.\.\.<Tab>/ /
an <silent> 20.410.10 Edit.Find.Find\.\.\. :promptfind<CR>
vunmenu Edit.Find.Find\.\.\.
vnoremenu <silent> Edit.Find.Find\.\.\. y:promptfind <C-R>=<SID>FixFText()<CR><CR>
an 20.410.20 Edit.Find.Find\ Next <Nop>
an 20.410.30 Edit.Find.Find\ Previous <Nop>
vmenu 20.410.35 Edit.Find.Use\ Selection\ for\ Find y:let @/=@"<CR>:<BS>
an 20.410.40 Edit.Find.-SEP1- <Nop>
an 20.410.50 Edit.Find.Find\ and\ Replace\.\.\.<Tab>:%s :%s/
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 <Nop>
@@ -157,6 +161,9 @@ if !exists("macvim_skip_cmd_opt_movement")
ino <D-Down> <C-End>
map <M-Down> }
imap <M-Down> <C-o>}
imap <M-BS> <C-w>
imap <D-BS> <C-u>
endif " !exists("macvim_skip_cmd_opt_movement")
+71
View File
@@ -40,6 +40,77 @@
Sparkle supports updates in zip, tar, tbz, tgz, or dmg format.
-->
<item>
<title>Snapshot 39 released</title>
<description><![CDATA[
<h1>MacVim snapshot 39 released</h1>
<p> Changes since snapshot 36 (snapshots 37 and 38 were skipped):
<ul>
<li> Avoid "Stray process..." warning messages (Ben Schmidt) </li>
<li> Add Cmd-BackSpace and Alt-BackSpace insert mode mappings (Nico Weber) </li>
<li> Dropping multiple files on a window no longer results in an error </li>
<li> Fix "Login shell" problems (Ben Schmidt) </li>
<li> Exit Vim process if connection becomes invalid -- this should avoid the system log filling up with error messages, but please let me know when it happens (and send me the output from Console.app) </li>
<li> Fix bug where Vim would crash when resizing a window with double-width characters </li>
<li> Add option 'macmeta' to use "alt/option" as meta key to allow bindings to &lt;M-..&gt; (see ":h 'macmeta') </li>
<li> Add basic support for AppleScript (Jason Foreman). E.g. to zoom a window:
<pre>
tell application MacVim
set zoomed of first window to true
end tell
</pre>
</li>
<li> Fix various bugs relating to initial window positioning </li>
<li> Keep window is visible on ":set lines=..." and "set columns=..." </li>
<li> Inserting text from "Special Characters" palette works again </li>
<li> Remove the functionality to use a modifier key as Esc (use the PCKeyboardHack app instead, see ":h macvim-hints | /esc") </li>
<li> More help on keyboard shortcuts (":h macvim-shortcuts") and the mvim script (see ":h mvim") </li>
<li> Speed up live resize </li>
<li> Support mvim script symlinks to [m|g]ex and rmvim (see ":h mvim") </li>
<li> Tentative support for receiving input from system services (Try this: insert "2+3", select the text, then hit Cmd-*. Result: "2+3" is replaced with "5". Sometimes it seems you have to choose "MacVim-&gt;Services-&gt;Script Editor-&gt;Get Result of AppleScript" instead of pressing Cmd-* for this to work.) </li>
<li> No more Vim zombie processes </li>
<li> Add "Reload"/"Ignore All" buttons to the file changed dialog </li>
<li> Latest runtime files, and Vim patches </li>
</ul>
</p>
]]></description>
<pubDate>Sun, 23 Nov 2008 18:09 CET</pubDate>
<enclosure type="application/octet-stream"
url="http://newmacvim.muskokamug.org/mirror/files/MacVim-snapshot-39.tbz"
length="8012682"
sparkle:version="39"
sparkle:shortVersionString="7.2"
/>
</item>
<item>
<title>Snapshot 36 released</title>
<description><![CDATA[
<h1>MacVim snapshot 36 released</h1>
<p> This snapshot fixes a problem with dropped characters that was introduced with snapshot 35. Other changes since snapshot 35:
<ul>
<li> More help file updates </li>
<li> Fixed memory leak (Jonathon Mah) </li>
<li> Tool tips for truncated tab labels (Jonathon Mah) </li>
<li> Support drag and drop on tabs and on tabline (Jonathon Mah) </li>
<li> Modifier key can be used as Esc (useful for turning Caps Lock into Esc, see ":h macvim-esc") </li>
<li> Added "Find & Replace" dialog box (Cmd-f) </li>
</ul>
</p>
]]></description>
<pubDate>Sat, 04 Oct 2008 18:38 CET</pubDate>
<enclosure type="application/octet-stream"
url="http://newmacvim.muskokamug.org/mirror/files/MacVim-snapshot-36.tbz"
length="8005820"
sparkle:version="36"
sparkle:shortVersionString="7.2"
/>
</item>
<item>
<title>Snapshot 35 released</title>
<description><![CDATA[
+5 -2
View File
@@ -39,12 +39,12 @@ gui=
opts=
# GUI mode, implies forking
case "$name" in m*|g*|rg*) gui=true ;; esac
case "$name" in m*|g*|rm*|rg*) gui=true ;; esac
# Restricted mode
case "$name" in r*) opts="$opts -Z";; esac
# vimdiff and view
# vimdiff, view, and ex mode
case "$name" in
*vimdiff)
opts="$opts -dO"
@@ -52,6 +52,9 @@ case "$name" in
*view)
opts="$opts -R"
;;
*ex)
opts="$opts -e"
;;
esac
# Last step: fire up vim.
+17 -9
View File
@@ -16819,21 +16819,29 @@ if test "x$MACARCH" = "xboth"; then
LDFLAGS="$LDFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
fi
{ $as_echo "$as_me:$LINENO: checking for GCC 3 or later" >&5
$as_echo_n "checking for GCC 3 or later... " >&6; }
DEPEND_CFLAGS_FILTER=
if test "$GCC" = yes; then
{ $as_echo "$as_me:$LINENO: checking for GCC 3 or later" >&5
$as_echo_n "checking for GCC 3 or later... " >&6; }
gccmajor=`echo "$gccversion" | sed -e 's/^\([1-9]\)\..*$/\1/g'`
if test "$gccmajor" -gt "2"; then
DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
fi
fi
if test "$DEPEND_CFLAGS_FILTER" = ""; then
{ $as_echo "$as_me:$LINENO: result: no" >&5
$as_echo "no" >&6; }
else
{ $as_echo "$as_me:$LINENO: result: yes" >&5
{ $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:$LINENO: result: no" >&5
$as_echo "no" >&6; }
fi
{ $as_echo "$as_me:$LINENO: checking whether we need -D_FORTIFY_SOURCE=1" >&5
$as_echo_n "checking whether we need -D_FORTIFY_SOURCE=1... " >&6; }
if test "$gccmajor" -gt "3"; then
CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1"
{ $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:$LINENO: result: no" >&5
$as_echo "no" >&6; }
fi
fi
+72 -17
View File
@@ -33,7 +33,7 @@ static char_u *buflist_match __ARGS((regprog_T *prog, buf_T *buf));
static char_u *fname_match __ARGS((regprog_T *prog, char_u *name));
#endif
static void buflist_setfpos __ARGS((buf_T *buf, win_T *win, linenr_T lnum, colnr_T col, int copy_options));
static wininfo_T *find_wininfo __ARGS((buf_T *buf));
static wininfo_T *find_wininfo __ARGS((buf_T *buf, int skip_diff_buffer));
#ifdef UNIX
static buf_T *buflist_findname_stat __ARGS((char_u *ffname, struct stat *st));
static int otherfile_buf __ARGS((buf_T *buf, char_u *ffname, struct stat *stp));
@@ -651,6 +651,9 @@ free_buffer_stuff(buf, free_options)
vim_free(buf->b_start_fenc);
buf->b_start_fenc = NULL;
#endif
#ifdef FEAT_SPELL
ga_clear(&buf->b_langp);
#endif
}
/*
@@ -1094,7 +1097,7 @@ do_buffer(action, start, dir, count, forceit)
#endif
setpcmark();
retval = do_ecmd(0, NULL, NULL, NULL, ECMD_ONE,
forceit ? ECMD_FORCEIT : 0);
forceit ? ECMD_FORCEIT : 0, curwin);
/*
* do_ecmd() may create a new buffer, then we have to delete
@@ -1241,7 +1244,7 @@ do_buffer(action, start, dir, count, forceit)
* "buf" if one exists */
if ((swb_flags & SWB_USEOPEN) && buf_jump_open_win(buf))
return OK;
/* If 'switchbuf' contians "usetab": jump to first window in any tab
/* If 'switchbuf' contains "usetab": jump to first window in any tab
* page containing "buf" if one exists */
if ((swb_flags & SWB_USETAB) && buf_jump_open_tab(buf))
return OK;
@@ -1317,7 +1320,7 @@ set_curbuf(buf, action)
setpcmark();
if (!cmdmod.keepalt)
curwin->w_alt_fnum = curbuf->b_fnum; /* remember alternate file */
buflist_altfpos(); /* remember curpos */
buflist_altfpos(curwin); /* remember curpos */
#ifdef FEAT_VISUAL
/* Don't restart Select mode after switching to another buffer. */
@@ -1402,6 +1405,9 @@ enter_buffer(buf)
curwin->w_cursor.coladd = 0;
#endif
curwin->w_set_curswant = TRUE;
#ifdef FEAT_AUTOCMD
curwin->w_topline_was_set = FALSE;
#endif
/* Make sure the buffer is loaded. */
if (curbuf->b_ml.ml_mfp == NULL) /* need to load the file */
@@ -1441,7 +1447,8 @@ enter_buffer(buf)
maketitle();
#endif
#ifdef FEAT_AUTOCMD
if (curwin->w_topline == 1) /* when autocmds didn't change it */
/* when autocmds didn't change it */
if (curwin->w_topline == 1 && !curwin->w_topline_was_set)
#endif
scroll_cursor_halfway(FALSE); /* redisplay at correct position */
@@ -2405,22 +2412,70 @@ buflist_setfpos(buf, win, lnum, col, copy_options)
return;
}
#ifdef FEAT_DIFF
static int wininfo_other_tab_diff __ARGS((wininfo_T *wip));
/*
* Return TRUE when "wip" has 'diff' set and the diff is only for another tab
* page. That's because a diff is local to a tab page.
*/
static int
wininfo_other_tab_diff(wip)
wininfo_T *wip;
{
win_T *wp;
if (wip->wi_opt.wo_diff)
{
for (wp = firstwin; wp != NULL; wp = wp->w_next)
/* return FALSE when it's a window in the current tab page, thus
* the buffer was in diff mode here */
if (wip->wi_win == wp)
return FALSE;
return TRUE;
}
return FALSE;
}
#endif
/*
* Find info for the current window in buffer "buf".
* If not found, return the info for the most recently used window.
* When "skip_diff_buffer" is TRUE avoid windows with 'diff' set that is in
* another tab page.
* Returns NULL when there isn't any info.
*/
/*ARGSUSED*/
static wininfo_T *
find_wininfo(buf)
find_wininfo(buf, skip_diff_buffer)
buf_T *buf;
int skip_diff_buffer;
{
wininfo_T *wip;
for (wip = buf->b_wininfo; wip != NULL; wip = wip->wi_next)
if (wip->wi_win == curwin)
if (wip->wi_win == curwin
#ifdef FEAT_DIFF
&& (!skip_diff_buffer || !wininfo_other_tab_diff(wip))
#endif
)
break;
if (wip == NULL) /* if no fpos for curwin, use the first in the list */
wip = buf->b_wininfo;
/* If no wininfo for curwin, use the first in the list (that doesn't have
* 'diff' set and is in another tab page). */
if (wip == NULL)
{
#ifdef FEAT_DIFF
if (skip_diff_buffer)
{
for (wip = buf->b_wininfo; wip != NULL; wip = wip->wi_next)
if (!wininfo_other_tab_diff(wip))
break;
}
else
#endif
wip = buf->b_wininfo;
}
return wip;
}
@@ -2441,7 +2496,7 @@ get_winopts(buf)
clearFolding(curwin);
#endif
wip = find_wininfo(buf);
wip = find_wininfo(buf, TRUE);
if (wip != NULL && wip->wi_optset)
{
copy_winopt(&wip->wi_opt, &curwin->w_onebuf_opt);
@@ -2473,7 +2528,7 @@ buflist_findfpos(buf)
wininfo_T *wip;
static pos_T no_position = {1, 0};
wip = find_wininfo(buf);
wip = find_wininfo(buf, FALSE);
if (wip != NULL)
return &(wip->wi_fpos);
else
@@ -2794,14 +2849,14 @@ buflist_slash_adjust()
#endif
/*
* Set alternate cursor position for current window.
* Set alternate cursor position for the current buffer and window "win".
* Also save the local window option values.
*/
void
buflist_altfpos()
buflist_altfpos(win)
win_T *win;
{
buflist_setfpos(curbuf, curwin, curwin->w_cursor.lnum,
curwin->w_cursor.col, TRUE);
buflist_setfpos(curbuf, win, win->w_cursor.lnum, win->w_cursor.col, TRUE);
}
/*
@@ -3974,7 +4029,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
width = vim_strsize(out);
if (maxwidth > 0 && width > maxwidth)
{
/* Result is too long, must trunctate somewhere. */
/* Result is too long, must truncate somewhere. */
l = 0;
if (itemcnt == 0)
s = out;
@@ -4499,7 +4554,7 @@ do_arg_all(count, forceit, keep_tabs)
ECMD_ONE,
((P_HID(curwin->w_buffer)
|| bufIsChanged(curwin->w_buffer)) ? ECMD_HIDE : 0)
+ ECMD_OLDBUF);
+ ECMD_OLDBUF, curwin);
#ifdef FEAT_AUTOCMD
if (use_firstwin)
++autocmd_no_leave;
+13 -6
View File
@@ -3188,18 +3188,25 @@ dnl use "-isystem" instead of "-I" for all non-Vim include dirs.
dnl But only when making dependencies, cproto and lint don't take "-isystem".
dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
dnl the number before the version number.
AC_MSG_CHECKING(for GCC 3 or later)
DEPEND_CFLAGS_FILTER=
if test "$GCC" = yes; then
AC_MSG_CHECKING(for GCC 3 or later)
gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'`
if test "$gccmajor" -gt "2"; then
DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is
dnl declared as char x[1] but actually longer. Introduced in gcc 4.0.
AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
if test "$gccmajor" -gt "3"; then
CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
fi
if test "$DEPEND_CFLAGS_FILTER" = ""; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
fi
AC_SUBST(DEPEND_CFLAGS_FILTER)
+127 -11
View File
@@ -348,6 +348,7 @@ static struct vimvar
{VV_NAME("mouse_col", VAR_NUMBER), 0},
{VV_NAME("operator", VAR_STRING), VV_RO},
{VV_NAME("searchforward", VAR_NUMBER), 0},
{VV_NAME("oldfiles", VAR_LIST), 0},
};
/* shorthand */
@@ -355,6 +356,7 @@ static struct vimvar
#define vv_nr vv_di.di_tv.vval.v_number
#define vv_float vv_di.di_tv.vval.v_float
#define vv_str vv_di.di_tv.vval.v_string
#define vv_list vv_di.di_tv.vval.v_list
#define vv_tv vv_di.di_tv
/*
@@ -426,7 +428,6 @@ static long list_find_nr __ARGS((list_T *l, long idx, int *errorp));
static long list_idx_of_item __ARGS((list_T *l, listitem_T *item));
static void list_append __ARGS((list_T *l, listitem_T *item));
static int list_append_tv __ARGS((list_T *l, typval_T *tv));
static int list_append_string __ARGS((list_T *l, char_u *str, int len));
static int list_append_number __ARGS((list_T *l, varnumber_T n));
static int list_insert_tv __ARGS((list_T *l, typval_T *tv, listitem_T *item));
static int list_extend __ARGS((list_T *l1, list_T *l2, listitem_T *bef));
@@ -845,11 +846,17 @@ eval_clear()
p = &vimvars[i];
if (p->vv_di.di_tv.v_type == VAR_STRING)
{
vim_free(p->vv_di.di_tv.vval.v_string);
p->vv_di.di_tv.vval.v_string = NULL;
vim_free(p->vv_str);
p->vv_str = NULL;
}
else if (p->vv_di.di_tv.v_type == VAR_LIST)
{
list_unref(p->vv_list);
p->vv_list = NULL;
}
}
hash_clear(&vimvarht);
hash_init(&vimvarht); /* garbage_collect() will access it */
hash_clear(&compat_hashtab);
/* script-local variables */
@@ -3287,7 +3294,7 @@ ex_call(eap)
if (*startarg != '(')
{
EMSG2(_("E107: Missing braces: %s"), eap->arg);
EMSG2(_("E107: Missing parentheses: %s"), eap->arg);
goto end;
}
@@ -6056,6 +6063,25 @@ list_find_nr(l, idx, errorp)
return get_tv_number_chk(&li->li_tv, errorp);
}
/*
* Get list item "l[idx - 1]" as a string. Returns NULL for failure.
*/
char_u *
list_find_str(l, idx)
list_T *l;
long idx;
{
listitem_T *li;
li = list_find(l, idx - 1);
if (li == NULL)
{
EMSGN(_(e_listidx), idx);
return NULL;
}
return get_tv_string(&li->li_tv);
}
/*
* Locate "item" list "l" and return its index.
* Returns -1 when "item" is not in the list.
@@ -6147,7 +6173,7 @@ list_append_dict(list, dict)
* When "len" >= 0 use "str[len]".
* Returns FAIL when out of memory.
*/
static int
int
list_append_string(l, str, len)
list_T *l;
char_u *str;
@@ -6507,6 +6533,9 @@ garbage_collect()
set_ref_in_ht(&fc->l_avars.dv_hashtab, copyID);
}
/* v: vars */
set_ref_in_ht(&vimvarht, copyID);
/*
* 2. Go through the list of dicts and free items without the copyID.
*/
@@ -6597,7 +6626,7 @@ set_ref_in_item(tv, copyID)
{
case VAR_DICT:
dd = tv->vval.v_dict;
if (dd->dv_copyID != copyID)
if (dd != NULL && dd->dv_copyID != copyID)
{
/* Didn't see this dict yet. */
dd->dv_copyID = copyID;
@@ -6607,7 +6636,7 @@ set_ref_in_item(tv, copyID)
case VAR_LIST:
ll = tv->vval.v_list;
if (ll->lv_copyID != copyID)
if (ll != NULL && ll->lv_copyID != copyID)
{
/* Didn't see this list yet. */
ll->lv_copyID = copyID;
@@ -18126,14 +18155,28 @@ get_vim_var_str(idx)
}
/*
* Set v:count, v:count1 and v:prevcount.
* Get List v: variable value. Caller must take care of reference count when
* needed.
*/
list_T *
get_vim_var_list(idx)
int idx;
{
return vimvars[idx].vv_list;
}
/*
* Set v:count to "count" and v:count1 to "count1".
* When "set_prevcount" is TRUE first set v:prevcount from v:count.
*/
void
set_vcount(count, count1)
set_vcount(count, count1, set_prevcount)
long count;
long count1;
int set_prevcount;
{
vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr;
if (set_prevcount)
vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr;
vimvars[VV_COUNT].vv_nr = count;
vimvars[VV_COUNT1].vv_nr = count1;
}
@@ -18160,6 +18203,20 @@ set_vim_var_string(idx, val, len)
vimvars[idx].vv_str = vim_strnsave(val, len);
}
/*
* Set List v: variable to "val".
*/
void
set_vim_var_list(idx, val)
int idx;
list_T *val;
{
list_unref(vimvars[idx].vv_list);
vimvars[idx].vv_list = val;
if (val != NULL)
++val->lv_refcount;
}
/*
* Set v:register if needed.
*/
@@ -21116,8 +21173,11 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
init_var_dict(&fc.l_avars, &fc.l_avars_var);
add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "0",
(varnumber_T)(argcount - fp->uf_args.ga_len));
/* Use "name" to avoid a warning from some compiler that checks the
* destination size. */
v = &fc.fixvar[fixvar_idx++].var;
STRCPY(v->di_key, "000");
name = v->di_key;
STRCPY(name, "000");
v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
hash_add(&fc.l_avars.dv_hashtab, DI2HIKEY(v));
v->di_tv.v_type = VAR_LIST;
@@ -21920,6 +21980,62 @@ last_set_msg(scriptID)
}
}
/*
* List v:oldfiles in a nice way.
*/
/*ARGSUSED*/
void
ex_oldfiles(eap)
exarg_T *eap;
{
list_T *l = vimvars[VV_OLDFILES].vv_list;
listitem_T *li;
int nr = 0;
if (l == NULL)
msg((char_u *)_("No old files"));
else
{
msg_start();
msg_scroll = TRUE;
for (li = l->lv_first; li != NULL && !got_int; li = li->li_next)
{
msg_outnum((long)++nr);
MSG_PUTS(": ");
msg_outtrans(get_tv_string(&li->li_tv));
msg_putchar('\n');
out_flush(); /* output one line at a time */
ui_breakcheck();
}
/* Assume "got_int" was set to truncate the listing. */
got_int = FALSE;
#ifdef FEAT_BROWSE_CMD
if (cmdmod.browse)
{
quit_more = FALSE;
nr = prompt_for_number(FALSE);
msg_starthere();
if (nr > 0)
{
char_u *p = list_find_str(get_vim_var_list(VV_OLDFILES),
(long)nr);
if (p != NULL)
{
p = expand_env_save(p);
eap->arg = p;
eap->cmdidx = CMD_edit;
cmdmod.browse = FALSE;
do_exedit(eap, NULL);
vim_free(p);
}
}
}
#endif
}
}
#endif /* FEAT_EVAL */
+36 -26
View File
@@ -24,7 +24,7 @@ static int linelen __ARGS((int *has_tab));
static void do_filter __ARGS((linenr_T line1, linenr_T line2, exarg_T *eap, char_u *cmd, int do_in, int do_out));
#ifdef FEAT_VIMINFO
static char_u *viminfo_filename __ARGS((char_u *));
static void do_viminfo __ARGS((FILE *fp_in, FILE *fp_out, int want_info, int want_marks, int force_read));
static void do_viminfo __ARGS((FILE *fp_in, FILE *fp_out, int flags));
static int viminfo_encoding __ARGS((vir_T *virp));
static int read_viminfo_up_to_marks __ARGS((vir_T *virp, int forceit, int writing));
#endif
@@ -1676,14 +1676,12 @@ viminfo_error(errnum, message, line)
/*
* read_viminfo() -- Read the viminfo file. Registers etc. which are already
* set are not over-written unless force is TRUE. -- webb
* set are not over-written unless "flags" includes VIF_FORCEIT. -- webb
*/
int
read_viminfo(file, want_info, want_marks, forceit)
char_u *file;
int want_info;
int want_marks;
int forceit;
read_viminfo(file, flags)
char_u *file; /* file name or NULL to use default name */
int flags; /* VIF_WANT_INFO et al. */
{
FILE *fp;
char_u *fname;
@@ -1691,7 +1689,7 @@ read_viminfo(file, want_info, want_marks, forceit)
if (no_viminfo())
return FAIL;
fname = viminfo_filename(file); /* may set to default if NULL */
fname = viminfo_filename(file); /* get file name in allocated buffer */
if (fname == NULL)
return FAIL;
fp = mch_fopen((char *)fname, READBIN);
@@ -1701,8 +1699,9 @@ read_viminfo(file, want_info, want_marks, forceit)
verbose_enter();
smsg((char_u *)_("Reading viminfo file \"%s\"%s%s%s"),
fname,
want_info ? _(" info") : "",
want_marks ? _(" marks") : "",
(flags & VIF_WANT_INFO) ? _(" info") : "",
(flags & VIF_WANT_MARKS) ? _(" marks") : "",
(flags & VIF_GET_OLDFILES) ? _(" oldfiles") : "",
fp == NULL ? _(" FAILED") : "");
verbose_leave();
}
@@ -1712,10 +1711,9 @@ read_viminfo(file, want_info, want_marks, forceit)
return FAIL;
viminfo_errcnt = 0;
do_viminfo(fp, NULL, want_info, want_marks, forceit);
do_viminfo(fp, NULL, flags);
fclose(fp);
return OK;
}
@@ -1968,7 +1966,7 @@ write_viminfo(file, forceit)
}
viminfo_errcnt = 0;
do_viminfo(fp_in, fp_out, !forceit, !forceit, FALSE);
do_viminfo(fp_in, fp_out, forceit ? 0 : (VIF_WANT_INFO | VIF_WANT_MARKS));
fclose(fp_out); /* errors are ignored !? */
if (fp_in != NULL)
@@ -2041,12 +2039,10 @@ viminfo_filename(file)
* do_viminfo() -- Should only be called from read_viminfo() & write_viminfo().
*/
static void
do_viminfo(fp_in, fp_out, want_info, want_marks, force_read)
do_viminfo(fp_in, fp_out, flags)
FILE *fp_in;
FILE *fp_out;
int want_info;
int want_marks;
int force_read;
int flags;
{
int count = 0;
int eof = FALSE;
@@ -2061,8 +2057,9 @@ do_viminfo(fp_in, fp_out, want_info, want_marks, force_read)
if (fp_in != NULL)
{
if (want_info)
eof = read_viminfo_up_to_marks(&vir, force_read, fp_out != NULL);
if (flags & VIF_WANT_INFO)
eof = read_viminfo_up_to_marks(&vir,
flags & VIF_FORCEIT, fp_out != NULL);
else
/* Skip info, find start of marks */
while (!(eof = viminfo_readline(&vir))
@@ -2092,8 +2089,9 @@ do_viminfo(fp_in, fp_out, want_info, want_marks, force_read)
write_viminfo_bufferlist(fp_out);
count = write_viminfo_marks(fp_out);
}
if (fp_in != NULL && want_marks)
copy_viminfo_marks(&vir, fp_out, count, eof);
if (fp_in != NULL
&& (flags & (VIF_WANT_MARKS | VIF_GET_OLDFILES | VIF_FORCEIT)))
copy_viminfo_marks(&vir, fp_out, count, eof, flags);
vim_free(vir.vir_line);
#ifdef FEAT_MBYTE
@@ -3054,7 +3052,8 @@ getfile(fnum, ffname, sfname, setpm, lnum, forceit)
retval = 0; /* it's in the same file */
}
else if (do_ecmd(fnum, ffname, sfname, NULL, lnum,
(P_HID(curbuf) ? ECMD_HIDE : 0) + (forceit ? ECMD_FORCEIT : 0)) == OK)
(P_HID(curbuf) ? ECMD_HIDE : 0) + (forceit ? ECMD_FORCEIT : 0),
curwin) == OK)
retval = -1; /* opened another file */
else
retval = 1; /* error encountered */
@@ -3087,17 +3086,21 @@ theend:
* ECMD_OLDBUF: use existing buffer if it exists
* ECMD_FORCEIT: ! used for Ex command
* ECMD_ADDBUF: don't edit, just add to buffer list
* oldwin: Should be "curwin" when editing a new buffer in the current
* window, NULL when splitting the window first. When not NULL info
* of the previous buffer for "oldwin" is stored.
*
* return FAIL for failure, OK otherwise
*/
int
do_ecmd(fnum, ffname, sfname, eap, newlnum, flags)
do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin)
int fnum;
char_u *ffname;
char_u *sfname;
exarg_T *eap; /* can be NULL! */
linenr_T newlnum;
int flags;
win_T *oldwin;
{
int other_file; /* TRUE if editing another file */
int oldbuf; /* TRUE if using existing buffer */
@@ -3269,7 +3272,8 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags)
{
if (!cmdmod.keepalt)
curwin->w_alt_fnum = curbuf->b_fnum;
buflist_altfpos();
if (oldwin != NULL)
buflist_altfpos(oldwin);
}
if (fnum)
@@ -3373,7 +3377,7 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags)
/* close the link to the current buffer */
u_sync(FALSE);
close_buffer(curwin, curbuf,
close_buffer(oldwin, curbuf,
(flags & ECMD_HIDE) ? 0 : DOBUF_UNLOAD);
#ifdef FEAT_AUTOCMD
@@ -5611,7 +5615,13 @@ ex_help(eap)
*/
alt_fnum = curbuf->b_fnum;
(void)do_ecmd(0, NULL, NULL, NULL, ECMD_LASTL,
ECMD_HIDE + ECMD_SET_HELP);
ECMD_HIDE + ECMD_SET_HELP,
#ifdef FEAT_WINDOWS
NULL /* buffer is still open, don't store info */
#else
curwin
#endif
);
if (!cmdmod.keepalt)
curwin->w_alt_fnum = alt_fnum;
empty_fnum = curbuf->b_fnum;
+5 -3
View File
@@ -278,7 +278,7 @@ EX(CMD_cquit, "cquit", ex_cquit,
EX(CMD_crewind, "crewind", ex_cc,
RANGE|NOTADR|COUNT|TRLBAR|BANG),
EX(CMD_cscope, "cscope", do_cscope,
EXTRA|NOTRLCOM|SBOXOK|XFILE),
EXTRA|NOTRLCOM|XFILE),
EX(CMD_cstag, "cstag", do_cstag,
BANG|TRLBAR|WORD1),
EX(CMD_cunmap, "cunmap", ex_unmap,
@@ -506,7 +506,7 @@ EX(CMD_lchdir, "lchdir", ex_cd,
EX(CMD_lclose, "lclose", ex_cclose,
RANGE|NOTADR|COUNT|TRLBAR),
EX(CMD_lcscope, "lcscope", do_cscope,
EXTRA|NOTRLCOM|SBOXOK|XFILE),
EXTRA|NOTRLCOM|XFILE),
EX(CMD_left, "left", ex_align,
TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY),
EX(CMD_leftabove, "leftabove", ex_wrongmodifier,
@@ -657,6 +657,8 @@ EX(CMD_nunmenu, "nunmenu", ex_menu,
EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
EX(CMD_open, "open", ex_open,
RANGE|EXTRA),
EX(CMD_oldfiles, "oldfiles", ex_oldfiles,
BANG|TRLBAR|SBOXOK|CMDWIN),
EX(CMD_omap, "omap", ex_map,
EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
EX(CMD_omapclear, "omapclear", ex_mapclear,
@@ -808,7 +810,7 @@ EX(CMD_scriptnames, "scriptnames", ex_scriptnames,
EX(CMD_scriptencoding, "scriptencoding", ex_scriptencoding,
WORD1|TRLBAR|CMDWIN),
EX(CMD_scscope, "scscope", do_scscope,
EXTRA|NOTRLCOM|SBOXOK),
EXTRA|NOTRLCOM),
EX(CMD_set, "set", ex_set,
TRLBAR|EXTRA|CMDWIN|SBOXOK),
EX(CMD_setfiletype, "setfiletype", ex_setfiletype,
+2 -2
View File
@@ -2205,8 +2205,8 @@ do_argfile(eap, argn)
* argument index. */
if (do_ecmd(0, alist_name(&ARGLIST[curwin->w_arg_idx]), NULL,
eap, ECMD_LAST,
(P_HID(curwin->w_buffer) ? ECMD_HIDE : 0) +
(eap->forceit ? ECMD_FORCEIT : 0)) == FAIL)
(P_HID(curwin->w_buffer) ? ECMD_HIDE : 0)
+ (eap->forceit ? ECMD_FORCEIT : 0), curwin) == FAIL)
curwin->w_arg_idx = old_arg_idx;
/* like Vi: set the mark where the cursor is in the file. */
else if (eap->cmdidx != CMD_argdo)
+47 -16
View File
@@ -220,7 +220,8 @@ static void ex_popup __ARGS((exarg_T *eap));
#ifndef FEAT_GUI_MSWIN
# define ex_simalt ex_ni
#endif
#if !defined(FEAT_GUI_MSWIN) && !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_MOTIF)
#if !(defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK) || \
defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_MACVIM))
# define gui_mch_find_dialog ex_ni
# define gui_mch_replace_dialog ex_ni
#endif
@@ -365,6 +366,7 @@ static void ex_tag_cmd __ARGS((exarg_T *eap, char_u *name));
# define ex_function ex_ni
# define ex_delfunction ex_ni
# define ex_return ex_ni
# define ex_oldfiles ex_ni
#endif
static char_u *arg_all __ARGS((void));
#ifdef FEAT_SESSION
@@ -1776,7 +1778,7 @@ do_one_cmd(cmdlinep, sourcing,
}
if (checkforcmd(&ea.cmd, "browse", 3))
{
#ifdef FEAT_BROWSE
#ifdef FEAT_BROWSE_CMD
cmdmod.browse = TRUE;
#endif
continue;
@@ -3615,6 +3617,7 @@ set_one_cmd_context(xp, buff)
return set_context_in_autocmd(xp, arg, FALSE);
case CMD_doautocmd:
case CMD_doautoall:
return set_context_in_autocmd(xp, arg, TRUE);
#endif
case CMD_set:
@@ -7504,7 +7507,8 @@ do_exedit(eap, old_curwin)
/* ":new" or ":tabnew" without argument: edit an new empty buffer */
setpcmark();
(void)do_ecmd(0, NULL, NULL, eap, ECMD_ONE,
ECMD_HIDE + (eap->forceit ? ECMD_FORCEIT : 0));
ECMD_HIDE + (eap->forceit ? ECMD_FORCEIT : 0),
old_curwin == NULL ? curwin : NULL);
}
else if ((eap->cmdidx != CMD_split
#ifdef FEAT_VERTSPLIT
@@ -7541,7 +7545,7 @@ do_exedit(eap, old_curwin)
#ifdef FEAT_LISTCMDS
+ (eap->cmdidx == CMD_badd ? ECMD_ADDBUF : 0 )
#endif
) == FAIL)
, old_curwin == NULL ? curwin : NULL) == FAIL)
{
/* Editing the file failed. If the window was split, close it. */
#ifdef FEAT_WINDOWS
@@ -9526,24 +9530,50 @@ eval_vars(src, srcstart, usedlen, lnump, errormsg, escaped)
break;
}
s = src + 1;
if (*s == '<') /* "#<99" uses v:oldfiles */
++s;
i = (int)getdigits(&s);
*usedlen = (int)(s - src); /* length of what we expand */
buf = buflist_findnr(i);
if (buf == NULL)
if (src[1] == '<')
{
*errormsg = (char_u *)_("E194: No alternate file name to substitute for '#'");
if (*usedlen < 2)
{
/* Should we give an error message for #<text? */
*usedlen = 1;
return NULL;
}
#ifdef FEAT_EVAL
result = list_find_str(get_vim_var_list(VV_OLDFILES),
(long)i);
if (result == NULL)
{
*errormsg = (char_u *)"";
return NULL;
}
#else
*errormsg = (char_u *)_("E809: #< is not available without the +eval feature");
return NULL;
}
if (lnump != NULL)
*lnump = ECMD_LAST;
if (buf->b_fname == NULL)
{
result = (char_u *)"";
valid = 0; /* Must have ":p:h" to be valid */
#endif
}
else
result = buf->b_fname;
{
buf = buflist_findnr(i);
if (buf == NULL)
{
*errormsg = (char_u *)_("E194: No alternate file name to substitute for '#'");
return NULL;
}
if (lnump != NULL)
*lnump = ECMD_LAST;
if (buf->b_fname == NULL)
{
result = (char_u *)"";
valid = 0; /* Must have ":p:h" to be valid */
}
else
result = buf->b_fname;
}
break;
#ifdef FEAT_SEARCHPATH
@@ -10726,7 +10756,8 @@ ex_viminfo(eap)
p_viminfo = (char_u *)"'100";
if (eap->cmdidx == CMD_rviminfo)
{
if (read_viminfo(eap->arg, TRUE, TRUE, eap->forceit) == FAIL)
if (read_viminfo(eap->arg, VIF_WANT_INFO | VIF_WANT_MARKS
| (eap->forceit ? VIF_FORCEIT : 0)) == FAIL)
EMSG(_("E195: Cannot open viminfo file for reading"));
}
else
+1 -1
View File
@@ -6054,7 +6054,7 @@ ex_window()
cmdwin_type = '-';
/* Create the command-line buffer empty. */
(void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE);
(void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, NULL);
(void)setfname(curbuf, (char_u *)"[Command Line]", NULL, TRUE);
set_option_value((char_u *)"bt", 0L, (char_u *)"nofile", OPT_LOCAL);
set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
+7 -3
View File
@@ -770,9 +770,13 @@
/*
* +browse ":browse" command.
* or just the ":browse" command modifier
*/
#if defined(FEAT_NORMAL) && (defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MAC) || defined(FEAT_GUI_MACVIM))
# define FEAT_BROWSE
#if defined(FEAT_NORMAL)
# define FEAT_BROWSE_CMD
# if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MAC) || defined(FEAT_GUI_MACVIM)
# define FEAT_BROWSE
# endif
#endif
/*
@@ -1099,7 +1103,7 @@
#endif
#if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MOTIF) \
|| defined(MSWIN_FIND_REPLACE)
|| defined(MSWIN_FIND_REPLACE) || defined(FEAT_GUI_MACVIM)
# define FIND_REPLACE_DIALOG 1
#endif
+41 -9
View File
@@ -932,7 +932,10 @@ retry:
else
{
if (eap != NULL && eap->force_ff != 0)
{
fileformat = get_fileformat_force(curbuf, eap);
try_unix = try_dos = try_mac = FALSE;
}
else if (curbuf->b_p_bin)
fileformat = EOL_UNIX; /* binary: use Unix format */
else if (*p_ffs == NUL)
@@ -2341,11 +2344,6 @@ failed:
STRCAT(IObuff, _("[CR missing]"));
c = TRUE;
}
if (ff_error == EOL_MAC)
{
STRCAT(IObuff, _("[NL found]"));
c = TRUE;
}
if (split)
{
STRCAT(IObuff, _("[long lines split]"));
@@ -2711,7 +2709,7 @@ check_marks_read()
{
if (!curbuf->b_marks_read && get_viminfo_parameter('\'') > 0
&& curbuf->b_ffname != NULL)
read_viminfo(NULL, FALSE, TRUE, FALSE);
read_viminfo(NULL, VIF_WANT_MARKS);
/* Always set b_marks_read; needed when 'viminfo' is changed to include
* the ' parameter after opening a buffer. */
@@ -5554,9 +5552,10 @@ check_for_bom(p, size, lenp, flags)
name = "ucs-4le"; /* FF FE 00 00 */
len = 4;
}
else if (flags == FIO_ALL || flags == (FIO_UCS2 | FIO_ENDIAN_L))
else if (flags == (FIO_UCS2 | FIO_ENDIAN_L))
name = "ucs-2le"; /* FF FE */
else if (flags == (FIO_UTF16 | FIO_ENDIAN_L))
else if (flags == FIO_ALL || flags == (FIO_UTF16 | FIO_ENDIAN_L))
/* utf-16le is preferred, it also works for ucs-2le text */
name = "utf-16le"; /* FF FE */
}
else if (p[0] == 0xfe && p[1] == 0xff
@@ -6232,6 +6231,9 @@ vim_rename(from, to)
}
static int already_warned = FALSE;
#ifdef FEAT_GUI_MACVIM
static int default_reload_choice = 0;
#endif
/*
* Check if any not hidden buffer has been changed.
@@ -6274,6 +6276,9 @@ check_timestamps(focus)
++no_wait_return;
did_check_timestamps = TRUE;
already_warned = FALSE;
#ifdef FEAT_GUI_MACVIM
default_reload_choice = 0;
#endif
for (buf = firstbuf; buf != NULL; )
{
/* Only check buffers in a window. */
@@ -6292,6 +6297,9 @@ check_timestamps(focus)
}
buf = buf->b_next;
}
#ifdef FEAT_GUI_MACVIM
default_reload_choice = 0;
#endif
--no_wait_return;
need_check_timestamps = FALSE;
if (need_wait_return && didit == 2)
@@ -6551,9 +6559,33 @@ buf_check_timestamp(buf, focus)
STRCAT(tbuf, "\n");
STRCAT(tbuf, mesg2);
}
# ifdef FEAT_GUI_MACVIM
if (default_reload_choice > 0)
{
if (default_reload_choice == 2)
reload = TRUE;
}
else
{
switch (do_dialog(VIM_WARNING, (char_u *)_("Warning"), tbuf,
(char_u *)_("&OK\n&Load File\nLoad &All\n&Ignore All"),
1, NULL))
{
case 3:
default_reload_choice = 2;
case 2:
reload = TRUE;
break;
case 4:
default_reload_choice = 1;
break;
}
}
# else
if (do_dialog(VIM_WARNING, (char_u *)_("Warning"), tbuf,
(char_u *)_("&OK\n&Load File"), 1, NULL) == 2)
reload = TRUE;
# endif
}
else
#endif
@@ -9113,7 +9145,7 @@ static int include_groups = FALSE;
set_context_in_autocmd(xp, arg, doautocmd)
expand_T *xp;
char_u *arg;
int doautocmd; /* TRUE for :doautocmd, FALSE for :autocmd */
int doautocmd; /* TRUE for :doauto*, FALSE for :autocmd */
{
char_u *p;
int group;
+2 -2
View File
@@ -695,7 +695,7 @@ gui_mch_set_winpos(int x, int y)
gui_mch_set_shellsize(width, height, min_width, min_height, base_width, base_height, direction)
int width; /* In OS units */
int height;
int min_width; /* Smallest permissable window size (ignored) */
int min_width; /* Smallest permissible window size (ignored) */
int min_height;
int base_width; /* Space for scroll bars, etc */
int base_height;
@@ -863,7 +863,7 @@ zap_load_file(name, style)
if (strncmp(file, "ZapFont\015", 8) == 0)
return file; /* Loaded OK! */
free(file);
vim_free(file);
return NULL; /* Not a valid font file */
}
+5 -5
View File
@@ -992,7 +992,7 @@ _WndProc(
SendMessage(lpdi->hdr.hwndFrom, TTM_SETMAXTIPWIDTH,
0, 500);
tt_text = enc_to_ucs2(str, NULL);
tt_text = enc_to_utf16(str, NULL);
lpdi->lpszText = tt_text;
/* can't show tooltip if failed */
}
@@ -1935,7 +1935,7 @@ GetResultStr(HWND hwnd, int GCS, int *lenp)
if (buf == NULL)
return NULL;
convbuf = ucs2_to_enc(buf, lenp);
convbuf = utf16_to_enc(buf, lenp);
pImmReleaseContext(hwnd, hIMC);
vim_free(buf);
return convbuf;
@@ -2566,7 +2566,7 @@ gui_mch_add_menu(
{
/* 'encoding' differs from active codepage: convert menu name
* and use wide function */
wn = enc_to_ucs2(menu->name, NULL);
wn = enc_to_utf16(menu->name, NULL);
if (wn != NULL)
{
MENUITEMINFOW infow;
@@ -2728,7 +2728,7 @@ gui_mch_add_menu_item(
{
/* 'encoding' differs from active codepage: convert menu item name
* and use wide function */
wn = enc_to_ucs2(menu->name, NULL);
wn = enc_to_utf16(menu->name, NULL);
if (wn != NULL)
{
n = InsertMenuW(parent->submenu_id, (UINT)idx,
@@ -3570,7 +3570,7 @@ nCopyAnsiToWideChar(
if (enc_codepage == 0 && (int)GetACP() != enc_codepage)
{
/* Not a codepage, use our own conversion function. */
wn = enc_to_ucs2(lpAnsiIn, NULL);
wn = enc_to_utf16(lpAnsiIn, NULL);
if (wn != NULL)
{
wcscpy(lpWCStr, wn);
+20 -17
View File
@@ -547,7 +547,7 @@ char_to_string(int ch, char_u *string, int slen, int had_alt)
else
{
len = 1;
ws = ucs2_to_enc(wstring, &len);
ws = utf16_to_enc(wstring, &len);
if (ws == NULL)
len = 0;
else
@@ -2128,7 +2128,7 @@ GetTextWidthEnc(HDC hdc, char_u *str, int len)
{
/* 'encoding' differs from active codepage: convert text and use wide
* function */
wstr = enc_to_ucs2(str, &wlen);
wstr = enc_to_utf16(str, &wlen);
if (wstr != NULL)
{
n = GetTextExtentPointW(hdc, wstr, wlen, &size);
@@ -2252,7 +2252,7 @@ add_tabline_popup_menu_entry(HMENU pmenu, UINT item_id, char_u *item_text)
{
/* 'encoding' differs from active codepage: convert menu name
* and use wide function */
wn = enc_to_ucs2(item_text, NULL);
wn = enc_to_utf16(item_text, NULL);
if (wn != NULL)
{
MENUITEMINFOW infow;
@@ -2422,7 +2422,7 @@ gui_mch_update_tabline(void)
if (use_unicode)
{
/* Need to go through Unicode. */
wstr = enc_to_ucs2(NameBuff, NULL);
wstr = enc_to_utf16(NameBuff, NULL);
if (wstr != NULL)
{
TCITEMW tiw;
@@ -2521,8 +2521,8 @@ set_window_title(HWND hwnd, char *title)
WCHAR *wbuf;
int n;
/* Convert the title from 'encoding' to ucs2. */
wbuf = (WCHAR *)enc_to_ucs2((char_u *)title, NULL);
/* Convert the title from 'encoding' to UTF-16. */
wbuf = (WCHAR *)enc_to_utf16((char_u *)title, NULL);
if (wbuf != NULL)
{
n = SetWindowTextW(hwnd, wbuf);
@@ -3222,7 +3222,7 @@ gui_mch_browseW(
char_u *initdir,
char_u *filter)
{
/* We always use the wide function. This means enc_to_ucs2() must work,
/* We always use the wide function. This means enc_to_utf16() must work,
* otherwise it fails miserably! */
OPENFILENAMEW fileStruct;
WCHAR fileBuf[MAXPATHL];
@@ -3238,7 +3238,7 @@ gui_mch_browseW(
fileBuf[0] = NUL;
else
{
wp = enc_to_ucs2(dflt, NULL);
wp = enc_to_utf16(dflt, NULL);
if (wp == NULL)
fileBuf[0] = NUL;
else
@@ -3263,11 +3263,11 @@ gui_mch_browseW(
#endif
if (title != NULL)
titlep = enc_to_ucs2(title, NULL);
titlep = enc_to_utf16(title, NULL);
fileStruct.lpstrTitle = titlep;
if (ext != NULL)
extp = enc_to_ucs2(ext, NULL);
extp = enc_to_utf16(ext, NULL);
fileStruct.lpstrDefExt = extp;
fileStruct.lpstrFile = fileBuf;
@@ -3278,7 +3278,7 @@ gui_mch_browseW(
if (initdir != NULL && *initdir != NUL)
{
/* Must have backslashes here, no matter what 'shellslash' says */
initdirp = enc_to_ucs2(initdir, NULL);
initdirp = enc_to_utf16(initdir, NULL);
if (initdirp != NULL)
{
for (wp = initdirp; *wp != NUL; ++wp)
@@ -3318,7 +3318,7 @@ gui_mch_browseW(
vim_free(extp);
/* Convert from UCS2 to 'encoding'. */
p = ucs2_to_enc(fileBuf, NULL);
p = utf16_to_enc(fileBuf, NULL);
if (p != NULL)
/* when out of memory we get garbage for non-ASCII chars */
STRCPY(fileBuf, p);
@@ -3335,7 +3335,7 @@ gui_mch_browseW(
/*
* Convert the string s to the proper format for a filter string by replacing
* the \t and \n delimeters with \0.
* the \t and \n delimiters with \0.
* Returns the converted string in allocated memory.
*
* Keep in sync with convert_filterW() above!
@@ -3518,7 +3518,7 @@ _OnDropFiles(
{
#ifdef FEAT_MBYTE
if (DragQueryFileW(hDrop, i, wszFile, BUFPATHLEN) > 0)
fnames[i] = ucs2_to_enc(wszFile, NULL);
fnames[i] = utf16_to_enc(wszFile, NULL);
else
#endif
{
@@ -3674,7 +3674,8 @@ _OnScroll(
* Use "prog" as the name of the program and "cmdline" as the arguments.
* Copy the arguments to allocated memory.
* Return the number of arguments (including program name).
* Return pointers to the arguments in "argvp".
* Return pointers to the arguments in "argvp". Memory is allocated with
* malloc(), use free() instead of vim_free().
* Return pointer to buffer in "tofree".
* Returns zero when out of memory.
*/
@@ -3692,6 +3693,8 @@ get_cmd_args(char *prog, char *cmdline, char ***argvp, char **tofree)
char **argv = NULL;
int round;
*tofree = NULL;
#ifdef FEAT_MBYTE
/* Try using the Unicode version first, it takes care of conversion when
* 'encoding' is changed. */
@@ -3802,15 +3805,15 @@ get_cmd_args(char *prog, char *cmdline, char ***argvp, char **tofree)
argv = (char **)malloc((argc + 1) * sizeof(char *));
if (argv == NULL )
{
vim_free(newcmdline);
free(newcmdline);
return 0; /* malloc error */
}
pnew = newcmdline;
*tofree = newcmdline;
}
}
done:
argv[argc] = NULL; /* NULL-terminated list */
*argvp = argv;
return argc;
+1 -1
View File
@@ -2450,7 +2450,7 @@ find_closest_color(colormap, colorPtr)
*colorPtr = colortable[closest];
}
free(colortable);
vim_free(colortable);
return OK;
}
+8 -1
View File
@@ -531,6 +531,12 @@ Python_Init(void)
if (PythonMod_Init())
goto fail;
/* Remove the element from sys.path that was added because of our
* argv[0] value in PythonMod_Init(). Previously we used an empty
* string, but dependinding on the OS we then get an empty entry or
* the current directory in sys.path. */
PyRun_SimpleString("import sys; sys.path = filter(lambda x: x != '/must>not&exist', sys.path)");
/* the first python thread is vim's, release the lock */
Python_SaveThread();
@@ -2345,7 +2351,8 @@ PythonMod_Init(void)
{
PyObject *mod;
PyObject *dict;
static char *(argv[2]) = {"", NULL};
/* The special value is removed from sys.path in Python_Init(). */
static char *(argv[2]) = {"/must>not&exist/foo", NULL};
/* Fixups... */
BufferType.ob_type = &PyType_Type;
+2 -1
View File
@@ -1114,7 +1114,8 @@ vi_open_file(fname)
char *fname;
{
++no_wait_return;
do_ecmd(0, (char_u *)fname, NULL, NULL, ECMD_ONE, ECMD_HIDE+ECMD_OLDBUF);
do_ecmd(0, (char_u *)fname, NULL, NULL, ECMD_ONE, ECMD_HIDE+ECMD_OLDBUF,
curwin);
curbuf->b_sniff = TRUE;
--no_wait_return; /* [ex_docmd.c] */
}
+3 -3
View File
@@ -737,7 +737,7 @@ ServerReplyFind(w, op)
+ serverReply.ga_len;
e.id = w;
ga_init2(&e.strings, 1, 100);
memcpy(p, &e, sizeof(e));
mch_memmove(p, &e, sizeof(e));
serverReply.ga_len++;
}
}
@@ -1019,7 +1019,7 @@ LookupName(dpy, name, delete, loose)
p++;
count = numItems - (p - regProp);
if (count > 0)
memcpy(entry, p, count);
mch_memmove(entry, p, count);
XChangeProperty(dpy, RootWindow(dpy, 0), registryProperty, XA_STRING,
8, PropModeReplace, regProp,
(int)(numItems - (p - entry)));
@@ -1073,7 +1073,7 @@ DeleteAnyLingerer(dpy, win)
p++;
lastHalf = numItems - (p - regProp);
if (lastHalf > 0)
memcpy(entry, p, lastHalf);
mch_memmove(entry, p, lastHalf);
numItems = (entry - regProp) + lastHalf;
p = entry;
continue;
+14 -4
View File
@@ -660,11 +660,12 @@ main
#ifdef FEAT_VIMINFO
/*
* Read in registers, history etc, but not marks, from the viminfo file
* Read in registers, history etc, but not marks, from the viminfo file.
* This is where v:oldfiles gets filled.
*/
if (*p_viminfo != NUL)
{
read_viminfo(NULL, TRUE, FALSE, FALSE);
read_viminfo(NULL, VIF_WANT_INFO | VIF_GET_OLDFILES);
TIME_MSG("reading viminfo");
}
#endif
@@ -1591,7 +1592,8 @@ parse_command_name(parmp)
early_arg_scan(parmp)
mparm_T *parmp;
{
#if defined(FEAT_XCLIPBOARD) || defined(FEAT_CLIENTSERVER)
#if defined(FEAT_XCLIPBOARD) || defined(FEAT_CLIENTSERVER) \
|| !defined(FEAT_NETBEANS_INTG)
int argc = parmp->argc;
char **argv = parmp->argv;
int i;
@@ -1663,6 +1665,14 @@ early_arg_scan(parmp)
else if (STRICMP(argv[i], "--echo-wid") == 0)
echo_wid_arg = TRUE;
# endif
# ifndef FEAT_NETBEANS_INTG
else if (strncmp(argv[i], "-nb", (size_t)3) == 0)
{
mch_errmsg(_("'-nb' cannot be used: not enabled at compile time\n"));
mch_exit(2);
}
# endif
}
#endif
}
@@ -2669,7 +2679,7 @@ edit_buffers(parmp)
# endif
(void)do_ecmd(0, arg_idx < GARGCOUNT
? alist_name(&GARGLIST[arg_idx]) : NULL,
NULL, NULL, ECMD_LASTL, ECMD_HIDE);
NULL, NULL, ECMD_LASTL, ECMD_HIDE, curwin);
# ifdef HAS_SWAP_EXISTS_ACTION
if (swap_exists_did_quit)
{
+24 -4
View File
@@ -1627,15 +1627,17 @@ write_one_mark(fp_out, c, pos)
/*
* Handle marks in the viminfo file:
* fp_out == NULL read marks for current buffer only
* fp_out != NULL copy marks for buffers not in buffer list
* fp_out != NULL: copy marks for buffers not in buffer list
* fp_out == NULL && (flags & VIF_WANT_MARKS): read marks for curbuf only
* fp_out == NULL && (flags & VIF_GET_OLDFILES | VIF_FORCEIT): fill v:oldfiles
*/
void
copy_viminfo_marks(virp, fp_out, count, eof)
copy_viminfo_marks(virp, fp_out, count, eof, flags)
vir_T *virp;
FILE *fp_out;
int count;
int eof;
int flags;
{
char_u *line = virp->vir_line;
buf_T *buf;
@@ -1647,10 +1649,23 @@ copy_viminfo_marks(virp, fp_out, count, eof)
char_u *p;
char_u *name_buf;
pos_T pos;
#ifdef FEAT_EVAL
list_T *list = NULL;
#endif
if ((name_buf = alloc(LSIZE)) == NULL)
return;
*name_buf = NUL;
#ifdef FEAT_EVAL
if (fp_out == NULL && (flags & (VIF_GET_OLDFILES | VIF_FORCEIT)))
{
list = list_alloc();
if (list != NULL)
set_vim_var_list(VV_OLDFILES, list);
}
#endif
num_marked_files = get_viminfo_parameter('\'');
while (!eof && (count < num_marked_files || fp_out == NULL))
{
@@ -1681,6 +1696,11 @@ copy_viminfo_marks(virp, fp_out, count, eof)
p++;
*p = NUL;
#ifdef FEAT_EVAL
if (list != NULL)
list_append_string(list, str, -1);
#endif
/*
* If fp_out == NULL, load marks for current buffer.
* If fp_out != NULL, copy marks for buffers not in buflist.
@@ -1688,7 +1708,7 @@ copy_viminfo_marks(virp, fp_out, count, eof)
load_marks = copy_marks_out = FALSE;
if (fp_out == NULL)
{
if (curbuf->b_ffname != NULL)
if ((flags & VIF_WANT_MARKS) && curbuf->b_ffname != NULL)
{
if (*name_buf == NUL) /* only need to do this once */
home_replace(NULL, curbuf->b_ffname, name_buf, LSIZE, TRUE);
+6 -6
View File
@@ -3131,7 +3131,7 @@ enc_locale()
else
s = p + 1;
}
for (i = 0; s[i] != NUL && s + i < buf + sizeof(buf) - 1; ++i)
for (i = 0; s[i] != NUL && i < sizeof(buf) - 1; ++i)
{
if (s[i] == '_' || s[i] == '-')
buf[i] = '-';
@@ -5384,7 +5384,7 @@ preedit_draw_cbproc(XIC xic, XPointer client_data, XPointer call_data)
draw_feedback = (char *)alloc(draw_data->chg_first
+ text->length);
else
draw_feedback = realloc(draw_feedback,
draw_feedback = vim_realloc(draw_feedback,
draw_data->chg_first + text->length);
if (draw_feedback != NULL)
{
@@ -6101,7 +6101,7 @@ string_convert_ext(vcp, ptr, lenp, unconvlenp)
/* 1. codepage/UTF-8 -> ucs-2. */
if (vcp->vc_cpfrom == 0)
tmp_len = utf8_to_ucs2(ptr, len, NULL, NULL);
tmp_len = utf8_to_utf16(ptr, len, NULL, NULL);
else
tmp_len = MultiByteToWideChar(vcp->vc_cpfrom, 0,
ptr, len, 0, 0);
@@ -6109,13 +6109,13 @@ string_convert_ext(vcp, ptr, lenp, unconvlenp)
if (tmp == NULL)
break;
if (vcp->vc_cpfrom == 0)
utf8_to_ucs2(ptr, len, tmp, unconvlenp);
utf8_to_utf16(ptr, len, tmp, unconvlenp);
else
MultiByteToWideChar(vcp->vc_cpfrom, 0, ptr, len, tmp, tmp_len);
/* 2. ucs-2 -> codepage/UTF-8. */
if (vcp->vc_cpto == 0)
retlen = ucs2_to_utf8(tmp, tmp_len, NULL);
retlen = utf16_to_utf8(tmp, tmp_len, NULL);
else
retlen = WideCharToMultiByte(vcp->vc_cpto, 0,
tmp, tmp_len, 0, 0, 0, 0);
@@ -6123,7 +6123,7 @@ string_convert_ext(vcp, ptr, lenp, unconvlenp)
if (retval != NULL)
{
if (vcp->vc_cpto == 0)
ucs2_to_utf8(tmp, tmp_len, retval);
utf16_to_utf8(tmp, tmp_len, retval);
else
WideCharToMultiByte(vcp->vc_cpto, 0,
tmp, tmp_len, retval, retlen, 0, 0);
+5 -5
View File
@@ -3245,9 +3245,9 @@ prompt_for_number(mouse_used)
/* When using ":silent" assume that <CR> was entered. */
if (mouse_used != NULL)
MSG_PUTS(_("Type number or click with mouse (<Enter> cancels): "));
MSG_PUTS(_("Type number and <Enter> or click with mouse (empty cancels): "));
else
MSG_PUTS(_("Choice number (<Enter> cancels): "));
MSG_PUTS(_("Type number and <Enter> (empty cancels): "));
/* Set the state such that text can be selected/copied/pasted and we still
* get mouse events. */
@@ -8728,7 +8728,7 @@ dos_expandpath(
/* The active codepage differs from 'encoding'. Attempt using the
* wide function. If it fails because it is not implemented fall back
* to the non-wide version (for Windows 98) */
wn = enc_to_ucs2(buf, NULL);
wn = enc_to_utf16(buf, NULL);
if (wn != NULL)
{
hFind = FindFirstFileW(wn, &wfb);
@@ -8756,7 +8756,7 @@ dos_expandpath(
#ifdef WIN3264
# ifdef FEAT_MBYTE
if (wn != NULL)
p = ucs2_to_enc(wfb.cFileName, NULL); /* p is allocated here */
p = utf16_to_enc(wfb.cFileName, NULL); /* p is allocated here */
else
# endif
p = (char_u *)fb.cFileName;
@@ -8830,7 +8830,7 @@ dos_expandpath(
if (wn != NULL)
{
vim_free(wn);
wn = enc_to_ucs2(buf, NULL);
wn = enc_to_utf16(buf, NULL);
if (wn != NULL)
hFind = FindFirstFileW(wn, &wfb);
}
+1 -1
View File
@@ -873,7 +873,7 @@ lalloc(size, message)
/* 3. check for available memory: call mch_avail_mem() */
if (mch_avail_mem(TRUE) < KEEP_ROOM && !releasing)
{
vim_free((char *)p); /* System is low... no go! */
free((char *)p); /* System is low... no go! */
p = NULL;
}
else
+14 -5
View File
@@ -280,18 +280,20 @@ update_topline()
if (curwin->w_botline <= curbuf->b_ml.ml_line_count)
{
if (curwin->w_cursor.lnum < curwin->w_botline
&& ((long)curwin->w_cursor.lnum
if (curwin->w_cursor.lnum < curwin->w_botline)
{
if (((long)curwin->w_cursor.lnum
>= (long)curwin->w_botline - p_so
#ifdef FEAT_FOLDING
|| hasAnyFolding(curwin)
#endif
))
{
{
lineoff_T loff;
/* Cursor is above botline, check if there are 'scrolloff'
* window lines below the cursor. If not, need to scroll. */
/* Cursor is (a few lines) above botline, check if there are
* 'scrolloff' window lines below the cursor. If not, need to
* scroll. */
n = curwin->w_empty_rows;
loff.lnum = curwin->w_cursor.lnum;
#ifdef FEAT_FOLDING
@@ -317,6 +319,10 @@ update_topline()
if (n >= p_so)
/* sufficient context, no need to scroll */
check_botline = FALSE;
}
else
/* sufficient context, no need to scroll */
check_botline = FALSE;
}
if (check_botline)
{
@@ -509,6 +515,9 @@ set_topline(wp, lnum)
/* Approximate the value of w_botline */
wp->w_botline += lnum - wp->w_topline;
wp->w_topline = lnum;
#ifdef FEAT_AUTOCMD
wp->w_topline_was_set = TRUE;
#endif
#ifdef FEAT_DIFF
wp->w_topfill = 0;
#endif
+3 -3
View File
@@ -1795,7 +1795,7 @@ nb_do_cmd(
buf->displayname = NULL;
netbeansReadFile = 0; /* don't try to open disk file */
do_ecmd(0, NULL, 0, 0, ECMD_ONE, ECMD_HIDE + ECMD_OLDBUF);
do_ecmd(0, NULL, 0, 0, ECMD_ONE, ECMD_HIDE + ECMD_OLDBUF, curwin);
netbeansReadFile = 1;
buf->bufp = curbuf;
maketitle();
@@ -1960,7 +1960,7 @@ nb_do_cmd(
netbeansReadFile = 0; /* don't try to open disk file */
do_ecmd(0, (char_u *)buf->displayname, 0, 0, ECMD_ONE,
ECMD_HIDE + ECMD_OLDBUF);
ECMD_HIDE + ECMD_OLDBUF, curwin);
netbeansReadFile = 1;
buf->bufp = curbuf;
maketitle();
@@ -1979,7 +1979,7 @@ nb_do_cmd(
vim_free(buf->displayname);
buf->displayname = nb_unquote(args, NULL);
do_ecmd(0, (char_u *)buf->displayname, NULL, NULL, ECMD_ONE,
ECMD_HIDE + ECMD_OLDBUF);
ECMD_HIDE + ECMD_OLDBUF, curwin);
buf->bufp = curbuf;
buf->initDone = TRUE;
doupdate = 1;
+36 -6
View File
@@ -183,6 +183,8 @@ static void nv_drop __ARGS((cmdarg_T *cap));
static void nv_cursorhold __ARGS((cmdarg_T *cap));
#endif
static char *e_noident = N_("E349: No identifier under cursor");
/*
* Function to be called for a Normal or Visual mode command.
* The argument is a cmdarg_T.
@@ -578,6 +580,9 @@ normal_cmd(oap, toplevel)
static int old_mapped_len = 0;
#endif
int idx;
#ifdef FEAT_EVAL
int set_prevcount = FALSE;
#endif
vim_memset(&ca, 0, sizeof(ca)); /* also resets ca.retval */
ca.oap = oap;
@@ -613,7 +618,12 @@ normal_cmd(oap, toplevel)
/* When not finishing an operator and no register name typed, reset the
* count. */
if (!finish_op && !oap->regname)
{
ca.opcount = 0;
#ifdef FEAT_EVAL
set_prevcount = TRUE;
#endif
}
#ifdef FEAT_AUTOCMD
/* Restore counts from before receiving K_CURSORHOLD. This means after
@@ -717,7 +727,15 @@ getcount:
* command, so that v:count can be used in an expression mapping
* right after the count. */
if (toplevel && stuff_empty())
set_vcount(ca.count0, ca.count0 == 0 ? 1 : ca.count0);
{
long count = ca.count0;
/* multiply with ca.opcount the same way as below */
if (ca.opcount != 0)
count = ca.opcount * (count == 0 ? 1 : count);
set_vcount(count, count == 0 ? 1 : count, set_prevcount);
set_prevcount = FALSE; /* only set v:prevcount once */
}
#endif
if (ctrl_w)
{
@@ -804,7 +822,7 @@ getcount:
* Only set v:count when called from main() and not a stuffed command.
*/
if (toplevel && stuff_empty())
set_vcount(ca.count0, ca.count1);
set_vcount(ca.count0, ca.count1, set_prevcount);
#endif
/*
@@ -1132,7 +1150,8 @@ getcount:
out_flush();
#endif
#ifdef FEAT_AUTOCMD
did_cursorhold = FALSE;
if (ca.cmdchar != K_IGNORE)
did_cursorhold = FALSE;
#endif
State = NORMAL;
@@ -3511,7 +3530,7 @@ find_ident_at_pos(wp, lnum, startcol, string, find_type)
if (find_type & FIND_STRING)
EMSG(_("E348: No string under cursor"));
else
EMSG(_("E349: No identifier under cursor"));
EMSG(_(e_noident));
return 0;
}
ptr += col;
@@ -5490,8 +5509,17 @@ nv_ident(cap)
{
/* An external command will probably use an argument starting
* with "-" as an option. To avoid trouble we skip the "-". */
while (*ptr == '-')
while (*ptr == '-' && n > 0)
{
++ptr;
--n;
}
if (n == 0)
{
EMSG(_(e_noident)); /* found dashes only */
vim_free(buf);
return;
}
/* When a count is given, turn it into a range. Is this
* really what we want? */
@@ -5538,7 +5566,9 @@ nv_ident(cap)
if (cmdchar == 'K' && !kp_help)
{
/* Escape the argument properly for a shell command */
ptr = vim_strnsave(ptr, n);
p = vim_strsave_shellescape(ptr, TRUE);
vim_free(ptr);
if (p == NULL)
{
vim_free(buf);
@@ -6055,7 +6085,7 @@ nv_gotofile(cap)
autowrite(curbuf, FALSE);
setpcmark();
(void)do_ecmd(0, ptr, NULL, NULL, ECMD_LAST,
P_HID(curbuf) ? ECMD_HIDE : 0);
P_HID(curbuf) ? ECMD_HIDE : 0, curwin);
if (cap->nchar == 'F' && lnum >= 0)
{
curwin->w_cursor.lnum = lnum;
+27 -3
View File
@@ -138,6 +138,9 @@
#define PV_ML OPT_BUF(BV_ML)
#define PV_MOD OPT_BUF(BV_MOD)
#define PV_MPS OPT_BUF(BV_MPS)
#ifdef FEAT_GUI_MACVIM
#define PV_MMTA OPT_BUF(BV_MMTA)
#endif
#define PV_NF OPT_BUF(BV_NF)
#ifdef FEAT_OSFILETYPE
# define PV_OFT OPT_BUF(BV_OFT)
@@ -322,6 +325,9 @@ static int p_lisp;
#endif
static int p_ml;
static int p_ma;
#ifdef FEAT_GUI_MACVIM
static int p_mmta;
#endif
static int p_mod;
static char_u *p_mps;
static char_u *p_nf;
@@ -1658,6 +1664,13 @@ static struct vimoption
(char_u *)&p_macatsui, PV_NONE,
{(char_u *)TRUE, (char_u *)0L}},
#endif
{"macmeta", "mmta", P_BOOL|P_VI_DEF,
#ifdef FEAT_GUI_MACVIM
(char_u *)&p_mmta, PV_MMTA,
#else
(char_u *)NULL, PV_NONE,
#endif
{(char_u *)FALSE, (char_u *)0L}},
{"magic", NULL, P_BOOL|P_VI_DEF,
(char_u *)&p_magic, PV_NONE,
{(char_u *)TRUE, (char_u *)0L}},
@@ -2618,13 +2631,13 @@ static struct vimoption
#ifdef FEAT_VIMINFO
(char_u *)&p_viminfo, PV_NONE,
#if defined(MSDOS) || defined(MSWIN) || defined(OS2)
{(char_u *)"", (char_u *)"'20,<50,s10,h,rA:,rB:"}
{(char_u *)"", (char_u *)"'100,<50,s10,h,rA:,rB:"}
#else
# ifdef AMIGA
{(char_u *)"",
(char_u *)"'20,<50,s10,h,rdf0:,rdf1:,rdf2:"}
(char_u *)"'100,<50,s10,h,rdf0:,rdf1:,rdf2:"}
# else
{(char_u *)"", (char_u *)"'20,<50,s10,h"}
{(char_u *)"", (char_u *)"'100,<50,s10,h"}
# endif
#endif
#else
@@ -8089,6 +8102,11 @@ set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags)
else /* curwin->w_p_scr > curwin->w_height */
curwin->w_p_scr = curwin->w_height;
}
if (p_hi < 0)
{
errmsg = e_positive;
p_hi = 0;
}
if (p_report < 0)
{
errmsg = e_positive;
@@ -9235,6 +9253,9 @@ get_varp(p)
#endif
case PV_ML: return (char_u *)&(curbuf->b_p_ml);
case PV_MPS: return (char_u *)&(curbuf->b_p_mps);
#ifdef FEAT_GUI_MACVIM
case PV_MMTA: return (char_u *)&(curbuf->b_p_mmta);
#endif
case PV_MA: return (char_u *)&(curbuf->b_p_ma);
case PV_MOD: return (char_u *)&(curbuf->b_changed);
case PV_NF: return (char_u *)&(curbuf->b_p_nf);
@@ -9606,6 +9627,9 @@ buf_copy_options(buf, flags)
#ifdef FEAT_KEYMAP
buf->b_p_keymap = vim_strsave(p_keymap);
buf->b_kmap_state |= KEYMAP_INIT;
#endif
#ifdef FEAT_GUI_MACVIM
buf->b_p_mmta = p_mmta;
#endif
/* This isn't really an option, but copying the langmap and IME
* state from the current buffer is better than resetting it. */
+3
View File
@@ -981,6 +981,9 @@ enum
, BV_ML
, BV_MOD
, BV_MPS
#ifdef FEAT_GUI_MACVIM
, BV_MMTA
#endif
, BV_NF
#ifdef FEAT_OSFILETYPE
, BV_OFT
+57 -32
View File
@@ -309,7 +309,7 @@ mch_settitle(
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{
/* Convert the title from 'encoding' to the active codepage. */
WCHAR *wp = enc_to_ucs2(title, NULL);
WCHAR *wp = enc_to_utf16(title, NULL);
int n;
if (wp != NULL)
@@ -406,10 +406,10 @@ mch_FullName(
* - invoke _wfullpath()
* - convert the result from UCS2 to 'encoding'.
*/
wname = enc_to_ucs2(fname, NULL);
wname = enc_to_utf16(fname, NULL);
if (wname != NULL && _wfullpath(wbuf, wname, MAX_PATH - 1) != NULL)
{
cname = ucs2_to_enc((short_u *)wbuf, NULL);
cname = utf16_to_enc((short_u *)wbuf, NULL);
if (cname != NULL)
{
vim_strncpy(buf, cname, len - 1);
@@ -507,7 +507,7 @@ vim_stat(const char *name, struct stat *stp)
# endif
)
{
WCHAR *wp = enc_to_ucs2(buf, NULL);
WCHAR *wp = enc_to_utf16(buf, NULL);
int n;
if (wp != NULL)
@@ -668,7 +668,7 @@ mch_chdir(char *path)
#ifdef FEAT_MBYTE
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{
WCHAR *p = enc_to_ucs2(path, NULL);
WCHAR *p = enc_to_utf16(path, NULL);
int n;
if (p != NULL)
@@ -891,19 +891,20 @@ mch_libcall(
#if defined(FEAT_MBYTE) || defined(PROTO)
/*
* Convert an UTF-8 string to UCS-2.
* Convert an UTF-8 string to UTF-16.
* "instr[inlen]" is the input. "inlen" is in bytes.
* When "outstr" is NULL only return the number of UCS-2 words produced.
* When "outstr" is NULL only return the number of UTF-16 words produced.
* Otherwise "outstr" must be a buffer of sufficient size.
* Returns the number of UCS-2 words produced.
* Returns the number of UTF-16 words produced.
*/
int
utf8_to_ucs2(char_u *instr, int inlen, short_u *outstr, int *unconvlenp)
utf8_to_utf16(char_u *instr, int inlen, short_u *outstr, int *unconvlenp)
{
int outlen = 0;
char_u *p = instr;
int todo = inlen;
int l;
int ch;
while (todo > 0)
{
@@ -917,8 +918,19 @@ utf8_to_ucs2(char_u *instr, int inlen, short_u *outstr, int *unconvlenp)
break;
}
if (outstr != NULL)
*outstr++ = utf_ptr2char(p);
ch = utf_ptr2char(p);
if (ch >= 0x10000)
{
/* non-BMP character, encoding with surrogate pairs */
++outlen;
if (outstr != NULL)
{
*outstr++ = (0xD800 - (0x10000 >> 10)) + (ch >> 10);
*outstr++ = 0xDC00 | (ch & 0x3FF);
}
}
else if (outstr != NULL)
*outstr++ = ch;
++outlen;
p += l;
todo -= l;
@@ -928,29 +940,42 @@ utf8_to_ucs2(char_u *instr, int inlen, short_u *outstr, int *unconvlenp)
}
/*
* Convert an UCS-2 string to UTF-8.
* The input is "instr[inlen]" with "inlen" in number of ucs-2 words.
* Convert an UTF-16 string to UTF-8.
* The input is "instr[inlen]" with "inlen" in number of UTF-16 words.
* When "outstr" is NULL only return the required number of bytes.
* Otherwise "outstr" must be a buffer of sufficient size.
* Return the number of bytes produced.
*/
int
ucs2_to_utf8(short_u *instr, int inlen, char_u *outstr)
utf16_to_utf8(short_u *instr, int inlen, char_u *outstr)
{
int outlen = 0;
int todo = inlen;
short_u *p = instr;
int l;
int ch, ch2;
while (todo > 0)
{
ch = *p;
if (ch >= 0xD800 && ch <= 0xDBFF && todo > 1)
{
/* surrogate pairs handling */
ch2 = p[1];
if (ch2 >= 0xDC00 && ch2 <= 0xDFFF)
{
ch = ((ch - 0xD800) << 10) + (ch2 & 0x3FF) + 0x10000;
++p;
--todo;
}
}
if (outstr != NULL)
{
l = utf_char2bytes(*p, outstr);
l = utf_char2bytes(ch, outstr);
outstr += l;
}
else
l = utf_char2len(*p);
l = utf_char2len(ch);
++p;
outlen += l;
--todo;
@@ -1079,14 +1104,14 @@ crnl_to_nl(const char_u *str, int *size)
*/
/*
* Convert "str" from 'encoding' to UCS-2.
* Convert "str" from 'encoding' to UTF-16.
* Input in "str" with length "*lenp". When "lenp" is NULL, use strlen().
* Output is returned as an allocated string. "*lenp" is set to the length of
* the result. A trailing NUL is always added.
* Returns NULL when out of memory.
*/
short_u *
enc_to_ucs2(char_u *str, int *lenp)
enc_to_utf16(char_u *str, int *lenp)
{
vimconv_T conv;
WCHAR *ret;
@@ -1102,7 +1127,7 @@ enc_to_ucs2(char_u *str, int *lenp)
if (enc_codepage > 0)
{
/* We can do any CP### -> UCS-2 in one pass, and we can do it
/* We can do any CP### -> UTF-16 in one pass, and we can do it
* without iconv() (convert_* may need iconv). */
MultiByteToWideChar_alloc(enc_codepage, 0, str, *lenp, &ret, &length);
}
@@ -1123,11 +1148,11 @@ enc_to_ucs2(char_u *str, int *lenp)
}
convert_setup(&conv, NULL, NULL);
length = utf8_to_ucs2(str, *lenp, NULL, NULL);
length = utf8_to_utf16(str, *lenp, NULL, NULL);
ret = (WCHAR *)alloc((unsigned)((length + 1) * sizeof(WCHAR)));
if (ret != NULL)
{
utf8_to_ucs2(str, *lenp, (short_u *)ret, NULL);
utf8_to_utf16(str, *lenp, (short_u *)ret, NULL);
ret[length] = 0;
}
@@ -1139,7 +1164,7 @@ enc_to_ucs2(char_u *str, int *lenp)
}
/*
* Convert an UCS-2 string to 'encoding'.
* Convert an UTF-16 string to 'encoding'.
* Input in "str" with length (counted in wide characters) "*lenp". When
* "lenp" is NULL, use wcslen().
* Output is returned as an allocated string. If "*lenp" is not NULL it is
@@ -1147,7 +1172,7 @@ enc_to_ucs2(char_u *str, int *lenp)
* Returns NULL when out of memory.
*/
char_u *
ucs2_to_enc(short_u *str, int *lenp)
utf16_to_enc(short_u *str, int *lenp)
{
vimconv_T conv;
char_u *utf8_str = NULL, *enc_str = NULL;
@@ -1161,7 +1186,7 @@ ucs2_to_enc(short_u *str, int *lenp)
if (enc_codepage > 0)
{
/* We can do any UCS-2 -> CP### in one pass. */
/* We can do any UTF-16 -> CP### in one pass. */
int length;
WideCharToMultiByte_alloc(enc_codepage, 0, str, *lenp,
@@ -1171,10 +1196,10 @@ ucs2_to_enc(short_u *str, int *lenp)
}
/* Avoid allocating zero bytes, it generates an error message. */
utf8_str = alloc(ucs2_to_utf8(str, *lenp == 0 ? 1 : *lenp, NULL));
utf8_str = alloc(utf16_to_utf8(str, *lenp == 0 ? 1 : *lenp, NULL));
if (utf8_str != NULL)
{
*lenp = ucs2_to_utf8(str, *lenp, utf8_str);
*lenp = utf16_to_utf8(str, *lenp, utf8_str);
/* We might be called before we have p_enc set up. */
conv.vc_type = CONV_NONE;
@@ -1308,7 +1333,7 @@ clip_mch_request_selection(VimClipboard *cbd)
if (hMemWstr[str_size] == NUL)
break;
}
to_free = str = ucs2_to_enc((short_u *)hMemWstr, &str_size);
to_free = str = utf16_to_enc((short_u *)hMemWstr, &str_size);
GlobalUnlock(hMemW);
}
}
@@ -1340,7 +1365,7 @@ clip_mch_request_selection(VimClipboard *cbd)
# if defined(FEAT_MBYTE) && defined(WIN3264)
/* The text is in the active codepage. Convert to 'encoding',
* going through UCS-2. */
* going through UTF-16. */
acp_to_enc(str, str_size, &to_free, &maxlen);
if (to_free != NULL)
{
@@ -1404,7 +1429,7 @@ acp_to_enc(str, str_size, out, outlen)
if (widestr != NULL)
{
++*outlen; /* Include the 0 after the string */
*out = ucs2_to_enc((short_u *)widestr, outlen);
*out = utf16_to_enc((short_u *)widestr, outlen);
vim_free(widestr);
}
}
@@ -1466,9 +1491,9 @@ clip_mch_set_selection(VimClipboard *cbd)
WCHAR *out;
int len = metadata.txtlen;
/* Convert the text to UCS-2. This is put on the clipboard as
/* Convert the text to UTF-16. This is put on the clipboard as
* CF_UNICODETEXT. */
out = (WCHAR *)enc_to_ucs2(str, &len);
out = (WCHAR *)enc_to_utf16(str, &len);
if (out != NULL)
{
WCHAR *lpszMemW;
@@ -1488,7 +1513,7 @@ clip_mch_set_selection(VimClipboard *cbd)
WideCharToMultiByte(GetACP(), 0, out, len,
str, metadata.txtlen, 0, 0);
/* Allocate memory for the UCS-2 text, add one NUL word to
/* Allocate memory for the UTF-16 text, add one NUL word to
* terminate the string. */
hMemW = (LPSTR)GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE,
(len + 1) * sizeof(WCHAR));
+5 -3
View File
@@ -2907,7 +2907,7 @@ mch_early_init()
* Ignore any errors.
*/
#if defined(HAVE_SIGALTSTACK) || defined(HAVE_SIGSTACK)
signal_stack = malloc(SIGSTKSZ);
signal_stack = (char *)alloc(SIGSTKSZ);
init_signal_stack();
#endif
}
@@ -2938,7 +2938,8 @@ mch_free_mem()
}
# endif
# endif
# ifdef FEAT_X11
/* Don't close the display for GTK 1, it is done in exit(). */
# if defined(FEAT_X11) && (!defined(FEAT_GUI_GTK) || defined(HAVE_GTK2))
if (x11_display != NULL
# ifdef FEAT_XCLIPBOARD
&& x11_display != xterm_dpy
@@ -6816,7 +6817,8 @@ xsmp_close()
if (xsmp_icefd != -1)
{
SmcCloseConnection(xsmp.smcconn, 0, NULL);
vim_free(xsmp.clientid);
if (xsmp.clientid != NULL)
free(xsmp.clientid);
xsmp.clientid = NULL;
xsmp_icefd = -1;
}
+6 -6
View File
@@ -228,7 +228,7 @@ mch_getenv(char_u *lognam)
else if ((sbuf = getenv((char *)lognam)))
{
lengte = strlen(sbuf) + 1;
cp = (char_u *)malloc((size_t)lengte);
cp = (char_u *)alloc((size_t)lengte);
if (cp)
strcpy((char *)cp, sbuf);
return cp;
@@ -381,7 +381,7 @@ vms_wproc(char *name, int val)
if (--vms_match_free == 0) {
/* add more space to store matches */
vms_match_alloced += EXPL_ALLOC_INC;
vms_fmatch = (char_u **)realloc(vms_fmatch,
vms_fmatch = (char_u **)vim_realloc(vms_fmatch,
sizeof(char **) * vms_match_alloced);
if (!vms_fmatch)
return 0;
@@ -460,7 +460,7 @@ mch_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file, i
if (--files_free < 1)
{
files_alloced += EXPL_ALLOC_INC;
*file = (char_u **)realloc(*file,
*file = (char_u **)vim_realloc(*file,
sizeof(char_u **) * files_alloced);
if (*file == NULL)
{
@@ -614,14 +614,14 @@ vms_fixfilename(void *instring)
{
buflen = len + 128;
if (buf)
buf = (char *)realloc(buf, buflen);
buf = (char *)vim_realloc(buf, buflen);
else
buf = (char *)calloc(buflen, sizeof(char));
buf = (char *)alloc(buflen * sizeof(char));
}
#ifdef DEBUG
char *tmpbuf = NULL;
tmpbuf = (char *)calloc(buflen, sizeof(char));
tmpbuf = (char *)alloc(buflen * sizeof(char));
strcpy(tmpbuf, instring);
#endif
+2 -1
View File
@@ -129,7 +129,8 @@ WinMain(
errout:
#endif
free(argv);
free(tofree);
if (tofree != NULL)
free(tofree);
#ifdef FEAT_MBYTE
free_cmd_argsW();
#endif
+2 -1
View File
@@ -121,7 +121,8 @@ WinMain(
pmain(argc, argv);
free(argv);
free(tofree);
if (tofree != NULL)
free(tofree);
return 0;
}
+18 -18
View File
@@ -1587,7 +1587,7 @@ executable_exists(char *name)
#ifdef FEAT_MBYTE
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{
WCHAR *p = enc_to_ucs2(name, NULL);
WCHAR *p = enc_to_utf16(name, NULL);
WCHAR fnamew[_MAX_PATH];
WCHAR *dumw;
long n;
@@ -2440,7 +2440,7 @@ mch_dirname(
if (GetCurrentDirectoryW(_MAX_PATH, wbuf) != 0)
{
char_u *p = ucs2_to_enc(wbuf, NULL);
char_u *p = utf16_to_enc(wbuf, NULL);
if (p != NULL)
{
@@ -2466,7 +2466,7 @@ mch_getperm(char_u *name)
#ifdef FEAT_MBYTE
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{
WCHAR *p = enc_to_ucs2(name, NULL);
WCHAR *p = enc_to_utf16(name, NULL);
long n;
if (p != NULL)
@@ -2495,7 +2495,7 @@ mch_setperm(
#ifdef FEAT_MBYTE
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{
WCHAR *p = enc_to_ucs2(name, NULL);
WCHAR *p = enc_to_utf16(name, NULL);
long n;
if (p != NULL)
@@ -2522,7 +2522,7 @@ mch_hide(char_u *name)
WCHAR *p = NULL;
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
p = enc_to_ucs2(name, NULL);
p = enc_to_utf16(name, NULL);
#endif
#ifdef FEAT_MBYTE
@@ -2590,7 +2590,7 @@ mch_is_linked(char_u *fname)
WCHAR *wn = NULL;
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
wn = enc_to_ucs2(fname, NULL);
wn = enc_to_utf16(fname, NULL);
if (wn != NULL)
{
hFile = CreateFileW(wn, /* file name */
@@ -4239,7 +4239,7 @@ mch_remove(char_u *name)
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{
wn = enc_to_ucs2(name, NULL);
wn = enc_to_utf16(name, NULL);
if (wn != NULL)
{
SetFileAttributesW(wn, FILE_ATTRIBUTE_NORMAL);
@@ -4382,8 +4382,8 @@ mch_rename(
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{
wold = enc_to_ucs2((char_u *)pszOldFile, NULL);
wnew = enc_to_ucs2((char_u *)pszNewFile, NULL);
wold = enc_to_utf16((char_u *)pszOldFile, NULL);
wnew = enc_to_utf16((char_u *)pszNewFile, NULL);
if (wold != NULL && wnew != NULL)
retval = mch_wrename(wold, wnew);
vim_free(wold);
@@ -4492,7 +4492,7 @@ mch_access(char *n, int p)
WCHAR *wn = NULL;
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
wn = enc_to_ucs2(n, NULL);
wn = enc_to_utf16(n, NULL);
#endif
if (mch_isdir(n))
@@ -4618,7 +4618,7 @@ getout:
#if defined(FEAT_MBYTE) || defined(PROTO)
/*
* Version of open() that may use ucs2 file name.
* Version of open() that may use UTF-16 file name.
*/
int
mch_open(char *name, int flags, int mode)
@@ -4630,7 +4630,7 @@ mch_open(char *name, int flags, int mode)
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{
wn = enc_to_ucs2(name, NULL);
wn = enc_to_utf16(name, NULL);
if (wn != NULL)
{
f = _wopen(wn, flags, mode);
@@ -4648,7 +4648,7 @@ mch_open(char *name, int flags, int mode)
}
/*
* Version of fopen() that may use ucs2 file name.
* Version of fopen() that may use UTF-16 file name.
*/
FILE *
mch_fopen(char *name, char *mode)
@@ -4675,8 +4675,8 @@ mch_fopen(char *name, char *mode)
else if (newMode == 'b')
_set_fmode(_O_BINARY);
# endif
wn = enc_to_ucs2(name, NULL);
wm = enc_to_ucs2(mode, NULL);
wn = enc_to_utf16(name, NULL);
wm = enc_to_utf16(mode, NULL);
if (wn != NULL && wm != NULL)
f = _wfopen(wn, wm);
vim_free(wn);
@@ -4776,8 +4776,8 @@ copy_infostreams(char_u *from, char_u *to)
int len;
/* Convert the file names to wide characters. */
fromw = enc_to_ucs2(from, NULL);
tow = enc_to_ucs2(to, NULL);
fromw = enc_to_utf16(from, NULL);
tow = enc_to_utf16(to, NULL);
if (fromw != NULL && tow != NULL)
{
/* Open the file for reading. */
@@ -5122,7 +5122,7 @@ fix_arg_enc(void)
for (i = 0; i < used_file_count; ++i)
{
idx = used_file_indexes[i];
str = ucs2_to_enc(ArglistW[idx], NULL);
str = utf16_to_enc(ArglistW[idx], NULL);
if (str != NULL)
{
#ifdef FEAT_DIFF
+1 -1
View File
@@ -573,7 +573,7 @@ pum_set_selected(n, repeat)
{
/* Don't want to sync undo in the current buffer. */
++no_u_sync;
res = do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, 0);
res = do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, 0, NULL);
--no_u_sync;
if (res == OK)
{
+1 -1
View File
@@ -33,7 +33,7 @@ buf_T *setaltfname __ARGS((char_u *ffname, char_u *sfname, linenr_T lnum));
char_u *getaltfname __ARGS((int errmsg));
int buflist_add __ARGS((char_u *fname, int flags));
void buflist_slash_adjust __ARGS((void));
void buflist_altfpos __ARGS((void));
void buflist_altfpos __ARGS((win_T *win));
int otherfile __ARGS((char_u *ffname));
void buf_setino __ARGS((buf_T *buf));
void fileinfo __ARGS((int fullname, int shorthelp, int dont_truncate));
+7 -2
View File
@@ -17,7 +17,7 @@ void eval_patch __ARGS((char_u *origfile, char_u *difffile, char_u *outfile));
int eval_to_bool __ARGS((char_u *arg, int *error, char_u **nextcmd, int skip));
char_u *eval_to_string_skip __ARGS((char_u *arg, char_u **nextcmd, int skip));
int skip_expr __ARGS((char_u **pp));
char_u *eval_to_string __ARGS((char_u *arg, char_u **nextcmd, int dolist));
char_u *eval_to_string __ARGS((char_u *arg, char_u **nextcmd, int convert));
char_u *eval_to_string_safe __ARGS((char_u *arg, char_u **nextcmd, int use_sandbox));
int eval_to_number __ARGS((char_u *expr));
list_T *eval_spell_expr __ARGS((char_u *badword, char_u *expr));
@@ -46,7 +46,9 @@ list_T *list_alloc __ARGS((void));
void list_unref __ARGS((list_T *l));
void list_free __ARGS((list_T *l, int recurse));
dictitem_T *dict_lookup __ARGS((hashitem_T *hi));
char_u *list_find_str __ARGS((list_T *l, long idx));
int list_append_dict __ARGS((list_T *list, dict_T *dict));
int list_append_string __ARGS((list_T *l, char_u *str, int len));
int garbage_collect __ARGS((void));
dict_T *dict_alloc __ARGS((void));
int dict_add_nr_str __ARGS((dict_T *d, char *key, long nr, char_u *str));
@@ -58,8 +60,10 @@ long do_searchpair __ARGS((char_u *spat, char_u *mpat, char_u *epat, int dir, ch
void set_vim_var_nr __ARGS((int idx, long val));
long get_vim_var_nr __ARGS((int idx));
char_u *get_vim_var_str __ARGS((int idx));
void set_vcount __ARGS((long count, long count1));
list_T *get_vim_var_list __ARGS((int idx));
void set_vcount __ARGS((long count, long count1, int set_prevcount));
void set_vim_var_string __ARGS((int idx, char_u *val, int len));
void set_vim_var_list __ARGS((int idx, list_T *val));
void set_reg_var __ARGS((int c));
char_u *v_exception __ARGS((char_u *oldval));
char_u *v_throwpoint __ARGS((char_u *oldval));
@@ -94,6 +98,7 @@ int read_viminfo_varlist __ARGS((vir_T *virp, int writing));
void write_viminfo_varlist __ARGS((FILE *fp));
int store_session_globals __ARGS((FILE *fd));
void last_set_msg __ARGS((scid_T scriptID));
void ex_oldfiles __ARGS((exarg_T *eap));
int modify_fname __ARGS((char_u *src, int *usedlen, char_u **fnamep, char_u **bufp, int *fnamelen));
char_u *do_string_sub __ARGS((char_u *str, char_u *pat, char_u *sub, char_u *flags));
/* vim: set ft=c : */
+2 -2
View File
@@ -11,7 +11,7 @@ void do_shell __ARGS((char_u *cmd, int flags));
char_u *make_filter_cmd __ARGS((char_u *cmd, char_u *itmp, char_u *otmp));
void append_redir __ARGS((char_u *buf, char_u *opt, char_u *fname));
int viminfo_error __ARGS((char *errnum, char *message, char_u *line));
int read_viminfo __ARGS((char_u *file, int want_info, int want_marks, int forceit));
int read_viminfo __ARGS((char_u *file, int flags));
void write_viminfo __ARGS((char_u *file, int forceit));
int viminfo_readline __ARGS((vir_T *virp));
char_u *viminfo_readstring __ARGS((vir_T *virp, int off, int convert));
@@ -27,7 +27,7 @@ void ex_wnext __ARGS((exarg_T *eap));
void do_wqall __ARGS((exarg_T *eap));
int not_writing __ARGS((void));
int getfile __ARGS((int fnum, char_u *ffname, char_u *sfname, int setpm, linenr_T lnum, int forceit));
int do_ecmd __ARGS((int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T newlnum, int flags));
int do_ecmd __ARGS((int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T newlnum, int flags, win_T *oldwin));
void ex_append __ARGS((exarg_T *eap));
void ex_change __ARGS((exarg_T *eap));
void ex_z __ARGS((exarg_T *eap));
+5
View File
@@ -207,3 +207,8 @@ int is_valid_macaction(char_u *action);
void gui_macvim_wait_for_startup();
void gui_macvim_get_window_layout(int *count, int *layout);
void
gui_mch_find_dialog(exarg_T *eap);
void
gui_mch_replace_dialog(exarg_T *eap);
+1 -1
View File
@@ -26,5 +26,5 @@ int read_viminfo_filemark __ARGS((vir_T *virp, int force));
void write_viminfo_filemarks __ARGS((FILE *fp));
int removable __ARGS((char_u *name));
int write_viminfo_marks __ARGS((FILE *fp_out));
void copy_viminfo_marks __ARGS((vir_T *virp, FILE *fp_out, int count, int eof));
void copy_viminfo_marks __ARGS((vir_T *virp, FILE *fp_out, int count, int eof, int flags));
/* vim: set ft=c : */
+4 -4
View File
@@ -22,14 +22,14 @@ int mch_chdir __ARGS((char *path));
int can_end_termcap_mode __ARGS((int give_msg));
int mch_screenmode __ARGS((char_u *arg));
int mch_libcall __ARGS((char_u *libname, char_u *funcname, char_u *argstring, int argint, char_u **string_result, int *number_result));
int utf8_to_ucs2 __ARGS((char_u *instr, int inlen, short_u *outstr, int *unconvlenp));
int ucs2_to_utf8 __ARGS((short_u *instr, int inlen, char_u *outstr));
int utf8_to_utf16 __ARGS((char_u *instr, int inlen, short_u *outstr, int *unconvlenp));
int utf16_to_utf8 __ARGS((short_u *instr, int inlen, char_u *outstr));
void MultiByteToWideChar_alloc __ARGS((UINT cp, DWORD flags, LPCSTR in, int inlen, LPWSTR *out, int *outlen));
void WideCharToMultiByte_alloc __ARGS((UINT cp, DWORD flags, LPCWSTR in, int inlen, LPSTR *out, int *outlen, LPCSTR def, LPBOOL useddef));
int clip_mch_own_selection __ARGS((VimClipboard *cbd));
void clip_mch_lose_selection __ARGS((VimClipboard *cbd));
short_u *enc_to_ucs2 __ARGS((char_u *str, int *lenp));
char_u *ucs2_to_enc __ARGS((short_u *str, int *lenp));
short_u *enc_to_utf16 __ARGS((char_u *str, int *lenp));
char_u *utf16_to_enc __ARGS((short_u *str, int *lenp));
void clip_mch_request_selection __ARGS((VimClipboard *cbd));
void acp_to_enc __ARGS((char_u *str, int str_size, char_u **out, int *outlen));
void clip_mch_set_selection __ARGS((VimClipboard *cbd));
+8 -3
View File
@@ -1420,6 +1420,7 @@ qf_jump(qi, dir, errornr, forceit)
win_T *win;
win_T *altwin;
#endif
win_T *oldwin = curwin;
int print_message = TRUE;
int len;
#ifdef FEAT_FOLDING
@@ -1744,7 +1745,8 @@ qf_jump(qi, dir, errornr, forceit)
}
else
ok = do_ecmd(qf_ptr->qf_fnum, NULL, NULL, NULL, (linenr_T)1,
ECMD_HIDE + ECMD_SET_HELP);
ECMD_HIDE + ECMD_SET_HELP,
oldwin == curwin ? curwin : NULL);
}
else
ok = buflist_getfile(qf_ptr->qf_fnum,
@@ -2267,6 +2269,7 @@ ex_copen(eap)
win_T *win;
tabpage_T *prevtab = curtab;
buf_T *qf_buf;
win_T *oldwin = curwin;
if (eap->cmdidx == CMD_lopen || eap->cmdidx == CMD_lwindow)
{
@@ -2326,14 +2329,16 @@ ex_copen(eap)
win->w_llist->qf_refcount++;
}
if (oldwin != curwin)
oldwin = NULL; /* don't store info when in another window */
if (qf_buf != NULL)
/* Use the existing quickfix buffer */
(void)do_ecmd(qf_buf->b_fnum, NULL, NULL, NULL, ECMD_ONE,
ECMD_HIDE + ECMD_OLDBUF);
ECMD_HIDE + ECMD_OLDBUF, oldwin);
else
{
/* Create a new quickfix buffer */
(void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE);
(void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, oldwin);
/* switch off 'swapfile' */
set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
set_option_value((char_u *)"bt", 0L, (char_u *)"quickfix",
+11 -3
View File
@@ -2439,9 +2439,17 @@ fold_line(wp, fold_count, foldinfo, lnum, row)
#ifdef FEAT_SYN_HL
/* Show 'cursorcolumn' in the fold line. */
if (wp->w_p_cuc && (int)wp->w_virtcol + txtcol < W_WIDTH(wp))
ScreenAttrs[off + wp->w_virtcol + txtcol] = hl_combine_attr(
ScreenAttrs[off + wp->w_virtcol + txtcol], hl_attr(HLF_CUC));
if (wp->w_p_cuc)
{
txtcol += wp->w_virtcol;
if (wp->w_p_wrap)
txtcol -= wp->w_skipcol;
else
txtcol -= wp->w_leftcol;
if (txtcol >= 0 && txtcol < W_WIDTH(wp))
ScreenAttrs[off + txtcol] = hl_combine_attr(
ScreenAttrs[off + txtcol], hl_attr(HLF_CUC));
}
#endif
SCREEN_LINE(row + W_WINROW(wp), W_WINCOL(wp), (int)W_WIDTH(wp),
+10 -2
View File
@@ -459,7 +459,7 @@ typedef struct expand
typedef struct
{
int hide; /* TRUE when ":hide" was used */
# ifdef FEAT_BROWSE
# ifdef FEAT_BROWSE_CMD
int browse; /* TRUE to invoke file dialog */
# endif
# ifdef FEAT_WINDOWS
@@ -1456,6 +1456,9 @@ struct file_buffer
char_u *b_p_dict; /* 'dictionary' local value */
char_u *b_p_tsr; /* 'thesaurus' local value */
#endif
#ifdef FEAT_GUI_MACVIM
int b_p_mmta; /* 'macmeta' local value */
#endif
/* end of buffer options */
@@ -1789,10 +1792,15 @@ struct window_S
#endif
/*
* The next three specify the offsets for displaying the buffer:
* "w_topline", "w_leftcol" and "w_skipcol" specify the offsets for
* displaying the buffer.
*/
linenr_T w_topline; /* buffer line number of the line at the
top of the window */
#ifdef FEAT_AUTOCMD
char w_topline_was_set; /* flag set to TRUE when topline is set,
e.g. by winrestview() */
#endif
#ifdef FEAT_DIFF
int w_topfill; /* number of filler lines above w_topline */
int w_old_topfill; /* w_topfill at last redraw */
Binary file not shown.
+54
View File
@@ -691,6 +691,60 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
49,
/**/
48,
/**/
47,
/**/
46,
/**/
45,
/**/
44,
/**/
43,
/**/
42,
/**/
41,
/**/
40,
/**/
39,
/**/
38,
/**/
37,
/**/
36,
/**/
35,
/**/
34,
/**/
33,
/**/
32,
/**/
31,
/**/
30,
/**/
29,
/**/
28,
/**/
27,
/**/
26,
/**/
25,
/**/
24,
/**/
23,
/**/
22,
/**/
+20 -4
View File
@@ -342,8 +342,14 @@
#ifdef BACKSLASH_IN_FILENAME
# define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`%#'\"|!<")
#else
# define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<")
# define SHELL_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<>();&")
# ifdef VMS
/* VMS allows a lot of characters in the file name */
# define PATH_ESC_CHARS ((char_u *)" \t\n*?{`\\%#'\"|!")
# define SHELL_ESC_CHARS ((char_u *)" \t\n*?{`\\%#'|!()&")
# else
# define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<")
# define SHELL_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<>();&")
# endif
#endif
#define NUMBUFLEN 30 /* length of a buffer to store a number in ASCII */
@@ -371,7 +377,7 @@ typedef __int64 long_i;
* Define __w64 as an empty token for everything but MSVC 7.x or later.
*/
# if !defined(_MSC_VER) || (_MSC_VER < 1300)
# define __w64
# define __w64
# endif
typedef unsigned long __w64 long_u;
typedef long __w64 long_i;
@@ -1731,7 +1737,8 @@ typedef int proftime_T; /* dummy for function prototypes */
#define VV_MOUSE_COL 51
#define VV_OP 52
#define VV_SEARCHFORWARD 53
#define VV_LEN 54 /* number of v: vars */
#define VV_OLDFILES 54
#define VV_LEN 55 /* number of v: vars */
#ifdef FEAT_CLIPBOARD
@@ -1982,6 +1989,9 @@ typedef int VimClipboard; /* This is required for the prototypes. */
# endif
#endif
#ifndef FEAT_NETBEANS_INTG
# undef NBDEBUG
#endif
#ifdef NBDEBUG /* Netbeans debugging. */
# include "nbdebug.h"
#else
@@ -2057,4 +2067,10 @@ typedef int VimClipboard; /* This is required for the prototypes. */
#define DOSO_VIMRC 1 /* loading vimrc file */
#define DOSO_GVIMRC 2 /* loading gvimrc file */
/* flags for read_viminfo() and children */
#define VIF_WANT_INFO 1 /* load non-mark info */
#define VIF_WANT_MARKS 2 /* load file marks */
#define VIF_FORCEIT 4 /* overwrite info already read */
#define VIF_GET_OLDFILES 8 /* load v:oldfiles */
#endif /* VIM__H */
+2 -1
View File
@@ -531,7 +531,8 @@ wingotofile:
# ifdef FEAT_SCROLLBIND
curwin->w_p_scb = FALSE;
# endif
(void)do_ecmd(0, ptr, NULL, NULL, ECMD_LASTL, ECMD_HIDE);
(void)do_ecmd(0, ptr, NULL, NULL, ECMD_LASTL,
ECMD_HIDE, NULL);
if (nchar == 'F' && lnum >= 0)
{
curwin->w_cursor.lnum = lnum;