Compare commits

...

12 Commits

Author SHA1 Message Date
Bjorn Winckler ee1fd606dd Snapshot 36 2008-10-04 19:26:05 +02:00
Bjorn Winckler ac3900639d Update credits 2008-10-04 17:27:58 +02:00
Bjorn Winckler aa3ac2d303 Add Find & Replace dialog box 2008-10-04 17:25:07 +02:00
Bjorn Winckler e84420f7d1 Remove TODO 2008-10-03 16:26:33 +02:00
Bjorn Winckler f3c411fafe Add help on "modifier key as Esc" 2008-10-02 22:53:17 +02:00
Bjorn Winckler d366864ff5 Add preference to change fake Esc modifier key 2008-10-02 22:28:52 +02:00
Bjorn Winckler 3d2d6a810e Modifier key sends Esc
Adds possibility to make the left Ctrl, Alt, or Cmd key function as a
second Esc key.  The key will still function as a modifier if held down
in conjunction with another key.  Enable by setting the user default
"MMFakeEscModifier" to:
    1 = Left Ctrl
    2 = Left Alt
    3 = Left Cmd
    any other number disables this functionality

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

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

The fact that the Esc event is sent on release makes it feel somewhat
sluggish.  It is possible to have the event sent when the modifier key
is pressed by setting the user default "MMFakeEscOnKeyDown" but then the
left modifier key can only be used as an Esc key.
2008-09-30 22:06:30 +02:00
Jonathon Mah 6fb7a6f38b Added dragging to tab bar
Dragging a file to a tab will open it in that tab.
Dragging files to the end of the tab bar will open them in new tabs.
2008-09-30 02:09:17 +09:30
Jonathon Mah cf7a0a71bd Added tool tips for tabs when tab labels are truncated 2008-09-29 22:06:54 +09:30
Jonathon Mah 6e1e046cbb Fixed memory leak in -[MMAppController openFiles:withArguments:] 2008-09-29 21:20:28 +09:30
Bjorn Winckler 2d1fc65b0e Don't drop non-repeating keyboard input
Keyboard input is not dropped, unless the input was received due to a
key being automatically repeated (as a consequence of the key being held
down).  This way characters are never dropped while typing, but it also
avoids situations where the screen doesn't stop scrolling immediately
when "j" is released after being held.
2008-09-28 23:50:39 +02:00
Bjorn Winckler e378d7332b Add keyboard shortcuts to help file 2008-09-28 22:07:07 +02:00
36 changed files with 832 additions and 282 deletions
+2 -2
View File
@@ -806,13 +806,13 @@ This replaces each 'E' character with a euro sign. Read more in |<Char->|.
:promptf[ind] [string]
Put up a Search dialog. When [string] is given, it is
used as the initial search string.
{only for Win32, Motif and GTK GUI}
{only for Win32, Motif, GTK and MacVim GUI}
*:promptr* *:promptrepl*
:promptr[epl] [string]
Put up a Search/Replace dialog. When [string] is
given, it is used as the initial search string.
{only for Win32, Motif and GTK GUI}
{only for Win32, Motif, GTK and MacVim GUI}
4.4 Changing tabs *change-tabs*
+94 -18
View File
@@ -1,4 +1,4 @@
*gui_mac.txt* For Vim version 7.2. Last change: 2008 Jul 12
*gui_mac.txt* For Vim version 7.2. Last change: 2008 Oct 04
VIM REFERENCE MANUAL by Bjorn Winckler
@@ -16,8 +16,9 @@ The MacVim Graphical User Interface *macvim* *gui-macvim*
7. Dialogs |macvim-dialogs|
8. System services |macvim-services|
9. mvim:// URL handler |macvim-url-handler|
10. Known bugs/missing features |macvim-todo|
11. Hints |macvim-hints|
10. Keyboard shortcuts |macvim-shortcuts|
11. Known bugs/missing features |macvim-todo|
12. Hints |macvim-hints|
Other relevant documentation:
|gui.txt| For generic items of the GUI.
@@ -76,16 +77,6 @@ file at all. In this situation, you will need to set both 'encoding' and
'fileencodings' to a simple single-byte encoding such as Latin1 so that when
the file is read into memory, the original bytes are left untouched.
*macvim-movement*
Some Mac OS X standard key mappings involving Cmd or Option and an arrow key
are set up by default in "$VIM/gvimrc". You can quickly disable all of these
by adding the following lines to your "~/.vimrc" (not .gvimrc) file: >
if has("gui_macvim")
let macvim_skip_cmd_opt_movement = 1
endif
Note: These are the only key mappings that MacVim makes (not counting menu key
equivalents which are not set up with :map).
*macvim-shift-movement*
Text editors on Mac OS X lets the user hold down shift+movement key to extend
the selection. Also, pressing a printable key whilst selecting replaces the
@@ -251,6 +242,8 @@ Here is a list of relevant dictionary entries:
KEY VALUE ~
MMCellWidthMultiplier width of a normal glyph in em units [float]
MMDialogsTrackPwd open/save dialogs track the Vim pwd [bool]
MMFakeEscTimeout timeout for modifier to count as Esc [float]
MMFakeEscOnKeyDown send Esc when modifier is pressed [bool]
MMLoginShellArgument login shell parameter [string]
MMLoginShellCommand which shell to use to launch Vim [string]
MMNoFontSubstitution disable automatic font substitution [bool]
@@ -292,6 +285,30 @@ user default MMLoginShellArgument (e.g. to "-l"). Finally, if the "bash"
shell is used, then "-l" is automatically added as an argument. To override
this behaviour set MMLoginShellArgument to "--".
*macvim-esc*
MacVim can treat a modifier key as Esc in order to avoid having to reach for
the Esc key all the time. The actual modifier key to treat as Esc can be
selected in the preferences (only the left modifier key is affected on
keyboards which have a left and a right modifier key). This is most useful if
Caps Lock has also been remapped to the chosen modifier since it is then
possible to use Caps Lock (which is very easy to reach) to go to normal mode
instead of using Esc (which is somewhat harder to reach). Caps Lock can be
remapped in the "Keyboard & Mouse" System Preference by clicking on the
"Modifier Keys..." button.
This feature works by swapping the modifier key release event for an Esc key
press event, so the Esc is only sent when the modifier is released. Also, if
the modifier is not released quickly enough no Esc event is sent. This way it
is possible to keep using the modifier key as a modifier (by holding the key
down and pressing another key) as well as using it as Esc (by quickly pressing
the key). It is possible to make MacVim send Esc when the modifier is pressed
(which makes the key feel more responsive) by setting the MMFakeEscOnKeyDown
user default, but then that modifier key can only be used as Esc. The timeout
can also be change by setting the MMFakeEscTimeout user default to the desired
timeout in seconds (e.g. if you want to be able to press the modifier more
slowly but still having it count as Esc, then you could increase the timeout
to 1.0).
==============================================================================
4. Special colors *macvim-colors*
@@ -538,10 +555,69 @@ For example, the link >
Note that url has to be a file:// url pointing to an existing local file.
==============================================================================
10. Known bugs/missing features *macvim-todo*
10. Keyboard shortcuts *macvim-shortcuts*
Here are some of the bigger bugs in MacVim. Of course there are others, but
these are ones that are know and/or which were judged major.
Most keyboard shortcuts in MacVim are bound to menu items and can be
discovered by looking through the menus. The remaining shortcuts are listed
here:
*Cmd-.* *<D-.>*
Cmd-. Interrupt Vim. This is synonymous with CTRL-C and can
hence be used instead of Esc to exit insert mode (in
case you find Esc a bit hard to reach).
*Cmd-`* *<D-`>*
Cmd-` Cycle to the next window. On an American keyboard the
`-key is located under the Esc-key. On European
keyboards this key is often adjacent to the left
Shift-key and it may be not even be marked with "`".
*Cmd-Left* *<D-Left>*
Cmd-Left Move cursor to the beginning of the line
(see |cmd-movement|).
*Cmd-Right* *<D-Right>*
Cmd-Right Move cursor to the end of the line (see |cmd-movement|).
*Cmd-Up* *<D-Up>*
Cmd-Up Move cursor to the first line (see |cmd-movement|).
*Cmd-Down* *<D-Down>*
Cmd-Down Move cursor to the last line (see |cmd-movement|).
*Alt-Left* *<M-Left>*
Alt-Left Move cursor to the beginning of the previous word
(see |alt-movement|).
*Alt-Right* *<M-Right>*
Alt-Right Move cursor to the beginning of the next word
(see |alt-movement|).
*Alt-Up* *<M-Up>*
Alt-Up Move cursor one paragraph forward (see |alt-movement|).
*Alt-Down* *<M-Down>*
Alt-Down Move cursor to the previous paragraph
(see |alt-movement|).
*cmd-movement* *alt-movement*
The above mappings involving Cmd/Alt + arrow key are enabled by default in the
system gvimrc file "$VIM/gvimrc". You can quickly disable all of these by
adding the following lines to your "~/.vimrc" (not .gvimrc) file: >
if has("gui_macvim")
let macvim_skip_cmd_opt_movement = 1
endif
Note: These are the only key mappings that MacVim makes (not counting menu key
equivalents which are not set up with :map).
See |macvim-shift-movement| if you want Shift to select text when used in
conjunction with the above Cmd/Alt movement shortcuts.
==============================================================================
11. Known bugs/missing features *macvim-todo*
This list is by no means exhaustive, it only enumerates some of the more
prominent bugs/missing features.
- Localized menus are not supported. Choosing anything but "English" in the
"International" pane of "System Prefences" may break the menus (and
@@ -552,7 +628,7 @@ these are ones that are know and/or which were judged major.
automatic font substitution by setting 'guifontwide' manually.
- Printing. As a temporary solution <D-p> creates a PostScript file which is
then opened in Preview where it may be printed.
- No find/replace dialog
- The toolbar looks ugly and is not very useful.
If you find new bugs then add a new issue at http://code.google.com/p/macvim/
or post your findings to the |vim_mac| mailing list. If you are missing
@@ -561,7 +637,7 @@ might be simple to implement, but unless somebody asks for a particular
feature then there is little incentive to add it.
==============================================================================
11. Hints *macvim-hints*
12. Hints *macvim-hints*
In this section some general (not necessarily MacVim specific) hints are
given.
+2 -1
View File
@@ -1,4 +1,4 @@
{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf330
{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf350
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\vieww9000\viewh8400\viewkind0
@@ -30,6 +30,7 @@ Kyle Lippincott\
Matt Tolton\
Kaoru Yoshida\
Ron Olson\
Jonathon Mah\
\i0 \
...and many others who have helped by reporting bugs etc.\
+2
View File
@@ -76,6 +76,8 @@
<dict>
<key>atsuiButtonClicked</key>
<string>id</string>
<key>fakeEscModifierKeyChanged</key>
<string>id</string>
<key>loginShellButtonClicked</key>
<string>id</string>
<key>quickstartButtonClicked</key>
+1 -1
View File
@@ -13,7 +13,7 @@
<integer>115</integer>
</array>
<key>IBSystem Version</key>
<string>9E17</string>
<string>9F33</string>
<key>targetFramework</key>
<string>IBCocoaFramework</string>
</dict>
Binary file not shown.
+87
View File
@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBClasses</key>
<array>
<dict>
<key>CLASS</key>
<string>RBSplitView</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>OUTLETS</key>
<dict>
<key>delegate</key>
<string>id</string>
</dict>
<key>SUPERCLASS</key>
<string>RBSplitSubview</string>
</dict>
<dict>
<key>CLASS</key>
<string>RBSplitSubview</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
<string>NSView</string>
</dict>
<dict>
<key>ACTIONS</key>
<dict>
<key>findAndReplace</key>
<string>id</string>
</dict>
<key>CLASS</key>
<string>FirstResponder</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
<string>NSObject</string>
</dict>
<dict>
<key>CLASS</key>
<string>NSMenu</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
<string>NSObject</string>
</dict>
<dict>
<key>ACTIONS</key>
<dict>
<key>didAdjustSubviews</key>
<string>RBSplitView</string>
<key>willAdjustSubviews</key>
<string>RBSplitView</string>
</dict>
<key>CLASS</key>
<string>NSObject</string>
<key>LANGUAGE</key>
<string>ObjC</string>
</dict>
<dict>
<key>CLASS</key>
<string>MMFindReplaceController</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>OUTLETS</key>
<dict>
<key>backwardButton</key>
<string>NSButton</string>
<key>findBox</key>
<string>NSTextField</string>
<key>ignoreCaseButton</key>
<string>NSButton</string>
<key>matchWordButton</key>
<string>NSButton</string>
<key>replaceBox</key>
<string>NSTextField</string>
</dict>
<key>SUPERCLASS</key>
<string>NSWindowController</string>
</dict>
</array>
<key>IBVersion</key>
<string>1</string>
</dict>
</plist>
+20
View File
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBFramework Version</key>
<string>629</string>
<key>IBLastKnownRelativeProjectPath</key>
<string>../MacVim.xcodeproj</string>
<key>IBOldestOS</key>
<integer>5</integer>
<key>IBOpenObjects</key>
<array>
<integer>7</integer>
</array>
<key>IBSystem Version</key>
<string>9F33</string>
<key>targetFramework</key>
<string>IBCocoaFramework</string>
</dict>
</plist>
Binary file not shown.
+1 -1
View File
@@ -558,7 +558,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>35</string>
<string>36</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
+5 -1
View File
@@ -185,6 +185,10 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
[NSNumber numberWithBool:NO], MMVerticalSplitKey,
[NSNumber numberWithInt:0], MMPreloadCacheSizeKey,
[NSNumber numberWithInt:0], MMLastWindowClosedBehaviorKey,
[NSNumber numberWithInt:MMDisableFakeEsc],
MMFakeEscModifierKey,
[NSNumber numberWithFloat:0.3], MMFakeEscTimeoutKey,
[NSNumber numberWithBool:NO], MMFakeEscOnKeyDownKey,
nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:dict];
@@ -761,7 +765,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
// arguments for each launching process can be looked up by its PID (in the
// pidArguments dictionary).
NSMutableDictionary *arguments = (args ? [args mutableCopy]
NSMutableDictionary *arguments = (args ? [[args mutableCopy] autorelease]
: [NSMutableDictionary dictionary]);
//
+9
View File
@@ -12,6 +12,15 @@
@interface MMApplication : NSApplication {
CFAbsoluteTime fakeEscTimeDown;
CFAbsoluteTime fakeEscTimeout;
int fakeEscKeyCode;
unsigned fakeEscModifierMask;
BOOL blockFakeEscEvent;
BOOL blockKeyDown;
BOOL fakeEscOnKeyDown;
}
- (IBAction)fakeEscModifierKeyChanged:(id)sender;
@end
+106 -1
View File
@@ -14,6 +14,7 @@
*/
#import "MMApplication.h"
#import "Miscellaneous.h"
// Ctrl-Tab is broken on pre 10.5, so we add a hack to make it work.
#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4
@@ -26,11 +27,88 @@
@implementation MMApplication
- (void)awakeFromNib
{
[self fakeEscModifierKeyChanged:nil];
}
- (void)sendEvent:(NSEvent *)event
{
NSEventType type = [event type];
unsigned flags = [event modifierFlags];
// The following hack allows the user to set one modifier key of choice
// (Ctrl, Alt, or Cmd) to generate an Esc key press event. In order for
// the key to still be used as a modifier we only send the "faked" Esc
// event if the modifier was pressed and released without any other keys
// being pressed in between. The user may elect to have the chosen
// modifier sending Esc on key down, since sending it on key up makes it
// appear a bit sluggish. However, this effectively disables the modifier
// key (but only the left key and not the right one, in case there are two
// on the keyboard).
//
// This hack is particularly useful in conjunction with Mac OS X's ability
// to turn Caps-Lock into a modifier key of choice because it enables us to
// turn Caps-Lock into a quasi-Esc key! (This remapping be done inside
// "System Preferences -> Keyboard & Mouse -> Modifier Keys...".)
//
if (fakeEscKeyCode != 0) {
if (NSFlagsChanged == type && [event keyCode] == fakeEscKeyCode) {
BOOL sendEsc = NO;
CFAbsoluteTime timeNow = CFAbsoluteTimeGetCurrent();
if ((flags & fakeEscModifierMask) == 0) {
// The chosen modifier was released. If the modifier was
// recently pressed then convert this event to a "fake" Esc key
// press event.
if (!blockFakeEscEvent && !fakeEscOnKeyDown &&
timeNow - fakeEscTimeDown < fakeEscTimeout)
sendEsc = YES;
blockFakeEscEvent = YES;
blockKeyDown = NO;
} else {
// The chosen modifier was pressed.
blockFakeEscEvent = NO;
fakeEscTimeDown = timeNow;
if (fakeEscOnKeyDown) {
sendEsc = YES;
// Block key down while the fake Esc modifier key is held,
// otherwise "marked text" may pop up if a key is pressed
// while the fake Esc modifier is held (which looks ugly,
// but is harmless).
blockKeyDown = YES;
}
}
if (sendEsc) {
NSEvent *e = [NSEvent keyEventWithType:NSKeyDown
location:[event locationInWindow]
modifierFlags:flags & 0x0000ffffU
timestamp:[event timestamp]
windowNumber:[event windowNumber]
context:[event context]
characters:@"\x1b" // Esc
charactersIgnoringModifiers:@"\x1b"
isARepeat:NO
keyCode:53];
[self postEvent:e atStart:YES];
return;
}
} else if (type != NSKeyUp) {
// Another event occurred, so don't send any fake Esc events now
// (else the modifier would not function as a modifier key any
// more).
blockFakeEscEvent = YES;
}
if (blockKeyDown && type == NSKeyDown)
return;
}
#ifdef MM_CTRL_TAB_HACK
NSResponder *firstResponder = [[self keyWindow] firstResponder];
@@ -51,7 +129,7 @@
// key event.
if ((NSKeyDown == type || NSKeyUp == type) && (flags & NSHelpKeyMask)) {
flags &= ~NSHelpKeyMask;
event = [NSEvent keyEventWithType:[event type]
NSEvent *e = [NSEvent keyEventWithType:[event type]
location:[event locationInWindow]
modifierFlags:flags
timestamp:[event timestamp]
@@ -61,6 +139,9 @@
charactersIgnoringModifiers:[event charactersIgnoringModifiers]
isARepeat:[event isARepeat]
keyCode:[event keyCode]];
[self postEvent:e atStart:YES];
return;
}
[super sendEvent:event];
@@ -83,4 +164,28 @@
nil]];
}
- (IBAction)fakeEscModifierKeyChanged:(id)sender
{
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
switch ([ud integerForKey:MMFakeEscModifierKey]) {
case MMCtrlFakeEsc:
fakeEscKeyCode = 59;
fakeEscModifierMask = NSControlKeyMask;
break;
case MMAltFakeEsc:
fakeEscKeyCode = 58;
fakeEscModifierMask = NSAlternateKeyMask;
break;
case MMCmdFakeEsc:
fakeEscKeyCode = 55;
fakeEscModifierMask = NSCommandKeyMask;
break;
default:
fakeEscKeyCode = fakeEscModifierMask = 0;
}
fakeEscTimeout = [ud floatForKey:MMFakeEscTimeoutKey];
fakeEscOnKeyDown = [ud boolForKey:MMFakeEscOnKeyDownKey];
}
@end
+74 -30
View File
@@ -91,7 +91,7 @@ static NSString *MMSymlinkWarningString =
- (void)processInputQueue;
- (void)handleInputEvent:(int)msgid data:(NSData *)data;
+ (NSDictionary *)specialKeys;
- (void)handleInsertText:(NSData *)data;
- (void)handleInsertText:(NSString *)text;
- (void)handleKeyDown:(NSString *)key modifiers:(int)mods;
- (void)queueMessage:(int)msgid data:(NSData *)data;
- (void)connectionDidDie:(NSNotification *)notification;
@@ -109,6 +109,7 @@ static NSString *MMSymlinkWarningString =
- (void)addInput:(NSString *)input;
- (BOOL)unusedEditor;
- (void)redrawScreen;
- (void)handleFindReplace:(NSDictionary *)args;
@end
@@ -1048,11 +1049,16 @@ static NSString *MMSymlinkWarningString =
BOOL interrupt = NO;
if (msgid == InterruptMsgID) {
interrupt = YES;
} else if (InsertTextMsgID == msgid && data != nil && [data length] == 1) {
char_u *str = (char_u*)[data bytes];
if ((str[0] == Ctrl_C && ctrl_c_interrupts) ||
(str[0] == intr_char && intr_char != Ctrl_C))
interrupt = YES;
} else if (InsertTextMsgID == msgid && data != nil) {
const void *bytes = [data bytes];
bytes += sizeof(int);
int len = *((int*)bytes); bytes += sizeof(int);
if (1 == len) {
char_u *str = (char_u*)bytes;
if ((str[0] == Ctrl_C && ctrl_c_interrupts) ||
(str[0] == intr_char && intr_char != Ctrl_C))
interrupt = YES;
}
}
if (interrupt) {
@@ -1063,18 +1069,36 @@ static NSString *MMSymlinkWarningString =
// Remove all previous instances of this message from the input queue, else
// the input queue may fill up as a result of Vim not being able to keep up
// with the speed at which new messages are received. This avoids annoying
// situations such as when the keyboard repeat rate is higher than what Vim
// can cope with (which would cause a 'stutter' when scrolling by holding
// down 'j' and then when 'j' was released the screen kept scrolling for a
// little while).
// with the speed at which new messages are received.
// Keyboard input is never dropped, unless the input represents and
// auto-repeated key.
int i, count = [inputQueue count];
for (i = 1; i < count; i+=2) {
if ([[inputQueue objectAtIndex:i-1] intValue] == msgid) {
[inputQueue removeObjectAtIndex:i];
[inputQueue removeObjectAtIndex:i-1];
break;
BOOL isKeyRepeat = NO;
BOOL isKeyboardInput = NO;
if (data && (InsertTextMsgID == msgid || KeyDownMsgID == msgid ||
CmdKeyMsgID == msgid)) {
isKeyboardInput = YES;
// The lowest bit of the first int is set if this key is a repeat.
int flags = *((int*)[data bytes]);
if (flags & 1)
isKeyRepeat = YES;
}
// Keyboard input is not removed from the queue; repeats are ignored if
// there already is keyboard input on the input queue.
if (isKeyRepeat || !isKeyboardInput) {
int i, count = [inputQueue count];
for (i = 1; i < count; i+=2) {
if ([[inputQueue objectAtIndex:i-1] intValue] == msgid) {
if (isKeyRepeat)
return;
[inputQueue removeObjectAtIndex:i];
[inputQueue removeObjectAtIndex:i-1];
break;
}
}
}
@@ -1539,18 +1563,21 @@ static NSString *MMSymlinkWarningString =
- (void)handleInputEvent:(int)msgid data:(NSData *)data
{
if (InsertTextMsgID == msgid) {
[self handleInsertText:data];
} else if (KeyDownMsgID == msgid || CmdKeyMsgID == msgid) {
if (InsertTextMsgID == msgid || KeyDownMsgID == msgid ||
CmdKeyMsgID == msgid) {
if (!data) return;
const void *bytes = [data bytes];
int mods = *((int*)bytes); bytes += sizeof(int);
int len = *((int*)bytes); bytes += sizeof(int);
NSString *key = [[NSString alloc] initWithBytes:bytes length:len
encoding:NSUTF8StringEncoding];
NSString *key = [[NSString alloc] initWithBytes:bytes
length:len
encoding:NSUTF8StringEncoding];
mods = eventModifierFlagsToVimModMask(mods);
[self handleKeyDown:key modifiers:mods];
if (InsertTextMsgID == msgid)
[self handleInsertText:key];
else
[self handleKeyDown:key modifiers:mods];
[key release];
} else if (ScrollWheelMsgID == msgid) {
@@ -1713,6 +1740,8 @@ static NSString *MMSymlinkWarningString =
[self handleXcodeMod:data];
} else if (OpenWithArgumentsMsgID == msgid) {
[self handleOpenWithArguments:[NSDictionary dictionaryWithData:data]];
} else if (FindReplaceMsgID == msgid) {
[self handleFindReplace:[NSDictionary dictionaryWithData:data]];
} else {
NSLog(@"WARNING: Unknown message received (msgid=%d)", msgid);
}
@@ -1732,14 +1761,12 @@ static NSString *MMSymlinkWarningString =
return specialKeys;
}
- (void)handleInsertText:(NSData *)data
- (void)handleInsertText:(NSString *)text
{
if (!data) return;
if (!text) return;
NSString *key = [[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding];
char_u *str = (char_u*)[key UTF8String];
int i, len = [key lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
char_u *str = (char_u*)[text UTF8String];
int i, len = [text lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
#ifdef FEAT_MBYTE
char_u *conv_str = NULL;
@@ -1765,7 +1792,6 @@ static NSString *MMSymlinkWarningString =
if (conv_str)
vim_free(conv_str);
#endif
[key release];
}
- (void)handleKeyDown:(NSString *)key modifiers:(int)mods
@@ -2486,6 +2512,24 @@ static NSString *MMSymlinkWarningString =
redrawcmdline();
}
- (void)handleFindReplace:(NSDictionary *)args
{
if (!args) return;
NSString *findString = [args objectForKey:@"find"];
if (!findString) return;
char_u *find = [findString vimStringSave];
char_u *replace = [[args objectForKey:@"replace"] vimStringSave];
int flags = [[args objectForKey:@"flags"] intValue];
// NOTE: The flag 0x100 is used to indicate a backward search.
gui_do_findrepl(flags, find, replace, (flags & 0x100) == 0);
vim_free(find);
vim_free(replace);
}
@end // MMBackend (Private)
+29
View File
@@ -0,0 +1,29 @@
/* vi:set ts=8 sts=4 sw=4 ft=objc:
*
* VIM - Vi IMproved by Bram Moolenaar
* MacVim GUI port by Bjorn Winckler
*
* Do ":help uganda" in Vim to read copying and usage conditions.
* Do ":help credits" in Vim to see a list of people who contributed.
* See README.txt for an overview of the Vim source code.
*/
#import <Cocoa/Cocoa.h>
@interface MMFindReplaceController : NSWindowController {
IBOutlet NSTextField *findBox;
IBOutlet NSTextField *replaceBox;
IBOutlet NSButton *ignoreCaseButton;
IBOutlet NSButton *matchWordButton;
}
+ (MMFindReplaceController *)sharedInstance;
- (void)showWithText:(NSString *)text flags:(int)flags;
- (NSString *)findString;
- (NSString *)replaceString;
- (BOOL)ignoreCase;
- (BOOL)matchWord;
@end
+63
View File
@@ -0,0 +1,63 @@
/* vi:set ts=8 sts=4 sw=4 ft=objc:
*
* VIM - Vi IMproved by Bram Moolenaar
* MacVim GUI port by Bjorn Winckler
*
* Do ":help uganda" in Vim to read copying and usage conditions.
* Do ":help credits" in Vim to see a list of people who contributed.
* See README.txt for an overview of the Vim source code.
*/
#import "MMFindReplaceController.h"
@implementation MMFindReplaceController
+ (MMFindReplaceController *)sharedInstance
{
static MMFindReplaceController *singleton = nil;
if (!singleton) {
singleton = [[MMFindReplaceController alloc]
initWithWindowNibName:@"FindAndReplace"];
[singleton setWindowFrameAutosaveName:@"FindAndReplace"];
}
return singleton;
}
- (void)showWithText:(NSString *)text flags:(int)flags
{
// Ensure that the window has been loaded by calling this first.
NSWindow *window = [self window];
if (text && [text length] > 0)
[findBox setStringValue:text];
// NOTE: The 'flags' values must match the FRD_ defines in gui.h.
[matchWordButton setState:(flags & 0x08 ? NSOnState : NSOffState)];
[ignoreCaseButton setState:(flags & 0x10 ? NSOffState : NSOnState)];
[window makeKeyAndOrderFront:self];
}
- (NSString *)findString
{
return [findBox stringValue];
}
- (NSString *)replaceString
{
return [replaceBox stringValue];
}
- (BOOL)ignoreCase
{
return [ignoreCaseButton state] == NSOnState;
}
- (BOOL)matchWord
{
return [matchWordButton state] == NSOnState;
}
@end // MMFindReplaceController
+28 -6
View File
@@ -38,7 +38,8 @@ static float MMDragAreaSize = 73.0f;
- (MMWindowController *)windowController;
- (MMVimController *)vimController;
- (void)dispatchKeyEvent:(NSEvent *)event;
- (void)sendKeyDown:(const char *)chars length:(int)len modifiers:(int)flags;
- (void)sendKeyDown:(const char *)chars length:(int)len modifiers:(int)flags
isARepeat:(BOOL)isARepeat;
- (void)hideMouseCursor;
- (void)startDragTimerWithInterval:(NSTimeInterval)t;
- (void)dragTimerFired:(NSTimer *)timer;
@@ -157,8 +158,17 @@ static float MMDragAreaSize = 73.0f;
//NSLog(@"send InsertTextMsgID: %@", string);
[[self vimController] sendMessage:InsertTextMsgID
data:[string dataUsingEncoding:NSUTF8StringEncoding]];
NSMutableData *data = [NSMutableData data];
int len = [string lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
int flags = [event modifierFlags] & 0xffff0000U;
if ([event isARepeat])
flags |= 1;
[data appendBytes:&flags length:sizeof(int)];
[data appendBytes:&len length:sizeof(int)];
[data appendBytes:[string UTF8String] length:len];
[[self vimController] sendMessage:InsertTextMsgID data:data];
}
- (void)doCommandBySelector:(SEL)selector
@@ -193,7 +203,8 @@ static float MMDragAreaSize = 73.0f;
chars = MMKeypadEnter;
}
[self sendKeyDown:chars length:len modifiers:[event modifierFlags]];
[self sendKeyDown:chars length:len modifiers:[event modifierFlags]
isARepeat:[event isARepeat]];
} else {
[self dispatchKeyEvent:event];
}
@@ -214,7 +225,7 @@ static float MMDragAreaSize = 73.0f;
// stroke (some input methods use e.g. arrow keys). The function key down
// event will still reach Vim though (via keyDown:). The exceptions to
// this rule are: PageUp/PageDown (keycode 116/121).
int flags = [event modifierFlags];
int flags = [event modifierFlags] & 0xffff0000U;
if ([event type] != NSKeyDown || flags & NSFunctionKeyMask
&& !(116 == [event keyCode] || 121 == [event keyCode]))
return NO;
@@ -272,6 +283,9 @@ static float MMDragAreaSize = 73.0f;
len = [unmodchars lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
}
if ([event isARepeat])
flags |= 1;
[data appendBytes:&flags length:sizeof(int)];
[data appendBytes:&len length:sizeof(int)];
[data appendBytes:[unmodchars UTF8String] length:len];
@@ -748,14 +762,22 @@ static float MMDragAreaSize = 73.0f;
bytes = [chars UTF8String];
}
[self sendKeyDown:bytes length:len modifiers:mods];
[self sendKeyDown:bytes length:len modifiers:mods
isARepeat:[event isARepeat]];
}
- (void)sendKeyDown:(const char *)chars length:(int)len modifiers:(int)flags
isARepeat:(BOOL)isARepeat
{
if (chars && len > 0) {
NSMutableData *data = [NSMutableData data];
// The low 16 bits are not used for modifier flags by NSEvent. Use
// these bits for custom flags.
flags &= 0xffff0000;
if (isARepeat)
flags |= 1;
[data appendBytes:&flags length:sizeof(int)];
[data appendBytes:&len length:sizeof(int)];
[data appendBytes:chars length:len];
+2
View File
@@ -55,6 +55,8 @@
- (NSDate *)creationDate;
- (void)cleanup;
- (void)dropFiles:(NSArray *)filenames forceOpen:(BOOL)force;
- (void)file:(NSString *)filename draggedToTabAtIndex:(NSUInteger)tabIndex;
- (void)filesDraggedToTabBar:(NSArray *)filenames;
- (void)dropString:(NSString *)string;
- (void)passArguments:(NSDictionary *)args;
- (void)sendMessage:(int)msgid data:(NSData *)data;
+31
View File
@@ -25,6 +25,7 @@
#import "MMAppController.h"
#import "MMAtsuiTextView.h"
#import "MMFindReplaceController.h"
#import "MMTextView.h"
#import "MMVimController.h"
#import "MMVimView.h"
@@ -255,6 +256,29 @@ static BOOL isUnsafeMessage(int msgid);
[self sendMessage:DropFilesMsgID data:[args dictionaryAsData]];
}
- (void)file:(NSString *)filename draggedToTabAtIndex:(NSUInteger)tabIndex
{
NSString *fnEsc = [filename stringByEscapingSpecialFilenameCharacters];
NSString *input = [NSString stringWithFormat:@"<C-\\><C-N>:silent "
"tabnext %d |"
"edit! %@<CR>", tabIndex + 1, fnEsc];
[self addVimInput:input];
}
- (void)filesDraggedToTabBar:(NSArray *)filenames
{
NSUInteger i, count = [filenames count];
NSMutableString *input = [NSMutableString stringWithString:@"<C-\\><C-N>"
":silent! tabnext 9999"];
for (i = 0; i < count; i++) {
NSString *fn = [filenames objectAtIndex:i];
NSString *fnEsc = [fn stringByEscapingSpecialFilenameCharacters];
[input appendFormat:@"|tabedit %@", fnEsc];
}
[input appendString:@"<CR>"];
[self addVimInput:input];
}
- (void)dropString:(NSString *)string
{
int len = [string lengthOfBytesUsingEncoding:NSUTF8StringEncoding] + 1;
@@ -928,6 +952,13 @@ static BOOL isUnsafeMessage(int msgid);
NSColor *color = [NSColor colorWithRgbInt:*bg];
[windowController setFullscreenBackgroundColor:color];
} else if (ShowFindReplaceDialogMsgID == msgid) {
NSDictionary *dict = [NSDictionary dictionaryWithData:data];
if (dict) {
[[MMFindReplaceController sharedInstance]
showWithText:[dict objectForKey:@"text"]
flags:[[dict objectForKey:@"flags"] intValue]];
}
// IMPORTANT: When adding a new message, make sure to update
// isUnsafeMessage() if necessary!
} else {
+36
View File
@@ -132,6 +132,8 @@ enum {
[[tabBarControl addTabButton] setTarget:self];
[[tabBarControl addTabButton] setAction:@selector(addNewTab:)];
[tabBarControl setAllowsDragBetweenWindows:NO];
[tabBarControl registerForDraggedTypes:
[NSArray arrayWithObject:NSFilenamesPboardType]];
[tabBarControl setAutoresizingMask:NSViewWidthSizable|NSViewMinYMargin];
@@ -498,6 +500,40 @@ enum {
[vimController sendMessage:DraggedTabMsgID data:data];
}
- (NSDragOperation)tabBarControl:(PSMTabBarControl *)theTabBarControl
draggingEntered:(id <NSDraggingInfo>)sender
forTabAtIndex:(unsigned)tabIndex
{
NSPasteboard *pb = [sender draggingPasteboard];
return [[pb types] containsObject:NSFilenamesPboardType]
? NSDragOperationCopy
: NSDragOperationNone;
}
- (BOOL)tabBarControl:(PSMTabBarControl *)theTabBarControl
performDragOperation:(id <NSDraggingInfo>)sender
forTabAtIndex:(unsigned)tabIndex
{
NSPasteboard *pb = [sender draggingPasteboard];
if ([[pb types] containsObject:NSFilenamesPboardType]) {
NSArray *filenames = [pb propertyListForType:NSFilenamesPboardType];
if ([filenames count] == 0)
return NO;
if (tabIndex != NSNotFound) {
// If dropping on a specific tab, only open one file
[vimController file:[filenames objectAtIndex:0]
draggedToTabAtIndex:tabIndex];
} else {
// Files were dropped on empty part of tab bar; open them all
[vimController filesDraggedToTabBar:filenames];
}
return YES;
} else {
return NO;
}
}
// -- NSView customization ---------------------------------------------------
+1
View File
@@ -75,5 +75,6 @@
- (IBAction)vimToolbarItemAction:(id)sender;
- (IBAction)fontSizeUp:(id)sender;
- (IBAction)fontSizeDown:(id)sender;
- (IBAction)findAndReplace:(id)sender;
@end
+29
View File
@@ -57,6 +57,7 @@
#import "MMAppController.h"
#import "MMAtsuiTextView.h"
#import "MMFindReplaceController.h"
#import "MMFullscreenWindow.h"
#import "MMTextView.h"
#import "MMTypesetter.h"
@@ -660,6 +661,34 @@
[NSNumber numberWithInt:NSSizeDownFontAction]];
}
- (IBAction)findAndReplace:(id)sender
{
int tag = [sender tag];
MMFindReplaceController *fr = [MMFindReplaceController sharedInstance];
int flags = 0;
// NOTE: The 'flags' values must match the FRD_ defines in gui.h (except
// for 0x100 which we use to indicate a backward search).
switch (tag) {
case 1: flags = 0x100; break;
case 2: flags = 3; break;
case 3: flags = 4; break;
}
if ([fr matchWord])
flags |= 0x08;
if (![fr ignoreCase])
flags |= 0x10;
NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:
[fr findString], @"find",
[fr replaceString], @"replace",
[NSNumber numberWithInt:flags], @"flags",
nil];
[vimController sendMessage:FindReplaceMsgID data:[args dictionaryAsData]];
}
- (BOOL)validateMenuItem:(NSMenuItem *)item
{
if ([item action] == @selector(vimMenuItemAction:)
+2
View File
@@ -175,6 +175,8 @@ enum {
CloseWindowMsgID,
InterruptMsgID,
SetFullscreenColorMsgID,
ShowFindReplaceDialogMsgID,
FindReplaceMsgID,
};
+2
View File
@@ -82,6 +82,8 @@ char *MessageStrings[] =
"CloseWindowMsgID",
"InterruptMsgID",
"SetFullscreenColorMsgID",
"ShowFindReplaceDialogMsgID",
"FindReplaceMsgID",
};
+13 -3
View File
@@ -30,6 +30,8 @@
1D3D19140CA690FF0004A0A5 /* DejaVuSansMono.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 1D3D19100CA690FF0004A0A5 /* DejaVuSansMono.ttf */; };
1D493D580C5247BF00AB718C /* Vim in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1D493D570C5247BF00AB718C /* Vim */; };
1D493DBA0C52534300AB718C /* PSMTabBarControl.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 1D493DB90C52533B00AB718C /* PSMTabBarControl.framework */; };
1D6008830E96886D003763F0 /* FindAndReplace.nib in Resources */ = {isa = PBXBuildFile; fileRef = 1D6008820E96886D003763F0 /* FindAndReplace.nib */; };
1D60088B0E96A0B2003763F0 /* MMFindReplaceController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D60088A0E96A0B2003763F0 /* MMFindReplaceController.m */; };
1D71ACB40BC702AB002F2B60 /* doc-bm-c.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D71ACA90BC702AB002F2B60 /* doc-bm-c.icns */; };
1D71ACB50BC702AC002F2B60 /* doc-bm-h.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D71ACAA0BC702AB002F2B60 /* doc-bm-h.icns */; };
1D71ACB60BC702AC002F2B60 /* doc-bm-html.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1D71ACAB0BC702AB002F2B60 /* doc-bm-html.icns */; };
@@ -210,6 +212,9 @@
1D3D19100CA690FF0004A0A5 /* DejaVuSansMono.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = DejaVuSansMono.ttf; path = "dejavu-ttf/DejaVuSansMono.ttf"; sourceTree = "<group>"; };
1D493D570C5247BF00AB718C /* Vim */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; name = Vim; path = ../Vim; sourceTree = SOURCE_ROOT; };
1D493DB30C52533B00AB718C /* PSMTabBarControl.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = PSMTabBarControl.xcodeproj; path = PSMTabBarControl/PSMTabBarControl.xcodeproj; sourceTree = "<group>"; };
1D6008820E96886D003763F0 /* FindAndReplace.nib */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; path = FindAndReplace.nib; sourceTree = "<group>"; };
1D6008890E96A0B2003763F0 /* MMFindReplaceController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMFindReplaceController.h; sourceTree = "<group>"; };
1D60088A0E96A0B2003763F0 /* MMFindReplaceController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMFindReplaceController.m; sourceTree = "<group>"; };
1D71ACA90BC702AB002F2B60 /* doc-bm-c.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "doc-bm-c.icns"; sourceTree = "<group>"; };
1D71ACAA0BC702AB002F2B60 /* doc-bm-h.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "doc-bm-h.icns"; sourceTree = "<group>"; };
1D71ACAB0BC702AB002F2B60 /* doc-bm-html.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "doc-bm-html.icns"; sourceTree = "<group>"; };
@@ -328,6 +333,8 @@
080E96DDFE201D6D7F000001 /* MacVim Source */ = {
isa = PBXGroup;
children = (
1D6008890E96A0B2003763F0 /* MMFindReplaceController.h */,
1D60088A0E96A0B2003763F0 /* MMFindReplaceController.m */,
1D145C7D0E5227CE00691AA0 /* MMTextViewHelper.h */,
1D145C7E0E5227CE00691AA0 /* MMTextViewHelper.m */,
1D8059220E118663001699D1 /* Miscellaneous.h */,
@@ -510,6 +517,7 @@
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
1D6008820E96886D003763F0 /* FindAndReplace.nib */,
1D22374A0E45DF4800E6FFFF /* Advanced.png */,
BD9DF09F0DB2BA020025C97C /* PlugInView.nib */,
1DD3D51D0D82D4C9006E4320 /* ibeam.png */,
@@ -668,6 +676,7 @@
1DCD00D10E50B2B700460166 /* SaveSesn.png in Resources */,
1DCD00D20E50B2B700460166 /* TagJump.png in Resources */,
1DCD00D30E50B2B700460166 /* Undo.png in Resources */,
1D6008830E96886D003763F0 /* FindAndReplace.nib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -702,6 +711,7 @@
BD9DF0B00DB41E780025C97C /* PlugInGUI.m in Sources */,
BD9DF0FB0DB48C860025C97C /* CTGradient.m in Sources */,
1D145C7F0E5227CE00691AA0 /* MMTextViewHelper.m in Sources */,
1D60088B0E96A0B2003763F0 /* MMFindReplaceController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -756,7 +766,7 @@
i386,
);
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 35;
CURRENT_PROJECT_VERSION = 36;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
@@ -797,7 +807,7 @@
buildSettings = {
ARCHS = "$(NATIVE_ARCH)";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 35;
CURRENT_PROJECT_VERSION = 36;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
@@ -829,7 +839,7 @@
buildSettings = {
ARCHS = "$(NATIVE_ARCH)";
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 35;
CURRENT_PROJECT_VERSION = 36;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
+11
View File
@@ -53,6 +53,9 @@ extern NSString *MMOpenLayoutKey;
extern NSString *MMVerticalSplitKey;
extern NSString *MMPreloadCacheSizeKey;
extern NSString *MMLastWindowClosedBehaviorKey;
extern NSString *MMFakeEscModifierKey;
extern NSString *MMFakeEscTimeoutKey;
extern NSString *MMFakeEscOnKeyDownKey;
// Enum for MMUntitledWindowKey
@@ -79,6 +82,14 @@ enum {
MMTerminateWhenLastWindowClosed = 2,
};
// Enum for MMFakeEscModifierKey
enum {
MMDisableFakeEsc = 0,
MMCtrlFakeEsc = 1,
MMAltFakeEsc = 2,
MMCmdFakeEsc = 3
};
+3
View File
@@ -44,6 +44,9 @@ NSString *MMOpenLayoutKey = @"MMOpenLayout";
NSString *MMVerticalSplitKey = @"MMVerticalSplit";
NSString *MMPreloadCacheSizeKey = @"MMPreloadCacheSize";
NSString *MMLastWindowClosedBehaviorKey = @"MMLastWindowClosedBehavior";
NSString *MMFakeEscModifierKey = @"MMFakeEscModifier";
NSString *MMFakeEscTimeoutKey = @"MMFakeEscTimeout";
NSString *MMFakeEscOnKeyDownKey = @"MMFakeEscOnKeyDown";
@@ -68,7 +68,9 @@ enum {
// drag and drop
NSEvent *_lastMouseDownEvent; // keep this for dragging reference
BOOL _allowsDragBetweenWindows;
BOOL _allowsDragBetweenWindows;
BOOL _delegateHandlingDrag;
NSDragOperation _delegateInitialDragOperation;
// MVC help
IBOutlet id delegate;
@@ -121,4 +123,11 @@ enum {
- (void)tabView:(NSTabView *)aTabView willCloseTabViewItem:(NSTabViewItem *)tabViewItem;
- (void)tabView:(NSTabView *)aTabView didCloseTabViewItem:(NSTabViewItem *)tabViewItem;
- (void)tabView:(NSTabView *)aTabView didDragTabViewItem:(NSTabViewItem *)tabViewItem toIndex:(int)idx;
- (NSDragOperation)tabBarControl:(PSMTabBarControl *)theTabBarControl draggingEntered:(id <NSDraggingInfo>)sender forTabAtIndex:(unsigned)tabIndex;
- (NSDragOperation)tabBarControl:(PSMTabBarControl *)theTabBarControl draggingUpdated:(id <NSDraggingInfo>)sender forTabAtIndex:(unsigned)tabIndex;
- (void)tabBarControl:(PSMTabBarControl *)theTabBarControl draggingExited:(id <NSDraggingInfo>)sender forTabAtIndex:(unsigned)tabIndex;
- (BOOL)tabBarControl:(PSMTabBarControl *)theTabBarControl prepareForDragOperation:(id <NSDraggingInfo>)sender forTabAtIndex:(unsigned)tabIndex;
- (BOOL)tabBarControl:(PSMTabBarControl *)theTabBarControl performDragOperation:(id <NSDraggingInfo>)sender forTabAtIndex:(unsigned)tabIndex;
- (void)tabBarControl:(PSMTabBarControl *)theTabBarControl concludeDragOperation:(id <NSDraggingInfo>)sender forTabAtIndex:(unsigned)tabIndex;
@end
@@ -57,6 +57,8 @@
// convenience
- (id)cellForPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame;
- (unsigned)indexOfCellAtPoint:(NSPoint)point;
- (unsigned)indexOfCellAtPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame;
- (PSMTabBarCell *)lastVisibleTab;
- (int)numberOfVisibleTabs;
@@ -98,6 +100,7 @@
// default config
_allowsDragBetweenWindows = YES;
_delegateHandlingDrag = NO;
_canCloseOnlyTab = NO;
_showAddTabButton = NO;
_hideForSingleTab = NO;
@@ -644,7 +647,10 @@
[self removeTrackingRect:[cell cellTrackingTag]];
}
}
// nuke old tool tips
[self removeAllToolTips];
// calculate number of cells to fit in control and cell widths
float availableWidth = [self availableCellWidth];
NSMutableArray *newWidths = [NSMutableArray arrayWithCapacity:cellCount];
@@ -757,7 +763,11 @@
tag = [self addTrackingRect:cellRect owner:cell userData:nil assumeInside:NO];
[cell setCellTrackingTag:tag];
[cell setEnabled:YES];
// add tool tip if label will be truncated
if ([cell desiredWidthOfCell] > NSWidth([cell frame]))
[self addToolTipRect:cellRect owner:[cell stringValue] userData:NULL];
// selected? set tab states...
if([[cell representedObject] isEqualTo:[tabView selectedTabViewItem]]){
[cell setState:NSOnState];
@@ -975,16 +985,28 @@
return YES;
}
- (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation
{
[[PSMTabDragAssistant sharedDragAssistant] draggedImageEndedAt:aPoint operation:operation];
}
// NSDraggingDestination
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
{
NSPoint point = [self convertPoint:[sender draggingLocation] fromView:nil];
_delegateHandlingDrag = NO;
if([[[sender draggingPasteboard] types] indexOfObject:@"PSMTabBarControlItemPBType"] != NSNotFound) {
if ([sender draggingSource] != self && ![self allowsDragBetweenWindows])
return NSDragOperationNone;
[[PSMTabDragAssistant sharedDragAssistant] draggingEnteredTabBar:self atPoint:[self convertPoint:[sender draggingLocation] fromView:nil]];
[[PSMTabDragAssistant sharedDragAssistant] draggingEnteredTabBar:self atPoint:point];
return NSDragOperationMove;
} else if (delegate && [delegate respondsToSelector:@selector(tabBarControl:draggingEntered:forTabAtIndex:)]) {
NSDragOperation op = [delegate tabBarControl:self draggingEntered:sender forTabAtIndex:[self indexOfCellAtPoint:point]];
_delegateHandlingDrag = (op != NSDragOperationNone);
_delegateInitialDragOperation = op;
return op;
}
return NSDragOperationNone;
@@ -992,13 +1014,19 @@
- (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender
{
NSPoint point = [self convertPoint:[sender draggingLocation] fromView:nil];
if ([[[sender draggingPasteboard] types] indexOfObject:@"PSMTabBarControlItemPBType"] != NSNotFound) {
if ([sender draggingSource] != self && ![self allowsDragBetweenWindows])
return NSDragOperationNone;
[[PSMTabDragAssistant sharedDragAssistant] draggingUpdatedInTabBar:self atPoint:[self convertPoint:[sender draggingLocation] fromView:nil]];
[[PSMTabDragAssistant sharedDragAssistant] draggingUpdatedInTabBar:self atPoint:point];
return NSDragOperationMove;
} else if (_delegateHandlingDrag) {
if ([delegate respondsToSelector:@selector(tabBarControl:draggingUpdated:forTabAtIndex:)])
return [delegate tabBarControl:self draggingUpdated:sender forTabAtIndex:[self indexOfCellAtPoint:point]];
else
return _delegateInitialDragOperation;
}
return NSDragOperationNone;
@@ -1006,44 +1034,61 @@
- (void)draggingExited:(id <NSDraggingInfo>)sender
{
[[PSMTabDragAssistant sharedDragAssistant] draggingExitedTabBar:self];
if (!_delegateHandlingDrag) {
[[PSMTabDragAssistant sharedDragAssistant] draggingExitedTabBar:self];
} else if ([delegate respondsToSelector:@selector(tabBarControl:draggingExited:forTabAtIndex:)]) {
NSPoint point = [self convertPoint:[sender draggingLocation] fromView:nil];
[delegate tabBarControl:self draggingExited:sender forTabAtIndex:[self indexOfCellAtPoint:point]];
}
}
- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender
{
if (_delegateHandlingDrag && [delegate respondsToSelector:@selector(tabBarControl:prepareForDragOperation:forTabAtIndex:)]) {
NSPoint point = [self convertPoint:[sender draggingLocation] fromView:nil];
return [delegate tabBarControl:self prepareForDragOperation:sender forTabAtIndex:[self indexOfCellAtPoint:point]];
}
return YES;
}
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
if (!_delegateHandlingDrag) {
#if 1
// HACK! Used below.
NSTabViewItem *tvi = [[[PSMTabDragAssistant sharedDragAssistant] draggedCell] representedObject];
// HACK! Used below.
NSTabViewItem *tvi = [[[PSMTabDragAssistant sharedDragAssistant] draggedCell] representedObject];
#endif
[[PSMTabDragAssistant sharedDragAssistant] performDragOperation];
[[PSMTabDragAssistant sharedDragAssistant] performDragOperation];
#if 1
// HACK! Notify the delegate that a tab was dragged to a new position.
if (delegate && [delegate respondsToSelector:@selector(tabView:didDragTabViewItem:toIndex:)]) {
int idx = [[self representedTabViewItems] indexOfObject:tvi];
if (NSNotFound != idx) {
[delegate tabView:[self tabView] didDragTabViewItem:tvi toIndex:idx];
// HACK! Notify the delegate that a tab was dragged to a new position.
if (delegate && [delegate respondsToSelector:@selector(tabView:didDragTabViewItem:toIndex:)]) {
int idx = [[self representedTabViewItems] indexOfObject:tvi];
if (NSNotFound != idx) {
[delegate tabView:[self tabView] didDragTabViewItem:tvi toIndex:idx];
}
}
#endif
} else {
if ([delegate respondsToSelector:@selector(tabBarControl:performDragOperation:forTabAtIndex:)]) {
NSPoint point = [self convertPoint:[sender draggingLocation] fromView:nil];
return [delegate tabBarControl:self performDragOperation:sender forTabAtIndex:[self indexOfCellAtPoint:point]];
} else {
return NO;
}
}
#endif
return YES;
}
- (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation
{
[[PSMTabDragAssistant sharedDragAssistant] draggedImageEndedAt:aPoint operation:operation];
}
- (void)concludeDragOperation:(id <NSDraggingInfo>)sender
{
if (_delegateHandlingDrag && [delegate respondsToSelector:@selector(tabBarControl:concludeDragOperation:forTabAtIndex:)]) {
NSPoint point = [self convertPoint:[sender draggingLocation] fromView:nil];
[delegate tabBarControl:self concludeDragOperation:sender forTabAtIndex:[self indexOfCellAtPoint:point]];
}
}
#pragma mark -
@@ -1350,11 +1395,25 @@
}
- (id)cellForPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame
{
unsigned i = [self indexOfCellAtPoint:point cellFrame:outFrame];
if (i == NSNotFound)
return nil;
PSMTabBarCell *cell = [_cells objectAtIndex:i];
return cell;
}
- (unsigned)indexOfCellAtPoint:(NSPoint)point
{
return [self indexOfCellAtPoint:point cellFrame:NULL];
}
- (unsigned)indexOfCellAtPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame
{
NSRect aRect = [self genericCellRect];
if(!NSPointInRect(point,aRect)){
return nil;
return NSNotFound;
}
int i, cnt = [_cells count];
@@ -1367,11 +1426,11 @@
if(outFrame){
*outFrame = aRect;
}
return cell;
return i;
}
aRect.origin.x += width;
}
return nil;
return NSNotFound;
}
- (PSMTabBarCell *)lastVisibleTab
-185
View File
@@ -1,185 +0,0 @@
Active:
- transparent text view
- Listen to NSSystemColorsDidChangeNotification and update highlighting
- Add support for 'mousehide' (needs to check p_mh)
- Build Vim (make) from Xcode project
- Cmd-W in about box sends vimMenuAction: instead of performClose:
- Terminal support. :!bash -> no cursor, arrow keys mucks up display
- Press Cmd-n multiple times and quickly press Cmd-q; sometimes two or more
instances of MacVim opens up
- hide toolbar, open new tab, show toolbar: baseline sepearator still visible
(seems like a drawing bug in PSMTabBarControl)
- file modified outside vim dialog sometimes only appear after pressing a key
- let user choose file encoding and format in open/save dialogs
- autosave settings ?
- encoding -- convert strings from vim to utf-8
- main menu (buffers menu, window menu)
- standardize NSString usage (initialization & how it is passed in messages)
- autosave window rows&columns?
- improve drag and drop support (modifier keys are ignored)
- grey out menus which can't be used: Tab Next/Prev/Close, Undo/Redo, etc.
- find/replace toolbar item (FIND_REPLACE_DIALOG)
- drag-to-resize, delay if mouse button held down
- ability to modify key equivalents at any time (?)
- validate menu actions for when no windows are open (e.g. selectNextWindow:)
- need E??? numbers for vim errors
- tab-completion for :action command?
- proper font handling
- check for memory leaks
- i8n
- change building procedure so that the Makefile compiles and links VimTask and
then calls pbxbuild to build MacVim (and put MacVim.app) in the src folder
- icons for all built in toolbar items
- window title is never set when starting with terminal vim and typing :gui
- forking doesn't work with :gui (i think)
- make sure [NSMutableData appendByte:length:] is never called with 0 length
(this will lead to a crash)
- update speed whilst resizing with mouse is excruciatingly slow
- window count should be typeset nicely in tab ?
- track pad scrolling is jerky
- sanity check all input in handlePortMessage: etc.
- nice looking cursors (both the block and in insert mode) ?
- support project builder external editor
http://www.codingmonkeys.de/techpubs/externaleditor/pbxexternaleditor.html
- dock icon menu
- horizontal scrolling with trackpad does not work
- got this error when clicking to close second last tab:
2007-07-23 08:19:29.398 MacVim[335] *** Assertion failure in -[PSMTabBarControl lockFocus], AppKit.subproj/NSView.m:3248
2007-07-23 08:19:29.410 MacVim[335] lockFocus sent to a view whose window is deferred and does not yet have a corresponding platform window
Pending:
- marked text
- set gfn=*
- improve drag and drop support (drop in command line mode not working)
- System colors don't come out the same as in other apps (as measure with
Digital Color Meter)
- Select-mode for <S-Key>
- Insertion point blinking
- Hollow insertion point drawing does not always work
- cursor in replace mode
- should ignore action message if is called too often (e.g. in addNewTab:)
- application:openFiles: should open in tabs in current window instead of in a
new window, only if user default is set
- Mouse cursor changes depeding on context
- Ctrl-C does not update screen until another key press (in command window)
- Underline color is never set properly (sp_color)
- Lock up when opening large session files (increasing MMFlushTimeoutInterval
alleviates this problem)
- Respond to "should change" instead of "will change" tab messages
- scrolling when mouse is over scrollbar doesn't work
- gui dialogs (FEAT_GUI_DIALOG)
- no warning when buffer modified outside vim (implement gui_mch_dialog())
- call gui_focus_change() when appropriate
- ability to interrupt vim (needs to check the run-loop for interrupts)
- got this error on Cmd-N with no other windows open:
2007-07-27 22:00:17.680 MacVim[454] *** -[NSToolbarView frameDidChange:]: selector not recognized [self = 0x39ba80]
2007-07-27 22:00:17.690 MacVim[454] Exception raised during posting of notification. Ignored. exception: *** -[NSToolbarView frameDidChange:]: selector not recognized [self = 0x39ba80]
- got this error when opening MacVim from terminal (with 'gvim gvimrc&'):
Frost:~/Projects/vim7/src/MacVim winckler$ 2007-08-05 13:25:01.151 MacVim[223] *** -[NSThemeFrame frameDidChange:]: selector not recognized [self = 0x3baa30]
2007-08-05 13:25:01.152 MacVim[223] Exception raised during posting of notification. Ignored. exception: *** -[NSThemeFrame frameDidChange:]: selector not recognized [self = 0x3baa30]
2007-08-05 13:25:01.155 MacVim[223] *** -[NSThemeFrame frameDidChange:]: selector not recognized [self = 0x3baa30]
2007-08-05 13:25:01.156 MacVim[223] Exception raised during posting of notification. Ignored. exception: *** -[NSThemeFrame frameDidChange:]: selector not recognized [self = 0x3baa30]
2007-08-05 13:25:01.246 MacVim[223] *** -[NSThemeFrame frameDidChange:]: selector not recognized [self = 0x3baa30]
2007-08-05 13:25:01.247 MacVim[223] Exception raised during posting of notification. Ignored. exception: *** -[NSThemeFrame frameDidChange:]: selector not recognized [self = 0x3baa30]
- toogle toolbar off, maximize window, toolbar on -> text view under toolbar
- clicking pill button does not update 'guioptions'
- detect Cmd-. (and Ctrl-C) for interrupt
Done:
- :popup
- popup menus
- when only one tab open make <D-w> close window
- cscope, ctags
- Ctrl-O in insert mode
- remember window position
- font selection dialog (:set gfn=*)
- services menu
- wide characters are badly supported: they render as too wide
- dropping directories does not work
- memory leak with text view? (need to release text storage)
- drag and drop inside view (FEAT_GUI_DND, gui_handle_drop())
- hide baseline separator when tabbar is visible (and make sure clicking the
hide/show toolbar button in the top right of the corner does not show it
again)
- toolbar drawing bug
- Cmd-zoom -> no input received, drawing broken
- scrollbars not positioned over resize box
- offset text away from left edge
- add menu options with key equiv:
Cmd+Option+Left/Right to change tab, Cmd+x/c/v cut/copy/paste,
Cmd+z/Z undo/redo, Cmd+o open, Cmd+w/W close tab/window,
Cmd+Option+T special characters,
etc.
- menu key equivalents
- startup is a bit flakey (up until openWindowWithRows:columns:)
- background color of text view doesn't get set if :colorscheme is in .gvimrc,
since textView=nil when setDefaultColorsBackground:foreground: is called
- resize window on font change
- don't clear the text storage on setMaxRows:: so that display does not go
blank when dragging to resize
- zoom&resize broken
- add user default for min/max tab size
- :colorscheme elflord, :set lines+=3 --> colors are not updated properly
- use DO to communicate between GUI and Vim (only for two-way communication,
one-way communication should still use mach ports)
- make scrollbar inactive if it is too small to display properly
- make vertical scrollbars cover command line as well
- setting font in .gvimrc has no effect since textStorage has not been init'ed
- fonts
- scroll bars
- Make MacVim project depend on PSMTabBarControl project
- Change Makefile so that it builds a vim executable and copy this into the
MacVim.app from the MacVim project
- warning before closing modified buffer
- On quitting, warn user if modified files are open
- An untitled window should not open when the GUI is started from the terminal
(figure out how to pass '-nowindow yes' option when launching GUI)
- support using VimTask as a standalone terminal app, with support for :gui
- path is set to / when not starting from command line, set it to $HOME instead
- input of wide characters does not work
- tab completion doesn't work on iMac
- close icons on tabs don't appear on iMac
- toolbar
- copy runtime files to bundle properly (only works for debug at the moment)
- don't resize to make window bigger than what can fit on screen
- window resizing using mouse & zoom
- cmd-click to maximize window, :tabnew...the text view overlaps the tabline
- colorscheme changes are buggy (open two tabs, change colorscheme, open new
tab; the new tab has wrong color on first and last lines.)
- tab selection bug: open three tabs, selct middle, drag last tab so it becomes
middle without selecting it, select middle tab...selects middle, then last
- tab selection bug #2: :tabnew, drag tab #2 to pos #1, press enter. tab #2 is
selected.
- this stuffs up the display: set go-=e; :tabnew
- with 2 tabs: closing one tab using mouse makes screen flash (does not happen
if tab is closed using :q)
- resize to fit every draw update
- insertion point
- copy/paste
- compute text storage size based on actual content
- color changes (:colorscheme)
- set text storage dimensions properly when creating text view
- text dimension changes
- notify vim task when user closes/selects tabs
- mouse handling in text view
- file type associations (Info.plist)
- drag and drop onto app icon
- remove tab update hack when flushing (edit vim code to call update)
- crash when typing :browse e $vim (but not :browse e $vim/)
- maintain queue of messages to send from task (to ensure they are passed in
the same order they arrive)
- do not include shift flag in chars that are already shifted (%, A, etc.)
- open file(s) in tab(s) (never open in new window?)
- key handling:
<M-Space> works, <M-S-Space> does not
clean up dispatchKeyEvent
- reordering tab pages (gui tabs must have same order as vim tabs)
- make sure tab is wide enough to fit label
- encoding (did_set_string_option, option.c, line 5675)
in init:
set_option_value((char_u *)"termencoding", 0L, (char_u *)"utf-8", 0);
+42
View File
@@ -1231,6 +1231,48 @@ im_get_status(void)
// -- Find & Replace dialog -------------------------------------------------
#ifdef FIND_REPLACE_DIALOG
static void
macvim_find_and_replace(char_u *arg, BOOL replace)
{
// TODO: Specialized dialog for find without replace?
int wholeWord = FALSE;
int matchCase = !p_ic;
char_u *text = get_find_dialog_text(arg, &wholeWord, &matchCase);
int flags = 0;
if (wholeWord) flags |= FRD_WHOLE_WORD;
if (matchCase) flags |= FRD_MATCH_CASE;
NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:
[NSString stringWithVimString:text], @"text",
[NSNumber numberWithInt:flags], @"flags",
nil];
[[MMBackend sharedInstance] queueMessage:ShowFindReplaceDialogMsgID
properties:args];
}
void
gui_mch_find_dialog(exarg_T *eap)
{
macvim_find_and_replace(eap->arg, NO);
}
void
gui_mch_replace_dialog(exarg_T *eap)
{
macvim_find_and_replace(eap->arg, YES);
}
#endif // FIND_REPLACE_DIALOG
// -- Unsorted --------------------------------------------------------------
+10 -6
View File
@@ -1,7 +1,7 @@
" System gvimrc file for MacVim
"
" Maintainer: Bjorn Winckler <bjorn.winckler@gmail.com>
" Last Change: Sun Aug 03 2008
" Last Change: Sun Oct 04 2008
"
" This is a work in progress. If you feel so inclined, please help me improve
" this file.
@@ -60,17 +60,21 @@ an 10.350 File.Save\ As\.\.\.<Tab>:sav :browse confirm saveas<CR>
" Edit menu
" The following function is aken from menu.vim
fun! s:FixFText()
" Fix text in nameless register to be used with :promptfind.
return substitute(@", "[\r\n]", '\\n', 'g')
endfun
aunmenu Edit.Find
aunmenu Edit.Find\ and\ Replace
an 20.410.10 Edit.Find.Find\.\.\.<Tab>/ /
an <silent> 20.410.10 Edit.Find.Find\.\.\. :promptfind<CR>
vunmenu Edit.Find.Find\.\.\.
vnoremenu <silent> Edit.Find.Find\.\.\. y:promptfind <C-R>=<SID>FixFText()<CR><CR>
an 20.410.20 Edit.Find.Find\ Next <Nop>
an 20.410.30 Edit.Find.Find\ Previous <Nop>
vmenu 20.410.35 Edit.Find.Use\ Selection\ for\ Find y:let @/=@"<CR>:<BS>
an 20.410.40 Edit.Find.-SEP1- <Nop>
an 20.410.50 Edit.Find.Find\ and\ Replace\.\.\.<Tab>:%s :%s/
vunmenu Edit.Find.Find\ and\ Replace\.\.\.<Tab>:%s
vnoremenu Edit.Find.Find\ and\ Replace\.\.\.<Tab>:s :s/
an 20.460 Edit.-SEP4- <Nop>
an 20.465.10 Edit.Font.Show\ Fonts <Nop>
+26
View File
@@ -40,6 +40,32 @@
Sparkle supports updates in zip, tar, tbz, tgz, or dmg format.
-->
<item>
<title>Snapshot 36 released</title>
<description><![CDATA[
<h1>MacVim snapshot 36 released</h1>
<p> This snapshot fixes a problem with dropped characters that was introduced with snapshot 35. Other changes since snapshot 35:
<ul>
<li> More help file updates </li>
<li> Fixed memory leak (Jonathon Mah) </li>
<li> Tool tips for truncated tab labels (Jonathon Mah) </li>
<li> Support drag and drop on tabs and on tabline (Jonathon Mah) </li>
<li> Modifier key can be used as Esc (useful for turning Caps Lock into Esc, see ":h macvim-esc") </li>
<li> Added "Find & Replace" dialog box (Cmd-f) </li>
</ul>
</p>
]]></description>
<pubDate>Sat, 04 Oct 2008 18:38 CET</pubDate>
<enclosure type="application/octet-stream"
url="http://newmacvim.muskokamug.org/mirror/files/MacVim-snapshot-36.tbz"
length="8005820"
sparkle:version="36"
sparkle:shortVersionString="7.2"
/>
</item>
<item>
<title>Snapshot 35 released</title>
<description><![CDATA[
+2 -1
View File
@@ -220,7 +220,8 @@ static void ex_popup __ARGS((exarg_T *eap));
#ifndef FEAT_GUI_MSWIN
# define ex_simalt ex_ni
#endif
#if !defined(FEAT_GUI_MSWIN) && !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_MOTIF)
#if !(defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_GTK) || \
defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_MACVIM))
# define gui_mch_find_dialog ex_ni
# define gui_mch_replace_dialog ex_ni
#endif
+1 -1
View File
@@ -1099,7 +1099,7 @@
#endif
#if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MOTIF) \
|| defined(MSWIN_FIND_REPLACE)
|| defined(MSWIN_FIND_REPLACE) || defined(FEAT_GUI_MACVIM)
# define FIND_REPLACE_DIALOG 1
#endif
+5
View File
@@ -207,3 +207,8 @@ int is_valid_macaction(char_u *action);
void gui_macvim_wait_for_startup();
void gui_macvim_get_window_layout(int *count, int *layout);
void
gui_mch_find_dialog(exarg_T *eap);
void
gui_mch_replace_dialog(exarg_T *eap);