Compare commits

..

57 Commits

Author SHA1 Message Date
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
61 changed files with 2012 additions and 881 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 \
+99 -29
View File
@@ -15,12 +15,12 @@ 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. Known bugs/missing features |macvim-todo|
11. 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}
@@ -108,6 +108,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 +165,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,9 +177,8 @@ 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
@@ -199,6 +204,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 +249,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 +279,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 +368,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
@@ -370,7 +387,7 @@ can be used to send action messages.
The key equivalent is specified with the <D-..>
syntax. Note that key equivalents must contain the
Cmd modifier flag (<D-...>), and they take precedence
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
@@ -463,11 +480,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,17 +503,42 @@ 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 Here: Open a new window and set the current directory to that
of the selected text. This is intended to be used from a Finder window to
open an empty document in the currently selected folder.
* New Document Containing Selection: Open a new window and paste the currently
selected text.
* Open Selected File: If the selected text represents a file name, then the
corresponding file is opened in a new window.
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*
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. Known bugs/missing features *macvim-todo*
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.
@@ -507,7 +550,8 @@ 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
- Printing. As a temporary solution <D-p> creates a PostScript file which is
then opened in Preview where it may be printed.
- No find/replace dialog
If you find new bugs then add a new issue at http://code.google.com/p/macvim/
@@ -517,7 +561,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*
11. Hints *macvim-hints*
In this section some general (not necessarily MacVim specific) hints are
given.
@@ -584,6 +628,32 @@ 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 -c "au VimLeave * maca hide:"
(You may need to add the "-f" switch before the "-c", see the Scenario above.)
Scenario: ~
You can't find the information on MacVim you thought should be in this manual
+10 -1
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.
+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:
+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
+1
View File
@@ -29,6 +29,7 @@ Enno L\'fcbbers\
Kyle Lippincott\
Matt Tolton\
Kaoru Yoshida\
Ron Olson\
\i0 \
...and many others who have helped by reporting bugs etc.\
Binary file not shown.
+19 -6
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>35</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,7 +584,7 @@
<key>NSMenuItem</key>
<dict>
<key>default</key>
<string>MacVim/Open Selected File in Tab</string>
<string>MacVim/Open Selected File</string>
</dict>
<key>NSMessage</key>
<string>openFile</string>
@@ -582,16 +595,16 @@
<string>NSStringPboardType</string>
</array>
<key>NSUserData</key>
<string>Tab</string>
<string>Window</string>
</dict>
<dict>
<key>NSMenuItem</key>
<dict>
<key>default</key>
<string>MacVim/Open Selected File in Window</string>
<string>MacVim/New Document Here</string>
</dict>
<key>NSMessage</key>
<string>openFile</string>
<string>newFileHere</string>
<key>NSPortName</key>
<string>MacVim</string>
<key>NSSendTypes</key>
+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;
+327 -156
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:
@@ -159,7 +163,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 +184,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];
@@ -312,6 +316,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 +379,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 +407,9 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender
{
return [[NSUserDefaults standardUserDefaults]
boolForKey:MMTerminateAfterLastWindowClosedKey];
return (MMTerminateWhenLastWindowClosed ==
[[NSUserDefaults standardUserDefaults]
integerForKey:MMLastWindowClosedBehaviorKey]);
}
- (NSApplicationTerminateReply)applicationShouldTerminate:
@@ -715,6 +602,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 +632,20 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
}
if (!NSEqualPoints(topLeft, NSZeroPoint)) {
NSPoint oldTopLeft = topLeft;
if (topWin)
topLeft = [win cascadeTopLeftFromPoint:topLeft];
[win setFrameTopLeftPoint:topLeft];
if ([win frame].origin.y < [[win screen] frame].origin.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 (1 == [vimControllers count]) {
@@ -843,6 +746,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]
: [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 +1136,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 +1171,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 +1412,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
+181 -32
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);
@@ -750,12 +844,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 +1018,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 +1036,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 +1214,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 +1235,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;
+245 -255
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,
@@ -114,6 +108,7 @@ static NSString *MMSymlinkWarningString =
- (BOOL)checkForModifiedBuffers;
- (void)addInput:(NSString *)input;
- (BOOL)unusedEditor;
- (void)redrawScreen;
@end
@@ -327,7 +322,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 +468,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 +482,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 +510,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 +566,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 +695,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 +1013,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 +1041,55 @@ 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;
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);
[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 {
// 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])];
BOOL interrupt = NO;
if (msgid == InterruptMsgID) {
interrupt = YES;
} else if (InsertTextMsgID == msgid && data != nil && [data length] == 1) {
char_u *str = (char_u*)[data bytes];
if ((str[0] == Ctrl_C && ctrl_c_interrupts) ||
(str[0] == intr_char && intr_char != Ctrl_C))
interrupt = YES;
}
// 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. This avoids annoying
// situations such as when the keyboard repeat rate is higher than what Vim
// can cope with (which would cause a 'stutter' when scrolling by holding
// down 'j' and then when 'j' was released the screen kept scrolling for a
// little while).
int i, count = [inputQueue count];
for (i = 1; i < count; i+=2) {
if ([[inputQueue objectAtIndex:i-1] intValue] == msgid) {
[inputQueue removeObjectAtIndex:i];
[inputQueue removeObjectAtIndex:i-1];
break;
}
}
[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 +1204,6 @@ static NSString *MMSymlinkWarningString =
[self addInput:input];
[self addClient:(id)client];
inputReceived = YES;
}
- (NSString *)evaluateExpression:(in bycopy NSString *)expr
@@ -1340,15 +1233,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 +1286,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));
}
@@ -1636,17 +1515,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 +1539,96 @@ static NSString *MMSymlinkWarningString =
- (void)handleInputEvent:(int)msgid data:(NSData *)data
{
//NSLog(@"%s%s", _cmd, MessageStrings[msgid]);
if (InsertTextMsgID == msgid) {
[self handleInsertText:data];
} else if (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) {
[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 +1651,31 @@ 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 = SetTextDimensionsMsgID;
}
// 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];
[self queueMessage:msgid data:d];
//NSLog(@"[VimTask] Resizing shell to %dx%d.", cols, rows);
gui_resize_shell(cols, rows);
@@ -1770,12 +1750,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]) {
@@ -1864,12 +1838,6 @@ static NSString *MMSymlinkWarningString =
//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
@@ -2003,13 +1971,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 +2063,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 +2214,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 +2318,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 +2330,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 +2379,6 @@ static NSString *MMSymlinkWarningString =
maketitle();
flushDisabled = NO;
gui_mch_flush();
}
}
@@ -2425,6 +2390,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 +2471,21 @@ 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();
}
@end // MMBackend (Private)
@@ -2838,7 +2829,6 @@ static id evalExprCocoa(NSString * expr, NSString ** errstr)
@implementation NSString (VimStrings)
+ (id)stringWithVimString:(char_u *)s
+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
+93 -161
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);
@@ -335,6 +314,11 @@
[(MMTextStorage*)[self textStorage] setFont:newFont];
}
- (NSFont *)fontWide
{
return [(MMTextStorage*)[self textStorage] fontWide];
}
- (void)setWideFont:(NSFont *)newFont
{
[(MMTextStorage*)[self textStorage] setWideFont:newFont];
@@ -356,6 +340,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 +374,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 +449,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 +529,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 +542,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 +560,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 +574,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 +585,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 +606,7 @@
ipRect.size.width = frac;
}
[[self insertionPointColor] set];
[[helper insertionPointColor] set];
if (MMInsertionPointHollow == insertionPointShape) {
NSFrameRect(ipRect);
} else {
@@ -584,7 +619,7 @@
//NSLog(@"%s draw insertion point %@ shape=%d color=%@", _cmd,
// NSStringFromRect(ipRect), insertionPointShape,
// [self insertionPointColor]);
// [helper insertionPointColor]);
}
#if 0
@@ -627,109 +662,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 +889,7 @@
return YES;
}
@end // MMTextView
@@ -933,37 +897,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 +910,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 +925,6 @@
insertionPointColumn = col;
insertionPointShape = shape;
insertionPointFraction = percent;
[self setInsertionPointColor:color];
}
- (void)drawInvertedRectAtRow:(int)row column:(int)col numRows:(int)nrows
@@ -1003,8 +936,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 +945,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
+192 -36
View File
@@ -33,10 +33,6 @@ 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;
@@ -48,18 +44,37 @@ static NSTimeInterval MMScrollWheelDelay = 0.05;
- (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);
@@ -227,6 +242,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];
@@ -264,16 +286,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 +535,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
@@ -706,26 +884,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)
+23 -9
View File
@@ -923,6 +923,11 @@ 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];
// IMPORTANT: When adding a new message, make sure to update
// isUnsafeMessage() if necessary!
} else {
@@ -1457,17 +1462,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])
+2
View File
@@ -62,6 +62,8 @@
- (void)enterFullscreen:(int)fuoptions backgroundColor:(NSColor *)back;
- (void)leaveFullscreen;
- (void)setFullscreenBackgroundColor:(NSColor *)back;
- (void)setBuffersModified:(BOOL)mod;
- (IBAction)addNewTab:(id)sender;
+6
View File
@@ -571,6 +571,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
+18
View File
@@ -121,6 +121,8 @@ enum {
UpdateTabBarMsgID,
ShowTabBarMsgID,
HideTabBarMsgID,
SetTextRowsMsgID,
SetTextColumnsMsgID,
SetTextDimensionsMsgID,
SetWindowTitleMsgID,
ScrollWheelMsgID,
@@ -171,6 +173,8 @@ enum {
SetDocumentFilenameMsgID,
OpenWithArgumentsMsgID,
CloseWindowMsgID,
InterruptMsgID,
SetFullscreenColorMsgID,
};
@@ -253,3 +257,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
+4
View File
@@ -28,6 +28,8 @@ char *MessageStrings[] =
"UpdateTabBarMsgID",
"ShowTabBarMsgID",
"HideTabBarMsgID",
"SetTextRowsMsgID",
"SetTextColumsMsgID",
"SetTextDimensionsMsgID",
"SetWindowTitleMsgID",
"ScrollWheelMsgID",
@@ -78,6 +80,8 @@ char *MessageStrings[] =
"SetDocumentFilenameMsgID",
"OpenWithArgumentsMsgID",
"CloseWindowMsgID",
"InterruptMsgID",
"SetFullscreenColorMsgID",
};
+3 -3
View File
@@ -756,7 +756,7 @@
i386,
);
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 34;
CURRENT_PROJECT_VERSION = 35;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
@@ -797,7 +797,7 @@
buildSettings = {
ARCHS = "$(NATIVE_ARCH)";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 34;
CURRENT_PROJECT_VERSION = 35;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
@@ -829,7 +829,7 @@
buildSettings = {
ARCHS = "$(NATIVE_ARCH)";
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 34;
CURRENT_PROJECT_VERSION = 35;
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";
+49 -50
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)
{
@@ -1600,6 +1599,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 +1750,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 +1818,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;
}
+1 -1
View File
@@ -66,7 +66,7 @@ aunmenu Edit.Find\ and\ Replace
an 20.410.10 Edit.Find.Find\.\.\.<Tab>/ /
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
vmenu 20.410.35 Edit.Find.Use\ Selection\ for\ Find y:let @/=@"<CR>:<BS>
an 20.410.40 Edit.Find.-SEP1- <Nop>
an 20.410.50 Edit.Find.Find\ and\ Replace\.\.\.<Tab>:%s :%s/
vunmenu Edit.Find.Find\ and\ Replace\.\.\.<Tab>:%s
+46 -2
View File
@@ -40,12 +40,56 @@
Sparkle supports updates in zip, tar, tbz, tgz, or dmg format.
-->
<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 +112,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"
+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);
+25 -11
View File
@@ -1256,23 +1256,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 +1283,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);
@@ -3657,8 +3667,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)
@@ -15858,10 +15868,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 +16687,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);
@@ -20610,6 +20619,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 +20670,8 @@ func_dump_profile(fd)
prof_self_cmp);
prof_sort_list(fd, sorttab, st_len, "SELF", TRUE);
}
vim_free(sorttab);
}
static void
@@ -21224,7 +21238,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 +21269,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);
+1
View File
@@ -5059,6 +5059,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;
}
+2
View File
@@ -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,
+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
+18
View File
@@ -2984,6 +2984,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},
@@ -9560,6 +9561,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 +9907,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
+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
@@ -8528,6 +8528,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 +8607,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 +8625,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 +8818,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 +8927,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
+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},
+2 -1
View File
@@ -1539,7 +1539,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
-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 */
-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.
+52 -27
View File
@@ -5488,6 +5488,11 @@ 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 == '-')
++ptr;
/* When a count is given, turn it into a range. Is this
* really what we want? */
isman = (STRCMP(kp, "man") == 0);
@@ -5530,37 +5535,57 @@ 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 */
p = vim_strsave_shellescape(ptr, TRUE);
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.
+5 -1
View File
@@ -1155,7 +1155,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
@@ -10875,6 +10875,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
+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
+1
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);
+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)
+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)
+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 */
+45 -1
View File
@@ -691,6 +691,50 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
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 +845,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)
{