Compare commits

...

105 Commits

Author SHA1 Message Date
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
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
Bjorn Winckler 4879bdfc5e Snapshot 35 2008-09-26 21:33:40 +02:00
Kaoru Yoshida 52bb6e960f Add IM support to ATSUI renderer
More functionality now shared between ATSUI and Cocoa renderers.
(Some modifications by Bjorn Winckler.)
2008-09-24 21:19:24 +02:00
Bjorn Winckler 0b018a5836 Use -[NSString vimStringSave] 2008-09-24 20:19:24 +02:00
Bjorn Winckler ae2eb1cf48 Merge upstream
Conflicts:
	src/pty.c
2008-09-20 16:28:00 +02:00
vimboss 597590c414 updated for version 7.2-022 2008-09-20 14:27:03 +00:00
Bjorn Winckler 2a70805ffb Put cursor back on cmdline after Cmd-=
Changing the font size up/down while the cursor was on the command line
would cause the cursor to jump away from the cmdline.  This is no longer
the case.  Also fixes a similar problem when showing/hiding the toolbar
by clicking the "pill button".
2008-09-19 20:17:01 +02:00
Bjorn Winckler 86ae8db7d6 Don't coalesce scroll wheel events
Since the backend now pops off all input events at once whenever it
tends to the run-loop, it is no longer necessary to coalesce scroll
wheel events.  In fact, without coalescing the scroll wheel (or track
pad) feels a lot smoother.
2008-09-19 17:50:07 +02:00
Bjorn Winckler dc9008674b Fix typos in help 2008-09-19 16:54:50 +02:00
vimboss 99b9fe4a6d updated for version 7.2-021 2008-09-18 19:29:58 +00:00
vimboss 1d73dbfbe5 updated for version 7.2-020 2008-09-18 18:57:10 +00:00
vimboss 7d9d31e97d updated for version 7.2-019 2008-09-18 10:44:28 +00:00
Bjorn Winckler 8bc680dd63 Update Credits 2008-09-16 22:55:53 +02:00
Bjorn Winckler 5da159c4eb Correct bug in previous commit 2008-09-16 23:08:22 +02:00
Bjorn Winckler def2d1a9e4 Update fullscreen background color immediately
It is no longer necessary to exit and re-enter fullscreen to see changes
to the "background" setting in 'fopt'.
2008-09-16 22:51:08 +02:00
Bjorn Winckler bdb7f8efa6 Fix scrolling bug
Scrolling now works e.g. after pressing 'f' in normal mode (previously
the scrollbar moved, but the window content did not scroll).
2008-09-16 22:14:43 +02:00
Bjorn Winckler db0d1f51a5 Update help file 2008-09-16 21:28:42 +02:00
Bjorn Winckler 6b4059f69d Simplify Services menu
All services open a new window by default, unless new files are set to
open in the current window in the General preference pane.
2008-09-16 21:24:50 +02:00
Ron Olson 232024f71d Add "New Document Here" Service
The "New Document Here" service will create a blank document in the
currently selected directory.  If new files are set to open in the
current window, then the blank document opens in a new tab in the
topmost window, otherwise a new window is opened.
2008-09-14 20:47:55 -05:00
vimboss d732c28bfc updated for version 7.2-018 2008-09-14 19:41:30 +00:00
vimboss e5bae4cb22 updated for version 7.2-017 2008-09-14 13:58:34 +00:00
vimboss bb36e94f24 updated for version 7.2-016 2008-09-14 12:42:29 +00:00
Bjorn Winckler 2e22c44eab Cmd-. sends interrupt
In other words, Cmd-. is synonymous with Ctrl-C.  The former is standard
for Mac apps whereas the latter is standard for Vim.  Incidentally,
Cmd-. may thus be used as a substitute for Esc to exit insert mode.
2008-09-13 21:14:30 +02:00
Bjorn Winckler f6f6f2c8f8 Decrease connection polling interval on startup
This reduces the startup time by almost 1 second when starting MacVim
from Terminal.
2008-09-13 18:47:22 +02:00
Bjorn Winckler ad6fe811e7 Check for Ctrl-C when gui_mch_update() is called
Since gui_mch_update() is called so frequently we only check for
interrupts at most once per second.
2008-09-13 02:48:57 +02:00
Bjorn Winckler deaae7e717 Ignore gui_mch_update()
By making gui_mch_update() a no-op the frame-rate is dramatically
increased in certain situations.  The downside is that it is no longer
possible to interrupt Vim with Ctrl-C when it is busy processing.
2008-09-13 00:37:09 +02:00
Bjorn Winckler e52ae8cbc0 Be more conservative about flushing output queue
Don't flush on gui_mch_flush(); instead only flush when forced (happens
e.g. if Vim is about to take a nap) or just before waiting for new
input.  This reduces screen flicker dramatically in certain cases.
2008-09-13 00:30:07 +02:00
Bjorn Winckler 8e7466bccc Do not allow input queue to fill up
The backend keeps at most one copy of each message on the input queue.
This makes MacVim feel a lot more responsive e.g. when scrolling the
screen.  It used to be that holding down 'j' to scroll and then
releasing 'j' would cause the screen to keep scrolling for a while even
after the release.
2008-09-13 00:08:47 +02:00
Bjorn Winckler 4100056f46 Don't init backend if Vim is about to fork
This way we avoid doing the initializations twice and cut down a bit on
the startup time when starting MacVim from Terminal.
2008-09-11 19:19:03 +02:00
Jjgod Jiang df35270598 Fix blurry text problem in full screen mode for ATSUI 2008-09-11 21:31:46 +02:00
vimboss b2e17cca75 updated for version 7.2-015 2008-09-10 16:26:04 +00:00
vimboss e25a17541d updated for version 7.2-014 2008-09-10 13:39:10 +00:00
vimboss e76375a3e9 updated for version 7.2-013 2008-09-07 19:48:53 +00:00
vimboss ea83ab3650 updated for version 7.2-012 2008-09-07 13:50:37 +00:00
vimboss c53513d4ac updated for version 7.2-011 2008-09-07 11:55:43 +00:00
vimboss 06c64fe88c updated for version 7.2-010 2008-09-06 14:44:59 +00:00
vimboss b39b209d02 updated for version 7.2-009 2008-09-01 15:56:45 +00:00
vimboss 3e5bc79f11 updated for version 7.2-008 2008-09-01 15:33:17 +00:00
vimboss 96e61949b3 updated for version 7.2-007 2008-09-01 14:51:37 +00:00
Bjorn Winckler ce613d4671 Cmd-E copies selection to Find pasteboard but does not search 2008-08-26 02:14:28 +02:00
vimboss b2e259fb62 updated for version 7.2-006 2008-08-25 03:04:18 +00:00
vimboss 28132658b2 updated for version 7.2-005 2008-08-25 02:49:18 +00:00
vimboss 92ed496e29 updated for version 7.2-004 2008-08-25 02:35:59 +00:00
vimboss 91ed612ac0 updated for version 7.2-003 2008-08-25 02:14:05 +00:00
Bjorn Winckler cec4f8b9ee Ensure order of files to open is not affected by 'suffixes'
Opening the same set of files in a new window and in an already open
window could result in the order of the files being different due to a
non-empty 'suffixes' option.  This patch clears 'suffix' before opening
multiple files and restores it afterwards.
2008-08-24 19:32:04 +02:00
Nico Weber 22799739f5 Fix problems with 'fullscreen' and :mksession
If 'fullscreen', 'lines' and 'columns' are all set in the same Vim
script then it used to be possible that the latter two options got
ignored.  This would in particular cause problems with :mks.
2008-08-24 19:00:37 +02:00
Bjorn Winckler 053d76dc13 Update help on mvim:// URL handler 2008-08-24 18:08:10 +02:00
Bjorn Winckler 38a0fd10d1 Make "Save changes" dialog conform to Apple HIG
If 'guioptions' has "c" set then the standard Vim dialog is used
instead.

The dialog for multiple unsaved changes has also been updated to be a
little more like the "Save changes" dialog.
2008-08-23 19:55:21 +02:00
Bjorn Winckler 325a3db78d Add "line" and "column" support to mvim:// URL handler 2008-08-24 00:10:09 +02:00
Bjorn Winckler 27c683092d Add option to hide MacVim when last window closes 2008-08-23 22:01:30 +02:00
Bjorn Winckler 0b896e4f59 Try to ensure new windows open with bottom edge visible on screen
In particular, if new windows are set to open maximized in the vertical
direction then the top of newly opened windows will be in line with the
top of the frontmost window.
2008-08-22 23:07:23 +02:00
Bjorn Winckler 6fcd21f338 Sort files opened from Finder
Finder does not take into consideration the order in which files are
selected anyway, so sorting the files makes opening multiple files more
predictable without breaking anything.
2008-08-22 02:19:10 +02:00
Bjorn Winckler 316034e1db Now works to use :maca on VimLeave auto command
To fix this the output queue is flushed before exiting a Vim process.
Also, the CloseWindowMsgID is added to the "unsafe" list so that other
unsafe messages (such as ExecuteActionMsgID) are not delayed until after
CloseWindowMsgID.
2008-08-22 01:53:24 +02:00
Bjorn Winckler dd46cfc500 Update 'go' help on 'T' option 2008-08-22 00:40:38 +02:00
Bjorn Winckler 28c43bdc64 Update Appcast 2008-08-21 20:11:00 +02:00
Nico Weber 97b5e3c119 Add support for mvim:// URL handler 2008-08-18 20:38:54 +02:00
vimboss 17f08c9776 updated for version 7.2-002 2008-08-17 21:44:45 +00:00
vimboss 9e2f853d00 updated for version 7.2-001 2008-08-17 21:03:18 +00:00
91 changed files with 3495 additions and 1298 deletions
+1
View File
@@ -285,6 +285,7 @@ SRC_DOS = \
src/proto/os_win32.pro \
src/proto/os_mswin.pro \
src/testdir/Make_dos.mak \
src/testdir/Make_ming.mak \
src/testdir/dos.vim \
src/uninstal.c \
src/vim.def \
+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>,
+203 -52
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
@@ -15,12 +15,13 @@ The MacVim Graphical User Interface *macvim* *gui-macvim*
6. Toolbar |macvim-toolbar|
7. Dialogs |macvim-dialogs|
8. System services |macvim-services|
9. Known bugs/missing features |macvim-todo|
10. Hints |macvim-hints|
9. mvim:// URL handler |macvim-url-handler|
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.
|os_mac.txt| For Mac specific items.
{Vi does not have a 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
@@ -108,6 +99,10 @@ If a file is dropped on the Dock icon, it is always opened in a new tab
regardless of the mode Vim is currently in. The same holds if you
double-click on a file in the Finder.
The "Open files from applications" preference in the General preference pane
gives more options on how dropped files should open, in case tabs are not
desired.
*macvim-default-menu*
The default menu in MacVim has been changed to conform better with the Apple
Human Interface Guidelines (HIG). At the moment this breaks the localized
@@ -161,8 +156,10 @@ formats. This enables you to double-click a file to open it with MacVim (if
it is not associated with another program), or to right-click a file to bring
up the "Open with" menu. You can also drag and drop files onto the Dock icon
to open them in tabs in a new window, or you can drop them in an already open
window to open the files in tabs in that specific window. Finally, you can
use Mac OS X System Services to open files in MacVim, see |macvim-services|.
window to open the files in tabs in that specific window (it is possible to
have files open in e.g. splits by changing the "Open files from applications"
option in the General preference pane). Finally, you can use Mac OS X System
Services to open files in MacVim, see |macvim-services|.
There are essentially two ways to start MacVim from Terminal: either call the
Vim binary with the -g switch >
@@ -171,18 +168,19 @@ or use the "open" command (this method can not be used to pass parameters to
Vim) >
open -a MacVim file ...
The advantage of using the latter method is that the settings relating to file
opening in the preferences panel are respected, and files open significantly
faster if preloading of Vim processes is enabled (i.e. if the user default
MMPreloadCacheSize is positive, see |macvim-user-defaults|).
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
@@ -190,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.
@@ -199,6 +208,20 @@ command:
:gui [++opt] [+cmd] [-f|-b] [files...]
Note: Forking ("-b") currently does not work.
*Quickstart*
Quickstart ensures that new windows open instantaneously e.g. when <D-n> is
pressed. This feature can be enabled from the Advanced preferences pane (it
is disabled by default). Note that this setting does not affect the speed
with which windows open when using the |mvim| command.
The main reason why this feature is not enabled by default is because on OS X
10.4 changes to runtime files (e.g. those in "~/.vim") are not detected. For
example, if you install a new plugin and then press <D-n> to open a new
window, then that first window will not notice the plugin (but any consecutive
windows after the first one will). On OS X 10.5 and later all modifications
to runtime files in "~/.vim" are detected, so unless you keep runtime files in
another folder there should be no problems.
*odbeditor* *external-editor*
MacVim can act as an 'external editor' for Mac OS X applications that support
the ODB Editor Protocol (or the 'external editor' protocol). Each application
@@ -230,13 +253,11 @@ as general information regarding Mac OS X user defaults.
Here is a list of relevant dictionary entries:
KEY VALUE ~
MMAtsuiRenderer enable ATSUI renderer [bool]
MMCellWidthMultiplier width of a normal glyph in em units [float]
MMDialogsTrackPwd open/save dialogs track the Vim pwd [bool]
MMLoginShellArgument login shell parameter [string]
MMLoginShellCommand which shell to use to launch Vim [string]
MMNoFontSubstitution disable automatic font substitution [bool]
MMPreloadCacheSize number of Vim processes to preload [int]
MMTabMaxWidth maximum width of a tab [int]
MMTabMinWidth minimum width of a tab [int]
MMTabOptimumWidth default width of a tab [int]
@@ -262,7 +283,7 @@ Terminal and type: >
Applications opened from the Finder do not automatically source the user's
environment variables (which are typically set in .profile or .bashrc). This
presents a problem when using |:!| to execute commands in the shell since e.g.
$PATH might not be set properly. To work around this problem MacVim can start
$PATH might not be set properly. To work around this problem MacVim starts
new Vim processes via a login shell so that all environment variables are set.
By default MacVim uses the $SHELL environment variable to determine which
@@ -351,7 +372,7 @@ can be used to send action messages.
property list file called |Actions.plist|.
*:macm* *:macmenu*
:mac[menu] {menu} {key}={arg} ...
:macm[enu] {menu} {key}={arg} ...
Set Mac specific properties for {menu}. The
properties that can be set are:
action the action this menu sends
@@ -369,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
@@ -395,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
@@ -463,11 +491,12 @@ icon can be found a warning triangle is displayed instead.
Dialogs can be controlled with the keyboard in two ways. By default each
button in a dialog is bound to a key. The button that is highlighted by blue
is bound to Enter, and any button with the title "Cancel" is bound to Escape.
Other buttons are usually bound to the first letter in the title of the
button. There is no visual feedback to indicate which letter a button is
bound to, so sometimes some experimentation might be required in order to
figure out which key to press.
is bound to Enter, any button with the title "Cancel" is bound to Escape, and
any button with the title "Don't Save" is bound to <D-d>. Other buttons are
usually bound to the first letter in the title of the button. There is no
visual feedback to indicate which letter a button is bound to, so sometimes
some experimentation might be required in order to figure out which key to
press.
The second way of controlling dialogs with the keyboard is to enable "Full
keyboard access" in the "Keyboard & Mouse" pane of the System Preferences (you
@@ -485,20 +514,104 @@ 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 Tab Containing Selection: Opens a new tab in the topmost window and
pastes the currently selected text in that tab. A new window will be
opened if necessary.
* Open Selected File in Tab: If the selected text represents a file
name, then the corresponding file is opened in a new tab in the topmost
window.
* Open Selected File in Window: Same as the above, but always open 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
opening a new window.
==============================================================================
9. Known bugs/missing features *macvim-todo*
9. mvim:// URL handler *mvim://* *macvim-url-handler*
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.
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/.
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)
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.
Note that url has to be a file:// url pointing to an existing local file.
==============================================================================
10. Keyboard shortcuts *macvim-shortcuts*
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
@@ -507,8 +620,9 @@ these are ones that are know and/or which were judged major.
- Sometimes multibyte characters look "too wide", i.e. they overlap the
following character. It might help to change 'ambiwidth', or override the
automatic font substitution by setting 'guifontwide' manually.
- Printing
- No find/replace dialog
- Printing. As a temporary solution <D-p> creates a PostScript file which is
then opened in Preview where it may be printed.
- 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
@@ -517,7 +631,7 @@ might be simple to implement, but unless somebody asks for a particular
feature then there is little incentive to add it.
==============================================================================
10. Hints *macvim-hints*
12. Hints *macvim-hints*
In this section some general (not necessarily MacVim specific) hints are
given.
@@ -551,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.
@@ -584,6 +698,43 @@ If that helps, then you can permanently disable "matchparen" by adding the
following line to your "~/.vimrc": >
let loaded_matchparen=1
<
Scenario: ~
You want to use MacVim as an editor for some external application.
Solution: ~
If the external application lets you set a program to execute then something
like "mvim -f" might be all you need (the "-f" switch ensures that the "mvim"
script returns only after you close the editor window, otherwise "mvim"
returns immediately). If the external program honors the EDITOR environment
variable (e.g Git does this) then you may get away by adding the following
line to your "~/.profile": >
export EDITOR='mvim -f'
If you have not installed the "mvim" script in your path you can provide the
path to the Vim binary instead. Thus, if "MacVim.app" resides in the
Applications folder then you would use the following line: >
export EDITOR='/Applications/MacVim.app/Contents/MacOS/Vim -g -f'
Scenario: ~
You have set MacVim to open from an external program and when you finish
editing (by closing the MacVim window) you want the external program to regain
focus.
Solution: ~
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 -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
+24 -3
View File
@@ -3081,6 +3081,15 @@ A jump table for the options with a short description can be found at |Q_op|.
See 'fuoptions' for how Vim resizes and colors the background when
entering and leaving fullscreen mode.
Note: Setting 'fullscreen' usually changes the size of the Vim
control. However, for technical reasons, 'lines' and 'columns' will
currently only be updated when Vim runs its event loop. As a
consequence, if you set 'fullscreen' and 'lines' or 'columns' in a
Vim script file, you should always set 'fullscreen' after setting
'lines' and 'columns', else 'lines' and 'columns' will be overwritten
with the values 'fullscreen' sets after the script has been executed
and the event loop is ran again.
XXX: Add fuenter/fuleave autocommands? You might want to display
a NERDTree or a Tlist only in fullscreen for example. Then again, this
could probably be in a sizechanged autocommand that triggers if the
@@ -3499,7 +3508,7 @@ A jump table for the options with a short description can be found at |Q_op|.
Exception: Athena will always use grey menu items.
*'go-t'*
't' Include tearoff menu items. Currently only works for Win32,
GTK+, and Motif 1.2 GUI.
GTK+, MacVim, and Motif 1.2 GUI.
*'go-T'*
'T' Include Toolbar. Currently only in Win32, GTK+, Motif, Photon
and Athena GUIs.
@@ -4484,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
@@ -5430,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,
@@ -5445,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,
+125 -4
View File
@@ -1,4 +1,4 @@
*os_vms.txt* For Vim version 7.2. Last change: 2006 Nov 18
*os_vms.txt* For Vim version 7.2. Last change: 2008 Aug 19
VIM REFERENCE MANUAL
@@ -312,7 +312,7 @@ features, it is worth to choose non GUI executables.
8. Useful notes *vms-notes*
8.1 backspace/delete
8.1 Backspace/delete
8.2 Filters
8.3 VMS file version numbers
8.4 Directory conversion
@@ -326,8 +326,10 @@ features, it is worth to choose non GUI executables.
8.12 diff-mode
8.13 Allow '$' in C keywords
8.14 VIMTUTOR for beginners
8.15 Slow start in console mode issue
8.16 Common VIM directory - different architectures
8.1 backspace/delete
8.1 Backspace/delete
There are backspace/delete key inconsistencies with VMS.
:fixdel doesn't do the trick, but the solution is: >
@@ -663,12 +665,130 @@ start it with: >
(Thomas.R.Wyant III, Vim 6.1)
8.14 Slow start in console mode issue
As GUI/GTK Vim works equally well in console mode, many administartors
deploy those executables system wide.
Unfortunately, on a remote slow connections GUI/GTK executables behave rather
slow when user wants to run Vim just in the console mode - because of X environment detection timeout.
Luckily, there is a simple solution for that. Administrators need to deploy
both GUI/GTK build and just console build executables, like below: >
|- vim72
|----- doc
|----- syntax
vimrc (system rc files)
gvimrc
gvim.exe (the remaned GUI or GTK built vim.exe)
vim.exe (the console only executable)
Define system symbols like below in for ex in LOGIN.COM or SYLOGIN.COM: >
$ define/nolog VIM RF10:[UTIL.VIM72] ! where you VIM directory is
$ vi*m :== mcr VIM:VIM.EXE
$ gvi*m :== mcr VIM:GVIM.EXE
$ ! or you can try to spawn with
$ gv*im :== spawn/nowait/input=NLA0 mcr VIM:GVIM.EXE -g -GEOMETRY 80x40
Like this, users that do not have X environment and want to use Vim just in
console mode can avoid performance problems.
(Zoltan Arpadffy, Vim 7.2)
8.15 Common VIM directory - different architectures
In a cluster that contains nodes with different architectures like below:
$show cluster
View of Cluster from system ID 11655 node: TOR 18-AUG-2008 11:58:31
+---------------------------------+
¦ SYSTEMS ¦ MEMBERS ¦
+-----------------------+---------¦
¦ NODE ¦ SOFTWARE ¦ STATUS ¦
+--------+--------------+---------¦
¦ TOR ¦ VMS V7.3-2 ¦ MEMBER ¦
¦ TITAN2 ¦ VMS V8.3 ¦ MEMBER ¦
¦ ODIN ¦ VMS V7.3-2 ¦ MEMBER ¦
+---------------------------------+
It is convinient to have a common VIM directory but execute different
executables.
There are more solutions for this problem:
solution 1. all executables in the same directory with different names
This is easily done with the following script that can be added
to the login.com or sylogin.com: >
$ if f$getsyi("NODE_HWTYPE") .eqs. "VAX"
$ then
$ say "VAX platform"
$ vi*m:== mcr vim:VIM.EXE_VAX
$ endif
$ if f$getsyi("NODE_HWTYPE") .eqs. "ALPH"
$ then
$ say "ALPHA platform"
$ vi*m :== mcr vim:VIM.EXE_AXP
$ endif
$ if f$getsyi("ARCH_NAME") .eqs. "IA64"
$ then
$ say "IA64 platform"
$ vi*m :== mcr vim:VIM.EXE_IA64
$ endif
solution 2. different directories: >
$ if f$getsyi("NODE_HWTYPE") .eqs. "VAX"
$ then
$ say "VAX platform"
$ define/nolog VIM RF10:[UTIL.VAX_EXE] ! VAX executables
$ endif
$ if f$getsyi("NODE_HWTYPE") .eqs. "ALPH"
$ then
$ say "ALPHA platform"
$ define/nolog VIM RF10:[UTIL.AXP_EXE] ! AXP executables
$ endif
$ if f$getsyi("ARCH_NAME") .eqs. "IA64"
$ then
$ say "IA64 platform"
$ define/nolog VIM RF10:[UTIL.IA64_EXE] ! IA64 executables
$ endif
$! VIMRUNTIME must be defined in order to find runtime files
$ define/nolog VIMRUNTIME RF10:[UTIL.VIM72]
A good examle for this approach is the [GNU]gnu_tools.com script from GNU_TOOLS.ZIP
package downloadable from http://www.polarhome.com/vim/
(Zoltan Arpadffy, Vim 7.2)
==============================================================================
9. VMS related changes *vms-changes*
Version 7
Recent changes
- The following plugins are included into VMS runtime:
genutils 2.4, multiselect 2.2, multvals 3.1, selectbuf 4.3,
bufexplorer 7.1.7, taglist 4.5
- minor changes in vimrc (just in VMS runtime)
- make_vms.mms - HUGE model is the default
- [TESTDIR]make_vms.mms include as many tests possible
- modify test30 and test54 for VMS
- enable FLOAT feature in VMS port
- os_vms.txt updated
Version 7.2 (2008 Aug 9)
- VCF files write corrected
- CTAGS 5.7 included
- corrected make_vms.mms (on VAX gave syntax error)
Version 7.1 (2007 Jun 15)
- create TAGS file from menu
Version 7 (2006 May 8)
- Improved low level char input (affects just console mode)
- Fixed plugin bug
- CTAGS 5.6 included
Version 6.4 (2005 Oct 15)
- GTKLIB and Vim build on IA64
@@ -806,6 +926,7 @@ Version 4.5 (1996 Dec 16)
OpenVMS documentation and executables are maintained by:
Zoltan Arpadffy <arpadffy@polarhome.com>
OpenVMS Vim page: http://www.polarhome.com/vim/
This document uses parts and remarks from earlier authors and contributors
of OS_VMS.TXT:
+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
+4
View File
@@ -234,6 +234,10 @@ else
elseif s:line1 =~ '\<DTD\s\+XHTML\s'
set ft=xhtml
" HTML (e.g.: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN")
elseif s:line1 =~? '\<DOCTYPE\s\+html\>'
set ft=html
" PDF
elseif s:line1 =~ '^%PDF-'
set ft=pdf
+3 -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
@@ -29,6 +29,8 @@ Enno L\'fcbbers\
Kyle Lippincott\
Matt Tolton\
Kaoru Yoshida\
Ron Olson\
Jonathon Mah\
\i0 \
...and many others who have helped by reporting bugs etc.\
Binary file not shown.
+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.
+35 -20
View File
@@ -544,8 +544,21 @@
<string>7.2</string>
<key>CFBundleSignature</key>
<string>VIMM</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>org.vim.MacVim</string>
<key>CFBundleURLSchemes</key>
<array>
<string>mvim</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>34</string>
<string>37</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
@@ -556,7 +569,7 @@
<key>NSMenuItem</key>
<dict>
<key>default</key>
<string>MacVim/New Tab Containing Selection</string>
<string>MacVim/New Document Containing Selection</string>
</dict>
<key>NSMessage</key>
<string>openSelection</string>
@@ -571,24 +584,7 @@
<key>NSMenuItem</key>
<dict>
<key>default</key>
<string>MacVim/Open Selected File in Tab</string>
</dict>
<key>NSMessage</key>
<string>openFile</string>
<key>NSPortName</key>
<string>MacVim</string>
<key>NSSendTypes</key>
<array>
<string>NSStringPboardType</string>
</array>
<key>NSUserData</key>
<string>Tab</string>
</dict>
<dict>
<key>NSMenuItem</key>
<dict>
<key>default</key>
<string>MacVim/Open Selected File in Window</string>
<string>MacVim/Open Selected File</string>
</dict>
<key>NSMessage</key>
<string>openFile</string>
@@ -601,9 +597,28 @@
<key>NSUserData</key>
<string>Window</string>
</dict>
<dict>
<key>NSMenuItem</key>
<dict>
<key>default</key>
<string>MacVim/New Document Here</string>
</dict>
<key>NSMessage</key>
<string>newFileHere</string>
<key>NSPortName</key>
<string>MacVim</string>
<key>NSSendTypes</key>
<array>
<string>NSStringPboardType</string>
</array>
<key>NSUserData</key>
<string>Window</string>
</dict>
</array>
<key>SUFeedURL</key>
<string>http://bjorn.winckler.googlepages.com/macvim_latest.xml</string>
<key>NSAppleScriptEnabled</key>
<true/>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
+2
View File
@@ -46,6 +46,8 @@
- (void)windowControllerWillOpen:(MMWindowController *)windowController;
- (void)setMainMenu:(NSMenu *)mainMenu;
- (NSArray *)filterOpenFiles:(NSArray *)filenames;
- (BOOL)openFiles:(NSArray *)filenames withArguments:(NSDictionary *)args;
#ifdef MM_ENABLE_PLUGINS
- (void)addItemToPlugInMenu:(NSMenuItem *)item;
+338 -161
View File
@@ -94,6 +94,8 @@ static int executeInLoginShell(NSString *path, NSArray *args);
error:(NSString **)error;
- (void)openFile:(NSPasteboard *)pboard userData:(NSString *)userData
error:(NSString **)error;
- (void)newFileHere:(NSPasteboard *)pboard userData:(NSString *)userData
error:(NSString **)error;
@end
@@ -107,6 +109,8 @@ static int executeInLoginShell(NSString *path, NSArray *args);
- (void)handleXcodeModEvent:(NSAppleEventDescriptor *)event
replyEvent:(NSAppleEventDescriptor *)reply;
#endif
- (void)handleGetURLEvent:(NSAppleEventDescriptor *)event
replyEvent:(NSAppleEventDescriptor *)reply;
- (int)findLaunchingProcessWithoutArguments;
- (MMVimController *)findUnusedEditor;
- (NSMutableDictionary *)extractArgumentsFromOdocEvent:
@@ -150,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,
@@ -159,7 +166,6 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
[NSNumber numberWithInt:1], MMTextInsetRightKey,
[NSNumber numberWithInt:1], MMTextInsetTopKey,
[NSNumber numberWithInt:1], MMTextInsetBottomKey,
[NSNumber numberWithBool:NO], MMTerminateAfterLastWindowClosedKey,
@"MMTypesetter", MMTypesetterKey,
[NSNumber numberWithFloat:1], MMCellWidthMultiplierKey,
[NSNumber numberWithFloat:-1], MMBaselineOffsetKey,
@@ -181,6 +187,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
[NSNumber numberWithInt:3], MMOpenLayoutKey,
[NSNumber numberWithBool:NO], MMVerticalSplitKey,
[NSNumber numberWithInt:0], MMPreloadCacheSizeKey,
[NSNumber numberWithInt:0], MMLastWindowClosedBehaviorKey,
nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:dict];
@@ -227,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",
@@ -312,6 +314,13 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
forEventClass:'KAHL'
andEventID:'MOD '];
#endif
// Register 'mvim://' URL handler
[[NSAppleEventManager sharedAppleEventManager]
setEventHandler:self
andSelector:@selector(handleGetURLEvent:replyEvent:)
forEventClass:kInternetEventClass
andEventID:kAEGetURL];
}
- (void)applicationDidFinishLaunching:(NSNotification *)notification
@@ -368,150 +377,25 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames
{
// Opening files works like this:
// a) extract ODB/Xcode/Spotlight parameters from the current Apple event
// b) filter out any already open files
// c) open any remaining files
//
// A file is opened in an untitled window if there is one (it may be
// currently launching, or it may already be visible), otherwise a new
// window is opened.
//
// Each launching Vim process has a dictionary of arguments that are passed
// to the process when in checks in (via connectBackend:pid:). The
// arguments for each launching process can be looked up by its PID (in the
// pidArguments dictionary).
// Extract ODB/Xcode/Spotlight parameters from the current Apple event,
// sort the filenames, and then let openFiles:withArguments: do the heavy
// lifting.
if (!(filenames && [filenames count] > 0))
return;
//
// a) Extract ODB/Xcode/Spotlight parameters from the current Apple event
//
// Sort filenames since the Finder doesn't take care in preserving the
// order in which files are selected anyway (and "sorted" is more
// predictable than "random").
if ([filenames count] > 1)
filenames = [filenames sortedArrayUsingSelector:
@selector(localizedCompare:)];
// Extract ODB/Xcode/Spotlight parameters from the current Apple event
NSMutableDictionary *arguments = [self extractArgumentsFromOdocEvent:
[[NSAppleEventManager sharedAppleEventManager] currentAppleEvent]];
//
// b) Filter out any already open files
//
NSString *firstFile = [filenames objectAtIndex:0];
MMVimController *firstController = nil;
NSDictionary *openFilesDict = nil;
filenames = [self filterOpenFiles:filenames openFilesDict:&openFilesDict];
// Pass arguments to vim controllers that had files open.
id key;
NSEnumerator *e = [openFilesDict keyEnumerator];
// (Indicate that we do not wish to open any files at the moment.)
[arguments setObject:[NSNumber numberWithBool:YES] forKey:@"dontOpen"];
while ((key = [e nextObject])) {
NSArray *files = [openFilesDict objectForKey:key];
[arguments setObject:files forKey:@"filenames"];
MMVimController *vc = [key pointerValue];
[vc passArguments:arguments];
// If this controller holds the first file, then remember it for later.
if ([files containsObject:firstFile])
firstController = vc;
}
if ([filenames count] == 0) {
// Raise the window containing the first file that was already open,
// and make sure that the tab containing that file is selected. Only
// do this when there are no more files to open, otherwise sometimes
// the window with 'firstFile' will be raised, other times it might be
// the window that will open with the files in the 'filenames' array.
firstFile = [firstFile stringByEscapingSpecialFilenameCharacters];
NSString *input = [NSString stringWithFormat:@"<C-\\><C-N>"
":let oldswb=&swb|let &swb=\"useopen,usetab\"|"
"tab sb %@|let &swb=oldswb|unl oldswb|"
"cal foreground()|redr|f<CR>", firstFile];
[firstController addVimInput:input];
[NSApp replyToOpenOrPrint:NSApplicationDelegateReplySuccess];
return;
}
// Add filenames to "Recent Files" menu, unless they are being edited
// remotely (using ODB).
if ([arguments objectForKey:@"remoteID"] == nil) {
[[NSDocumentController sharedDocumentController]
noteNewRecentFilePaths:filenames];
}
//
// c) Open any remaining files
//
MMVimController *vc;
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
BOOL openInCurrentWindow = [ud boolForKey:MMOpenInCurrentWindowKey];
// The meaning of "layout" is defined by the WIN_* defines in main.c.
int layout = [ud integerForKey:MMOpenLayoutKey];
BOOL splitVert = [ud boolForKey:MMVerticalSplitKey];
if (splitVert && MMLayoutHorizontalSplit == layout)
layout = MMLayoutVerticalSplit;
if (layout < 0 || (layout > MMLayoutTabs && openInCurrentWindow))
layout = MMLayoutTabs;
[arguments setObject:[NSNumber numberWithInt:layout] forKey:@"layout"];
[arguments setObject:filenames forKey:@"filenames"];
// (Indicate that files should be opened from now on.)
[arguments setObject:[NSNumber numberWithBool:NO] forKey:@"dontOpen"];
if (openInCurrentWindow && (vc = [self topmostVimController])) {
// Open files in an already open window.
[[[vc windowController] window] makeKeyAndOrderFront:self];
[vc passArguments:arguments];
[NSApp replyToOpenOrPrint:NSApplicationDelegateReplySuccess];
return;
}
BOOL openOk = YES;
int numFiles = [filenames count];
if (MMLayoutWindows == layout && numFiles > 1) {
// Open one file at a time in a new window, but don't open too many at
// once (at most cap+1 windows will open). If the user has increased
// the preload cache size we'll take that as a hint that more windows
// should be able to open at once.
int cap = [self maxPreloadCacheSize] - 1;
if (cap < 4) cap = 4;
if (cap > numFiles) cap = numFiles;
int i;
for (i = 0; i < cap; ++i) {
NSArray *a = [NSArray arrayWithObject:[filenames objectAtIndex:i]];
[arguments setObject:a forKey:@"filenames"];
// NOTE: We have to copy the args since we'll mutate them in the
// next loop and the below call may retain the arguments while
// waiting for a process to start.
NSDictionary *args = [[arguments copy] autorelease];
openOk = [self openVimControllerWithArguments:args];
if (!openOk) break;
}
// Open remaining files in tabs in a new window.
if (openOk && numFiles > cap) {
NSRange range = { i, numFiles-cap };
NSArray *a = [filenames subarrayWithRange:range];
[arguments setObject:a forKey:@"filenames"];
[arguments setObject:[NSNumber numberWithInt:MMLayoutTabs]
forKey:@"layout"];
openOk = [self openVimControllerWithArguments:arguments];
}
} else {
// Open all files at once.
openOk = [self openVimControllerWithArguments:arguments];
}
if (openOk) {
if ([self openFiles:filenames withArguments:arguments]) {
[NSApp replyToOpenOrPrint:NSApplicationDelegateReplySuccess];
} else {
// TODO: Notify user of failure?
@@ -521,8 +405,9 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender
{
return [[NSUserDefaults standardUserDefaults]
boolForKey:MMTerminateAfterLastWindowClosedKey];
return (MMTerminateWhenLastWindowClosed ==
[[NSUserDefaults standardUserDefaults]
integerForKey:MMLastWindowClosedBehaviorKey]);
}
- (NSApplicationTerminateReply)applicationShouldTerminate:
@@ -715,6 +600,12 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
// The last editor window just closed so restore the main menu back to
// its default state (which is defined in MainMenu.nib).
[self setMainMenu:defaultMainMenu];
BOOL hide = (MMHideWhenLastWindowClosed ==
[[NSUserDefaults standardUserDefaults]
integerForKey:MMLastWindowClosedBehaviorKey]);
if (hide)
[NSApp hide:self];
}
}
@@ -739,10 +630,28 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
}
if (!NSEqualPoints(topLeft, NSZeroPoint)) {
NSPoint oldTopLeft = topLeft;
if (topWin)
topLeft = [win cascadeTopLeftFromPoint:topLeft];
[win setFrameTopLeftPoint:topLeft];
NSPoint screenOrigin = [[win screen] frame].origin;
if ([win frame].origin.y < screenOrigin.y) {
// Try to avoid shifting the new window downwards if it means that
// the bottom of the window will be off the screen. E.g. if the
// user has set windows to open maximized in the vertical direction
// then the new window will cascade horizontally only.
topLeft.y = oldTopLeft.y;
[win setFrameTopLeftPoint:topLeft];
}
if ([win 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]) {
@@ -843,6 +752,145 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
return [self filterOpenFiles:filenames openFilesDict:nil];
}
- (BOOL)openFiles:(NSArray *)filenames withArguments:(NSDictionary *)args
{
// Opening files works like this:
// a) filter out any already open files
// b) open any remaining files
//
// A file is opened in an untitled window if there is one (it may be
// currently launching, or it may already be visible), otherwise a new
// window is opened.
//
// Each launching Vim process has a dictionary of arguments that are passed
// to the process when in checks in (via connectBackend:pid:). The
// arguments for each launching process can be looked up by its PID (in the
// pidArguments dictionary).
NSMutableDictionary *arguments = (args ? [[args mutableCopy] autorelease]
: [NSMutableDictionary dictionary]);
//
// a) Filter out any already open files
//
NSString *firstFile = [filenames objectAtIndex:0];
MMVimController *firstController = nil;
NSDictionary *openFilesDict = nil;
filenames = [self filterOpenFiles:filenames openFilesDict:&openFilesDict];
// Pass arguments to vim controllers that had files open.
id key;
NSEnumerator *e = [openFilesDict keyEnumerator];
// (Indicate that we do not wish to open any files at the moment.)
[arguments setObject:[NSNumber numberWithBool:YES] forKey:@"dontOpen"];
while ((key = [e nextObject])) {
NSArray *files = [openFilesDict objectForKey:key];
[arguments setObject:files forKey:@"filenames"];
MMVimController *vc = [key pointerValue];
[vc passArguments:arguments];
// If this controller holds the first file, then remember it for later.
if ([files containsObject:firstFile])
firstController = vc;
}
if ([filenames count] == 0) {
// Raise the window containing the first file that was already open,
// and make sure that the tab containing that file is selected. Only
// do this when there are no more files to open, otherwise sometimes
// the window with 'firstFile' will be raised, other times it might be
// the window that will open with the files in the 'filenames' array.
firstFile = [firstFile stringByEscapingSpecialFilenameCharacters];
NSString *input = [NSString stringWithFormat:@"<C-\\><C-N>"
":let oldswb=&swb|let &swb=\"useopen,usetab\"|"
"tab sb %@|let &swb=oldswb|unl oldswb|"
"cal foreground()|redr|f<CR>", firstFile];
[firstController addVimInput:input];
return YES;
}
// Add filenames to "Recent Files" menu, unless they are being edited
// remotely (using ODB).
if ([arguments objectForKey:@"remoteID"] == nil) {
[[NSDocumentController sharedDocumentController]
noteNewRecentFilePaths:filenames];
}
//
// b) Open any remaining files
//
MMVimController *vc;
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
BOOL openInCurrentWindow = [ud boolForKey:MMOpenInCurrentWindowKey];
// The meaning of "layout" is defined by the WIN_* defines in main.c.
int layout = [ud integerForKey:MMOpenLayoutKey];
BOOL splitVert = [ud boolForKey:MMVerticalSplitKey];
if (splitVert && MMLayoutHorizontalSplit == layout)
layout = MMLayoutVerticalSplit;
if (layout < 0 || (layout > MMLayoutTabs && openInCurrentWindow))
layout = MMLayoutTabs;
[arguments setObject:[NSNumber numberWithInt:layout] forKey:@"layout"];
[arguments setObject:filenames forKey:@"filenames"];
// (Indicate that files should be opened from now on.)
[arguments setObject:[NSNumber numberWithBool:NO] forKey:@"dontOpen"];
if (openInCurrentWindow && (vc = [self topmostVimController])) {
// Open files in an already open window.
[[[vc windowController] window] makeKeyAndOrderFront:self];
[vc passArguments:arguments];
return YES;
}
BOOL openOk = YES;
int numFiles = [filenames count];
if (MMLayoutWindows == layout && numFiles > 1) {
// Open one file at a time in a new window, but don't open too many at
// once (at most cap+1 windows will open). If the user has increased
// the preload cache size we'll take that as a hint that more windows
// should be able to open at once.
int cap = [self maxPreloadCacheSize] - 1;
if (cap < 4) cap = 4;
if (cap > numFiles) cap = numFiles;
int i;
for (i = 0; i < cap; ++i) {
NSArray *a = [NSArray arrayWithObject:[filenames objectAtIndex:i]];
[arguments setObject:a forKey:@"filenames"];
// NOTE: We have to copy the args since we'll mutate them in the
// next loop and the below call may retain the arguments while
// waiting for a process to start.
NSDictionary *args = [[arguments copy] autorelease];
openOk = [self openVimControllerWithArguments:args];
if (!openOk) break;
}
// Open remaining files in tabs in a new window.
if (openOk && numFiles > cap) {
NSRange range = { i, numFiles-cap };
NSArray *a = [filenames subarrayWithRange:range];
[arguments setObject:a forKey:@"filenames"];
[arguments setObject:[NSNumber numberWithInt:MMLayoutTabs]
forKey:@"layout"];
openOk = [self openVimControllerWithArguments:arguments];
}
} else {
// Open all files at once.
openOk = [self openVimControllerWithArguments:arguments];
}
return openOk;
}
#ifdef MM_ENABLE_PLUGINS
- (void)addItemToPlugInMenu:(NSMenuItem *)item
{
@@ -1094,16 +1142,17 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
return;
}
MMVimController *vc = [self topmostVimController];
if (vc) {
// Open a new tab first, since dropString: does not do this.
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
BOOL openInCurrentWindow = [ud boolForKey:MMOpenInCurrentWindowKey];
MMVimController *vc;
if (openInCurrentWindow && (vc = [self topmostVimController])) {
[vc sendMessage:AddNewTabMsgID data:nil];
[vc dropString:[pboard stringForType:NSStringPboardType]];
} else {
// NOTE: There is no window to paste the selection into, so save the
// text, open a new window, and paste the text when the next window
// opens. (If this is called several times in a row, then all but the
// last call might be ignored.)
// Save the text, open a new window, and paste the text when the next
// window opens. (If this is called several times in a row, then all
// but the last call may be ignored.)
if (openSelectionString) [openSelectionString release];
openSelectionString = [[pboard stringForType:NSStringPboardType] copy];
@@ -1128,16 +1177,55 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
NSArray *filenames = [self filterFilesAndNotify:
[NSArray arrayWithObject:string]];
if ([filenames count] > 0) {
MMVimController *vc = nil;
if (userData && [userData isEqual:@"Tab"])
vc = [self topmostVimController];
if ([filenames count] == 0)
return;
if (vc) {
[vc dropFiles:filenames forceOpen:YES];
} else {
[self application:NSApp openFiles:filenames];
}
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
BOOL openInCurrentWindow = [ud boolForKey:MMOpenInCurrentWindowKey];
MMVimController *vc;
if (openInCurrentWindow && (vc = [self topmostVimController])) {
[vc dropFiles:filenames forceOpen:YES];
} else {
[self openFiles:filenames withArguments:nil];
}
}
- (void)newFileHere:(NSPasteboard *)pboard userData:(NSString *)userData
error:(NSString **)error
{
if (![[pboard types] containsObject:NSStringPboardType]) {
NSLog(@"WARNING: Pasteboard contains no object of type "
"NSStringPboardType");
return;
}
NSString *path = [pboard stringForType:NSStringPboardType];
BOOL dirIndicator;
if (![[NSFileManager defaultManager] fileExistsAtPath:path
isDirectory:&dirIndicator]) {
NSLog(@"Invalid path. Cannot open new document at: %@", path);
return;
}
if (!dirIndicator)
path = [path stringByDeletingLastPathComponent];
path = [path stringByReplacingOccurrencesOfString:@" " withString:@"\\ "];
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
BOOL openInCurrentWindow = [ud boolForKey:MMOpenInCurrentWindowKey];
MMVimController *vc;
if (openInCurrentWindow && (vc = [self topmostVimController])) {
NSString *input = [NSString stringWithFormat:@"<C-\\><C-N>"
":tabe|cd %@<CR>", path];
[vc addVimInput:input];
} else {
NSString *input = [NSString stringWithFormat:@":cd %@", path];
[self launchVimProcessWithArguments:[NSArray arrayWithObjects:
@"-c", input, nil]];
}
}
@@ -1330,6 +1418,95 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
}
#endif
- (void)handleGetURLEvent:(NSAppleEventDescriptor *)event
replyEvent:(NSAppleEventDescriptor *)reply
{
NSString *urlString = [[event paramDescriptorForKeyword:keyDirectObject]
stringValue];
NSURL *url = [NSURL URLWithString:urlString];
// We try to be compatible with TextMate's URL scheme here, as documented
// at 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).
//
// Example: mvim://open?url=file:///etc/profile&line=20
if ([[url host] isEqualToString:@"open"]) {
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
// Parse query ("url=file://...&line=14") into a dictionary
NSArray *queries = [[url query] componentsSeparatedByString:@"&"];
NSEnumerator *enumerator = [queries objectEnumerator];
NSString *param;
while( param = [enumerator nextObject] ) {
NSArray *arr = [param componentsSeparatedByString:@"="];
if ([arr count] == 2) {
[dict setValue:[[arr lastObject]
stringByReplacingPercentEscapesUsingEncoding:
NSUTF8StringEncoding]
forKey:[[arr objectAtIndex:0]
stringByReplacingPercentEscapesUsingEncoding:
NSUTF8StringEncoding]];
}
}
// Actually open the file.
NSString *file = [dict objectForKey:@"url"];
if (file != nil) {
NSURL *fileUrl= [NSURL URLWithString:file];
// TextMate only opens files that already exist.
if ([fileUrl isFileURL]
&& [[NSFileManager defaultManager] fileExistsAtPath:
[fileUrl path]]) {
// Strip 'file://' path, else application:openFiles: might think
// the file is not yet open.
NSArray *filenames = [NSArray arrayWithObject:[fileUrl path]];
// Look for the line and column options.
NSDictionary *args = nil;
NSString *line = [dict objectForKey:@"line"];
if (line) {
NSString *column = [dict objectForKey:@"column"];
if (column)
args = [NSDictionary dictionaryWithObjectsAndKeys:
line, @"cursorLine",
column, @"cursorColumn",
nil];
else
args = [NSDictionary dictionaryWithObject:line
forKey:@"cursorLine"];
}
[self openFiles:filenames withArguments:args];
}
}
} else {
NSAlert *alert = [[NSAlert alloc] init];
[alert addButtonWithTitle:NSLocalizedString(@"OK",
@"Dialog button")];
[alert setMessageText:NSLocalizedString(@"Unknown URL Scheme",
@"Unknown URL Scheme dialog, title")];
[alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(
@"This version of MacVim does not support \"%@\""
@" in its URL scheme.",
@"Unknown URL Scheme dialog, text"),
[url host]]];
[alert setAlertStyle:NSWarningAlertStyle];
[alert runModal];
[alert release];
}
}
- (int)findLaunchingProcessWithoutArguments
{
NSArray *keys = [pidArguments allKeysForObject:[NSNull null]];
+10 -4
View File
@@ -9,20 +9,21 @@
*/
#import <Cocoa/Cocoa.h>
#import "MMTextView.h"
enum { MMMaxCellsPerChar = 2 };
@class MMTextViewHelper;
@interface MMAtsuiTextView : NSView {
@interface MMAtsuiTextView : NSView <NSTextInput> {
// From MMTextStorage
int maxRows, maxColumns;
NSColor *defaultBackgroundColor;
NSColor *defaultForegroundColor;
NSSize cellSize;
NSFont *font;
NSFont *fontWide;
float linespace;
float ascender;
@@ -44,28 +45,33 @@ enum { MMMaxCellsPerChar = 2 };
// MMTextStorage methods
//
- (int)maxRows;
- (int)maxColumns;
- (void)getMaxRows:(int*)rows columns:(int*)cols;
- (void)setMaxRows:(int)rows columns:(int)cols;
- (void)setDefaultColorsBackground:(NSColor *)bgColor
foreground:(NSColor *)fgColor;
- (NSColor *)defaultBackgroundColor;
- (NSColor *)defaultForegroundColor;
- (NSRect)rectForRowsInRange:(NSRange)range;
- (NSRect)rectForColumnsInRange:(NSRange)range;
- (void)setFont:(NSFont *)newFont;
- (void)setWideFont:(NSFont *)newFont;
- (NSFont *)font;
- (NSFont *)fontWide;
- (NSSize)cellSize;
- (void)setLinespace:(float)newLinespace;
//
// MMTextView methods
//
- (void)setShouldDrawInsertionPoint:(BOOL)on;
- (void)setPreEditRow:(int)row column:(int)col;
- (void)hideMarkedTextField;
- (void)setMouseShape:(int)shape;
- (void)setAntialias:(BOOL)state;
- (BOOL)convertPoint:(NSPoint)point toRow:(int *)row column:(int *)column;
- (NSPoint)pointForRow:(int)row column:(int)col;
- (NSRect)rectForRow:(int)row column:(int)col numRows:(int)nr
numColumns:(int)nc;
//
// NSTextView methods
+185 -34
View File
@@ -87,7 +87,7 @@
column:(int)col2 color:(NSColor *)color;
- (void)clearAll;
- (void)drawInsertionPointAtRow:(int)row column:(int)col shape:(int)shape
fraction:(int)percent color:(NSColor *)color;
fraction:(int)percent;
- (void)drawInvertedRectAtRow:(int)row column:(int)col numRows:(int)nrows
numColumns:(int)ncols;
@end
@@ -139,6 +139,8 @@ defaultLineHeightForFont(NSFont *font)
- (void)dealloc
{
LOG_DEALLOC
[self disposeAtsuStyles];
[font release]; font = nil;
[defaultBackgroundColor release]; defaultBackgroundColor = nil;
@@ -155,6 +157,11 @@ defaultLineHeightForFont(NSFont *font)
return maxRows;
}
- (int)maxColumns
{
return maxColumns;
}
- (void)getMaxRows:(int*)rows columns:(int*)cols
{
if (rows) *rows = maxRows;
@@ -176,15 +183,22 @@ defaultLineHeightForFont(NSFont *font)
defaultBackgroundColor = bgColor ? [bgColor retain] : nil;
}
// NOTE: The default foreground color isn't actually used for anything, but
// other class instances might want to be able to access it so it is stored
// here.
if (defaultForegroundColor != fgColor) {
[defaultForegroundColor release];
defaultForegroundColor = fgColor ? [fgColor retain] : nil;
}
}
- (NSColor *)defaultBackgroundColor
{
return defaultBackgroundColor;
}
- (NSColor *)defaultForegroundColor
{
return defaultForegroundColor;
}
- (void)setTextContainerInset:(NSSize)size
{
insetSize = size;
@@ -247,6 +261,18 @@ defaultLineHeightForFont(NSFont *font)
- (void)setWideFont:(NSFont *)newFont
{
if (!newFont) {
if (font) [self setWideFont:font];
} else if (newFont != fontWide) {
float pointSize = [newFont pointSize];
NSFontDescriptor *desc = [newFont fontDescriptor];
NSDictionary *dictWide = [NSDictionary
dictionaryWithObject:[NSNumber numberWithFloat:2*cellSize.width]
forKey:NSFontFixedAdvanceAttribute];
desc = [desc fontDescriptorByAddingAttributes:dictWide];
fontWide = [NSFont fontWithDescriptor:desc size:pointSize];
[fontWide retain];
}
}
- (NSFont *)font
@@ -254,6 +280,11 @@ defaultLineHeightForFont(NSFont *font)
return font;
}
- (NSFont *)fontWide
{
return fontWide;
}
- (NSSize)cellSize
{
return cellSize;
@@ -274,17 +305,13 @@ defaultLineHeightForFont(NSFont *font)
- (void)setShouldDrawInsertionPoint:(BOOL)on
{
}
- (void)setPreEditRow:(int)row column:(int)col
{
}
- (void)hideMarkedTextField
{
[helper setPreEditRow:row column:col];
}
- (void)setMouseShape:(int)shape
@@ -297,9 +324,6 @@ defaultLineHeightForFont(NSFont *font)
antialias = state;
}
- (void)keyDown:(NSEvent *)event
{
[helper keyDown:event];
@@ -322,11 +346,32 @@ defaultLineHeightForFont(NSFont *font)
- (BOOL)hasMarkedText
{
return NO;
return [helper hasMarkedText];
}
- (NSRange)markedRange
{
return [helper markedRange];
}
- (NSDictionary *)markedTextAttributes
{
return [helper markedTextAttributes];
}
- (void)setMarkedTextAttributes:(NSDictionary *)attr
{
[helper setMarkedTextAttributes:attr];
}
- (void)setMarkedText:(id)text selectedRange:(NSRange)range
{
[helper setMarkedText:text selectedRange:range];
}
- (void)unmarkText
{
[helper unmarkText];
}
- (void)scrollWheel:(NSEvent *)event
@@ -457,19 +502,68 @@ defaultLineHeightForFont(NSFont *font)
- (void)drawRect:(NSRect)rect
{
NSRect srcRect = NSMakeRect(0, 0, imageSize.width, imageSize.height);
NSRect dstRect = srcRect;
dstRect.origin.x += insetSize.width;
dstRect.origin.y += insetSize.height;
[defaultBackgroundColor set];
NSRectFill(rect);
[contentImage drawInRect: dstRect
fromRect: srcRect
operation: NSCompositeCopy
fraction: 1.0];
NSPoint pt = { insetSize.width, insetSize.height };
[contentImage compositeToPoint:pt operation:NSCompositeCopy];
if ([self hasMarkedText]) {
int len = [[helper markedText] length];
int rows = 0;
int cols = maxColumns - [helper preEditColumn];
NSFont *theFont = [[self markedTextAttributes]
valueForKey:NSFontAttributeName];
if (theFont == [self fontWide])
cols = cols / 2;
int done = 0;
int lend = cols > len ? len : cols;
NSAttributedString *aString = [[helper markedText]
attributedSubstringFromRange:NSMakeRange(done, lend)];
NSPoint pt = [self pointForRow:[helper preEditRow]
column:[helper preEditColumn]];
[aString drawAtPoint:pt];
done = lend;
if (done != len) {
int r;
rows = (len - done) / (maxColumns / 2) + 1;
for (r = 1; r <= rows; r++) {
lend = len - done > maxColumns / 2
? maxColumns / 2 : len - done;
aString = [[helper markedText] attributedSubstringFromRange:
NSMakeRange(done, lend)];
NSPoint pt = [self pointForRow:[helper preEditRow]+r
column:0];
[aString drawAtPoint:pt];
done += lend;
}
}
rows = maxRows - 1 - [helper preEditRow];
cols = [helper preEditColumn];
if (theFont == fontWide) {
cols += ([helper imRange].location+[helper imRange].length) * 2;
if (cols >= maxColumns - 1) {
rows -= cols / maxColumns;
cols = cols % 2 ? cols % maxColumns + 1 :
cols % maxColumns;
}
} else {
cols += ([helper imRange].location+[helper imRange].length);
if (cols >= maxColumns) {
rows -= cols / maxColumns;
cols = cols % 2 ? cols % maxColumns + 1 :
cols % maxColumns;
}
}
// TODO: Could IM be in "right-left" mode? If so the insertion point
// will be on the wrong side.
[self drawInsertionPointAtRow:rows
column:cols
shape:MMInsertionPointVertical
fraction:25];
}
}
- (BOOL) wantsDefaultClipping
@@ -588,9 +682,9 @@ defaultLineHeightForFont(NSFont *font)
#if MM_DEBUG_DRAWING
NSLog(@" Draw cursor at (%d,%d)", row, col);
#endif
[helper setInsertionPointColor:[NSColor colorWithRgbInt:color]];
[self drawInsertionPointAtRow:row column:col shape:shape
fraction:percent
color:[NSColor colorWithRgbInt:color]];
fraction:percent];
} else if (DrawInvertedRectDrawType == type) {
int row = *((int*)bytes); bytes += sizeof(int);
int col = *((int*)bytes); bytes += sizeof(int);
@@ -616,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);
@@ -750,12 +846,67 @@ defaultLineHeightForFont(NSFont *font)
if (row) *row = floor((point.y-origin.y-1) / cellSize.height);
if (column) *column = floor((point.x-origin.x-1) / cellSize.width);
//NSLog(@"convertPoint:%@ toRow:%d column:%d", NSStringFromPoint(point),
// *row, *column);
return YES;
}
- (NSPoint)pointForRow:(int)row column:(int)col
{
// Return the lower left coordinate of the cell at (row,column).
NSPoint pt;
pt.x = insetSize.width + col*cellSize.width;
pt.y = [self frame].size.height -
(insetSize.height + (1+row)*cellSize.height);
return pt;
}
- (NSRect)rectForRow:(int)row column:(int)col numRows:(int)nr
numColumns:(int)nc
{
// Return the rect for the block which covers the specified rows and
// columns. The lower-left corner is the origin of this rect.
NSRect rect;
rect.origin.x = insetSize.width + col*cellSize.width;
rect.origin.y = [self frame].size.height -
(insetSize.height + (nr+row)*cellSize.height);
rect.size.width = nc*cellSize.width;
rect.size.height = nr*cellSize.height;
return rect;
}
- (NSArray *)validAttributesForMarkedText
{
return nil;
}
- (NSAttributedString *)attributedSubstringFromRange:(NSRange)range
{
return nil;
}
- (NSUInteger)characterIndexForPoint:(NSPoint)point
{
return NSNotFound;
}
- (NSInteger)conversationIdentifier
{
return (NSInteger)self;
}
- (NSRange)selectedRange
{
return [helper imRange];
}
- (NSRect)firstRectForCharacterRange:(NSRange)range
{
return [helper firstRectForCharacterRange:range];
}
@end // MMAtsuiTextView
@@ -869,7 +1020,7 @@ defaultLineHeightForFont(NSFont *font)
- (NSRect)rectFromRow:(int)row1 column:(int)col1
toRow:(int)row2 column:(int)col2
{
NSPoint origin = [self originForRow: row1 column: col1];
NSPoint origin = [self originForRow:row1 column:col1];
return NSMakeRect(origin.x, origin.y,
(col2 + 1 - col1) * cellSize.width,
(row2 + 1 - row1) * cellSize.height);
@@ -887,7 +1038,7 @@ defaultLineHeightForFont(NSFont *font)
//NSLog(@"resizeContentImage");
[contentImage release];
contentImage = [[NSImage alloc] initWithSize:[self textAreaSize]];
[contentImage setFlipped: YES];
[contentImage setFlipped:YES];
imageSize = [self textAreaSize];
}
@@ -1065,7 +1216,7 @@ defaultLineHeightForFont(NSFont *font)
}
- (void)drawInsertionPointAtRow:(int)row column:(int)col shape:(int)shape
fraction:(int)percent color:(NSColor *)color
fraction:(int)percent
{
NSPoint origin = [self originForRow:row column:col];
NSRect rect = NSMakeRect(origin.x, origin.y,
@@ -1086,7 +1237,7 @@ defaultLineHeightForFont(NSFont *font)
rect.size.width = frac;
}
[color set];
[[helper insertionPointColor] set];
if (MMInsertionPointHollow == shape) {
NSFrameRect(rect);
} else {
+1 -2
View File
@@ -25,14 +25,12 @@
NSDictionary *colorDict;
NSDictionary *sysColorDict;
NSDictionary *actionDict;
BOOL inputReceived;
BOOL tabBarVisible;
unsigned backgroundColor;
unsigned foregroundColor;
unsigned specialColor;
unsigned defaultBackgroundColor;
unsigned defaultForegroundColor;
NSDate *lastFlushDate;
id dialogReturn;
NSTimer *blinkTimer;
int blinkState;
@@ -113,6 +111,7 @@
- (void)enterFullscreen:(int)fuoptions background:(int)bg;
- (void)leaveFullscreen;
- (void)setFullscreenBackgroundColor:(int)color;
- (void)setAntialias:(BOOL)antialias;
+349 -271
View File
@@ -44,13 +44,6 @@
#define WIN_VER 2 // "-O" vertically split windows
#define WIN_TABS 3 // "-p" windows on tab pages
// This constant controls how often the command queue may be flushed. If it is
// too small the app might feel unresponsive; if it is too large there might be
// long periods without the screen updating (e.g. when sourcing a large session
// file). (The unit is seconds.)
static float MMFlushTimeoutInterval = 0.1f;
static int MMFlushQueueLenHint = 80*40;
static unsigned MMServerMax = 1000;
// TODO: Move to separate file.
@@ -70,6 +63,7 @@ vimmenu_T *menu_for_descriptor(NSArray *desc);
static id evalExprCocoa(NSString * expr, NSString ** errstr);
enum {
MMBlinkStateNone = 0,
MMBlinkStateOn,
@@ -97,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;
@@ -114,6 +108,8 @@ static NSString *MMSymlinkWarningString =
- (BOOL)checkForModifiedBuffers;
- (void)addInput:(NSString *)input;
- (BOOL)unusedEditor;
- (void)redrawScreen;
- (void)handleFindReplace:(NSDictionary *)args;
@end
@@ -327,7 +323,7 @@ static NSString *MMSymlinkWarningString =
NSOrderedDescending == [timeOutDate compare:[NSDate date]])
[[NSRunLoop currentRunLoop]
runMode:NSDefaultRunLoopMode
beforeDate:[NSDate dateWithTimeIntervalSinceNow:1]];
beforeDate:[NSDate dateWithTimeIntervalSinceNow:.1]];
// NOTE: [self connection] will set 'connection' as a side-effect.
if (!connection) {
@@ -473,17 +469,10 @@ static NSString *MMSymlinkWarningString =
- (void)update
{
// Tend to the run loop, returning immediately if there are no events
// waiting.
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
beforeDate:[NSDate distantPast]];
#if 0
// Keyboard and mouse input is handled directly, other input is queued and
// processed here. This call may enter a blocking loop.
if ([inputQueue count] > 0)
[self processInputQueue];
#endif
// Keep running the run-loop until there is no more input to process.
while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, true)
== kCFRunLoopRunHandledSource)
;
}
- (void)flushQueue:(BOOL)force
@@ -494,14 +483,6 @@ static NSString *MMSymlinkWarningString =
// NO.
if (flushDisabled) return;
// NOTE! This method gets called a lot; if we were to flush every time it
// got called MacVim would feel unresponsive. So there is a time out which
// ensures that the queue isn't flushed too often.
if (!force && lastFlushDate
&& -[lastFlushDate timeIntervalSinceNow] < MMFlushTimeoutInterval
&& [drawData length] < MMFlushQueueLenHint)
return;
if ([drawData length] > 0) {
// HACK! Detect changes to 'guifontwide'.
if (gui.wide_font != (GuiFont)oldWideFont) {
@@ -530,43 +511,40 @@ static NSString *MMSymlinkWarningString =
}
[outputQueue removeAllObjects];
[lastFlushDate release];
lastFlushDate = [[NSDate date] retain];
}
}
- (BOOL)waitForInput:(int)milliseconds
{
//NSLog(@"|ENTER| %s%d", _cmd, milliseconds);
// Return NO if we timed out waiting for input, otherwise return YES.
BOOL inputReceived = NO;
// Only start the run loop if the input queue is empty, otherwise process
// the input first so that the input on queue isn't delayed.
if ([inputQueue count]) {
inputReceived = YES;
} else {
NSDate *date = milliseconds > 0 ?
[NSDate dateWithTimeIntervalSinceNow:.001*milliseconds] :
[NSDate distantFuture];
// Wait for the specified amount of time, unless 'milliseconds' is
// negative in which case we wait "forever" (1e6 seconds translates to
// approximately 11 days).
CFTimeInterval dt = (milliseconds >= 0 ? .001*milliseconds : 1e6);
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
beforeDate:date];
while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, dt, true)
== kCFRunLoopRunHandledSource) {
// In order to ensure that all input on the run-loop has been
// processed we set the timeout to 0 and keep processing until the
// run-loop times out.
dt = 0.0;
inputReceived = YES;
}
}
// I know of no way to figure out if the run loop exited because input was
// found or because of a time out, so I need to manually indicate when
// input was received in processInput:data: and then reset it every time
// here.
BOOL yn = inputReceived;
inputReceived = NO;
// Keyboard and mouse input is handled directly, other input is queued and
// processed here. This call may enter a blocking loop.
// The above calls may have placed messages on the input queue so process
// it now. This call may enter a blocking loop.
if ([inputQueue count] > 0)
[self processInputQueue];
//NSLog(@"|LEAVE| %s input=%d", _cmd, yn);
return yn;
return inputReceived;
}
- (void)exit
@@ -589,10 +567,10 @@ static NSString *MMSymlinkWarningString =
if ([connection isValid]) {
@try {
int msgid = CloseWindowMsgID;
NSData *data = [NSData dataWithBytes:&msgid length:sizeof(int)];
NSArray *q = [NSArray arrayWithObjects:data, [NSData data], nil];
[frontendProxy processCommandQueue:q];
// Flush the entire queue in case a VimLeave autocommand added
// something to the queue.
[self queueMessage:CloseWindowMsgID data:nil];
[frontendProxy processCommandQueue:outputQueue];
}
@catch (NSException *e) {
NSLog(@"Exception caught when sending CloseWindowMsgID: \"%@\"", e);
@@ -718,16 +696,8 @@ static NSString *MMSymlinkWarningString =
[self waitForDialogReturn];
if (dialogReturn && [dialogReturn isKindOfClass:[NSString class]]) {
char_u *ret = (char_u*)[dialogReturn UTF8String];
#ifdef FEAT_MBYTE
ret = CONVERT_FROM_UTF8(ret);
#endif
s = vim_strsave(ret);
#ifdef FEAT_MBYTE
CONVERT_FROM_UTF8_FREE(ret);
#endif
}
if (dialogReturn && [dialogReturn isKindOfClass:[NSString class]])
s = [dialogReturn vimStringSave];
[dialogReturn release]; dialogReturn = nil;
}
@@ -1044,6 +1014,15 @@ static NSString *MMSymlinkWarningString =
[self queueMessage:LeaveFullscreenMsgID data:nil];
}
- (void)setFullscreenBackgroundColor:(int)color
{
NSMutableData *data = [NSMutableData data];
color = MM_COLOR(color);
[data appendBytes:&color length:sizeof(int)];
[self queueMessage:SetFullscreenColorMsgID data:data];
}
- (void)setAntialias:(BOOL)antialias
{
int msgid = antialias ? EnableAntialiasMsgID : DisableAntialiasMsgID;
@@ -1063,138 +1042,78 @@ static NSString *MMSymlinkWarningString =
- (oneway void)processInput:(int)msgid data:(in bycopy NSData *)data
{
// NOTE: This method might get called whenever the run loop is tended to.
// Normal keyboard and mouse input is added to input buffers, so there is
// no risk in handling these events directly (they return immediately, and
// do not call any other Vim functions). However, other events such
// as 'VimShouldCloseMsgID' may enter blocking loops that wait for key
// events which would cause this method to be called recursively. This
// in turn leads to various difficulties that we do not want to have to
// deal with. To avoid recursive calls here we add all events except
// keyboard and mouse events to an input queue which is processed whenever
// gui_mch_update() is called (see processInputQueue).
// Look for Cmd-. and Ctrl-C immediately instead of waiting until the input
// queue is processed since that only happens in waitForInput: (and Vim
// regularly checks for Ctrl-C in between waiting for input).
//NSLog(@"%s%s", _cmd, MessageStrings[msgid]);
// Don't flush too soon after receiving input or update speed will suffer.
[lastFlushDate release];
lastFlushDate = [[NSDate date] retain];
// Handle keyboard and mouse input now. All other events are queued.
if (InsertTextMsgID == msgid) {
[self handleInsertText:data];
} else if (KeyDownMsgID == msgid || CmdKeyMsgID == msgid) {
if (!data) return;
BOOL interrupt = NO;
if (msgid == InterruptMsgID) {
interrupt = YES;
} else if (InsertTextMsgID == msgid && data != nil) {
const void *bytes = [data bytes];
int mods = *((int*)bytes); bytes += sizeof(int);
bytes += sizeof(int);
int len = *((int*)bytes); bytes += sizeof(int);
NSString *key = [[NSString alloc] initWithBytes:bytes length:len
encoding:NSUTF8StringEncoding];
mods = eventModifierFlagsToVimModMask(mods);
[self handleKeyDown:key modifiers:mods];
[key release];
} else if (ScrollWheelMsgID == msgid) {
if (!data) return;
const void *bytes = [data bytes];
int row = *((int*)bytes); bytes += sizeof(int);
int col = *((int*)bytes); bytes += sizeof(int);
int flags = *((int*)bytes); bytes += sizeof(int);
float dy = *((float*)bytes); bytes += sizeof(float);
int button = MOUSE_5;
if (dy > 0) button = MOUSE_4;
flags = eventModifierFlagsToVimMouseModMask(flags);
int numLines = (int)round(dy);
if (numLines < 0) numLines = -numLines;
if (numLines == 0) numLines = 1;
#ifdef FEAT_GUI_SCROLL_WHEEL_FORCE
gui.scroll_wheel_force = numLines;
#endif
gui_send_mouse_event(button, col, row, NO, flags);
} else if (MouseDownMsgID == msgid) {
if (!data) return;
const void *bytes = [data bytes];
int row = *((int*)bytes); bytes += sizeof(int);
int col = *((int*)bytes); bytes += sizeof(int);
int button = *((int*)bytes); bytes += sizeof(int);
int flags = *((int*)bytes); bytes += sizeof(int);
int count = *((int*)bytes); bytes += sizeof(int);
button = eventButtonNumberToVimMouseButton(button);
if (button >= 0) {
flags = eventModifierFlagsToVimMouseModMask(flags);
gui_send_mouse_event(button, col, row, count>1, flags);
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;
}
} else if (MouseUpMsgID == msgid) {
if (!data) return;
const void *bytes = [data bytes];
int row = *((int*)bytes); bytes += sizeof(int);
int col = *((int*)bytes); bytes += sizeof(int);
int flags = *((int*)bytes); bytes += sizeof(int);
flags = eventModifierFlagsToVimMouseModMask(flags);
gui_send_mouse_event(MOUSE_RELEASE, col, row, NO, flags);
} else if (MouseDraggedMsgID == msgid) {
if (!data) return;
const void *bytes = [data bytes];
int row = *((int*)bytes); bytes += sizeof(int);
int col = *((int*)bytes); bytes += sizeof(int);
int flags = *((int*)bytes); bytes += sizeof(int);
flags = eventModifierFlagsToVimMouseModMask(flags);
gui_send_mouse_event(MOUSE_DRAG, col, row, NO, flags);
} else if (MouseMovedMsgID == msgid) {
const void *bytes = [data bytes];
int row = *((int*)bytes); bytes += sizeof(int);
int col = *((int*)bytes); bytes += sizeof(int);
gui_mouse_moved(col, row);
} else if (AddInputMsgID == msgid) {
NSString *string = [[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding];
if (string) {
[self addInput:string];
[string release];
}
} else if (TerminateNowMsgID == msgid) {
isTerminating = YES;
} else {
// Not keyboard or mouse event, queue it and handle later.
//NSLog(@"Add event %s to input event queue", MessageStrings[msgid]);
[inputQueue addObject:[NSNumber numberWithInt:msgid]];
[inputQueue addObject:(data ? (id)data : (id)[NSNull null])];
}
// See waitForInput: for an explanation of this flag.
inputReceived = YES;
if (interrupt) {
got_int = TRUE;
[inputQueue removeAllObjects];
return;
}
// 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.
// Keyboard input is never dropped, unless the input represents and
// auto-repeated key.
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;
}
}
}
[inputQueue addObject:[NSNumber numberWithInt:msgid]];
[inputQueue addObject:(data ? (id)data : [NSNull null])];
}
- (oneway void)processInputAndData:(in bycopy NSArray *)messages
{
// TODO: Get rid of this method?
//NSLog(@"%s%@", _cmd, messages);
unsigned i, count = [messages count];
for (i = 0; i < count; i += 2) {
int msgid = [[messages objectAtIndex:i] intValue];
id data = [messages objectAtIndex:i+1];
if ([data isEqual:[NSNull null]])
data = nil;
[self processInput:msgid data:data];
}
// This is just a convenience method that allows the frontend to delay
// sending messages.
int i, count = [messages count];
for (i = 1; i < count; i+=2)
[self processInput:[[messages objectAtIndex:i-1] intValue]
data:[messages objectAtIndex:i]];
}
- (id)evaluateExpressionCocoa:(in bycopy NSString *)expr
@@ -1309,8 +1228,6 @@ static NSString *MMSymlinkWarningString =
[self addInput:input];
[self addClient:(id)client];
inputReceived = YES;
}
- (NSString *)evaluateExpression:(in bycopy NSString *)expr
@@ -1340,15 +1257,8 @@ static NSString *MMSymlinkWarningString =
//[svrConn setReplyTimeout:MMReplyTimeout];
[svrConn setRootObject:self];
char_u *s = (char_u*)[svrName UTF8String];
#ifdef FEAT_MBYTE
s = CONVERT_FROM_UTF8(s);
#endif
// NOTE: 'serverName' is a global variable
serverName = vim_strsave(s);
#ifdef FEAT_MBYTE
CONVERT_FROM_UTF8_FREE(s);
#endif
serverName = [svrName vimStringSave];
#ifdef FEAT_EVAL
set_vim_var_string(VV_SEND_SERVER, serverName, -1);
#endif
@@ -1400,14 +1310,7 @@ static NSString *MMSymlinkWarningString =
NSString *eval = [proxy evaluateExpression:string client:self];
if (reply) {
if (eval) {
char_u *r = (char_u*)[eval UTF8String];
#ifdef FEAT_MBYTE
r = CONVERT_FROM_UTF8(r);
#endif
*reply = vim_strsave(r);
#ifdef FEAT_MBYTE
CONVERT_FROM_UTF8_FREE(r);
#endif
*reply = [eval vimStringSave];
} else {
*reply = vim_strsave((char_u*)_(e_invexprmsg));
}
@@ -1618,10 +1521,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.
@@ -1636,17 +1542,17 @@ static NSString *MMSymlinkWarningString =
if ([inputQueue count] == 0) return;
// NOTE: One of the input events may cause this method to be called
// recursively, so copy the input queue to a local variable and clear it
// before starting to process input events (otherwise we could get stuck in
// an endless loop).
// recursively, so copy the input queue to a local variable and clear the
// queue before starting to process input events (otherwise we could get
// stuck in an endless loop).
NSArray *q = [inputQueue copy];
unsigned i, count = [q count];
[inputQueue removeAllObjects];
for (i = 0; i < count-1; i += 2) {
int msgid = [[q objectAtIndex:i] intValue];
id data = [q objectAtIndex:i+1];
for (i = 1; i < count; i+=2) {
int msgid = [[q objectAtIndex:i-1] intValue];
id data = [q objectAtIndex:i];
if ([data isEqual:[NSNull null]])
data = nil;
@@ -1660,9 +1566,99 @@ static NSString *MMSymlinkWarningString =
- (void)handleInputEvent:(int)msgid data:(NSData *)data
{
//NSLog(@"%s%s", _cmd, MessageStrings[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];
mods = eventModifierFlagsToVimModMask(mods);
if (SelectTabMsgID == msgid) {
if (InsertTextMsgID == msgid)
[self handleInsertText:key];
else
[self handleKeyDown:key modifiers:mods];
[key release];
} else if (ScrollWheelMsgID == msgid) {
if (!data) return;
const void *bytes = [data bytes];
int row = *((int*)bytes); bytes += sizeof(int);
int col = *((int*)bytes); bytes += sizeof(int);
int flags = *((int*)bytes); bytes += sizeof(int);
float dy = *((float*)bytes); bytes += sizeof(float);
int button = MOUSE_5;
if (dy > 0) button = MOUSE_4;
flags = eventModifierFlagsToVimMouseModMask(flags);
int numLines = (int)round(dy);
if (numLines < 0) numLines = -numLines;
if (numLines == 0) numLines = 1;
#ifdef FEAT_GUI_SCROLL_WHEEL_FORCE
gui.scroll_wheel_force = numLines;
#endif
gui_send_mouse_event(button, col, row, NO, flags);
} else if (MouseDownMsgID == msgid) {
if (!data) return;
const void *bytes = [data bytes];
int row = *((int*)bytes); bytes += sizeof(int);
int col = *((int*)bytes); bytes += sizeof(int);
int button = *((int*)bytes); bytes += sizeof(int);
int flags = *((int*)bytes); bytes += sizeof(int);
int count = *((int*)bytes); bytes += sizeof(int);
button = eventButtonNumberToVimMouseButton(button);
if (button >= 0) {
flags = eventModifierFlagsToVimMouseModMask(flags);
gui_send_mouse_event(button, col, row, count>1, flags);
}
} else if (MouseUpMsgID == msgid) {
if (!data) return;
const void *bytes = [data bytes];
int row = *((int*)bytes); bytes += sizeof(int);
int col = *((int*)bytes); bytes += sizeof(int);
int flags = *((int*)bytes); bytes += sizeof(int);
flags = eventModifierFlagsToVimMouseModMask(flags);
gui_send_mouse_event(MOUSE_RELEASE, col, row, NO, flags);
} else if (MouseDraggedMsgID == msgid) {
if (!data) return;
const void *bytes = [data bytes];
int row = *((int*)bytes); bytes += sizeof(int);
int col = *((int*)bytes); bytes += sizeof(int);
int flags = *((int*)bytes); bytes += sizeof(int);
flags = eventModifierFlagsToVimMouseModMask(flags);
gui_send_mouse_event(MOUSE_DRAG, col, row, NO, flags);
} else if (MouseMovedMsgID == msgid) {
const void *bytes = [data bytes];
int row = *((int*)bytes); bytes += sizeof(int);
int col = *((int*)bytes); bytes += sizeof(int);
gui_mouse_moved(col, row);
} else if (AddInputMsgID == msgid) {
NSString *string = [[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding];
if (string) {
[self addInput:string];
[string release];
}
} else if (TerminateNowMsgID == msgid) {
isTerminating = YES;
} else if (SelectTabMsgID == msgid) {
if (!data) return;
const void *bytes = [data bytes];
int idx = *((int*)bytes) + 1;
@@ -1685,17 +1681,36 @@ static NSString *MMSymlinkWarningString =
int idx = *((int*)bytes);
tabpage_move(idx);
} else if (SetTextDimensionsMsgID == msgid || LiveResizeMsgID == msgid) {
} else if (SetTextDimensionsMsgID == msgid || LiveResizeMsgID == msgid
|| SetTextRowsMsgID == msgid || SetTextColumnsMsgID == msgid) {
if (!data) return;
const void *bytes = [data bytes];
int rows = *((int*)bytes); bytes += sizeof(int);
int cols = *((int*)bytes); bytes += sizeof(int);
int rows = Rows;
if (SetTextColumnsMsgID != msgid) {
rows = *((int*)bytes); bytes += sizeof(int);
}
int cols = Columns;
if (SetTextRowsMsgID != msgid) {
cols = *((int*)bytes); bytes += sizeof(int);
}
NSData *d = data;
if (SetTextRowsMsgID == msgid || SetTextColumnsMsgID == msgid) {
int dim[2] = { rows, cols };
d = [NSData dataWithBytes:dim length:2*sizeof(int)];
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.)
[self queueMessage:msgid data:data];
// 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);
gui_resize_shell(cols, rows);
@@ -1733,6 +1748,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);
}
@@ -1752,14 +1769,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;
@@ -1770,12 +1785,6 @@ static NSString *MMSymlinkWarningString =
}
#endif
if (len == 1 && ((str[0] == Ctrl_C && ctrl_c_interrupts)
|| (str[0] == intr_char && intr_char != Ctrl_C))) {
trash_input_buf();
got_int = TRUE;
}
for (i = 0; i < len; ++i) {
add_to_input_buf(str+i, 1);
if (CSI == str[i]) {
@@ -1791,11 +1800,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];
@@ -1858,18 +1867,55 @@ 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);
if (length == 1 && ((c == Ctrl_C && ctrl_c_interrupts)
|| (c == intr_char && intr_char != Ctrl_C))) {
trash_input_buf();
got_int = TRUE;
}
// HACK! In most circumstances the Ctrl and Shift modifiers should be
// cleared since they are already added to the key by the AppKit.
// Unfortunately, the only way to deal with when to clear the modifiers
@@ -1881,14 +1927,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);
@@ -2003,13 +2041,7 @@ static NSString *MMSymlinkWarningString =
set_option_value((char_u*)"guioptions", 0, go, 0);
// Force screen redraw (does it have to be this complicated?).
redraw_all_later(CLEAR);
update_screen(NOT_VALID);
setcursor();
out_flush();
gui_update_cursor(FALSE, FALSE);
gui_mch_flush();
[self redrawScreen];
}
- (void)handleScrollbarEvent:(NSData *)data
@@ -2101,13 +2133,7 @@ static NSString *MMSymlinkWarningString =
CONVERT_FROM_UTF8_FREE(s);
#endif
// Force screen redraw (does it have to be this complicated?).
redraw_all_later(CLEAR);
update_screen(NOT_VALID);
setcursor();
out_flush();
gui_update_cursor(FALSE, FALSE);
gui_mch_flush();
[self redrawScreen];
}
- (void)handleDropFiles:(NSData *)data
@@ -2258,17 +2284,20 @@ static NSString *MMSymlinkWarningString =
- (void)handleOpenWithArguments:(NSDictionary *)args
{
// ARGUMENT: DESCRIPTION:
// -------------------------------------------------------------
// filenames list of filenames
// dontOpen don't open files specified in above argument
// layout which layout to use to open files
// selectionRange range to select
// searchText string to search for
// remoteID ODB parameter
// remotePath ODB parameter
// remoteTokenDescType ODB parameter
// remoteTokenData ODB parameter
// ARGUMENT: DESCRIPTION:
// -------------------------------------------------------------
// filenames list of filenames
// dontOpen don't open files specified in above argument
// layout which layout to use to open files
// selectionRange range of lines to select
// searchText string to search for
// cursorLine line to position the cursor on
// cursorColumn column to position the cursor on
// (only valid when "cursorLine" is set)
// remoteID ODB parameter
// remotePath ODB parameter
// remoteTokenDescType ODB parameter
// remoteTokenData ODB parameter
//NSLog(@"%s%@ (starting=%d)", _cmd, args, starting);
@@ -2359,6 +2388,10 @@ static NSString *MMSymlinkWarningString =
[cmd appendString:file];
}
// 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:cmd];
// Split the view into multiple windows if requested.
@@ -2367,6 +2400,9 @@ static NSString *MMSymlinkWarningString =
else if (WIN_VER == layout)
[self addInput:@"|vert sall"];
// Restore the old value of 'suffixes'.
[self addInput:@"|let &su=t:mvim_oldsu|unlet t:mvim_oldsu"];
// Adding "|redr|f" ensures a "Hit ENTER" prompt is not shown.
[self addInput:@"|redr|f<CR>"];
} else {
@@ -2413,7 +2449,6 @@ static NSString *MMSymlinkWarningString =
maketitle();
flushDisabled = NO;
gui_mch_flush();
}
}
@@ -2425,6 +2460,17 @@ static NSString *MMSymlinkWarningString =
waitUntilDone:NO];
}
NSString *lineString = [args objectForKey:@"cursorLine"];
if (lineString && [lineString intValue] > 0) {
NSString *columnString = [args objectForKey:@"cursorColumn"];
if (!(columnString && [columnString intValue] > 0))
columnString = @"1";
NSString *cmd = [NSString stringWithFormat:@"<C-\\><C-N>:cal "
"cursor(%@,%@)|norm! zz<CR>:f<CR>", lineString, columnString];
[self addInput:cmd];
}
NSString *rangeString = [args objectForKey:@"selectionRange"];
if (rangeString) {
// Build a command line string that will select the given range of
@@ -2495,6 +2541,39 @@ static NSString *MMSymlinkWarningString =
return onlyOneTab && oneWindowInTab && !bufChanged && !bufHasFilename;
}
- (void)redrawScreen
{
// Force screen redraw (does it have to be this complicated?).
redraw_all_later(CLEAR);
update_screen(NOT_VALID);
setcursor();
out_flush();
gui_update_cursor(FALSE, FALSE);
// HACK! The cursor is not put back at the command line by the above
// "redraw commands". The following test seems to do the trick though.
if (State & CMDLINE)
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)
@@ -2838,7 +2917,6 @@ static id evalExprCocoa(NSString * expr, NSString ** errstr)
@implementation NSString (VimStrings)
+ (id)stringWithVimString:(char_u *)s
+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
+21 -3
View File
@@ -157,12 +157,30 @@ static int numFullscreenWindows = 0;
// if necessary, resize vim to target fu size
if (currRows != fuRows || currColumns != fuColumns) {
int newSize[2] = { fuRows, fuColumns };
NSData *data = [NSData dataWithBytes:newSize length:2*sizeof(int)];
// The size sent here is queued and sent to vim when it's in
// event processing mode again. Make sure to only send the values we
// care about, as they override any changes that were made to 'lines'
// and 'columns' after 'fu' was set but before the event loop is run.
NSData *data = nil;
int msgid = 0;
if (currRows != fuRows && currColumns != fuColumns) {
int newSize[2] = { fuRows, fuColumns };
data = [NSData dataWithBytes:newSize length:2*sizeof(int)];
msgid = SetTextDimensionsMsgID;
} else if (currRows != fuRows) {
data = [NSData dataWithBytes:&fuRows length:sizeof(int)];
msgid = SetTextRowsMsgID;
} else if (currColumns != fuColumns) {
data = [NSData dataWithBytes:&fuColumns length:sizeof(int)];
msgid = SetTextColumnsMsgID;
}
NSParameterAssert(data != nil && msgid != 0);
MMVimController *vimController =
[[self windowController] vimController];
[vimController sendMessage:SetTextDimensionsMsgID data:data];
[vimController sendMessage:msgid data:data];
[[view textView] setMaxRows:fuRows columns:fuColumns];
}
+7 -7
View File
@@ -19,12 +19,6 @@
int insertionPointColumn;
int insertionPointShape;
int insertionPointFraction;
NSRange imRange;
NSRange markedRange;
NSDictionary *markedTextAttributes;
NSMutableAttributedString *markedText;
int preEditRow;
int preEditColumn;
BOOL antialias;
NSRect *invertRects;
int numInvertRects;
@@ -34,7 +28,6 @@
- (id)initWithFrame:(NSRect)frame;
- (void)setShouldDrawInsertionPoint:(BOOL)on;
- (void)setPreEditRow:(int)row column:(int)col;
- (void)performBatchDrawWithData:(NSData *)data;
- (void)setMouseShape:(int)shape;
@@ -45,16 +38,20 @@
//
- (NSFont *)font;
- (void)setFont:(NSFont *)newFont;
- (NSFont *)fontWide;
- (void)setWideFont:(NSFont *)newFont;
- (NSSize)cellSize;
- (void)setLinespace:(float)newLinespace;
- (int)maxRows;
- (int)maxColumns;
- (void)getMaxRows:(int*)rows columns:(int*)cols;
- (void)setMaxRows:(int)rows columns:(int)cols;
- (NSRect)rectForRowsInRange:(NSRange)range;
- (NSRect)rectForColumnsInRange:(NSRange)range;
- (void)setDefaultColorsBackground:(NSColor *)bgColor
foreground:(NSColor *)fgColor;
- (NSColor *)defaultBackgroundColor;
- (NSColor *)defaultForegroundColor;
- (NSSize)constrainRows:(int *)rows columns:(int *)cols toSize:(NSSize)size;
- (NSSize)desiredSize;
@@ -62,5 +59,8 @@
- (BOOL)convertPoint:(NSPoint)point toRow:(int *)row column:(int *)column;
- (NSPoint)pointForRow:(int)row column:(int)col;
- (NSRect)rectForRow:(int)row column:(int)col numRows:(int)nr
numColumns:(int)nc;
@end
+95 -162
View File
@@ -35,13 +35,11 @@
@interface MMTextView (Private)
- (BOOL)convertRow:(int)row column:(int)column toPoint:(NSPoint *)point;
- (BOOL)convertRow:(int)row column:(int)column numRows:(int)nr
numColumns:(int)nc toRect:(NSRect *)rect;
- (MMWindowController *)windowController;
- (MMVimController *)vimController;
- (void)setShouldDrawInsertionPoint:(BOOL)on;
- (void)drawInsertionPointAtRow:(int)row column:(int)col shape:(int)shape
fraction:(int)percent color:(NSColor *)color;
fraction:(int)percent;
- (void)drawInvertedRectAtRow:(int)row column:(int)col numRows:(int)nrows
numColumns:(int)ncols invert:(int)invert;
@end
@@ -103,8 +101,6 @@
helper = [[MMTextViewHelper alloc] init];
[helper setTextView:self];
imRange = NSMakeRange(0, 0);
markedRange = NSMakeRange(0, 0);
// NOTE: If the default changes to 'NO' then the intialization of
// p_antialias in option.c must change as well.
antialias = YES;
@@ -116,12 +112,6 @@
{
LOG_DEALLOC
if (markedText) {
imRange = NSMakeRange(0, 0);
[markedText release];
markedText = nil;
}
if (invertRects) {
free(invertRects);
invertRects = NULL;
@@ -143,15 +133,9 @@
return NO;
}
- (void)setShouldDrawInsertionPoint:(BOOL)on
{
shouldDrawInsertionPoint = on;
}
- (void)setPreEditRow:(int)row column:(int)col
{
preEditRow = row;
preEditColumn = col;
[helper setPreEditRow:row column:col];
}
#define MM_DEBUG_DRAWING 0
@@ -231,13 +215,8 @@
// NOTE: If this is a call to draw the (block) cursor, then cancel
// any previous request to draw the insertion point, or it might
// get drawn as well.
if (flags & DRAW_CURSOR) {
if (flags & DRAW_CURSOR)
[self setShouldDrawInsertionPoint:NO];
//NSColor *color = [NSColor colorWithRgbInt:bg];
//[self drawInsertionPointAtRow:row column:col
// shape:MMInsertionPointBlock
// color:color];
}
[textStorage drawString:string
atRow:row column:col cells:cells
@@ -271,9 +250,9 @@
#if MM_DEBUG_DRAWING
NSLog(@" Draw cursor at (%d,%d)", row, col);
#endif
[helper setInsertionPointColor:[NSColor colorWithRgbInt:color]];
[self drawInsertionPointAtRow:row column:col shape:shape
fraction:percent
color:[NSColor colorWithRgbInt:color]];
fraction:percent];
} else if (DrawInvertedRectDrawType == type) {
int row = *((int*)bytes); bytes += sizeof(int);
int col = *((int*)bytes); bytes += sizeof(int);
@@ -308,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);
@@ -335,6 +315,11 @@
[(MMTextStorage*)[self textStorage] setFont:newFont];
}
- (NSFont *)fontWide
{
return [(MMTextStorage*)[self textStorage] fontWide];
}
- (void)setWideFont:(NSFont *)newFont
{
[(MMTextStorage*)[self textStorage] setWideFont:newFont];
@@ -356,6 +341,12 @@
return [ts maxRows];
}
- (int)maxColumns
{
MMTextStorage *ts = (MMTextStorage *)[self textStorage];
return [ts maxColumns];
}
- (void)getMaxRows:(int*)rows columns:(int*)cols
{
return [(MMTextStorage*)[self textStorage] getMaxRows:rows columns:cols];
@@ -384,6 +375,16 @@
setDefaultColorsBackground:bgColor foreground:fgColor];
}
- (NSColor *)defaultBackgroundColor
{
return [(MMTextStorage*)[self textStorage] defaultBackgroundColor];
}
- (NSColor *)defaultForegroundColor
{
return [(MMTextStorage*)[self textStorage] defaultForegroundColor];
}
- (NSSize)constrainRows:(int *)rows columns:(int *)cols toSize:(NSSize)size
{
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
@@ -449,6 +450,39 @@
return YES;
}
- (NSPoint)pointForRow:(int)row column:(int)col
{
// Return the upper-left coordinate for (row,column).
// NOTE: The coordinate system is flipped!
NSPoint pt = [self textContainerOrigin];
MMTextStorage *ts = (MMTextStorage*)[self textStorage];
NSSize cellSize = [ts cellSize];
pt.x += col * cellSize.width;
pt.y += row * cellSize.height;
return pt;
}
- (NSRect)rectForRow:(int)row column:(int)col numRows:(int)nr
numColumns:(int)nc
{
// Return the rect for the block which covers the specified rows and
// columns. The upper-left corner is the origin of this rect.
// NOTE: The coordinate system is flipped!
NSRect rect;
MMTextStorage *ts = (MMTextStorage*)[self textStorage];
NSSize cellSize = [ts cellSize];
rect.origin = [self textContainerOrigin];
rect.origin.x += col * cellSize.width;
rect.origin.y += row * cellSize.height;
rect.size.width = cellSize.width * nc;
rect.size.height = cellSize.height * nr;
return rect;
}
- (BOOL)isOpaque
{
return NO;
@@ -496,7 +530,7 @@
inset.height -= baseline;
int len = [markedText length];
int len = [[helper markedText] length];
// The following implementation should be re-written with
// more efficient way...
@@ -509,11 +543,11 @@
cols = cols / 2;
int done = 0;
int lend = cols > len ? len : cols;
NSAttributedString *aString = [markedText attributedSubstringFromRange:
NSMakeRange(done, lend)];
NSAttributedString *aString = [[helper markedText]
attributedSubstringFromRange:NSMakeRange(done, lend)];
[aString drawAtPoint:NSMakePoint(
preEditColumn*[ts cellSize].width + inset.width,
preEditRow*[ts cellSize].height + inset.height)];
[helper preEditColumn]*[ts cellSize].width + inset.width,
[helper preEditRow]*[ts cellSize].height + inset.height)];
done = lend;
// Check whether there're charecters that aren't drawn at
@@ -527,11 +561,11 @@
for (r = 1; r <= rows; r++) {
lend = len - done > [ts actualColumns] / 2
? [ts actualColumns] / 2 : len - done;
aString = [markedText attributedSubstringFromRange:
aString = [[helper markedText] attributedSubstringFromRange:
NSMakeRange(done, lend)];
[aString drawAtPoint:NSMakePoint(
inset.width,
(preEditRow + r)*[ts cellSize].height
([helper preEditRow] + r)*[ts cellSize].height
+ inset.height)];
done += lend;
}
@@ -541,8 +575,8 @@
if (shouldDrawInsertionPoint) {
MMTextStorage *ts = (MMTextStorage*)[self textStorage];
NSRect ipRect = [ts boundingRectForCharacterAtRow:preEditRow
column:preEditColumn];
NSRect ipRect = [ts boundingRectForCharacterAtRow:[helper preEditRow]
column:[helper preEditColumn]];
ipRect.origin.x += [self textContainerOrigin].x;
ipRect.origin.y += [self textContainerOrigin].y;
@@ -552,10 +586,12 @@
valueForKey:NSFontAttributeName];
if (theFont == [ts font])
ipRect.origin.x += [ts cellSize].width *
(imRange.location + imRange.length);
([helper imRange].location +
[helper imRange].length);
else
ipRect.origin.x += [ts cellSize].width * 2 *
(imRange.location + imRange.length);
([helper imRange].location +
[helper imRange].length);
}
if (MMInsertionPointHorizontal == insertionPointShape) {
@@ -571,7 +607,7 @@
ipRect.size.width = frac;
}
[[self insertionPointColor] set];
[[helper insertionPointColor] set];
if (MMInsertionPointHollow == insertionPointShape) {
NSFrameRect(ipRect);
} else {
@@ -584,7 +620,7 @@
//NSLog(@"%s draw insertion point %@ shape=%d color=%@", _cmd,
// NSStringFromRect(ipRect), insertionPointShape,
// [self insertionPointColor]);
// [helper insertionPointColor]);
}
#if 0
@@ -627,109 +663,37 @@
- (BOOL)hasMarkedText
{
//NSLog(@"%s", _cmd);
//return markedText && [markedText length] > 0;
return markedRange.length > 0 ? YES : NO;
return [helper hasMarkedText];
}
- (NSRange)markedRange
{
if ([self hasMarkedText]) {
return markedRange;
} else
return NSMakeRange(NSNotFound, 0);
return [helper markedRange];
}
- (NSDictionary *)markedTextAttributes
{
return markedTextAttributes;
return [helper markedTextAttributes];
}
- (void)setMarkedTextAttributes:(NSDictionary *)attr
{
if (attr != markedTextAttributes) {
[markedTextAttributes release];
markedTextAttributes = [attr retain];
}
[helper setMarkedTextAttributes:attr];
}
- (void)setMarkedText:(id)text selectedRange:(NSRange)range
{
//NSLog(@"setMarkedText:'%@' selectedRange:%@", text,
// NSStringFromRange(range));
MMTextStorage *ts = (MMTextStorage*)[self textStorage];
if (!ts)
return;
[self unmarkText];
if (text && [text length] > 0) {
if ([text isKindOfClass:[NSAttributedString class]]) {
[self setMarkedTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[ts fontWide], NSFontAttributeName,
[ts defaultBackgroundColor], NSBackgroundColorAttributeName,
[ts defaultForegroundColor], NSForegroundColorAttributeName,
nil]];
markedText = [[NSMutableAttributedString alloc]
initWithString:[text string]
attributes:[self markedTextAttributes]];
} else {
[self setMarkedTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[ts font], NSFontAttributeName,
[ts defaultBackgroundColor], NSBackgroundColorAttributeName,
[ts defaultForegroundColor], NSForegroundColorAttributeName,
nil]];
markedText = [[NSMutableAttributedString alloc]
initWithString:text
attributes:[self markedTextAttributes]];
}
markedRange = NSMakeRange(0, [markedText length]);
if (markedRange.length) {
[markedText addAttribute:NSUnderlineStyleAttributeName
value:[NSNumber numberWithInt:1]
range:markedRange];
}
imRange = range;
if (range.length) {
[markedText addAttribute:NSUnderlineStyleAttributeName
value:[NSNumber numberWithInt:2]
range:range];
}
}
[self setNeedsDisplay: YES];
[helper setMarkedText:text selectedRange:range];
}
- (void)unmarkText
{
//NSLog(@"%s", _cmd);
imRange = NSMakeRange(0, 0);
markedRange = NSMakeRange(NSNotFound, 0);
[markedText release];
markedText = nil;
[helper unmarkText];
}
- (NSRect)firstRectForCharacterRange:(NSRange)range
{
//NSLog(@"%s%@", _cmd, NSStringFromRange(range));
// HACK! This method is called when the input manager wants to pop up an
// auxiliary window. The position where this should be is controller by
// Vim by sending SetPreEditPositionMsgID so compute a position based on
// the pre-edit (row,column) pair.
MMTextStorage *ts = (MMTextStorage*)[self textStorage];
NSRect rect = [ts boundingRectForCharacterAtRow:preEditRow
column:preEditColumn];
rect.origin.x += [self textContainerOrigin].x;
rect.origin.y += [self textContainerOrigin].y + [ts cellSize].height;
rect.origin = [self convertPoint:rect.origin toView:nil];
rect.origin = [[self window] convertBaseToScreen:rect.origin];
return rect;
return [helper firstRectForCharacterRange:range];
}
- (void)scrollWheel:(NSEvent *)event
@@ -926,6 +890,7 @@
return YES;
}
@end // MMTextView
@@ -933,37 +898,6 @@
@implementation MMTextView (Private)
- (BOOL)convertRow:(int)row column:(int)column toPoint:(NSPoint *)point
{
MMTextStorage *ts = (MMTextStorage*)[self textStorage];
NSSize cellSize = [ts cellSize];
if (!(point && cellSize.width > 0 && cellSize.height > 0))
return NO;
*point = [self textContainerOrigin];
point->x += column * cellSize.width;
point->y += row * cellSize.height;
return YES;
}
- (BOOL)convertRow:(int)row column:(int)column numRows:(int)nr
numColumns:(int)nc toRect:(NSRect *)rect
{
MMTextStorage *ts = (MMTextStorage*)[self textStorage];
NSSize cellSize = [ts cellSize];
if (!(rect && cellSize.width > 0 && cellSize.height > 0))
return NO;
rect->origin = [self textContainerOrigin];
rect->origin.x += column * cellSize.width;
rect->origin.y += row * cellSize.height;
rect->size.width = cellSize.width * nc;
rect->size.height = cellSize.height * nr;
return YES;
}
- (MMWindowController *)windowController
{
id windowController = [[self window] windowController];
@@ -977,12 +911,14 @@
return [[self windowController] vimController];
}
- (void)drawInsertionPointAtRow:(int)row column:(int)col shape:(int)shape
fraction:(int)percent color:(NSColor *)color
- (void)setShouldDrawInsertionPoint:(BOOL)on
{
//NSLog(@"drawInsertionPointAtRow:%d column:%d shape:%d color:%@",
// row, col, shape, color);
shouldDrawInsertionPoint = on;
}
- (void)drawInsertionPointAtRow:(int)row column:(int)col shape:(int)shape
fraction:(int)percent
{
// This only stores where to draw the insertion point, the actual drawing
// is done in drawRect:.
shouldDrawInsertionPoint = YES;
@@ -990,8 +926,6 @@
insertionPointColumn = col;
insertionPointShape = shape;
insertionPointFraction = percent;
[self setInsertionPointColor:color];
}
- (void)drawInvertedRectAtRow:(int)row column:(int)col numRows:(int)nrows
@@ -1003,8 +937,8 @@
invertRects = reallocf(invertRects,
numInvertRects*sizeof(NSRect));
if (NULL != invertRects) {
[self convertRow:row column:col numRows:nrows numColumns:ncols
toRect:&invertRects[n]];
invertRects[n] = [self rectForRow:row column:col numRows:nrows
numColumns:ncols];
[self setNeedsDisplayInRect:invertRects[n]];
} else {
n = numInvertRects = 0;
@@ -1012,9 +946,8 @@
} else {
// The result should look normal; all we need to do is to mark
// the rect for redrawing and Cocoa will redraw the text.
NSRect rect;
[self convertRow:row column:col numRows:nrows numColumns:ncols
toRect:&rect];
NSRect rect = [self rectForRow:row column:col numRows:nrows
numColumns:ncols];
[self setNeedsDisplayInRect:rect];
}
}
+27 -1
View File
@@ -30,10 +30,20 @@ enum {
BOOL isAutoscrolling;
int mouseShape;
NSTrackingRectTag trackingRectTag;
float scrollWheelAccumulator;
NSColor *insertionPointColor;
// Input Manager
NSRange imRange;
NSRange markedRange;
NSDictionary *markedTextAttributes;
NSMutableAttributedString *markedText;
int preEditRow;
int preEditColumn;
}
- (void)setTextView:(id)view;
- (void)setInsertionPointColor:(NSColor *)color;
- (NSColor *)insertionPointColor;
- (void)keyDown:(NSEvent *)event;
- (void)insertText:(id)string;
@@ -54,4 +64,20 @@ enum {
- (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender;
- (void)setMouseShape:(int)shape;
// Input Manager
- (BOOL)hasMarkedText;
- (NSRange)markedRange;
- (NSDictionary *)markedTextAttributes;
- (void)setMarkedTextAttributes:(NSDictionary *)attr;
- (void)setMarkedText:(id)text selectedRange:(NSRange)range;
- (void)unmarkText;
- (NSMutableAttributedString *)markedText;
- (void)setPreEditRow:(int)row column:(int)col;
- (int)preEditRow;
- (int)preEditColumn;
- (void)setImRange:(NSRange)range;
- (NSRange)imRange;
- (void)setMarkedRange:(NSRange)range;
- (NSRect)firstRectForCharacterRange:(NSRange)range;
@end
+231 -42
View File
@@ -33,33 +33,49 @@ static NSTimeInterval MMDragTimerMinInterval = 0.01;
// The number of pixels in which the drag timer interval changes
static float MMDragAreaSize = 73.0f;
// Number of seconds to delay before sending scroll wheel events. (A delay of
// 0.05 seconds equals an update frequency of 20 Hz.)
static NSTimeInterval MMScrollWheelDelay = 0.05;
@interface MMTextViewHelper (Private)
- (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;
- (void)setCursor;
- (NSRect)trackingRect;
- (void)handleScrollWheelEvent:(id)event;
@end
@implementation MMTextViewHelper
- (void)dealloc
{
[markedText release]; markedText = nil;
[super dealloc];
}
- (void)setTextView:(id)view
{
// Only keep a weak reference to owning text view.
textView = view;
}
- (void)setInsertionPointColor:(NSColor *)color
{
if (color != insertionPointColor) {
[insertionPointColor release];
insertionPointColor = [color retain];
}
}
- (NSColor *)insertionPointColor
{
return insertionPointColor;
}
- (void)keyDown:(NSEvent *)event
{
//NSLog(@"%s %@", _cmd, event);
@@ -95,6 +111,17 @@ static NSTimeInterval MMScrollWheelDelay = 0.05;
} 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]];
}
@@ -142,8 +169,17 @@ static NSTimeInterval MMScrollWheelDelay = 0.05;
//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
@@ -178,7 +214,8 @@ static NSTimeInterval MMScrollWheelDelay = 0.05;
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];
}
@@ -199,7 +236,7 @@ static NSTimeInterval MMScrollWheelDelay = 0.05;
// 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;
@@ -227,6 +264,13 @@ static NSTimeInterval MMScrollWheelDelay = 0.05;
if ([unmodchars isEqual:@"?"])
return NO;
// Cmd-. is hard-wired to send an interrupt (like Ctrl-C).
if ((flags & NSDeviceIndependentModifierFlagsMask) == NSCommandKeyMask &&
[unmodchars isEqual:@"."]) {
[[self vimController] sendMessage:InterruptMsgID data:nil];
return YES;
}
//NSLog(@"%s%@", _cmd, event);
NSString *chars = [event characters];
@@ -250,6 +294,9 @@ static NSTimeInterval MMScrollWheelDelay = 0.05;
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];
@@ -264,16 +311,20 @@ static NSTimeInterval MMScrollWheelDelay = 0.05;
if ([event deltaY] == 0)
return;
// Don't send the event straight away because lots of these events may be
// received in rapid succession. Instead, accumulate the events and send
// off the scroll total at a predetermined maximum rate. This avoids
// clogging up the DO messaging system on faster machines.
if (0 == scrollWheelAccumulator)
[self performSelector:@selector(handleScrollWheelEvent:)
withObject:event
afterDelay:MMScrollWheelDelay];
int row, col;
NSPoint pt = [textView convertPoint:[event locationInWindow] fromView:nil];
if ([textView convertPoint:pt toRow:&row column:&col]) {
int flags = [event modifierFlags];
float dy = [event deltaY];
NSMutableData *data = [NSMutableData data];
scrollWheelAccumulator += [event deltaY];
[data appendBytes:&row length:sizeof(int)];
[data appendBytes:&col length:sizeof(int)];
[data appendBytes:&flags length:sizeof(int)];
[data appendBytes:&dy length:sizeof(float)];
[[self vimController] sendMessage:ScrollWheelMsgID data:data];
}
}
- (void)mouseDown:(NSEvent *)event
@@ -509,6 +560,158 @@ static NSTimeInterval MMScrollWheelDelay = 0.05;
[self setCursor];
}
- (BOOL)hasMarkedText
{
return markedRange.length > 0 ? YES : NO;
}
- (NSRange)markedRange
{
if ([self hasMarkedText])
return markedRange;
else
return NSMakeRange(NSNotFound, 0);
}
- (NSDictionary *)markedTextAttributes
{
return markedTextAttributes;
}
- (void)setMarkedTextAttributes:(NSDictionary *)attr
{
if (attr != markedTextAttributes) {
[markedTextAttributes release];
markedTextAttributes = [attr retain];
}
}
- (void)setMarkedText:(id)text selectedRange:(NSRange)range
{
[self unmarkText];
if (!(text && [text length] > 0))
return;
// HACK! Determine if the marked text is wide or normal width. This seems
// to always use 'wide' when there are both wide and normal width
// characters.
NSString *string = text;
NSFont *theFont = [textView font];
if ([text isKindOfClass:[NSAttributedString class]]) {
theFont = [textView fontWide];
string = [text string];
}
// TODO: Use special colors for marked text.
[self setMarkedTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
theFont, NSFontAttributeName,
[textView defaultBackgroundColor], NSBackgroundColorAttributeName,
[textView defaultForegroundColor], NSForegroundColorAttributeName,
nil]];
markedText = [[NSMutableAttributedString alloc]
initWithString:string
attributes:[self markedTextAttributes]];
markedRange = NSMakeRange(0, [markedText length]);
if (markedRange.length) {
[markedText addAttribute:NSUnderlineStyleAttributeName
value:[NSNumber numberWithInt:1]
range:markedRange];
}
imRange = range;
if (range.length) {
[markedText addAttribute:NSUnderlineStyleAttributeName
value:[NSNumber numberWithInt:2]
range:range];
}
[textView setNeedsDisplay:YES];
}
- (void)unmarkText
{
imRange = NSMakeRange(0, 0);
markedRange = NSMakeRange(NSNotFound, 0);
[markedText release];
markedText = nil;
}
- (NSMutableAttributedString *)markedText
{
return markedText;
}
- (void)setPreEditRow:(int)row column:(int)col
{
preEditRow = row;
preEditColumn = col;
}
- (int)preEditRow
{
return preEditRow;
}
- (int)preEditColumn
{
return preEditColumn;
}
- (void)setImRange:(NSRange)range
{
imRange = range;
}
- (NSRange)imRange
{
return imRange;
}
- (void)setMarkedRange:(NSRange)range
{
markedRange = range;
}
- (NSRect)firstRectForCharacterRange:(NSRange)range
{
// This method is called when the input manager wants to pop up an
// auxiliary window. The position where this should be is controlled by
// Vim by sending SetPreEditPositionMsgID so compute a position based on
// the pre-edit (row,column) pair.
int col = preEditColumn;
int row = preEditRow + 1;
NSFont *theFont = [[textView markedTextAttributes]
valueForKey:NSFontAttributeName];
if (theFont == [textView fontWide]) {
col += imRange.location * 2;
if (col >= [textView maxColumns] - 1) {
row += (col / [textView maxColumns]);
col = col % 2 ? col % [textView maxColumns] + 1 :
col % [textView maxColumns];
}
} else {
col += imRange.location;
if (col >= [textView maxColumns]) {
row += (col / [textView maxColumns]);
col = col % [textView maxColumns];
}
}
NSRect rect = [textView rectForRow:row
column:col
numRows:1
numColumns:range.length];
rect.origin = [textView convertPoint:rect.origin toView:nil];
rect.origin = [[textView window] convertBaseToScreen:rect.origin];
return rect;
}
@end // MMTextViewHelper
@@ -570,14 +773,22 @@ static NSTimeInterval MMScrollWheelDelay = 0.05;
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];
@@ -706,26 +917,4 @@ static NSTimeInterval MMScrollWheelDelay = 0.05;
return rect;
}
- (void)handleScrollWheelEvent:(id)event
{
if (0 == scrollWheelAccumulator)
return;
int row, col;
NSPoint pt = [textView convertPoint:[event locationInWindow] fromView:nil];
if ([textView convertPoint:pt toRow:&row column:&col]) {
int flags = [event modifierFlags];
NSMutableData *data = [NSMutableData data];
[data appendBytes:&row length:sizeof(int)];
[data appendBytes:&col length:sizeof(int)];
[data appendBytes:&flags length:sizeof(int)];
[data appendBytes:&scrollWheelAccumulator length:sizeof(float)];
[[self vimController] sendMessage:ScrollWheelMsgID data:data];
}
scrollWheelAccumulator = 0;
}
@end // MMTextViewHelper (Private)
+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;
+74 -20
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);
@@ -923,6 +956,18 @@ static BOOL isUnsafeMessage(int msgid);
}
} else if (CloseWindowMsgID == msgid) {
[self scheduleClose];
} else if (SetFullscreenColorMsgID == msgid) {
const int *bg = (const int*)[data bytes];
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 {
@@ -1457,17 +1502,26 @@ isUnsafeMessage(int msgid)
// example, UpdateTabBarMsgID may delete NSTabViewItem objects so it goes
// on this list.
static int unsafeMessages[] = { // REASON MESSAGE IS ON THIS LIST:
//OpenWindowMsgID, // Changes lots of state
UpdateTabBarMsgID, // May delete NSTabViewItem
RemoveMenuItemMsgID, // Deletes NSMenuItem
DestroyScrollbarMsgID, // Deletes NSScroller
ExecuteActionMsgID, // Impossible to predict
ShowPopupMenuMsgID, // Enters modal loop
ActivateMsgID, // ?
EnterFullscreenMsgID, // Modifies delegate of window controller
LeaveFullscreenMsgID, // Modifies delegate of window controller
//OpenWindowMsgID, // Changes lots of state
UpdateTabBarMsgID, // May delete NSTabViewItem
RemoveMenuItemMsgID, // Deletes NSMenuItem
DestroyScrollbarMsgID, // Deletes NSScroller
ExecuteActionMsgID, // Impossible to predict
ShowPopupMenuMsgID, // Enters modal loop
ActivateMsgID, // ?
EnterFullscreenMsgID, // Modifies delegate of window controller
LeaveFullscreenMsgID, // Modifies delegate of window controller
CloseWindowMsgID, // See note below
};
// NOTE about CloseWindowMsgID: If this arrives at the same time as say
// ExecuteActionMsgID, then the "execute" message will be lost due to it
// being queued and handled after the "close" message has caused the
// controller to cleanup...UNLESS we add CloseWindowMsgID to the list of
// unsafe messages. This is the _only_ reason it is on this list (since
// all that happens in response to it is that we schedule another message
// for later handling).
int i, count = sizeof(unsafeMessages)/sizeof(unsafeMessages[0]);
for (i = 0; i < count; ++i)
if (msgid == unsafeMessages[i])
+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
+6 -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;
@@ -62,6 +64,8 @@
- (void)enterFullscreen:(int)fuoptions backgroundColor:(NSColor *)back;
- (void)leaveFullscreen;
- (void)setFullscreenBackgroundColor:(NSColor *)back;
- (void)setBuffersModified:(BOOL)mod;
- (IBAction)addNewTab:(id)sender;
@@ -73,5 +77,6 @@
- (IBAction)vimToolbarItemAction:(id)sender;
- (IBAction)fontSizeUp:(id)sender;
- (IBAction)fontSizeDown:(id)sender;
- (IBAction)findAndReplace:(id)sender;
@end
+150 -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.
@@ -571,6 +603,12 @@
shouldResizeVimView = YES;
}
- (void)setFullscreenBackgroundColor:(NSColor *)back
{
if (fullscreenEnabled)
[fullscreenWindow setBackgroundColor:back];
}
- (void)setBuffersModified:(BOOL)mod
{
// NOTE: We only set the document edited flag on the decorated window since
@@ -654,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:)
@@ -701,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;
@@ -727,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];
@@ -734,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;
}
@@ -771,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
@@ -787,6 +880,7 @@
}
- (void)resizeWindowToFitContentSize:(NSSize)contentSize
keepOnScreen:(BOOL)onScreen
{
NSRect frame = [decoratedWindow frame];
NSRect contentRect = [decoratedWindow contentRectForFrameRect:frame];
@@ -795,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
@@ -812,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;
+22 -1
View File
@@ -121,7 +121,11 @@ enum {
UpdateTabBarMsgID,
ShowTabBarMsgID,
HideTabBarMsgID,
SetTextRowsMsgID,
SetTextColumnsMsgID,
SetTextDimensionsMsgID,
LiveResizeMsgID,
SetTextDimensionsReplyMsgID,
SetWindowTitleMsgID,
ScrollWheelMsgID,
MouseDownMsgID,
@@ -164,13 +168,16 @@ enum {
SetPreEditPositionMsgID,
TerminateNowMsgID,
XcodeModMsgID,
LiveResizeMsgID,
EnableAntialiasMsgID,
DisableAntialiasMsgID,
SetVimStateMsgID,
SetDocumentFilenameMsgID,
OpenWithArgumentsMsgID,
CloseWindowMsgID,
InterruptMsgID,
SetFullscreenColorMsgID,
ShowFindReplaceDialogMsgID,
FindReplaceMsgID,
};
@@ -253,3 +260,17 @@ ATSFontContainerRef loadFonts();
// MacVim Apple Event Constants
#define keyMMUntitledWindow 'MMuw'
#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4
// NSInteger was introduced in 10.5
# if __LP64__ || NS_BUILD_32_LIKE_64
typedef long NSInteger;
typedef unsigned long NSUInteger;
# else
typedef int NSInteger;
typedef unsigned int NSUInteger;
# endif
#endif
+8 -1
View File
@@ -28,7 +28,11 @@ char *MessageStrings[] =
"UpdateTabBarMsgID",
"ShowTabBarMsgID",
"HideTabBarMsgID",
"SetTextRowsMsgID",
"SetTextColumsMsgID",
"SetTextDimensionsMsgID",
"LiveResizeMsgID",
"SetTextDimensionsReplyMsgID",
"SetWindowTitleMsgID",
"ScrollWheelMsgID",
"MouseDownMsgID",
@@ -71,13 +75,16 @@ char *MessageStrings[] =
"SetPreEditPositionMsgID",
"TerminateNowMsgID",
"XcodeModMsgID",
"LiveResizeMsgID",
"EnableAntialiasMsgID",
"DisableAntialiasMsgID",
"SetVimStateMsgID",
"SetDocumentFilenameMsgID",
"OpenWithArgumentsMsgID",
"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 = 34;
CURRENT_PROJECT_VERSION = 37;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
@@ -797,7 +807,7 @@
buildSettings = {
ARCHS = "$(NATIVE_ARCH)";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 34;
CURRENT_PROJECT_VERSION = 37;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
@@ -829,7 +839,7 @@
buildSettings = {
ARCHS = "$(NATIVE_ARCH)";
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 34;
CURRENT_PROJECT_VERSION = 37;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
+8 -2
View File
@@ -30,7 +30,6 @@ extern NSString *MMTextInsetLeftKey;
extern NSString *MMTextInsetRightKey;
extern NSString *MMTextInsetTopKey;
extern NSString *MMTextInsetBottomKey;
extern NSString *MMTerminateAfterLastWindowClosedKey;
extern NSString *MMTypesetterKey;
extern NSString *MMCellWidthMultiplierKey;
extern NSString *MMBaselineOffsetKey;
@@ -53,6 +52,7 @@ extern NSString *MMShowLeftPlugInContainerKey;
extern NSString *MMOpenLayoutKey;
extern NSString *MMVerticalSplitKey;
extern NSString *MMPreloadCacheSizeKey;
extern NSString *MMLastWindowClosedBehaviorKey;
// Enum for MMUntitledWindowKey
@@ -63,7 +63,6 @@ enum {
MMUntitledWindowAlways = 3
};
// Enum for MMOpenLayoutKey (first 4 must match WIN_* defines in main.c)
enum {
MMLayoutArglist = 0,
@@ -73,6 +72,13 @@ enum {
MMLayoutWindows = 4,
};
// Enum for MMLastWindowClosedBehaviorKey
enum {
MMDoNothingWhenLastWindowClosed = 0,
MMHideWhenLastWindowClosed = 1,
MMTerminateWhenLastWindowClosed = 2,
};
+1 -2
View File
@@ -21,8 +21,6 @@ NSString *MMTextInsetLeftKey = @"MMTextInsetLeft";
NSString *MMTextInsetRightKey = @"MMTextInsetRight";
NSString *MMTextInsetTopKey = @"MMTextInsetTop";
NSString *MMTextInsetBottomKey = @"MMTextInsetBottom";
NSString *MMTerminateAfterLastWindowClosedKey
= @"MMTerminateAfterLastWindowClosed";
NSString *MMTypesetterKey = @"MMTypesetter";
NSString *MMCellWidthMultiplierKey = @"MMCellWidthMultiplier";
NSString *MMBaselineOffsetKey = @"MMBaselineOffset";
@@ -45,6 +43,7 @@ NSString *MMShowLeftPlugInContainerKey = @"MMShowLeftPlugInContainer";
NSString *MMOpenLayoutKey = @"MMOpenLayout";
NSString *MMVerticalSplitKey = @"MMVerticalSplit";
NSString *MMPreloadCacheSizeKey = @"MMPreloadCacheSize";
NSString *MMLastWindowClosedBehaviorKey = @"MMLastWindowClosedBehavior";
@@ -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
-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);
+94 -51
View File
@@ -20,15 +20,12 @@
// This constant controls how often [MMBackend update] may get called (see
// gui_mch_update()).
static NSTimeInterval MMUpdateTimeoutInterval = 0.1f;
// NOTE: The default font is bundled with the application.
static NSString *MMDefaultFontName = @"DejaVu Sans Mono";
static float MMDefaultFontSize = 12.0f;
static float MMMinFontSize = 6.0f;
static float MMMaxFontSize = 100.0f;
static BOOL gui_mch_init_has_finished = NO;
static NSFont *gui_macvim_font_with_name(char_u *name);
@@ -102,6 +99,15 @@ gui_mch_init(void)
{
//NSLog(@"gui_mch_init()");
// NOTE! Because OS X has to exec after fork we effectively end up doing
// the initialization twice (because this function is called before the
// fork). To avoid all this extra work we check if Vim is about to fork,
// and if so do nothing for now.
//
// TODO: Is this check 100% foolproof?
if (gui.dofork && (vim_strchr(p_go, GO_FORG) == NULL))
return OK;
if (![[MMBackend sharedInstance] checkin]) {
// TODO: Kill the process if there is no terminal to fall back on,
// otherwise the process will run outputting to the console.
@@ -134,6 +140,8 @@ gui_mch_init(void)
// in [g]vimrc.
gui_mch_adjust_charheight();
gui_mch_init_has_finished = YES;
return OK;
}
@@ -154,6 +162,12 @@ gui_mch_exit(int rc)
int
gui_mch_open(void)
{
//NSLog(@"gui_mch_open()");
// This check is to avoid doing extra work when we're about to fork.
if (!gui_mch_init_has_finished)
return OK;
return [[MMBackend sharedInstance] openGUIWindow];
}
@@ -167,39 +181,22 @@ gui_mch_open(void)
* nothing in the X event queue (& no timers pending), then we return
* immediately.
*/
#define MM_LOG_UPDATE_STATS 0
void
gui_mch_update(void)
{
// NOTE: This function can get called A LOT (~1 call/ms) and unfortunately
// checking the run loop takes a long time, resulting in noticable slow
// downs if it is done every time this function is called. Therefore we
// make sure that it is not done too often.
static NSDate *lastUpdateDate = nil;
#if MM_LOG_UPDATE_STATS
static int skipCount = 0;
#endif
// This function is called extremely often. It is tempting to do nothing
// here to avoid reduced frame-rates but then it would not be possible to
// interrupt Vim by presssing Ctrl-C during lengthy operations (e.g. after
// entering "10gs" it would not be possible to bring Vim out of the 10 s
// sleep prematurely). As a compromise we check for Ctrl-C only once per
// second.
static CFAbsoluteTime lastTime = 0;
if (lastUpdateDate && -[lastUpdateDate timeIntervalSinceNow] <
MMUpdateTimeoutInterval) {
#if MM_LOG_UPDATE_STATS
++skipCount;
#endif
return;
CFAbsoluteTime nowTime = CFAbsoluteTimeGetCurrent();
if (nowTime - lastTime > 1.0) {
[[MMBackend sharedInstance] update];
lastTime = nowTime;
}
#if MM_LOG_UPDATE_STATS
NSTimeInterval dt = -[lastUpdateDate timeIntervalSinceNow];
NSLog(@"Updating (last update %.2f seconds ago, skipped %d updates, "
"approx %.1f calls per second)",
dt, skipCount, dt > 0 ? skipCount/dt : 0);
skipCount = 0;
#endif
[[MMBackend sharedInstance] update];
[lastUpdateDate release];
lastUpdateDate = [[NSDate date] retain];
}
@@ -207,12 +204,14 @@ gui_mch_update(void)
void
gui_mch_flush(void)
{
[[MMBackend sharedInstance] flushQueue:NO];
// This function is called way too often to be useful as a hint for
// flushing. If we were to flush every time it was called the screen would
// flicker.
}
/* Force flush output to MacVim. Do not call this method unless absolutely
* necessary (use gui_mch_flush() instead). */
* necessary. */
void
gui_macvim_force_flush(void)
{
@@ -324,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)) {
@@ -1232,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 --------------------------------------------------------------
@@ -1600,6 +1643,20 @@ gui_mch_leave_fullscreen()
}
void
gui_mch_fuopt_update()
{
guicolor_T fg, bg;
if (fuoptions_flags & FUOPT_BGCOLOR_HLGROUP) {
syn_id2colors(fuoptions_bgcolor, &fg, &bg);
} else {
bg = fuoptions_bgcolor;
}
[[MMBackend sharedInstance] setFullscreenBackgroundColor:bg];
}
void
gui_macvim_update_modified_flag()
{
@@ -1737,14 +1794,7 @@ serverGetVimNames(void)
if (list) {
NSString *string = [list componentsJoinedByString:@"\n"];
char_u *s = (char_u*)[string UTF8String];
#ifdef FEAT_MBYTE
s = CONVERT_FROM_UTF8(s);
#endif
names = vim_strsave(s);
#ifdef FEAT_MBYTE
CONVERT_FROM_UTF8_FREE(s);
#endif
names = [string vimStringSave];
}
return names;
@@ -1812,14 +1862,7 @@ serverReadReply(int port, char_u **str)
{
NSString *reply = [[MMBackend sharedInstance] waitForReplyOnPort:port];
if (reply && str) {
char_u *s = (char_u*)[reply UTF8String];
#ifdef FEAT_MBYTE
s = CONVERT_FROM_UTF8(s);
#endif
*str = vim_strsave(s);
#ifdef FEAT_MBYTE
CONVERT_FROM_UTF8_FREE(s);
#endif
*str = [reply vimStringSave];
return 0;
}
+11 -7
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>n
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/
vmenu 20.410.35 Edit.Find.Use\ Selection\ for\ Find y:let @/=@"<CR>:<BS>
an 20.460 Edit.-SEP4- <Nop>
an 20.465.10 Edit.Font.Show\ Fonts <Nop>
+112 -2
View File
@@ -40,12 +40,122 @@
Sparkle supports updates in zip, tar, tbz, tgz, or dmg format.
-->
<item>
<title>Snapshot 37 released</title>
<description><![CDATA[
<h1>MacVim snapshot 37 released</h1>
<p> Changes since snapshot 36:
<ul>
<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> (Almost) Latest runtime files, and Vim patches </li>
</ul>
</p>
]]></description>
<pubDate>Sat, 15 Nov 2008 13:04 CET</pubDate>
<enclosure type="application/octet-stream"
url="http://newmacvim.muskokamug.org/mirror/files/MacVim-snapshot-37.tbz"
length="8007921"
sparkle:version="37"
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[
<h1>MacVim snapshot 35 released</h1>
<p> With this snapshot I have focused on making MacVim faster, fixing bugs, and updating the documentation. As a result MacVim now feels snappier, flickers less, takes less time to startup from Terminal, and in some cases there are tremendous speed increases. </p>
<p> Here is a summary of the changes since snapshot 34:
<ul>
<li> Faster startup times </li>
<li> Overall faster drawing </li>
<li> Quicker response to key presses </li>
<li> Fix bug where key presses were ignored when mouse was moved simultaneously </li>
<li> Update ":h macvim" docs </li>
<li> Add mvim:// URL handler support (Nico Weber) </li>
<li> The VimLeave autocommand works with :maca (see ":h macvim-hints") </li>
<li> Multiple files opened from Finder are sorted </li>
<li> Don't shift new windows downwards if they are vertically maximized </li>
<li> Add option to hide MacVim when last window closes </li>
<li> The "Save changes" dialog conforms to the Apple HIG (works with Cmd-D) </li>
<li> Fix problems with 'fullscreen' and :mksession (Nico Weber) </li>
<li> Cmd-e copies selection to Find Pasteboard without searching </li>
<li> Fix bug with blurry text in full-screen with ATSUI (Jjgod Jiang) </li>
<li> Cmd-. can be used to interrupt Vim (and to exit insert mode) </li>
<li> Add "New Document Here" system service (Ron Olson) </li>
<li> Simplify system services menu (honors the "Open files..." pref) </li>
<li> Full-screen background color is updated immediately when 'fuopt' changes </li>
<li> Cursor no longer escapes the command line on Cmd-=/Cmd-- </li>
<li> Add Input Manager support to ATSUI renderer (Kaoru Yoshida) </li>
<li> Use latest Vim source code and runtime files </li>
<li> Minor bug fixes </li>
</ul>
</p>
]]></description>
<pubDate>Fri, 26 Sep 2008 20:29 CET</pubDate>
<enclosure type="application/octet-stream"
url="http://newmacvim.muskokamug.org/mirror/files/MacVim-snapshot-35.tbz"
length="7986836"
sparkle:version="35"
sparkle:shortVersionString="7.2"
/>
</item>
<item>
<title>Snapshot 34 released</title>
<description><![CDATA[
<h1>MacVim snapshot 34 released</h1>
<p> Notice that there are now two prebuilt binaries of MacVim: a stable build and the snapshot build. The snapshot build will be updated fairly often whereas the stable build will not.</p>
<p> Notice that there are now two prebuilt binaries of MacVim: a stable build and the snapshot build. The snapshot build will be updated fairly often whereas the stable build will not. If you want to use the stable build you will have to download it manually from <a href="http://code.google.com/p/macvim">http://code.google.com/p/macvim</a>.</p>
<p> This snapshot is based on the recently released Vim 7.2 and it contains some new features and bug fixes. Here's a partial list of changes since snapshot 33:
@@ -68,7 +178,7 @@
]]></description>
<pubDate>Sat, 16 Aug 2008 16:59 CET</pubDate>
<enclosure type="application/octet-stream"
url="http://macvim.googlecode.com/files/MacVim-snapshot-34.tbz"
url="http://newmacvim.muskokamug.org/mirror/files/MacVim-snapshot-34.tbz"
length="7959893"
sparkle:version="34"
sparkle:shortVersionString="7.2"
+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.
+2 -2
View File
@@ -2,7 +2,7 @@
# Makefile for Vim on OpenVMS
#
# Maintainer: Zoltan Arpadffy <arpadffy@polarhome.com>
# Last change: 2007 Oct 22
# Last change: 2008 Aug 16
#
# This has script been tested on VMS 6.2 to 8.2 on DEC Alpha, VAX and IA64
# with MMS and MMK
@@ -36,7 +36,7 @@ DECC = YES
# BIG - Many features enabled, as rich as possible. (default)
# HUGE - All possible featues enabled.
# Please select one of these alternatives above.
MODEL = BIG
MODEL = HUGE
# GUI or terminal mode executable.
# Comment out if you want just the character terminal mode only.
+4 -3
View File
@@ -1355,11 +1355,12 @@ set_curbuf(buf, action)
}
}
#ifdef FEAT_AUTOCMD
/* An autocommand may have deleted "buf", already entered it (e.g., when
* it did ":bunload") or aborted the script processing! */
# ifdef FEAT_EVAL
/* An autocommand may have deleted buf or aborted the script processing! */
if (buf_valid(buf) && !aborting())
if (buf_valid(buf) && buf != curbuf && !aborting())
# else
if (buf_valid(buf)) /* an autocommand may have deleted buf! */
if (buf_valid(buf) && buf != curbuf)
# endif
#endif
enter_buffer(buf);
+141 -18
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,8 +846,13 @@ 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);
@@ -1256,23 +1262,26 @@ skip_expr(pp)
/*
* Top level evaluation function, returning a string.
* When "convert" is TRUE convert a List into a sequence of lines and convert
* a Float to a String.
* Return pointer to allocated memory, or NULL for failure.
*/
char_u *
eval_to_string(arg, nextcmd, dolist)
eval_to_string(arg, nextcmd, convert)
char_u *arg;
char_u **nextcmd;
int dolist; /* turn List into sequence of lines */
int convert;
{
typval_T tv;
char_u *retval;
garray_T ga;
char_u numbuf[NUMBUFLEN];
if (eval0(arg, &tv, nextcmd, TRUE) == FAIL)
retval = NULL;
else
{
if (dolist && tv.v_type == VAR_LIST)
if (convert && tv.v_type == VAR_LIST)
{
ga_init2(&ga, (int)sizeof(char), 80);
if (tv.vval.v_list != NULL)
@@ -1280,6 +1289,13 @@ eval_to_string(arg, nextcmd, dolist)
ga_append(&ga, NUL);
retval = (char_u *)ga.ga_data;
}
#ifdef FEAT_FLOAT
else if (convert && tv.v_type == VAR_FLOAT)
{
vim_snprintf((char *)numbuf, NUMBUFLEN, "%g", tv.vval.v_float);
retval = vim_strsave(numbuf);
}
#endif
else
retval = vim_strsave(get_tv_string(&tv));
clear_tv(&tv);
@@ -3277,7 +3293,7 @@ ex_call(eap)
if (*startarg != '(')
{
EMSG2(_("E107: Missing braces: %s"), eap->arg);
EMSG2(_("E107: Missing parentheses: %s"), eap->arg);
goto end;
}
@@ -3657,8 +3673,8 @@ item_lock(tv, deep, lock)
}
/*
* Return TRUE if typeval "tv" is locked: Either tha value is locked itself or
* it refers to a List or Dictionary that is locked.
* Return TRUE if typeval "tv" is locked: Either that value is locked itself
* or it refers to a List or Dictionary that is locked.
*/
static int
tv_islocked(tv)
@@ -6046,6 +6062,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.
@@ -6137,7 +6172,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;
@@ -6497,6 +6532,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.
*/
@@ -6587,7 +6625,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;
@@ -6597,7 +6635,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;
@@ -15858,10 +15896,9 @@ item_compare2(s1, s2)
if (res == FAIL)
res = ITEM_COMPARE_FAIL;
else
/* return value has wrong type */
res = get_tv_number_chk(&rettv, &item_compare_func_err);
if (item_compare_func_err)
res = ITEM_COMPARE_FAIL;
res = ITEM_COMPARE_FAIL; /* return value has wrong type */
clear_tv(&rettv);
return res;
}
@@ -16678,7 +16715,7 @@ f_synstack(argvars, rettv)
col = get_tv_number(&argvars[1]) - 1; /* -1 on type error */
if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count
&& col >= 0 && col < (long)STRLEN(ml_get(lnum))
&& col >= 0 && (col == 0 || col < (long)STRLEN(ml_get(lnum)))
&& rettv_list_alloc(rettv) != FAIL)
{
(void)syn_get_id(curwin, lnum, (colnr_T)col, FALSE, NULL, TRUE);
@@ -18116,6 +18153,17 @@ get_vim_var_str(idx)
return get_tv_string(&vimvars[idx].vv_tv);
}
/*
* 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, v:count1 and v:prevcount.
*/
@@ -18151,6 +18199,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.
*/
@@ -20610,6 +20672,9 @@ func_dump_profile(fd)
int st_len = 0;
todo = (int)func_hashtab.ht_used;
if (todo == 0)
return; /* nothing to dump */
sorttab = (ufunc_T **)alloc((unsigned)(sizeof(ufunc_T) * todo));
for (hi = func_hashtab.ht_array; todo > 0; ++hi)
@@ -20658,6 +20723,8 @@ func_dump_profile(fd)
prof_self_cmp);
prof_sort_list(fd, sorttab, st_len, "SELF", TRUE);
}
vim_free(sorttab);
}
static void
@@ -21224,7 +21291,7 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
if (!fp->uf_profiling && has_profiling(FALSE, fp->uf_name, NULL))
func_do_profile(fp);
if (fp->uf_profiling
|| (fc.caller != NULL && &fc.caller->func->uf_profiling))
|| (fc.caller != NULL && fc.caller->func->uf_profiling))
{
++fp->uf_tm_count;
profile_start(&call_start);
@@ -21255,13 +21322,13 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
#ifdef FEAT_PROFILE
if (do_profiling == PROF_YES && (fp->uf_profiling
|| (fc.caller != NULL && &fc.caller->func->uf_profiling)))
|| (fc.caller != NULL && fc.caller->func->uf_profiling)))
{
profile_end(&call_start);
profile_sub_wait(&wait_start, &call_start);
profile_add(&fp->uf_tm_total, &call_start);
profile_self(&fp->uf_tm_self, &call_start, &fp->uf_tm_children);
if (fc.caller != NULL && &fc.caller->func->uf_profiling)
if (fc.caller != NULL && fc.caller->func->uf_profiling)
{
profile_add(&fc.caller->func->uf_tm_children, &call_start);
profile_add(&fc.caller->func->uf_tml_children, &call_start);
@@ -21906,6 +21973,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 */
+20 -21
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
@@ -5059,6 +5057,7 @@ skip:
if (did_sub)
++sub_nlines;
vim_free(new_start); /* for when substitute was cancelled */
vim_free(sub_firstline); /* free the copy of the original line */
sub_firstline = NULL;
}
+7 -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,
@@ -639,6 +639,8 @@ EX(CMD_nnoremenu, "nnoremenu", ex_menu,
RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
EX(CMD_noremap, "noremap", ex_map,
BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN),
EX(CMD_noautocmd, "noautocmd", ex_wrongmodifier,
NEEDARG|EXTRA|NOTRLCOM),
EX(CMD_nohlsearch, "nohlsearch", ex_nohlsearch,
TRLBAR|SBOXOK|CMDWIN),
EX(CMD_noreabbrev, "noreabbrev", ex_abbreviate,
@@ -655,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,
@@ -806,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,
+75 -2
View File
@@ -1417,6 +1417,63 @@ browse_save_fname(buf)
}
#endif
#ifdef FEAT_GUI_MACVIM
/*
* "Save changes" dialog that conforms to the Apple HIG.
*/
int
vim_dialog_save_changes(buf)
buf_T *buf;
{
char_u buff[IOSIZE];
dialog_msg(buff, _("Do you want to save the changes you made in the "
"document \"%s\"?"), buf->b_fname);
switch (do_dialog(VIM_QUESTION, buff,
(char_u*) _("Your changes will be lost if you don't save "
"them."),
(buf->b_fname != NULL)
? (char_u *)_("&Save\n&Cancel\n&Don't Save")
: (char_u *)_("&Save...\n&Cancel\n&Don't Save"),
1, NULL))
{
case 1: return VIM_YES;
case 3: return VIM_NO;
}
return VIM_CANCEL;
}
/*
* "Save all changes" dialog that tries to emulate the above "Save changes"
* dialog for the case of several modified buffers.
*/
int
vim_dialog_save_all_changes(buf)
buf_T *buf;
{
char_u buff[IOSIZE];
dialog_msg(buff, _("There are several documents with unsaved changes. "
"Do you want to save the changes you made in the "
"document \"%s\"?"), buf->b_fname);
switch (do_dialog(VIM_QUESTION, buff,
(char_u*) _("Your changes will be lost if you don't save "
"them."),
(char_u *)_("&Save\n&Don't Save\nS&ave All\nD&iscard All\n"
"&Cancel"),
1, NULL))
{
case 1: return VIM_YES;
case 2: return VIM_NO;
case 3: return VIM_ALL;
case 4: return VIM_DISCARDALL;
}
return VIM_CANCEL;
}
#endif
/*
* Ask the user what to do when abondoning a changed buffer.
* Must check 'write' option first!
@@ -1430,6 +1487,19 @@ dialog_changed(buf, checkall)
int ret;
buf_T *buf2;
#ifdef FEAT_GUI_MACVIM
/* Save dialogs on Mac OS X are standardized so in case the GUI is enabled
* and "c" isn't in 'guioptions' we use a OS X specific dialog. */
if (gui.in_use && vim_strchr(p_go, GO_CONDIALOG) == NULL)
{
if (checkall)
ret = vim_dialog_save_all_changes(buf);
else
ret = vim_dialog_save_changes(buf);
}
else
{
#endif
dialog_msg(buff, _("Save changes to \"%s\"?"),
(buf->b_fname != NULL) ?
buf->b_fname : (char_u *)_("Untitled"));
@@ -1437,6 +1507,9 @@ dialog_changed(buf, checkall)
ret = vim_dialog_yesnoallcancel(VIM_QUESTION, NULL, buff, 1);
else
ret = vim_dialog_yesnocancel(VIM_QUESTION, NULL, buff, 1);
#ifdef FEAT_GUI_MACVIM
}
#endif
if (ret == VIM_YES)
{
@@ -3145,8 +3218,8 @@ do_source(fname, check_other, is_vimrc)
verbose_leave();
}
#ifdef STARTUPTIME
vim_snprintf(IObuff, IOSIZE, "sourcing %s", fname);
time_msg(IObuff, &tv_start);
vim_snprintf((char *)IObuff, IOSIZE, "sourcing %s", fname);
time_msg((char *)IObuff, &tv_start);
time_pop(&tv_rel);
#endif
+62 -14
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;
@@ -2984,6 +2986,7 @@ static struct cmdmod
{"keepmarks", 3, FALSE},
{"leftabove", 5, FALSE},
{"lockmarks", 3, FALSE},
{"noautocmd", 3, FALSE},
{"rightbelow", 6, FALSE},
{"sandbox", 3, FALSE},
{"silent", 3, FALSE},
@@ -3614,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:
@@ -9525,24 +9529,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
@@ -9560,6 +9590,15 @@ eval_vars(src, srcstart, usedlen, lnump, errormsg, escaped)
#ifdef FEAT_AUTOCMD
case SPEC_AFILE: /* file name for autocommand */
result = autocmd_fname;
if (result != NULL && !autocmd_fname_full)
{
/* Still need to turn the fname into a full path. It is
* postponed to avoid a delay when <afile> is not used. */
autocmd_fname_full = TRUE;
result = FullName_save(autocmd_fname, FALSE);
vim_free(autocmd_fname);
autocmd_fname = result;
}
if (result == NULL)
{
*errormsg = (char_u *)_("E495: no autocommand file name to substitute for \"<afile>\"");
@@ -9897,6 +9936,14 @@ makeopens(fd, dirnow)
if (fprintf(fd, "set lines=%ld columns=%ld" , Rows, Columns) < 0
|| put_eol(fd) == FAIL)
return FAIL;
#ifdef FEAT_FULLSCREEN
/* fullscreen needs to be set after lines and columns */
if (p_fullscreen)
{
if (fprintf(fd, "set fullscreen") < 0 || put_eol(fd) == FAIL)
return FAIL;
}
#endif
}
#ifdef FEAT_GUI
@@ -10708,7 +10755,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
+29 -3
View File
@@ -31,6 +31,8 @@ struct cmdline_info
int cmdattr; /* attributes for prompt */
int overstrike; /* Typing mode on the command line. Shared by
getcmdline() and put_on_cmdline(). */
expand_T *xpc; /* struct being used for expansion, xp_pattern
may point into cmdbuff */
int xp_context; /* type of expansion */
# ifdef FEAT_EVAL
char_u *xp_arg; /* user-defined expansion arg */
@@ -38,7 +40,11 @@ struct cmdline_info
# endif
};
static struct cmdline_info ccline; /* current cmdline_info */
/* The current cmdline_info. It is initialized in getcmdline() and after that
* used by other functions. When invoking getcmdline() recursively it needs
* to be saved with save_cmdline() and restored with restore_cmdline().
* TODO: make it local to getcmdline() and pass it around. */
static struct cmdline_info ccline;
static int cmd_showtail; /* Only show path tail in lists ? */
@@ -238,6 +244,7 @@ getcmdline(firstc, count, indent)
}
ExpandInit(&xpc);
ccline.xpc = &xpc;
#ifdef FEAT_RIGHTLEFT
if (curwin->w_p_rl && *curwin->w_p_rlc == 's'
@@ -408,9 +415,10 @@ getcmdline(firstc, count, indent)
#endif
/*
* <S-Tab> works like CTRL-P (unless 'wc' is <S-Tab>).
* When there are matching completions to select <S-Tab> works like
* CTRL-P (unless 'wc' is <S-Tab>).
*/
if (c != p_wc && c == K_S_TAB && xpc.xp_numfiles != -1)
if (c != p_wc && c == K_S_TAB && xpc.xp_numfiles > 0)
c = Ctrl_P;
#ifdef FEAT_WILDMENU
@@ -1513,6 +1521,7 @@ getcmdline(firstc, count, indent)
int old_firstc;
vim_free(ccline.cmdbuff);
xpc.xp_context = EXPAND_NOTHING;
if (hiscnt == hislen)
p = lookfor; /* back to the old one */
else
@@ -1839,6 +1848,7 @@ returncmd:
#endif
ExpandCleanup(&xpc);
ccline.xpc = NULL;
#ifdef FEAT_SEARCH_EXTRA
if (did_incsearch)
@@ -2508,6 +2518,20 @@ realloc_cmdbuff(len)
}
mch_memmove(ccline.cmdbuff, p, (size_t)ccline.cmdlen + 1);
vim_free(p);
if (ccline.xpc != NULL
&& ccline.xpc->xp_pattern != NULL
&& ccline.xpc->xp_context != EXPAND_NOTHING
&& ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL)
{
int i = ccline.xpc->xp_pattern - p;
/* If xp_pattern points inside the old cmdbuff it needs to be adjusted
* to point into the newly allocated memory. */
if (i >= 0 && i <= ccline.cmdlen)
ccline.xpc->xp_pattern = ccline.cmdbuff + i;
}
return OK;
}
@@ -2875,6 +2899,7 @@ save_cmdline(ccp)
prev_ccline = ccline;
ccline.cmdbuff = NULL;
ccline.cmdprompt = NULL;
ccline.xpc = NULL;
}
/*
@@ -3582,6 +3607,7 @@ ExpandOne(xp, str, orig, options, mode)
ExpandInit(xp)
expand_T *xp;
{
xp->xp_pattern = NULL;
xp->xp_backslash = XP_BS_NONE;
#ifndef BACKSLASH_IN_FILENAME
xp->xp_shell = FALSE;
+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
+42 -5
View File
@@ -2711,7 +2711,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. */
@@ -6232,6 +6232,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 +6277,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 +6298,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 +6560,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
@@ -8528,6 +8561,7 @@ apply_autocmds_group(event, fname, fname_io, force, group, buf, eap)
char_u *save_sourcing_name;
linenr_T save_sourcing_lnum;
char_u *save_autocmd_fname;
int save_autocmd_fname_full;
int save_autocmd_bufnr;
char_u *save_autocmd_match;
int save_autocmd_busy;
@@ -8606,6 +8640,7 @@ apply_autocmds_group(event, fname, fname_io, force, group, buf, eap)
* Save the autocmd_* variables and info about the current buffer.
*/
save_autocmd_fname = autocmd_fname;
save_autocmd_fname_full = autocmd_fname_full;
save_autocmd_bufnr = autocmd_bufnr;
save_autocmd_match = autocmd_match;
save_autocmd_busy = autocmd_busy;
@@ -8623,14 +8658,15 @@ apply_autocmds_group(event, fname, fname_io, force, group, buf, eap)
if (fname != NULL && *fname != NUL)
autocmd_fname = fname;
else if (buf != NULL)
autocmd_fname = buf->b_fname;
autocmd_fname = buf->b_ffname;
else
autocmd_fname = NULL;
}
else
autocmd_fname = fname_io;
if (autocmd_fname != NULL)
autocmd_fname = FullName_save(autocmd_fname, FALSE);
autocmd_fname = vim_strsave(autocmd_fname);
autocmd_fname_full = FALSE; /* call FullName_save() later */
/*
* Set the buffer number to be used for <abuf>.
@@ -8815,6 +8851,7 @@ apply_autocmds_group(event, fname, fname_io, force, group, buf, eap)
sourcing_lnum = save_sourcing_lnum;
vim_free(autocmd_fname);
autocmd_fname = save_autocmd_fname;
autocmd_fname_full = save_autocmd_fname_full;
autocmd_bufnr = save_autocmd_bufnr;
autocmd_match = save_autocmd_match;
#ifdef FEAT_EVAL
@@ -8923,7 +8960,7 @@ auto_next_pat(apc, stop_at_last)
{
apc->curpat = NULL;
/* only use a pattern when it has not been removed, has commands and
/* Only use a pattern when it has not been removed, has commands and
* the group matches. For buffer-local autocommands only check the
* buffer number. */
if (ap->pat != NULL && ap->cmds != NULL
@@ -9109,7 +9146,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;
+1
View File
@@ -1022,6 +1022,7 @@ EXTERN char_u *new_last_cmdline INIT(= NULL); /* new value for last_cmdline */
#endif
#ifdef FEAT_AUTOCMD
EXTERN char_u *autocmd_fname INIT(= NULL); /* fname for <afile> on cmdline */
EXTERN int autocmd_fname_full; /* autocmd_fname is full path */
EXTERN int autocmd_bufnr INIT(= 0); /* fnum for <abuf> on cmdline */
EXTERN char_u *autocmd_match INIT(= NULL); /* name for <amatch> on cmdline */
EXTERN int did_cursorhold INIT(= FALSE); /* set when CursorHold t'gerd */
+2 -1
View File
@@ -75,7 +75,8 @@
* On some systems scrolling needs to be done right away instead of in the
* main loop.
*/
#if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_MAC) || defined(HAVE_GTK2)
#if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_MAC) || defined(HAVE_GTK2) \
|| defined(FEAT_GUI_MACVIM)
# define USE_ON_FLY_SCROLL
#endif
+11 -2
View File
@@ -74,7 +74,7 @@ static cscmd_T cs_cmds[] =
{ "add", cs_add,
N_("Add a new database"), "add file|dir [pre-path] [flags]", 0 },
{ "find", cs_find,
N_("Query for a pattern"), FIND_USAGE, 1 },
N_("Query for a pattern"), "find c|d|e|f|g|i|s|t name", 1 },
{ "help", cs_help,
N_("Show this message"), "help", 0 },
{ "kill", cs_kill,
@@ -1180,7 +1180,16 @@ cs_help(eap)
(void)smsg((char_u *)_("%-5s: %-30s (Usage: %s)"),
cmdp->name, _(cmdp->help), cmdp->usage);
if (strcmp(cmdp->name, "find") == 0)
MSG_PUTS(FIND_HELP);
MSG_PUTS(_("\n"
" c: Find functions calling this function\n"
" d: Find functions called by this function\n"
" e: Find this egrep pattern\n"
" f: Find this file\n"
" g: Find this definition\n"
" i: Find files #including this file\n"
" s: Find this C symbol\n"
" t: Find assignments to\n"));
cmdp++;
}
-11
View File
@@ -42,17 +42,6 @@
* f 7name Find this file
* i 8name Find files #including this file
*/
#define FIND_USAGE "find c|d|e|f|g|i|s|t name"
#define FIND_HELP "\n\
c: Find functions calling this function\n\
d: Find functions called by this function\n\
e: Find this egrep pattern\n\
f: Find this file\n\
g: Find this definition\n\
i: Find files #including this file\n\
s: Find this C symbol\n\
t: Find assignments to\n"
typedef struct {
char * name;
+5
View File
@@ -136,6 +136,9 @@ EXTERN_C void boot_DynaLoader __ARGS((pTHX_ CV*));
# define Perl_newXS_flags dll_Perl_newXS_flags
#endif
# define Perl_sv_free dll_Perl_sv_free
# if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
# define Perl_sv_free2 dll_Perl_sv_free2
# endif
# define Perl_sv_isa dll_Perl_sv_isa
# define Perl_sv_magic dll_Perl_sv_magic
# define Perl_sv_setiv dll_Perl_sv_setiv
@@ -268,6 +271,7 @@ static SV* (*Perl_Isv_yes_ptr)(register PerlInterpreter*);
static void (*boot_DynaLoader)_((pTHX_ CV*));
#if (PERL_REVISION == 5) && (PERL_VERSION >= 10)
static void (*Perl_sv_free2)(pTHX_ SV*);
static void (*Perl_sys_init3)(int* argc, char*** argv, char*** env);
static void (*Perl_sys_term)(void);
static SV** (*Perl_ISv_ptr)(register PerlInterpreter*);
@@ -367,6 +371,7 @@ static struct {
{"Perl_TXpv_ptr", (PERL_PROC*)&Perl_TXpv_ptr},
{"Perl_Tna_ptr", (PERL_PROC*)&Perl_Tna_ptr},
#else
{"Perl_sv_free2", (PERL_PROC*)&Perl_sv_free2},
{"Perl_sys_init3", (PERL_PROC*)&Perl_sys_init3},
{"Perl_sys_term", (PERL_PROC*)&Perl_sys_term},
{"Perl_ISv_ptr", (PERL_PROC*)&Perl_ISv_ptr},
+5 -3
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
@@ -1539,7 +1540,8 @@ parse_command_name(parmp)
++initstr;
}
if (TOLOWER_ASC(initstr[0]) == 'g' || initstr[0] == 'k')
/* "gvim" starts the GUI. Also accept "Gvim" for MS-Windows. */
if (TOLOWER_ASC(initstr[0]) == 'g')
{
main_start_gui();
#ifdef FEAT_GUI
+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);
-2
View File
@@ -2540,7 +2540,6 @@ utf_head_off(base, p)
return (int)(p - q);
}
#if defined(FEAT_EVAL) || defined(PROTO)
/*
* Copy a character from "*fp" to "*tp" and advance the pointers.
*/
@@ -2555,7 +2554,6 @@ mb_copy_char(fp, tp)
*tp += l;
*fp += l;
}
#endif
/*
* Return the offset from "p" to the first byte of a character. When "p" is
+1
View File
@@ -1124,6 +1124,7 @@ show_menus(path_name, modes)
parent = menu;
menu = menu->children;
}
vim_free(path_name);
/* Now we have found the matching menu, and we list the mappings */
/* Highlight title */
+2 -2
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. */
-4
View File
@@ -1257,7 +1257,6 @@ vim_strsave_escaped_ext(string, esc_chars, cc, bsl)
return escaped_string;
}
#if !defined(BACKSLASH_IN_FILENAME) || defined(FEAT_EVAL) || defined(PROTO)
/*
* Return TRUE when 'shell' has "csh" in the tail.
*/
@@ -1266,9 +1265,7 @@ csh_like_shell()
{
return (strstr((char *)gettail(p_sh), "csh") != NULL);
}
#endif
#if defined(FEAT_EVAL) || defined(PROTO)
/*
* Escape "string" for use as a shell argument with system().
* This uses single quotes, except when we know we need to use double qoutes
@@ -1391,7 +1388,6 @@ vim_strsave_shellescape(string, do_special)
return escaped_string;
}
#endif
/*
* Like vim_strsave(), but make all characters uppercase.
+68 -29
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.
@@ -1132,7 +1134,8 @@ getcount:
out_flush();
#endif
#ifdef FEAT_AUTOCMD
did_cursorhold = FALSE;
if (ca.cmdchar != K_IGNORE)
did_cursorhold = FALSE;
#endif
State = NORMAL;
@@ -3511,7 +3514,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;
@@ -5488,6 +5491,20 @@ nv_ident(cap)
STRCPY(buf, "he! ");
else
{
/* An external command will probably use an argument starting
* with "-" as an option. To avoid trouble we skip the "-". */
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? */
isman = (STRCMP(kp, "man") == 0);
@@ -5530,37 +5547,59 @@ nv_ident(cap)
/*
* Now grab the chars in the identifier
*/
if (cmdchar == '*')
aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\");
else if (cmdchar == '#')
aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
else if (cmdchar == 'K' && !kp_help)
aux_ptr = (char_u *)" \t\\\"|!";
else
/* Don't escape spaces and Tabs in a tag with a backslash */
aux_ptr = (char_u *)"\\|\"";
p = buf + STRLEN(buf);
while (n-- > 0)
if (cmdchar == 'K' && !kp_help)
{
/* put a backslash before \ and some others */
if (vim_strchr(aux_ptr, *ptr) != NULL)
*p++ = '\\';
#ifdef FEAT_MBYTE
/* When current byte is a part of multibyte character, copy all bytes
* of that character. */
if (has_mbyte)
/* 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)
{
int i;
int len = (*mb_ptr2len)(ptr) - 1;
for (i = 0; i < len && n >= 1; ++i, --n)
*p++ = *ptr++;
vim_free(buf);
return;
}
#endif
*p++ = *ptr++;
buf = (char_u *)vim_realloc(buf, STRLEN(buf) + STRLEN(p) + 1);
if (buf == NULL)
{
vim_free(buf);
vim_free(p);
return;
}
STRCAT(buf, p);
vim_free(p);
}
else
{
if (cmdchar == '*')
aux_ptr = (char_u *)(p_magic ? "/.*~[^$\\" : "/^$\\");
else if (cmdchar == '#')
aux_ptr = (char_u *)(p_magic ? "/?.*~[^$\\" : "/?^$\\");
else
/* Don't escape spaces and Tabs in a tag with a backslash */
aux_ptr = (char_u *)"\\|\"\n*?[";
p = buf + STRLEN(buf);
while (n-- > 0)
{
/* put a backslash before \ and some others */
if (vim_strchr(aux_ptr, *ptr) != NULL)
*p++ = '\\';
#ifdef FEAT_MBYTE
/* When current byte is a part of multibyte character, copy all
* bytes of that character. */
if (has_mbyte)
{
int i;
int len = (*mb_ptr2len)(ptr) - 1;
for (i = 0; i < len && n >= 1; ++i, --n)
*p++ = *ptr++;
}
#endif
*p++ = *ptr++;
}
*p = NUL;
}
*p = NUL;
/*
* Execute the command.
+32 -4
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;
@@ -1155,7 +1161,7 @@ static struct vimoption
{(char_u *)FALSE, (char_u *)0L}
#endif
},
{"fullscreen", "fu", P_BOOL,
{"fullscreen", "fu", P_BOOL|P_NO_MKRC,
#ifdef FEAT_FULLSCREEN
(char_u *)&p_fullscreen, PV_NONE,
#else
@@ -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. */
@@ -10875,6 +10899,10 @@ check_fuoptions(p_fuoptions, flags, bgcolor)
*flags = new_fuoptions_flags;
*bgcolor = new_fuoptions_bgcolor;
/* Let the GUI know, in case the background color has changed. */
gui_mch_fuopt_update();
return OK;
}
#endif
+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
+2
View File
@@ -114,6 +114,8 @@
#define HAVE_PUTENV
#define HAVE_SETENV
#define HAVE_SETJMP_H
#define HAVE_MATH_H
#define HAVE_FLOAT_FUNCS
#undef HAVE_DIRENT_H
#undef HAVE_SYS_NDIR_H
+6 -1
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));
list_T *get_vim_var_list __ARGS((int idx));
void set_vcount __ARGS((long count, long count1));
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 : */
+1 -1
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));
+6
View File
@@ -192,6 +192,7 @@ int serverSendReply(char_u *serverid, char_u *str);
void gui_mch_enter_fullscreen(int fuoptions_flags, guicolor_T bg);
void gui_mch_leave_fullscreen(void);
void gui_mch_fuopt_update(void);
void gui_macvim_update_modified_flag();
void gui_macvim_add_to_find_pboard(char_u *pat);
@@ -206,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 : */
+2 -3
View File
@@ -272,9 +272,8 @@ OpenPTY(ttyn)
#if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux) && !defined(MACOS_X)
/* NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work! */
/* NOTE: Also with Mac OS X, I believe a compatibility mode can be chosen
that uses /dev/ptmx but this is not done, so we can't use this. */
/* NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work!
* Same for Mac OS X Leopard. */
#define PTY_DONE
int
OpenPTY(ttyn)
+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),
+3 -3
View File
@@ -77,7 +77,7 @@
/*
* Do the opposite: based on a maximum end score and a known sound score,
* compute the the maximum word score that can be used.
* compute the maximum word score that can be used.
*/
#define MAXSCORE(word_score, sound_score) ((4 * word_score - sound_score) / 3)
@@ -625,7 +625,7 @@ typedef struct suggest_S
/* TRUE if a word appears in the list of banned words. */
#define WAS_BANNED(su, word) (!HASHITEM_EMPTY(hash_find(&su->su_banned, word)))
/* Number of suggestions kept when cleaning up. we need to keep more than
/* Number of suggestions kept when cleaning up. We need to keep more than
* what is displayed, because when rescore_suggestions() is called the score
* may change and wrong suggestions may be removed later. */
#define SUG_CLEAN_COUNT(su) ((su)->su_maxcount < 130 ? 150 : (su)->su_maxcount + 20)
@@ -5980,7 +5980,7 @@ spell_read_aff(spin, fname)
else if (spin->si_newprefID == 0 || spin->si_newprefID == 127)
MSG(_("Too many compound flags"));
else
MSG(_("Too many posponed prefixes and/or compound flags"));
MSG(_("Too many postponed prefixes and/or compound flags"));
}
if (syllable != NULL)
+4 -1
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 */
+91
View File
@@ -0,0 +1,91 @@
# Makefile to run tests for Vim, on Dos-like machines
# with sh.exe or zsh.exe in the path or not.
#
# Author: Bill McCarthy
#
# Note that test54 has been removed until it is fixed.
#
# Requires a set of Unix tools: echo, diff, etc.
ifneq (sh.exe, $(SHELL))
DEL = rm -f
MV = mv
CP = cp
DIRSLASH = /
else
DEL = del
MV = rename
CP = copy
DIRSLASH = \\
endif
VIMPROG = ..$(DIRSLASH)vim
# Omitted:
# test2 "\\tmp" doesn't work.
# test10 'errorformat' is different
# test12 can't unlink a swap file
# test25 uses symbolic link
# test27 can't edit file with "*" in file name
# test31 16 bit version runs out of memory...
SCRIPTS16 = test1.out test19.out test20.out test22.out \
test23.out test24.out test28.out test29.out \
test35.out test36.out test43.out \
test44.out test45.out test46.out test47.out \
test48.out test51.out test53.out \
test55.out test56.out test57.out test58.out test59.out \
test60.out test61.out test62.out test63.out test64.out
# Had to remove test54 which doesn't work yet.
# test54.out
SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
test8.out test9.out test11.out test13.out test14.out \
test15.out test17.out test18.out test21.out test26.out \
test30.out test31.out test32.out test33.out test34.out \
test37.out test38.out test39.out test40.out test41.out \
test42.out test52.out test65.out
SCRIPTS32 = test50.out
SCRIPTS_GUI = test16.out
.SUFFIXES: .in .out
vimall: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS32)
echo ALL DONE
nongui: fixff $(SCRIPTS16) $(SCRIPTS)
echo ALL DONE
small:
echo ALL DONE
gui: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI)
echo ALL DONE
win32: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS32)
echo ALL DONE
fixff:
-$(VIMPROG) -u dos.vim --noplugin "+argdo set ff=dos|upd" +q *.in *.ok
clean:
-$(DEL) *.out
-$(DEL) test.ok
-$(DEL) small.vim
-$(DEL) tiny.vim
-$(DEL) mbyte.vim
-$(DEL) X*
-$(DEL) viminfo
.in.out:
$(CP) $*.ok test.ok
$(VIMPROG) -u dos.vim -U NONE --noplugin -s dotest.in $*.in
diff test.out $*.ok
-$(DEL) $*.out
$(MV) test.out $*.out
-$(DEL) X*
-$(DEL) test.ok
-$(DEL) viminfo
+34 -7
View File
@@ -4,9 +4,9 @@
# Authors: Zoltan Arpadffy, <arpadffy@polarhome.com>
# Sandor Kopanyi, <sandor.kopanyi@mailbox.hu>
#
# Last change: 2008 Jun 19
# Last change: 2008 Aug 19
#
# This has been tested on VMS 6.2 to 7.2 on DEC Alpha and VAX.
# This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
# Edit the lines in the Configuration section below to select.
#
# Execute with:
@@ -32,6 +32,15 @@
# and directory handling.
# WANT_UNIX = YES
# Comment out if you want to run Win32 specific tests as well, but please
# be aware, that on OpenVMS will fail, because of cat, rm, etc commands
# and directory handling.
# WANT_WIN = YES
# Comment out if you want to run spell checker tests.
# They fail because VMS does not support file names.
# WANT_SPELL = YES
# Comment out if you have gzip on your system
# HAVE_GZIP = YES
@@ -53,12 +62,12 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \
test13.out test14.out test15.out test17.out \
test18.out test19.out test20.out test21.out test22.out \
test23.out test24.out test26.out \
test28.out test29.out test31.out test32.out \
test28.out test29.out test30.out test31.out test32.out \
test33.out test34.out test35.out test36.out test37.out \
test38.out test39.out test40.out test41.out test42.out \
test43.out test44.out test45.out test46.out \
test48.out test51.out test53.out test54.out test55.out \
test56.out test57.out test58.out test59.out test60.out \
test56.out test57.out test60.out \
test61.out test62.out test63.out test64.out test65.out
.IFDEF WANT_GUI
@@ -67,7 +76,15 @@ GUI_OPTION = -g
.ENDIF
.IFDEF WANT_UNIX
SCRIPT_UNIX = test10.out test12.out test25.out test27.out test30.out test49.out
SCRIPT_UNIX = test10.out test12.out test25.out test27.out test49.out
.ENDIF
.IFDEF WANT_WIN
SCRIPT_WIN = test50.out test52.out
.ENDIF
.IFDEF WANT_SPELL
SCRIPT_SPELL = test58.out test59.out
.ENDIF
.IFDEF HAVE_GZIP
@@ -84,11 +101,11 @@ SCRIPT_GDIFF = test47.out
-@ write sys$output " "$*" "
-@ write sys$output "-----------------------------------------------"
-@ create/term/wait mcr $(VIMPROG) $(GUI_OPTION) -u vms.vim --noplugin -s dotest.in $*.in
-@ if "''F$SEARCH("test.out.*")'" .NES. "" then differences test.out $*.ok;
-@ if "''F$SEARCH("test.out.*")'" .NES. "" then differences /par test.out $*.ok;
-@ if "''F$SEARCH("test.out.*")'" .NES. "" then rename test.out $*.out
-@ if "''F$SEARCH("Xdotest.*")'" .NES. "" then delete/noconfirm/nolog Xdotest.*.*
all : clean nolog $(SCRIPT) $(SCRIPT_GUI) $(SCRIPT_UNIX) $(SCRIPT_GZIP) $(SCRIPT_GDIFF)
all : clean nolog $(SCRIPT) $(SCRIPT_GUI) $(SCRIPT_UNIX) $(SCRIPT_WIN) $(SCRIPT_SPELL) $(SCRIPT_GZIP) $(SCRIPT_GDIFF)
-@ write sys$output " "
-@ write sys$output "-----------------------------------------------"
-@ write sys$output " All done"
@@ -113,6 +130,8 @@ nolog :
-@ write sys$output "MAKE_VMS.MMS options:"
-@ write sys$output " WANT_GUI = ""$(WANT_GUI)"" "
-@ write sys$output " WANT_UNIX = ""$(WANT_UNIX)"" "
-@ write sys$output " WANT_WIN = ""$(WANT_WIN)"" "
-@ write sys$output " WANT_SPELL= ""$(WANT_SPELL)"" "
-@ write sys$output " HAVE_GZIP = ""$(HAVE_GZIP)"" "
-@ write sys$output " HAVE_GDIFF= ""$(HAVE_GDIFF)"" "
-@ write sys$output "Default vimrc file is VMS.VIM:
@@ -122,5 +141,13 @@ nolog :
clean :
-@ if "''F$SEARCH("*.out")'" .NES. "" then delete/noconfirm/nolog *.out.*
-@ if "''F$SEARCH("test.log")'" .NES. "" then delete/noconfirm/nolog test.log.*
-@ if "''F$SEARCH("test.ok")'" .NES. "" then delete/noconfirm/nolog test.ok.*
-@ if "''F$SEARCH("Xdotest.*")'" .NES. "" then delete/noconfirm/nolog Xdotest.*.*
-@ if "''F$SEARCH("*.*_sw*")'" .NES. "" then delete/noconfirm/nolog *.*_sw*.*
-@ if "''F$SEARCH("*.failed")'" .NES. "" then delete/noconfirm/nolog *.failed.*
-@ if "''F$SEARCH("*.rej")'" .NES. "" then delete/noconfirm/nolog *.rej.*
-@ if "''F$SEARCH("tiny.vim")'" .NES. "" then delete/noconfirm/nolog tiny.vim.*
-@ if "''F$SEARCH("small.vim")'" .NES. "" then delete/noconfirm/nolog small.vim.*
-@ if "''F$SEARCH("mbyte.vim")'" .NES. "" then delete/noconfirm/nolog mbyte.vim.*
-@ if "''F$SEARCH("viminfo.*")'" .NES. "" then delete/noconfirm/nolog viminfo.*.*
+10 -8
View File
@@ -26,15 +26,17 @@ SCRIPTS_GUI = test16.out
.SUFFIXES: .in .out
nongui: nolog $(SCRIPTS)
@echo
@cat test.log
@echo ALL DONE
nongui: nolog $(SCRIPTS) report
gui: nolog $(SCRIPTS) $(SCRIPTS_GUI)
gui: nolog $(SCRIPTS) $(SCRIPTS_GUI) report
report:
@echo
@cat test.log
@echo ALL DONE
@echo 'Test results:'
@/bin/sh -c "if test -f test.log; \
then cat test.log; echo TEST FAILURE; exit 1; \
else echo ALL DONE; \
fi"
$(SCRIPTS) $(SCRIPTS_GUI): $(VIMPROG)
@@ -71,4 +73,4 @@ test49.out: test49.vim
test60.out: test60.vim
nolog:
-echo Test results: >test.log
-rm -f test.log
+11 -4
View File
@@ -24,10 +24,17 @@ STARTTEST
:set nobin eol
:bwipe XXUnix XXDos XXMac
:" create mixed format files
:!cat XXUnix XXDos >XXUxDs
:!cat XXUnix XXMac >XXUxMac
:!cat XXDos XXMac >XXDosMac
:!cat XXUnix XXDos XXMac >XXUxDsMc
:if has("vms")
: !copy XXUnix,XXDos XXUxDs.
: !copy XXUnix,XXMac XXUxMac.
: !copy XXDos,XXMac XXDosMac.
: !copy XXUnix,XXDos,XXMac XXUxDsMc.
:else
: !cat XXUnix XXDos >XXUxDs
: !cat XXUnix XXMac >XXUxMac
: !cat XXDos XXMac >XXDosMac
: !cat XXUnix XXDos XXMac >XXUxDsMc
:endif
:"
:" try reading and writing with 'fileformats' empty
:set fileformat=unix
+7 -2
View File
@@ -3,8 +3,13 @@ Some tests for buffer-local autocommands
STARTTEST
:so small.vim
:e xx
:!rm -f test.out
:au BufLeave <buffer> :!echo buffer-local autommand in %>> test.out
:if has("vms")
: !del test.out.*
: au BufLeave <buffer> :!write sys$output "buffer-local autommand in %" > test.out
:else
: !rm -f test.out
: au BufLeave <buffer> :!echo buffer-local autommand in %>> test.out
:endif
:e somefile " here, autocommand for xx shall write test.out
: " but autocommand shall not apply to buffer named <buffer>
:bwipe xx " here, autocommand shall be auto-deleted
+38 -14
View File
@@ -2034,7 +2034,7 @@ clip_x11_request_selection_cb(w, success, sel_atom, type, value, length,
if (value == NULL || *length == 0)
{
clip_free_selection(cbd); /* ??? [what's the query?] */
clip_free_selection(cbd); /* nothing received, clear register */
*(int *)success = FALSE;
return;
}
@@ -2090,7 +2090,7 @@ clip_x11_request_selection_cb(w, success, sel_atom, type, value, length,
text_prop.value = (unsigned char *)value;
text_prop.encoding = *type;
text_prop.format = *format;
text_prop.nitems = STRLEN(value);
text_prop.nitems = len;
status = XmbTextPropertyToTextList(X_DISPLAY, &text_prop,
&text_list, &n_text);
if (status != Success || n_text < 1)
@@ -2124,6 +2124,8 @@ clip_x11_request_selection(myShell, dpy, cbd)
int i;
int nbytes = 0;
char_u *buffer;
time_t start_time;
int timed_out = FALSE;
for (i =
#ifdef FEAT_MBYTE
@@ -2143,6 +2145,7 @@ clip_x11_request_selection(myShell, dpy, cbd)
case 3: type = text_atom; break;
default: type = XA_STRING;
}
success = MAYBE;
XtGetSelectionValue(myShell, cbd->sel_atom, type,
clip_x11_request_selection_cb, (XtPointer)&success, CurrentTime);
@@ -2155,27 +2158,48 @@ clip_x11_request_selection(myShell, dpy, cbd)
* characters, then they will appear before the one that requested the
* paste! Don't worry, we will catch up with any other events later.
*/
for (;;)
start_time = time(NULL);
while (success == MAYBE)
{
if (XCheckTypedEvent(dpy, SelectionNotify, &event))
break;
if (XCheckTypedEvent(dpy, SelectionRequest, &event))
/* We may get a SelectionRequest here and if we don't handle
* it we hang. KDE klipper does this, for example. */
if (XCheckTypedEvent(dpy, SelectionNotify, &event)
|| XCheckTypedEvent(dpy, SelectionRequest, &event)
|| XCheckTypedEvent(dpy, PropertyNotify, &event))
{
/* This is where clip_x11_request_selection_cb() should be
* called. It may actually happen a bit later, so we loop
* until "success" changes.
* We may get a SelectionRequest here and if we don't handle
* it we hang. KDE klipper does this, for example.
* We need to handle a PropertyNotify for large selections. */
XtDispatchEvent(&event);
continue;
}
/* Time out after 2 to 3 seconds to avoid that we hang when the
* other process doesn't respond. Note that the SelectionNotify
* event may still come later when the selection owner comes back
* to life and the text gets inserted unexpectedly. Don't know
* why that happens or how to avoid that :-(. */
if (time(NULL) > start_time + 2)
{
timed_out = TRUE;
break;
}
/* Do we need this? Probably not. */
XSync(dpy, False);
/* Bernhard Walle solved a slow paste response in an X terminal by
* adding: usleep(10000); here. */
/* Wait for 1 msec to avoid that we eat up all CPU time. */
ui_delay(1L, TRUE);
}
/* this is where clip_x11_request_selection_cb() is actually called */
XtDispatchEvent(&event);
if (success)
if (success == TRUE)
return;
/* don't do a retry with another type after timing out, otherwise we
* hang for 15 seconds. */
if (timed_out)
break;
}
/* Final fallback position - use the X CUT_BUFFER0 store */
+65 -1
View File
@@ -691,6 +691,70 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
32,
/**/
31,
/**/
30,
/**/
29,
/**/
28,
/**/
27,
/**/
26,
/**/
25,
/**/
24,
/**/
23,
/**/
22,
/**/
21,
/**/
20,
/**/
19,
/**/
18,
/**/
17,
/**/
16,
/**/
15,
/**/
14,
/**/
13,
/**/
12,
/**/
11,
/**/
10,
/**/
9,
/**/
8,
/**/
7,
/**/
6,
/**/
5,
/**/
4,
/**/
3,
/**/
2,
/**/
1,
/**/
0
};
@@ -801,7 +865,7 @@ list_version()
MSG_PUTS(_("\nRISC OS version"));
#endif
#ifdef VMS
MSG_PUTS("\nOpenVMS version");
MSG_PUTS(_("\nOpenVMS version"));
# ifdef HAVE_PATHDEF
if (*compiled_arch != NUL)
{
+8 -1
View File
@@ -1731,7 +1731,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
@@ -2057,4 +2058,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 */