Commit Graph

1287 Commits

Author SHA1 Message Date
Bjorn Winckler bc28f07b5e <M-Up> and <M-Down> not triggered twice
The default Cocoa key bindings map these key presses to two commands
which led them to be triggered twice.  Avoid this by passing
Alt+Function key presses straight to Vim instead of to
interpretKeyEvents:.
2008-01-23 19:39:13 +01:00
Bjorn Winckler 807c425577 Window title is set on both decorated and full-screen window 2008-01-23 19:17:03 +01:00
Bjorn Winckler e5519102a7 Ensure menus are updated when window focus changes 2008-01-23 19:06:58 +01:00
Bjorn Winckler 284ae9fd34 Make text view first responder when leaving full-screen
The 'plus' button on the tabline got first responder status when leaving
full-screen, which (among other things) looks bad when full keyboard
access is enabled.

Also some code cleanup.
2008-01-22 19:50:50 +01:00
Bjorn Winckler a162472912 Window and view refactoring
Window and view code was refactored to better accomodate the transition
to the ATSUI text rendering code.  View specific code has been
completely moved into MMVimView and window code is now all in
MMWindowController; the window controller is also 'full-screen aware'.
Finally, the text storage is no longer referenced outside MMTextView --
the idea is that the text view is the public class for handling the
work that MMTextStorage used to be the public interface for.

This refactoring also brings some improvements:
- window resizing is more responsive
- full-screen window memory leak fixed
- proper fix for erroneous 'buffer modified' warning
- full-screen no longer tried to set 'nil-title' (this caused backend
  connection problems)
- changing lines/columns in full-screen works properly
- open dialog now works in full-screen on Tiger
2008-01-21 22:10:04 +01:00
Jjgod Jiang 41dfa1ceb3 Experimental ATSUI text rendering support
The ATSUI renderer can be enabled by setting the user default
MMAtsuiRenderer.  At the moment only very basic text drawing is supported.
2008-01-21 21:54:58 +01:00
Bjorn Winckler ba1599a054 Prepared for ATSUI renderer 2008-01-21 21:49:29 +01:00
Bjorn Winckler 46b5d6e03d Fixed potential font memory issue
The font was not retained when setting gui.norm_font leading to a pointer into
freed memory.  The font instance is now retained before its pointer value is
stored in gui.norm_font.
2008-01-07 20:28:10 +01:00
Nico Weber 38a4d64829 Fix full-screen mode for secondary monitors 2008-01-07 20:04:58 +01:00
Bjorn Winckler 02da38accf Avoid false 'documented edited' warning when quitting
If a Vim process is quit using :wq the 'document edited' flag is never cleared,
so always clear it during cleanup.
2007-12-18 17:37:11 +01:00
Bjorn Winckler 621f94828e Fix memory leak in window controller
The NSWindow object for a window controller was alloc'ed but never released
when initializing the window controller.
2007-12-14 18:56:18 +01:00
Nico Weber c9304c3b82 Fix forking infinite loop 2007-12-04 21:09:31 +01:00
Nico Weber 86ba888201 Fix tab color flicker problem on Leopard 2007-12-04 20:50:31 +01:00
Bjorn Winckler 922a70fafc Fix initial window placement
When ~/Library/Preferences/org.vim.MacVim.plist does not exist the window will
be placed according to the frame passed when initializing the NSWindow, so set
some sane default values.
2007-12-02 16:48:24 +01:00
Bjorn Winckler 81a1de822a Add mvim script, update credits 2007-12-02 15:57:54 +01:00
Nico Weber d4855706c0 Nicer looking tabs on Leopard
Make the tabs look almost identical to the Leopard Terminal.app tabs (only on
Leopard, the Tiger tabs are unchanged).
2007-12-02 15:00:37 +01:00
Nico Weber b86eee82f8 Add fork support
If vim is started via '-g', it forks and exec()s a new (!) vim instance in the
child process. But if the gui is started via `:gui`, no forking is done.

In MacVim, pass the '-f' flag when starting a new Vim process (should not fork
in this instance).
2007-12-02 13:05:14 +01:00
Bjorn Winckler 88d1e3c664 Parse selection range when opening files from Xcode
Xcode sets the 'keyAEPosition' parameter in the 'odoc' Apple event. This
contains information on the line range to select when opening files.
2007-11-28 20:12:44 +01:00
Bjorn Winckler 809f415bda Docs updated on ODB support, fixed Info.plist 2007-11-27 21:38:19 +01:00
Bjorn Winckler f99ce72a11 ODB Editor protocol (aka 'external editor') support
Programs that support ODB asks MacVim to open files. When a file is written or
closed, MacVim notifies the program of these events. (At the moment the 'Burl'
parameter is parsed but ignored. The 'RdEV' parameter is ignored.)
2007-11-27 21:07:08 +01:00
Bjorn Winckler 3a36672982 Improved support for Ctrl-mappings
Ctrl-letter keys are passed directly to the input buffer so that the backend
can separate e.g. <C-i> and <C-Tab>.
2007-11-19 21:20:56 +01:00
Bjorn Winckler 2fbfb74a77 MMLoginShell defaults to NO
Starting a tcsh shell with -c and -l doesn't work so disable this user default
until further notice.
2007-11-18 14:18:12 +01:00
Bjorn Winckler 240bb64660 Constrain window frame to screen after live resize
Always send SetTextDimensionsMsgID to Vim at the end of live resize to ensure
that resizeWindowToFit gets called.  Otherwise the window can be too big and
will then automatically resize when a dialog sheet is presented or when the
window is moved, which feels strange.
2007-11-18 14:16:42 +01:00
Bjorn Winckler 2e105da555 Fix a wide character bug
When replacing characters in the text storage it could happen that a row 'lost'
one column when a wide character was replaced with a normal one.
2007-11-17 18:03:47 +01:00
Bjorn Winckler 2d5e4ef21d Removed stray debug log message 2007-11-15 22:09:01 +01:00
Bjorn Winckler 8df6521434 Preserve swap files after crash
Before terminating gracefully, send a TerminateNowMsgID to every Vim process so
that they can determine whether MacVim quit or crashed.  If MacVim quits, call
getout() to exit Vim (this removes swap files), otherwise call
getout_preserve_modified() (this preserves swap files).
2007-11-15 22:04:06 +01:00
Bjorn Winckler e3cd69d29c Improved marked text handling
Delete, enter, escape, all work as expected with marked text visible.
2007-11-13 20:18:16 +01:00
Bjorn Winckler f7e4a83a92 Add IM control support
When the default system keyboard script is non-roman the input manager is
automatically switched to a roman keyboard script when going to normal mode.
See 'imd', 'imc', 'imi' for some relevant options.  MacVim uses an
over-the-spot style of IM support.
2007-11-13 19:15:11 +01:00
Bjorn Winckler eaaacf8af6 Disable login shell with "MMLoginShell"
New Vim processes are by default launched via a login shell so that the user's
environment gets profiled.  This behavior can be disabled by setting the user
default "MMLoginShell" to 0.
2007-11-12 20:17:57 +01:00
Nico Weber 3306ace54e Enable trackpad scrolling over the black area in full-screen 2007-11-11 20:34:57 +01:00
Bjorn Winckler 8e8f563178 Support file-open check for multiple files
When dropping multiple files, make sure none of the files are already open.  If
all files were already open, then select the window and tab of the first file
that was open.  If at least one file was not already open, then simply ignore
the open files and open the unopened ones.

Also don't check if files exists inside application:openFiles: since files that
are passed here are assumed to already exists.  The existence check has been
moved to the system services message openFile:userData:error:.
2007-11-11 20:27:03 +01:00
Bjorn Winckler 9d16bac368 New text drawing model, better unicode support, 'gfw' support, etc.
Characters and columns are no longer assumed to be in one-to-one
correspondence.  Thus when modifying the text storage a (row,column) pair must
be searched for.  This is managed using
    [NSString rangeOfComposedCharacterSequenceAtIndex:]
and by marking wide characters with an attribute (called "MMWideChar").  We
also provide an optimized code path for when characters and columns are in
one-to-one correspondence (no wide chars, only chars that can be represented by
one utf16 character).

A new typesetter is also used.  Instead of overriding
layoutGlyphsInLayoutManager:::: we override willSetLineFragmentRect::::.  This
typesetter can handle composing characters, whereas the old typesetter couldn't
(it can still be used by setting the user default "MMTypesetter" to
"MMTypesetter2".)

Note that text rendering still has flaws, the Cocoa Text System and Vim has
different opinions on how much space certain characters take up and this
results in display bugs.  (E.g. nonspacing marks such as U+064C are
problematic.)  Also, sometimes the layout manager hides glyphs but Vim assumes
that each character is displayed (resulting in yet more display bugs).

Added support for 'guifontwide'.  This can be set to anything (different font
size); it is quite possible to set it so that the display becomes completely
messed up.
2007-11-11 15:09:22 +01:00
Bjorn Winckler 94e4efed2d Don't attempt to open dropped file that is already open
When a file is dropped, each Vim process is checked to see if the file is
already open.  If so, raise the corresponding window and select the tab that
holds the opened file.  Only works when one file is dropped.
2007-11-08 20:14:34 +01:00
Bjorn Winckler 702917f6ed Add eval & add input methods to MacVim, apply to file open
Now possible to evaluate expressions in a Vim process from MacVim [MMBackend
evaluateExpression:], and to send arbitrary input to Vim [MMVimController
addVimInput:].  Expression evaluation is used to query Vim state from within
MacVim.

When opening a file use these methods to check if it is already loaded, if so
raise the corresponding window (doesn't work for multiple files).
2007-11-07 23:46:52 +01:00
Bjorn Winckler 4d517a0f74 Changed application termination procedure
On applicationShoulTerminate: check the 'documentEdited' flag of each window to
decide whether any buffers were modified instead of making a DO call to each
Vim process.
2007-11-07 22:07:21 +01:00
Bjorn Winckler 0a1ac7a24e Launch Vim process via login shell, handle spaces in file names
The user environment is not always sourced when MacVim starts.  To solve this
each Vim process is launched via a login shell like this:
    $SHELL -l -c "exec /path/to/Vim -g <args>"
Also make sure that if an argument contains a space then enclose it in quotes.
2007-11-07 21:25:05 +01:00
Bjorn Winckler 5aaf05255c Always open a dropped file in new tab
Always use ":tab drop" when dropping files.  (Used to call ":drop" when only
one file was dropped but this would not open the file in a new tab.)
2007-11-07 19:46:46 +01:00
Bjorn Winckler f1236d0fd3 Disable baseline change for underlined text.
This fixes a display bug on Leopard where lines with underlined text were
higher than lines without underlined text.
2007-11-05 15:44:27 +01:00
Bjorn Winckler 67576e0281 Only respond to left, right and middle mouse clicks.
This effectively ignores mouse clicks when [NSEvent buttonNumber] > 2.
2007-11-04 18:46:03 +01:00
Bjorn Winckler 0b104808a2 Enable compilation without FEAT_MBYTE. 2007-11-02 18:18:17 +01:00
Bjorn Winckler cf69540941 Fixed typo in the credits. 2007-11-02 13:29:17 +01:00
Dan Callahan 855ff922b8 New icon set (Gnome/Matt Ball/Jonas Rask derived) 2007-11-01 17:14:45 -05:00
Nico Weber 9b639cbbe2 Vim view refactoring.
This fixes the ':set lines=1000000' problem in fu mode.  Furthermore, this
fixes a regression that the tab sizes weren't adjusted when changing the window
size.
2007-10-30 21:44:23 +01:00
Bjorn Winckler 36b97011cf Removed stray debug log message. 2007-10-30 18:09:06 +01:00
Chris Willmore 25bf887ced Fix for Leopard Ctl-key bug.
In Leopard Ctrl-key events are sent to performKeyEquivalent: instead of
keyDown:, so we have to deal with them there as well.
2007-10-29 19:19:18 +01:00
Bjorn Winckler 75b61c87cf Optimize speed when 'matchparen' is enabled.
When matchparen is used gui_mch_update() gets called a lot.  This function
checks the run loop for new input which takes a long time.  To speed things up
make sure that the run loop is only checked every 100 ms or so (controlled by
MMUpdateTimeoutInterval in gui_macvim.m).
2007-10-28 13:51:01 +01:00
Bjorn Winckler 3d98b6f1f5 Use "macvim" color scheme as default.
The color scheme is set in $VIM/gvimrc, but only if the color scheme hasn't
already been set (in .vimrc).
2007-10-27 16:05:15 +02:00
Bjorn Winckler 4de2a14060 Ignore DRAW_TRANSP flag.
This flag is supposed to indicate that the background should be "transparent".
However, not setting the background color leads to a rendering artifact where
the character after the cursor sometimes is not drawn.  Simply ignoring the
DRAW_TRANSP flag takes care of this bug.
2007-10-26 19:51:47 +02:00
Tim Allen 85313038f6 Draw the current text view size in the titlebar during resize operations.
It seems that NSWindows get notfied of each step of the live-resize, but
NSViews get notified of the start and end events. So, we make MMTextView
forward these notifications to the window controller, and let the window
controller figure out when to change the title.

Signed-off-by: Tim Allen <screwtape@froup.com>
2007-10-26 14:14:41 +10:00
Bjorn Winckler 1e44f71605 Add input queue to backend, fixing process leak problem.
Mouse and keyboard input is handled immediately, all other input is put on a
queue which is processed whenever gui_mch_update() is called.  This avoids DO
calls to be sent from the backend during processing of another DO call.  (See
comments in MMBackend processInput:data: and processInputQueue.)  One problem
this caused was that connectionDidDie notification was not received when
processInput:data: got called recursively (and thus processes could "leak").

Also did some code cleanup to MMBackend.
2007-10-25 19:29:44 +02:00