Created
December 14, 2010 02:11
-
-
Save splhack/739907 to your computer and use it in GitHub Desktop.
MacVimとMacVim-KaoriYaの差分
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/MacVim/MMAppController.h b/src/MacVim/MMAppController.h | |
index 289c1cd..62f27e0 100644 | |
--- a/src/MacVim/MMAppController.h | |
+++ b/src/MacVim/MMAppController.h | |
@@ -53,6 +53,7 @@ | |
- (IBAction)selectPreviousWindow:(id)sender; | |
- (IBAction)orderFrontPreferencePanel:(id)sender; | |
- (IBAction)openWebsite:(id)sender; | |
+- (IBAction)openWebsiteKaoriYa:(id)sender; | |
- (IBAction)showVimHelp:(id)sender; | |
- (IBAction)zoomAll:(id)sender; | |
diff --git a/src/MacVim/MMAppController.m b/src/MacVim/MMAppController.m | |
index 7cb7b88..94a2020 100644 | |
--- a/src/MacVim/MMAppController.m | |
+++ b/src/MacVim/MMAppController.m | |
@@ -60,6 +60,8 @@ static NSTimeInterval MMRequestTimeout = 5; | |
static NSTimeInterval MMReplyTimeout = 5; | |
static NSString *MMWebsiteString = @"http://code.google.com/p/macvim/"; | |
+static NSString *MMWebsiteKaoriYaString = | |
+ @"http://code.google.com/p/macvim-kaoriya/"; | |
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) | |
// Latency (in s) between FS event occuring and being reported to MacVim. | |
@@ -220,7 +222,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef, | |
[NSNumber numberWithInt:0], MMPreloadCacheSizeKey, | |
[NSNumber numberWithInt:0], MMLastWindowClosedBehaviorKey, | |
#ifdef INCLUDE_OLD_IM_CODE | |
- [NSNumber numberWithBool:YES], MMUseInlineImKey, | |
+ [NSNumber numberWithBool:NO], MMUseInlineImKey, | |
#endif // INCLUDE_OLD_IM_CODE | |
nil]; | |
@@ -315,7 +317,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef, | |
int idx = [fileMenu indexOfItemWithAction:@selector(fileOpen:)]; | |
if (idx >= 0 && idx+1 < [fileMenu numberOfItems]) | |
- recentFilesMenuItem = [fileMenu itemWithTitle:@"Open Recent"]; | |
+ recentFilesMenuItem = | |
+ [fileMenu itemWithTitle:NSLocalizedString(@"Open Recent", nil)]; | |
[[recentFilesMenuItem submenu] performSelector:@selector(_setMenuName:) | |
withObject:@"NSRecentDocumentsMenu"]; | |
@@ -1118,6 +1121,13 @@ fsEventCallback(ConstFSEventStreamRef streamRef, | |
[NSURL URLWithString:MMWebsiteString]]; | |
} | |
+- (IBAction)openWebsiteKaoriYa:(id)sender | |
+{ | |
+ ASLogDebug(@"Open MacVim-KaoriYa website"); | |
+ [[NSWorkspace sharedWorkspace] openURL: | |
+ [NSURL URLWithString:MMWebsiteKaoriYaString]]; | |
+} | |
+ | |
- (IBAction)showVimHelp:(id)sender | |
{ | |
ASLogDebug(@"Open window with Vim help"); | |
@@ -1162,6 +1172,14 @@ fsEventCallback(ConstFSEventStreamRef streamRef, | |
[self rebuildPreloadCache]; | |
} | |
+- (IBAction)inlineImButtonClicked:(id)sender | |
+{ | |
+ ASLogDebug(@"Toggle inline IM option"); | |
+ // This action is called when the user clicks the "use inline IM" button | |
+ // in the advanced preferences pane. | |
+ [self rebuildPreloadCache]; | |
+} | |
+ | |
- (IBAction)loginShellButtonClicked:(id)sender | |
{ | |
ASLogDebug(@"Toggle login shell option"); | |
diff --git a/src/MacVim/MMApplication.m b/src/MacVim/MMApplication.m | |
index 9127d43..095467e 100644 | |
--- a/src/MacVim/MMApplication.m | |
+++ b/src/MacVim/MMApplication.m | |
@@ -74,7 +74,7 @@ | |
NSString *marketingVersion = [[NSBundle mainBundle] | |
objectForInfoDictionaryKey:@"CFBundleShortVersionString"]; | |
NSString *title = [NSString stringWithFormat: | |
- @"Custom Version %@ (%@)", marketingVersion, version]; | |
+ @"Custom Version %@ (KaoriYa %@)", marketingVersion, version]; | |
[self orderFrontStandardAboutPanelWithOptions: | |
[NSDictionary dictionaryWithObjectsAndKeys: | |
diff --git a/src/MacVim/MMAtsuiTextView.h b/src/MacVim/MMAtsuiTextView.h | |
index fd6d927..5acd6f6 100644 | |
--- a/src/MacVim/MMAtsuiTextView.h | |
+++ b/src/MacVim/MMAtsuiTextView.h | |
@@ -64,6 +64,7 @@ enum { MMMaxCellsPerChar = 2 }; | |
- (NSFont *)fontWide; | |
- (NSSize)cellSize; | |
- (void)setLinespace:(float)newLinespace; | |
+- (void)setProportionalFont:(BOOL)proportionalFont; | |
// | |
// MMTextView methods | |
diff --git a/src/MacVim/MMAtsuiTextView.m b/src/MacVim/MMAtsuiTextView.m | |
index f9cfd4a..de0ff13 100644 | |
--- a/src/MacVim/MMAtsuiTextView.m | |
+++ b/src/MacVim/MMAtsuiTextView.m | |
@@ -43,9 +43,12 @@ | |
#define DRAW_ITALIC 0x10 /* draw italic text */ | |
#define DRAW_CURSOR 0x20 | |
#define DRAW_WIDE 0x40 /* draw wide text */ | |
+#define DRAW_TUNDERL 0x100 /* draw thick underline text */ | |
#define kUnderlineOffset (-2) | |
#define kUnderlineHeight 1 | |
+#define kThickUnderlineOffset (-1) | |
+#define kThickUnderlineHeight 2 | |
#define kUndercurlHeight 2 | |
#define kUndercurlOffset (-2) | |
#define kUndercurlDotWidth 2 | |
@@ -330,6 +333,10 @@ defaultLineHeightForFont(NSFont *font) | |
cellSize.height = linespace + defaultLineHeightForFont(font); | |
} | |
+- (void)setProportionalFont:(BOOL)proportionalFont | |
+{ | |
+ // NOT IMPLEMENTED | |
+} | |
- (void)setShouldDrawInsertionPoint:(BOOL)on | |
@@ -1169,6 +1176,15 @@ defaultLineHeightForFont(NSFont *font) | |
rect.size.width, kUnderlineHeight)); | |
} | |
+ if (flags & DRAW_TUNDERL) | |
+ { | |
+ [sp set]; | |
+ NSRectFill(NSMakeRect(rect.origin.x, | |
+ (row + 1) * cellSize.height + | |
+ kThickUnderlineOffset, | |
+ rect.size.width, kThickUnderlineHeight)); | |
+ } | |
+ | |
if (flags & DRAW_UNDERC) | |
{ | |
[sp set]; | |
diff --git a/src/MacVim/MMBackend.h b/src/MacVim/MMBackend.h | |
index 79f6377..a4bc7de 100644 | |
--- a/src/MacVim/MMBackend.h | |
+++ b/src/MacVim/MMBackend.h | |
@@ -136,6 +136,7 @@ extern NSTimeInterval MMBalloonEvalInternalDelay; | |
- (void)setFullscreenBackgroundColor:(int)color; | |
- (void)setAntialias:(BOOL)antialias; | |
+- (void)setProportionalFont:(BOOL)proportionalFont; | |
- (void)updateModifiedFlag; | |
diff --git a/src/MacVim/MMBackend.m b/src/MacVim/MMBackend.m | |
index 92d6899..1d47203 100644 | |
--- a/src/MacVim/MMBackend.m | |
+++ b/src/MacVim/MMBackend.m | |
@@ -65,7 +65,7 @@ static id evalExprCocoa(NSString * expr, NSString ** errstr); | |
extern void im_preedit_start_macvim(); | |
extern void im_preedit_end_macvim(); | |
extern void im_preedit_abandon_macvim(); | |
-extern void im_preedit_changed_macvim(char *preedit_string, int cursor_index); | |
+extern void im_preedit_changed_macvim(char *preedit_string, int start_index, int cursor_index); | |
enum { | |
MMBlinkStateNone = 0, | |
@@ -1180,6 +1180,14 @@ extern GuiFont gui_mch_retain_font(GuiFont font); | |
[self queueMessage:msgid data:nil]; | |
} | |
+- (void)setProportionalFont:(BOOL)proportionalFont | |
+{ | |
+ int msgid = proportionalFont ? | |
+ EnableProportionalFontMsgID : DisableProportionalFontMsgID; | |
+ | |
+ [self queueMessage:msgid data:nil]; | |
+} | |
+ | |
- (void)updateModifiedFlag | |
{ | |
// Notify MacVim if _any_ buffer has changed from unmodified to modified or | |
@@ -2943,21 +2951,22 @@ static void netbeansReadCallback(CFSocketRef s, | |
- (void)handleMarkedText:(NSData *)data | |
{ | |
const void *bytes = [data bytes]; | |
+ unsigned textlen = *((unsigned*)bytes); bytes += sizeof(unsigned); | |
int32_t pos = *((int32_t*)bytes); bytes += sizeof(int32_t); | |
unsigned len = *((unsigned*)bytes); bytes += sizeof(unsigned); | |
char *chars = (char *)bytes; | |
- ASLogDebug(@"pos=%d len=%d chars=%s", pos, len, chars); | |
+ ASLogDebug(@"textlen=%d pos=%d len=%d chars=%s", textlen, pos, len, chars); | |
if (pos < 0) { | |
im_preedit_abandon_macvim(); | |
- } else if (len == 0) { | |
+ } else if (textlen == 0) { | |
im_preedit_end_macvim(); | |
} else { | |
if (!preedit_get_status()) | |
im_preedit_start_macvim(); | |
- im_preedit_changed_macvim(chars, pos); | |
+ im_preedit_changed_macvim(chars, pos, pos + len); | |
} | |
} | |
diff --git a/src/MacVim/MMCoreTextView.h b/src/MacVim/MMCoreTextView.h | |
index d513e1d..83c03be 100644 | |
--- a/src/MacVim/MMCoreTextView.h | |
+++ b/src/MacVim/MMCoreTextView.h | |
@@ -68,6 +68,7 @@ | |
- (NSFont *)fontWide; | |
- (NSSize)cellSize; | |
- (void)setLinespace:(float)newLinespace; | |
+- (void)setProportionalFont:(BOOL)proportionalFont; | |
// | |
// MMTextView methods | |
diff --git a/src/MacVim/MMCoreTextView.m b/src/MacVim/MMCoreTextView.m | |
index 3aed356..d0ff608 100644 | |
--- a/src/MacVim/MMCoreTextView.m | |
+++ b/src/MacVim/MMCoreTextView.m | |
@@ -46,6 +46,7 @@ | |
#define DRAW_ITALIC 0x10 /* draw italic text */ | |
#define DRAW_CURSOR 0x20 | |
#define DRAW_WIDE 0x40 /* draw wide text */ | |
+#define DRAW_TUNDERL 0x100 /* draw double underline text */ | |
@interface MMCoreTextView (Private) | |
- (MMWindowController *)windowController; | |
@@ -366,6 +367,10 @@ defaultAdvanceForFont(CTFontRef fontRef) | |
cellSize.height = linespace + defaultLineHeightForFont(font); | |
} | |
+- (void)setProportionalFont:(BOOL)proportionalFont | |
+{ | |
+ // NOT IMPLEMENTED | |
+} | |
@@ -927,6 +932,14 @@ defaultAdvanceForFont(CTFontRef fontRef) | |
// Convert UTF-8 chars to UTF-16 | |
CFStringRef sref = CFStringCreateWithBytesNoCopy(NULL, s, len, | |
kCFStringEncodingUTF8, false, kCFAllocatorNull); | |
+ if (sref == NULL) { | |
+ ASLogWarn(@"Conversion error len=%d row=%d col=%d flags=%#x", | |
+ len, row, col, flags); | |
+ s = "<CONVERR>"; | |
+ len = strlen(s); | |
+ sref = CFStringCreateWithBytesNoCopy(NULL, s, len, | |
+ kCFStringEncodingUTF8, false, kCFAllocatorNull); | |
+ } | |
CFIndex unilength = CFStringGetLength(sref); | |
const UniChar *unichars = CFStringGetCharactersPtr(sref); | |
UniChar *buffer = NULL; | |
@@ -1127,7 +1140,13 @@ recurseDraw(const unichar *chars, CGGlyph *glyphs, CGSize *advances, | |
if (flags & DRAW_UNDERL) { | |
// Draw underline | |
- CGRect rect = { {x, y+0.4*fontDescent}, {cells*cellSize.width, 1} }; | |
+ CGRect rect = { {x, y}, {cells*cellSize.width, 1} }; | |
+ CGContextSetRGBFillColor(context, RED(sp), GREEN(sp), BLUE(sp), | |
+ ALPHA(sp)); | |
+ CGContextFillRect(context, rect); | |
+ } else if (flags & DRAW_TUNDERL) { | |
+ // Draw underline | |
+ CGRect rect = { {x, y}, {cells*cellSize.width, 2} }; | |
CGContextSetRGBFillColor(context, RED(sp), GREEN(sp), BLUE(sp), | |
ALPHA(sp)); | |
CGContextFillRect(context, rect); | |
diff --git a/src/MacVim/MMPreferenceController.m b/src/MacVim/MMPreferenceController.m | |
index bcf7a6f..c425784 100644 | |
--- a/src/MacVim/MMPreferenceController.m | |
+++ b/src/MacVim/MMPreferenceController.m | |
@@ -47,20 +47,28 @@ static void loadSymbols() | |
{ | |
loadSymbols(); | |
+ NSString *generalLabel = NSLocalizedString(@"General", nil); | |
+ NSString *integrationLabel = NSLocalizedString(@"Integration", nil); | |
+ NSString *advancedLabel = NSLocalizedString(@"Advanced", nil); | |
+ | |
if (nsImageNamePreferencesGeneral != NULL) { | |
[self addView:generalPreferences | |
- label:@"General" | |
+ label:generalLabel | |
image:[NSImage imageNamed:nsImageNamePreferencesGeneral]]; | |
} else { | |
- [self addView:generalPreferences label:@"General"]; | |
+ [self addView:generalPreferences | |
+ label:generalLabel | |
+ image:[NSImage imageNamed:@"General"]]; | |
} | |
if (nsImageNamePreferencesAdvanced != NULL) { | |
[self addView:advancedPreferences | |
- label:@"Advanced" | |
+ label:advancedLabel | |
image:[NSImage imageNamed:nsImageNamePreferencesAdvanced]]; | |
} else { | |
- [self addView:advancedPreferences label:@"Advanced"]; | |
+ [self addView:advancedPreferences | |
+ label:advancedLabel | |
+ image:[NSImage imageNamed:@"Advanced"]]; | |
} | |
} | |
diff --git a/src/MacVim/MMTextStorage.h b/src/MacVim/MMTextStorage.h | |
index 1a7277c..4cd53ab 100644 | |
--- a/src/MacVim/MMTextStorage.h | |
+++ b/src/MacVim/MMTextStorage.h | |
@@ -45,6 +45,7 @@ typedef struct { | |
MMRowCacheEntry *rowCache; | |
#endif | |
BOOL characterEqualsColumn; | |
+ BOOL proportionalFont; | |
} | |
- (NSString *)string; | |
@@ -95,5 +96,6 @@ typedef struct { | |
#if MM_USE_ROW_CACHE | |
- (MMRowCacheEntry *)rowCache; | |
#endif | |
+- (void)setProportionalFont:(BOOL)proportionalFont; | |
@end | |
diff --git a/src/MacVim/MMTextStorage.m b/src/MacVim/MMTextStorage.m | |
index 9848314..6138f94 100644 | |
--- a/src/MacVim/MMTextStorage.m | |
+++ b/src/MacVim/MMTextStorage.m | |
@@ -41,6 +41,8 @@ | |
#define MM_TS_PARANOIA_LOG 1 | |
+#define FIX_HALFWIDE_KATAKANA | |
+ | |
// TODO: What does DRAW_TRANSP flag do? If the background isn't drawn when | |
// this flag is set, then sometimes the character after the cursor becomes | |
@@ -52,6 +54,7 @@ | |
#define DRAW_ITALIC 0x10 /* draw italic text */ | |
#define DRAW_CURSOR 0x20 | |
#define DRAW_WIDE 0x40 /* draw wide text */ | |
+#define DRAW_TUNDERL 0x100 /* draw thick underline text */ | |
static NSString *MMWideCharacterAttributeName = @"MMWideChar"; | |
@@ -66,6 +69,12 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; | |
@end | |
+#ifdef FIX_HALFWIDE_KATAKANA | |
+@interface NSString (Private) | |
+- (NSRange)rangeOfComposedCharacterSequenceAtIndexEx:(NSUInteger)anIndex; | |
+@end | |
+#endif | |
+ | |
@implementation MMTextStorage | |
@@ -296,6 +305,12 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; | |
[attributes setObject:value forKey:NSUnderlineStyleAttributeName]; | |
} | |
+ if (flags & DRAW_TUNDERL) { | |
+ NSNumber *value = [NSNumber numberWithInt:(NSUnderlineStyleThick | |
+ | NSUnderlinePatternSolid)]; // | NSUnderlineByWordMask | |
+ [attributes setObject:value forKey:NSUnderlineStyleAttributeName]; | |
+ } | |
+ | |
if (flags & DRAW_UNDERC) { | |
// TODO: figure out how do draw proper undercurls | |
NSNumber *value = [NSNumber numberWithInt:(NSUnderlineStyleThick | |
@@ -652,6 +667,8 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; | |
NSDictionary *dict = [NSDictionary | |
dictionaryWithObject:[NSNumber numberWithFloat:cellSize.width] | |
forKey:NSFontFixedAdvanceAttribute]; | |
+ if (proportionalFont) | |
+ dict = [NSDictionary dictionary]; | |
NSFontDescriptor *desc = [newFont fontDescriptor]; | |
desc = [desc fontDescriptorByAddingAttributes:dict]; | |
@@ -710,6 +727,8 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; | |
NSDictionary *dictWide = [NSDictionary | |
dictionaryWithObject:[NSNumber numberWithFloat:2*cellSize.width] | |
forKey:NSFontFixedAdvanceAttribute]; | |
+ if (proportionalFont) | |
+ dictWide = [NSDictionary dictionary]; | |
desc = [desc fontDescriptorByAddingAttributes:dictWide]; | |
fontWide = [NSFont fontWithDescriptor:desc size:pointSize]; | |
@@ -919,6 +938,21 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; | |
} | |
#endif | |
+- (void)setProportionalFont:(BOOL)pfont | |
+{ | |
+ if (proportionalFont != pfont) { | |
+ proportionalFont = pfont; | |
+ | |
+ NSFont *currentFont = font; | |
+ font = nil; | |
+ [self setFont:currentFont]; | |
+ | |
+ NSFont *currentFontWide = fontWide; | |
+ fontWide = nil; | |
+ [self setWideFont:currentFontWide]; | |
+ } | |
+} | |
+ | |
@end // MMTextStorage | |
@@ -1098,7 +1132,11 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; | |
while (col > i) { | |
if (idx >= stringLen) | |
return NSMakeRange(NSNotFound, 0); | |
+#ifdef FIX_HALFWIDE_KATAKANA | |
+ r = [string rangeOfComposedCharacterSequenceAtIndexEx:idx]; | |
+#else | |
r = [string rangeOfComposedCharacterSequenceAtIndex:idx]; | |
+#endif | |
// Wide chars take up two display cells. | |
if ([attribString attribute:MMWideCharacterAttributeName | |
@@ -1137,7 +1175,11 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; | |
for (i = 0; i < cells; ++i) { | |
if (idx >= stringLen) | |
return NSMakeRange(NSNotFound, 0); | |
+#ifdef FIX_HALFWIDE_KATAKANA | |
+ r = [string rangeOfComposedCharacterSequenceAtIndexEx:idx]; | |
+#else | |
r = [string rangeOfComposedCharacterSequenceAtIndex:idx]; | |
+#endif | |
// Wide chars take up two display cells. | |
if ([attribString attribute:MMWideCharacterAttributeName | |
@@ -1208,3 +1250,25 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; | |
} | |
@end // MMTextStorage (Private) | |
+ | |
+ | |
+#ifdef FIX_HALFWIDE_KATAKANA | |
+@implementation NSString (Private) | |
+ | |
+- (NSRange)rangeOfComposedCharacterSequenceAtIndexEx:(NSUInteger)anIndex | |
+{ | |
+ NSRange r; | |
+ unichar c = [self characterAtIndex:anIndex]; | |
+ unichar tc = anIndex < [self length] - 1 ? | |
+ [self characterAtIndex:(anIndex + 1)] : 0; | |
+ if ((c >= 0xff61 && c <= 0xff9f) || (tc >= 0xff61 && tc <= 0xff9f)) { | |
+ r.location = anIndex; | |
+ r.length = 1; | |
+ } else { | |
+ r = [self rangeOfComposedCharacterSequenceAtIndex:anIndex]; | |
+ } | |
+ return r; | |
+} | |
+ | |
+@end // NSString (Private) | |
+#endif | |
diff --git a/src/MacVim/MMTextView.h b/src/MacVim/MMTextView.h | |
index 001613b..2c9ed01 100644 | |
--- a/src/MacVim/MMTextView.h | |
+++ b/src/MacVim/MMTextView.h | |
@@ -65,6 +65,8 @@ | |
- (NSRect)rectForRow:(int)row column:(int)col numRows:(int)nr | |
numColumns:(int)nc; | |
+- (void)setProportionalFont:(BOOL)proportionalFont; | |
+ | |
// NOT IMPLEMENTED (only in Core Text renderer) | |
- (void)deleteSign:(NSString *)signName; | |
- (void)setToolTipAtMousePoint:(NSString *)string; | |
diff --git a/src/MacVim/MMTextView.m b/src/MacVim/MMTextView.m | |
index 81dd03f..db2da2f 100644 | |
--- a/src/MacVim/MMTextView.m | |
+++ b/src/MacVim/MMTextView.m | |
@@ -507,6 +507,12 @@ | |
// ONLY in Core Text! | |
} | |
+- (void)setProportionalFont:(BOOL)proportionalFont | |
+{ | |
+ MMTextStorage *ts = (MMTextStorage *)[self textStorage]; | |
+ [ts setProportionalFont:proportionalFont]; | |
+} | |
+ | |
- (BOOL)isOpaque | |
{ | |
return NO; | |
diff --git a/src/MacVim/MMTextViewHelper.m b/src/MacVim/MMTextViewHelper.m | |
index 3a88600..8e7d949 100644 | |
--- a/src/MacVim/MMTextViewHelper.m | |
+++ b/src/MacVim/MMTextViewHelper.m | |
@@ -43,7 +43,7 @@ static float MMDragAreaSize = 73.0f; | |
- (void)setCursor; | |
- (NSRect)trackingRect; | |
- (BOOL)inputManagerHandleMouseEvent:(NSEvent *)event; | |
-- (void)sendMarkedText:(NSString *)text position:(int32_t)pos; | |
+- (void)sendMarkedText:(NSString *)text position:(int32_t)pos length:(unsigned)len; | |
- (void)abandonMarkedText; | |
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6) | |
- (void)sendGestureEvent:(int)gesture flags:(int)flags; | |
@@ -218,7 +218,7 @@ KeyboardInputSourcesEqual(TISInputSourceRef a, TISInputSourceRef b) | |
- (void)insertText:(id)string | |
{ | |
if ([self hasMarkedText]) { | |
- [self sendMarkedText:nil position:0]; | |
+ [self sendMarkedText:nil position:0 length:0]; | |
// NOTE: If this call is left out then the marked text isn't properly | |
// erased when Return is used to accept the text. | |
@@ -338,7 +338,7 @@ KeyboardInputSourcesEqual(TISInputSourceRef a, TISInputSourceRef b) | |
if ([self hasMarkedText]) { | |
// We must clear the marked text since the cursor may move if the | |
// marked text moves outside the view as a result of scrolling. | |
- [self sendMarkedText:nil position:0]; | |
+ [self sendMarkedText:nil position:0 length:0]; | |
[self unmarkText]; | |
[[NSInputManager currentInputManager] markedTextAbandoned:self]; | |
} | |
@@ -641,7 +641,7 @@ KeyboardInputSourcesEqual(TISInputSourceRef a, TISInputSourceRef b) | |
imRange = range; | |
} | |
- [self sendMarkedText:text position:range.location]; | |
+ [self sendMarkedText:text position:range.location length:range.length]; | |
return; | |
} | |
@@ -957,6 +957,9 @@ KeyboardInputSourcesEqual(TISInputSourceRef a, TISInputSourceRef b) | |
if (mods & NSNumericPadKeyMask) { | |
flags = mods & NSDeviceIndependentModifierFlagsMask; | |
keyCode = [currentEvent keyCode]; | |
+ // HACK! ATOK sends Cursor-Down key. | |
+ if (imState && keyCode == 0x7d) | |
+ keyCode = 0; | |
} | |
if ([currentEvent isARepeat]) | |
@@ -1125,19 +1128,20 @@ KeyboardInputSourcesEqual(TISInputSourceRef a, TISInputSourceRef b) | |
return NO; | |
} | |
-- (void)sendMarkedText:(NSString *)text position:(int32_t)pos | |
+- (void)sendMarkedText:(NSString *)text position:(int32_t)pos length:(unsigned)len | |
{ | |
if (![self useInlineIm]) | |
return; | |
NSMutableData *data = [NSMutableData data]; | |
- unsigned len = text == nil ? 0 | |
+ unsigned textlen = text == nil ? 0 | |
: [text lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; | |
+ [data appendBytes:&textlen length:sizeof(unsigned)]; | |
[data appendBytes:&pos length:sizeof(int32_t)]; | |
[data appendBytes:&len length:sizeof(unsigned)]; | |
- if (len > 0) { | |
- [data appendBytes:[text UTF8String] length:len]; | |
+ if (textlen > 0) { | |
+ [data appendBytes:[text UTF8String] length:textlen]; | |
[data appendBytes:"\x00" length:1]; | |
} | |
@@ -1151,7 +1155,7 @@ KeyboardInputSourcesEqual(TISInputSourceRef a, TISInputSourceRef b) | |
// Send an empty marked text message with position set to -1 to indicate | |
// that the marked text should be abandoned. (If pos is set to 0 Vim will | |
// send backspace sequences to delete the old marked text.) | |
- [self sendMarkedText:nil position:-1]; | |
+ [self sendMarkedText:nil position:-1 length:0]; | |
[[NSInputManager currentInputManager] markedTextAbandoned:self]; | |
} | |
diff --git a/src/MacVim/MMVimController.m b/src/MacVim/MMVimController.m | |
index d56745d..ca1aa68 100644 | |
--- a/src/MacVim/MMVimController.m | |
+++ b/src/MacVim/MMVimController.m | |
@@ -777,6 +777,10 @@ static BOOL isUnsafeMessage(int msgid); | |
[[[windowController vimView] textView] setAntialias:YES]; | |
} else if (DisableAntialiasMsgID == msgid) { | |
[[[windowController vimView] textView] setAntialias:NO]; | |
+ } else if (EnableProportionalFontMsgID == msgid) { | |
+ [[[windowController vimView] textView] setProportionalFont:YES]; | |
+ } else if (DisableProportionalFontMsgID == msgid) { | |
+ [[[windowController vimView] textView] setProportionalFont:NO]; | |
} else if (SetVimStateMsgID == msgid) { | |
NSDictionary *dict = [NSDictionary dictionaryWithData:data]; | |
if (dict) { | |
diff --git a/src/MacVim/MacVim.h b/src/MacVim/MacVim.h | |
index 26b5af7..b2655b0 100644 | |
--- a/src/MacVim/MacVim.h | |
+++ b/src/MacVim/MacVim.h | |
@@ -166,6 +166,8 @@ enum { | |
XcodeModMsgID, | |
EnableAntialiasMsgID, | |
DisableAntialiasMsgID, | |
+ EnableProportionalFontMsgID, | |
+ DisableProportionalFontMsgID, | |
SetVimStateMsgID, | |
SetDocumentFilenameMsgID, | |
OpenWithArgumentsMsgID, | |
diff --git a/src/MacVim/MacVim.m b/src/MacVim/MacVim.m | |
index 2b10c8b..aaf312a 100644 | |
--- a/src/MacVim/MacVim.m | |
+++ b/src/MacVim/MacVim.m | |
@@ -76,6 +76,8 @@ char *MessageStrings[] = | |
"XcodeModMsgID", | |
"EnableAntialiasMsgID", | |
"DisableAntialiasMsgID", | |
+ "EnableProportionalFontMsgID", | |
+ "DisableProportionalFontMsgID", | |
"SetVimStateMsgID", | |
"SetDocumentFilenameMsgID", | |
"OpenWithArgumentsMsgID", | |
diff --git a/src/MacVim/gui_macvim.m b/src/MacVim/gui_macvim.m | |
index e02c03f..d1c380a 100644 | |
--- a/src/MacVim/gui_macvim.m | |
+++ b/src/MacVim/gui_macvim.m | |
@@ -53,6 +53,11 @@ macvim_early_init() | |
path = [path stringByAppendingPathComponent:@"runtime"]; | |
vim_setenv((char_u*)"VIMRUNTIME", (char_u*)[path UTF8String]); | |
+ | |
+ NSString *lang = [[[NSBundle mainBundle] | |
+ preferredLocalizations] objectAtIndex:0]; | |
+ if ([lang isEqualToString:@"Japanese"]) | |
+ vim_setenv((char_u*)"LANG", (char_u*)"ja_JP.UTF-8"); | |
} | |
#if 0 // NOTE: setlocale(LC_ALL, "") seems to work after a restart so this is | |
@@ -1218,8 +1223,15 @@ im_set_control(int enable) | |
void | |
+#if defined(FEAT_UIMFEP) | |
+gui_im_set_active(int active) | |
+#else // FEAT_UIMFEP | |
im_set_active(int active) | |
+#endif // FEAT_UIMFEP | |
{ | |
+ // Don't enable IM if imdisableactivate is true. | |
+ if (p_imdisableactivate && active) | |
+ return; | |
// Tell frontend to enable/disable IM (called e.g. when the mode changes). | |
if (!p_imdisable) { | |
int msgid = active ? ActivateKeyScriptMsgID : DeactivateKeyScriptMsgID; | |
@@ -1230,7 +1242,11 @@ im_set_active(int active) | |
int | |
+#if defined(FEAT_UIMFEP) | |
+gui_im_get_status(void) | |
+#else // FEAT_UIMFEP | |
im_get_status(void) | |
+#endif // FEAT_UIMFEP | |
{ | |
return [[MMBackend sharedInstance] imState]; | |
} | |
@@ -1723,6 +1739,11 @@ void gui_macvim_get_window_layout(int *count, int *layout) | |
} | |
} | |
+void gui_macvim_set_proportional_font(int proportional_font) | |
+{ | |
+ [[MMBackend sharedInstance] setProportionalFont:proportional_font]; | |
+} | |
+ | |
// -- Client/Server --------------------------------------------------------- | |
diff --git a/src/feature.h b/src/feature.h | |
index 61dd50f..bc20025 100644 | |
--- a/src/feature.h | |
+++ b/src/feature.h | |
@@ -1330,6 +1330,16 @@ | |
#endif | |
/* | |
+ * +migemo Regexp pattern expansion. See: | |
+ * http://migemo.namazu.org/ | |
+ * http://www.kaoriya.net/ | |
+ */ | |
+/* Use migemo_open() when it's available */ | |
+#if (defined(HAVE_MIGEMO_H) && defined(HAVE_MIGEMO)) || defined(DYNAMIC_MIGEMO) | |
+# define USE_MIGEMO | |
+#endif | |
+ | |
+/* | |
* +transparency 'transparency' option. | |
*/ | |
#if defined(FEAT_GUI_MACVIM) | |
@@ -1363,13 +1373,3 @@ | |
#if defined(FEAT_GUI) && defined(MACOS_X) | |
# define FEAT_ANTIALIAS | |
#endif | |
- | |
-/* | |
- * +migemo Regexp pattern expansion. See: | |
- * http://migemo.namazu.org/ | |
- * http://www.kaoriya.net/ | |
- */ | |
-/* Use migemo_open() when it's available */ | |
-#if (defined(HAVE_MIGEMO_H) && defined(HAVE_MIGEMO)) || defined(DYNAMIC_MIGEMO) | |
-# define USE_MIGEMO | |
-#endif | |
diff --git a/src/fileio.c b/src/fileio.c | |
index cde693b..ff65029 100644 | |
--- a/src/fileio.c | |
+++ b/src/fileio.c | |
@@ -199,6 +199,7 @@ filemess(buf, name, s, attr) | |
msg_scrolled_ign = FALSE; | |
} | |
+#if 0 | |
typedef struct encode_state encode_state; | |
typedef int (*encode_check)(encode_state* state, char_u d); | |
struct encode_state | |
@@ -432,6 +433,9 @@ guess_encode(char_u** fenc, int* fenc_alloced, char_u* fname) | |
} | |
return 1; | |
} | |
+#else | |
+extern int guess_encode(char_u** fenc, int* fenc_alloced, char_u* fname); | |
+#endif | |
/* | |
* Read lines from file "fname" into the buffer after line "from". | |
diff --git a/src/guess.c b/src/guess.c | |
new file mode 100644 | |
index 0000000..2371f2d | |
--- /dev/null | |
+++ b/src/guess.c | |
@@ -0,0 +1,205 @@ | |
+/* | |
+ * guess.c - guessing character encoding | |
+ * | |
+ * Copyright (c) 2000-2009 Shiro Kawai <shiro@acm.org> | |
+ * | |
+ * Redistribution and use in source and binary forms, with or without | |
+ * modification, are permitted provided that the following conditions | |
+ * are met: | |
+ * | |
+ * 1. Redistributions of source code must retain the above copyright | |
+ * notice, this list of conditions and the following disclaimer. | |
+ * | |
+ * 2. Redistributions in binary form must reproduce the above copyright | |
+ * notice, this list of conditions and the following disclaimer in the | |
+ * documentation and/or other materials provided with the distribution. | |
+ * | |
+ * 3. Neither the name of the authors nor the names of its contributors | |
+ * may be used to endorse or promote products derived from this | |
+ * software without specific prior written permission. | |
+ * | |
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED | |
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
+ * | |
+ * $Id: guess.c,v 1.6 2008-05-10 13:35:37 shirok Exp $ | |
+ */ | |
+ | |
+#include <stdio.h> | |
+#include <string.h> | |
+#include "vim.h" | |
+ | |
+typedef struct guess_arc_rec { | |
+ unsigned int next; /* next state */ | |
+ double score; /* score */ | |
+} guess_arc; | |
+ | |
+typedef struct guess_dfa_rec { | |
+ signed char (*states)[256]; | |
+ guess_arc *arcs; | |
+ int state; | |
+ double score; | |
+} guess_dfa; | |
+ | |
+#define DFA_INIT(st, ar) \ | |
+ { st, ar, 0, 1.0 } | |
+ | |
+#define DFA_NEXT(dfa, ch) \ | |
+ do { \ | |
+ int arc__; \ | |
+ if (dfa.state >= 0) { \ | |
+ arc__ = dfa.states[dfa.state][ch]; \ | |
+ if (arc__ < 0) { \ | |
+ dfa.state = -1; \ | |
+ } else { \ | |
+ dfa.state = dfa.arcs[arc__].next; \ | |
+ dfa.score *= dfa.arcs[arc__].score; \ | |
+ } \ | |
+ } \ | |
+ } while (0) | |
+ | |
+#define DFA_ALIVE(dfa) (dfa.state >= 0) | |
+ | |
+/* include DFA table generated by guess.scm */ | |
+#include "guess_tab.c" | |
+ | |
+static const char *guess_jp(FILE *in, const char *def) | |
+{ | |
+ int c; | |
+ guess_dfa eucj = DFA_INIT(guess_eucj_st, guess_eucj_ar); | |
+ guess_dfa sjis = DFA_INIT(guess_sjis_st, guess_sjis_ar); | |
+ guess_dfa utf8 = DFA_INIT(guess_utf8_st, guess_utf8_ar); | |
+ guess_dfa *top = NULL; | |
+ int sjis_halfwidth_alive = 1; | |
+ | |
+ while ((c = fgetc(in)) != EOF) { | |
+ | |
+ /* special treatment of jis escape sequence */ | |
+ if (c == 0x1b) { | |
+ c = fgetc(in); | |
+ if (c == EOF) | |
+ break; | |
+ if (c == '$' || c == '(') return "iso-2022-jp"; | |
+ } | |
+ | |
+ if (c >= 0x80 && (c < 0xa1 || c > 0xdf)) | |
+ sjis_halfwidth_alive = 0; | |
+ | |
+ if (DFA_ALIVE(eucj)) { | |
+ if (!DFA_ALIVE(sjis) && !DFA_ALIVE(utf8)) return "euc-jp"; | |
+ DFA_NEXT(eucj, c); | |
+ } | |
+ if (DFA_ALIVE(sjis)) { | |
+ if (!DFA_ALIVE(eucj) && !DFA_ALIVE(utf8)) return "cp932"; | |
+ DFA_NEXT(sjis, c); | |
+ } | |
+ if (DFA_ALIVE(utf8)) { | |
+ if (!DFA_ALIVE(sjis) && !DFA_ALIVE(eucj)) return "utf-8"; | |
+ DFA_NEXT(utf8, c); | |
+ } | |
+ | |
+ if (!DFA_ALIVE(eucj) && !DFA_ALIVE(sjis) && !DFA_ALIVE(utf8)) { | |
+ /* we ran out the possibilities */ | |
+ return NULL; | |
+ } | |
+ } | |
+ | |
+ if (DFA_ALIVE(eucj) && DFA_ALIVE(sjis) && !DFA_ALIVE(utf8) && | |
+ sjis_halfwidth_alive) { | |
+ /* non-ASCII chars are only cp932 half width chars */ | |
+ return "cp932"; | |
+ } | |
+ | |
+ /* Now, we have ambigous code. Pick the highest score. If more than | |
+ one candidate tie, pick the default encoding. */ | |
+ if (DFA_ALIVE(eucj)) top = &eucj; | |
+ if (DFA_ALIVE(utf8)) { | |
+ if (top) { | |
+ if (top->score <= utf8.score) top = &utf8; | |
+ } else { | |
+ top = &utf8; | |
+ } | |
+ } | |
+ if (DFA_ALIVE(sjis)) { | |
+ if (top) { | |
+ if (top->score < sjis.score) top = &sjis; | |
+ } else { | |
+ top = &sjis; | |
+ } | |
+ } | |
+ | |
+ if (top == &eucj) return "euc-jp"; | |
+ if (top == &utf8) return "utf-8"; | |
+ if (top == &sjis) return "cp932"; | |
+ return NULL; | |
+} | |
+ | |
+static const char *guess_bom(FILE *in) | |
+{ | |
+ int c, c2, c3; | |
+ | |
+ c = fgetc(in); | |
+ if (c == 0xFE || c == 0xFF) { | |
+ c2 = fgetc(in); | |
+ if (c == 0xFE && c2 == 0xFF) return "ucs-bom"; | |
+ if (c == 0xFF && c2 == 0xFE) return "ucs-bom"; | |
+ ungetc(c2, in); | |
+ } else if (c == 0xEF) { | |
+ c2 = fgetc(in); | |
+ c3 = fgetc(in); | |
+ if (c2 == 0xBB && c3 == 0xBF) return "ucs-bom"; | |
+ ungetc(c3, in); | |
+ ungetc(c2, in); | |
+ } | |
+ ungetc(c, in); | |
+ return NULL; | |
+} | |
+ | |
+int guess_encode(char_u** fenc, int* fenc_alloced, char_u* fname) | |
+{ | |
+ FILE *in; | |
+ const char *enc; | |
+ | |
+ if (p_verbose >= 1) | |
+ { | |
+ verbose_enter(); | |
+ smsg((char_u*)"guess_encode:"); | |
+ smsg((char_u*)" init: fenc=%s alloced=%d fname=%s\n", | |
+ *fenc, *fenc_alloced, fname); | |
+ verbose_leave(); | |
+ } | |
+ | |
+ if (!fname) | |
+ return 0; | |
+ in = mch_fopen((const char *)fname, "r"); | |
+ if (!in) | |
+ return 0; | |
+ | |
+ enc = guess_bom(in); | |
+ if (!enc) | |
+ enc = guess_jp(in, "utf-8"); | |
+ fclose(in); | |
+ | |
+ if (enc) | |
+ { | |
+ if (p_verbose >= 1) | |
+ { | |
+ verbose_enter(); | |
+ smsg((char_u*)" result: newenc=%s\n", enc); | |
+ verbose_leave(); | |
+ } | |
+ if (*fenc_alloced) | |
+ vim_free(*fenc); | |
+ *fenc = vim_strsave((char_u*)enc); | |
+ *fenc_alloced = TRUE; | |
+ } | |
+ return 1; | |
+} | |
diff --git a/src/guess_tab.c b/src/guess_tab.c | |
new file mode 100644 | |
index 0000000..0d6c154 | |
--- /dev/null | |
+++ b/src/guess_tab.c | |
@@ -0,0 +1,261 @@ | |
+/* State transition table for character code guessing */ | |
+/* This file is automatically generated by guess.scm */ | |
+ | |
+static signed char guess_eucj_st[][256] = { | |
+ { /* state init */ | |
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, | |
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, | |
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, | |
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, | |
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, | |
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, -1, | |
+ }, | |
+ { /* state jis0201_kana */ | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | |
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | |
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | |
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ }, | |
+ { /* state jis0213_1 */ | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, -1, | |
+ }, | |
+ { /* state jis0213_2 */ | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | |
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | |
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | |
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | |
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | |
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, -1, | |
+ }, | |
+}; | |
+ | |
+static guess_arc guess_eucj_ar[] = { | |
+ { 0, 1.0 }, /* init -> init */ | |
+ { 1, 0.8 }, /* init -> jis0201_kana */ | |
+ { 3, 0.95 }, /* init -> jis0213_2 */ | |
+ { 2, 1.0 }, /* init -> jis0213_1 */ | |
+ { 0, 1.0 }, /* jis0201_kana -> init */ | |
+ { 0, 1.0 }, /* jis0213_1 -> init */ | |
+ { 0, 1.0 }, /* jis0213_2 -> init */ | |
+}; | |
+ | |
+static signed char guess_sjis_st[][256] = { | |
+ { /* state init */ | |
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
+ -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
+ -1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
+ -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, | |
+ }, | |
+ { /* state jis0213 */ | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, -1, | |
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | |
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, -1, -1, -1, | |
+ }, | |
+}; | |
+ | |
+static guess_arc guess_sjis_ar[] = { | |
+ { 0, 1.0 }, /* init -> init */ | |
+ { 1, 1.0 }, /* init -> jis0213 */ | |
+ { 0, 0.8 }, /* init -> init */ | |
+ { 1, 0.95 }, /* init -> jis0213 */ | |
+ { 0, 0.8 }, /* init -> init */ | |
+ { 0, 1.0 }, /* jis0213 -> init */ | |
+}; | |
+ | |
+static signed char guess_utf8_st[][256] = { | |
+ { /* state init */ | |
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
+ 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, -1, -1, | |
+ }, | |
+ { /* state 1byte_more */ | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | |
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | |
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | |
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ }, | |
+ { /* state 2byte_more */ | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | |
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | |
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | |
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ }, | |
+ { /* state 3byte_more */ | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | |
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | |
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | |
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ }, | |
+ { /* state 4byte_more */ | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, | |
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, | |
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, | |
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ }, | |
+ { /* state 5byte_more */ | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, | |
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, | |
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, | |
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |
+ }, | |
+}; | |
+ | |
+static guess_arc guess_utf8_ar[] = { | |
+ { 0, 1.0 }, /* init -> init */ | |
+ { 1, 1.0 }, /* init -> 1byte_more */ | |
+ { 2, 1.0 }, /* init -> 2byte_more */ | |
+ { 3, 1.0 }, /* init -> 3byte_more */ | |
+ { 4, 1.0 }, /* init -> 4byte_more */ | |
+ { 5, 1.0 }, /* init -> 5byte_more */ | |
+ { 0, 1.0 }, /* 1byte_more -> init */ | |
+ { 1, 1.0 }, /* 2byte_more -> 1byte_more */ | |
+ { 2, 1.0 }, /* 3byte_more -> 2byte_more */ | |
+ { 3, 1.0 }, /* 4byte_more -> 3byte_more */ | |
+ { 4, 1.0 }, /* 5byte_more -> 4byte_more */ | |
+}; | |
+ | |
diff --git a/src/gui.c b/src/gui.c | |
index 3579ce3..4a7956f 100644 | |
--- a/src/gui.c | |
+++ b/src/gui.c | |
@@ -2223,6 +2223,12 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back) | |
/* Do we underline the text? */ | |
if (hl_mask_todo & HL_UNDERLINE) | |
draw_flags |= DRAW_UNDERL; | |
+ | |
+# if defined(FEAT_GUI_MACVIM) | |
+ /* Do we thick underline the text? */ | |
+ if (hl_mask_todo & HL_THICKUNDERLINE) | |
+ draw_flags |= DRAW_TUNDERL; | |
+# endif | |
#else | |
/* Do we underline the text? */ | |
if ((hl_mask_todo & HL_UNDERLINE) | |
diff --git a/src/gui.h b/src/gui.h | |
index 0242d62..359fd09 100644 | |
--- a/src/gui.h | |
+++ b/src/gui.h | |
@@ -158,6 +158,7 @@ | |
#define DRAW_CURSOR 0x20 /* drawing block cursor (win32) */ | |
#define DRAW_WIDE 0x40 /* drawing wide char (MacVim) */ | |
#define DRAW_COMP 0x80 /* drawing composing char (MacVim) */ | |
+#define DRAW_TUNDERL 0x100 /* drawing thick underline text (MacVim) */ | |
/* For our own tearoff menu item */ | |
#define TEAR_STRING "-->Detach" | |
diff --git a/src/if_perl.xs b/src/if_perl.xs | |
index 545dc7b..fd5ec46 100644 | |
--- a/src/if_perl.xs | |
+++ b/src/if_perl.xs | |
@@ -104,6 +104,11 @@ typedef int perl_key; | |
#define load_dll(n) dlopen((n), RTLD_LAZY|RTLD_GLOBAL) | |
#define symbol_from_dll dlsym | |
#define close_dll dlclose | |
+# if defined(MACOS_X_UNIX) | |
+# define DYNAMIC_PERL_DLL "/System/Library/Perl/lib/5.10/libperl.dylib" | |
+# else | |
+# define DYNAMIC_PERL_DLL "libperl.so" | |
+# endif | |
#else | |
#define PERL_PROC FARPROC | |
#define load_dll vimLoadLib | |
@@ -476,7 +481,16 @@ perl_runtime_link_init(char *libname, int verbose) | |
perl_enabled(verbose) | |
int verbose; | |
{ | |
- return perl_runtime_link_init(DYNAMIC_PERL_DLL, verbose) == OK; | |
+ int ret = FAIL; | |
+ int mustfree = FALSE; | |
+ char *s = (char *)vim_getenv((char_u *)"PERL_DLL", &mustfree); | |
+ if (s != NULL) | |
+ ret = perl_runtime_link_init(s, verbose); | |
+ if (mustfree) | |
+ vim_free(s); | |
+ if (ret == FAIL) | |
+ ret = perl_runtime_link_init(DYNAMIC_PERL_DLL, verbose); | |
+ return (ret == OK); | |
} | |
#endif /* DYNAMIC_PERL */ | |
diff --git a/src/if_python.c b/src/if_python.c | |
index 8698d6d..69157ce 100644 | |
--- a/src/if_python.c | |
+++ b/src/if_python.c | |
@@ -30,6 +30,20 @@ | |
# undef HAVE_FCNTL_H | |
#endif | |
+#if defined(DYNAMIC_PYTHON) && !defined(_WIN32) | |
+typedef void *HINSTANCE; | |
+typedef void *FARPROC; | |
+# include <dlfcn.h> | |
+# define LoadLibrary(a) dlopen(a,RTLD_NOW|RTLD_GLOBAL) | |
+# define FreeLibrary(a) dlclose(a) | |
+# define GetProcAddress dlsym | |
+# if defined(MACOS_X_UNIX) | |
+# define DYNAMIC_PYTHON_DLL "/System/Library/Frameworks/Python.framework/Versions/Current/Python" | |
+# else | |
+# define DYNAMIC_PYTHON_DLL "libpython.so" | |
+# endif | |
+#endif | |
+ | |
#ifdef _DEBUG | |
# undef _DEBUG | |
#endif | |
@@ -255,12 +269,14 @@ static PyObject *imp_PyExc_IndexError; | |
static PyObject *imp_PyExc_KeyboardInterrupt; | |
static PyObject *imp_PyExc_TypeError; | |
static PyObject *imp_PyExc_ValueError; | |
+static PyObject *imp_PyExc_IOError; | |
# define PyExc_AttributeError imp_PyExc_AttributeError | |
# define PyExc_IndexError imp_PyExc_IndexError | |
# define PyExc_KeyboardInterrupt imp_PyExc_KeyboardInterrupt | |
# define PyExc_TypeError imp_PyExc_TypeError | |
# define PyExc_ValueError imp_PyExc_ValueError | |
+# define PyExc_IOError imp_PyExc_IOError | |
/* | |
* Table of name to function pointer of python. | |
@@ -400,7 +416,16 @@ python_runtime_link_init(char *libname, int verbose) | |
int | |
python_enabled(int verbose) | |
{ | |
- return python_runtime_link_init(DYNAMIC_PYTHON_DLL, verbose) == OK; | |
+ int ret = FAIL; | |
+ int mustfree = FALSE; | |
+ char *s = (char *)vim_getenv((char_u *)"PYTHON_DLL", &mustfree); | |
+ if (s != NULL) | |
+ ret = python_runtime_link_init(s, verbose); | |
+ if (mustfree) | |
+ vim_free(s); | |
+ if (ret == FAIL) | |
+ ret = python_runtime_link_init(DYNAMIC_PYTHON_DLL, verbose); | |
+ return (ret == OK); | |
} | |
/* | |
@@ -417,11 +442,13 @@ get_exceptions(void) | |
imp_PyExc_KeyboardInterrupt = PyDict_GetItemString(exdict, "KeyboardInterrupt"); | |
imp_PyExc_TypeError = PyDict_GetItemString(exdict, "TypeError"); | |
imp_PyExc_ValueError = PyDict_GetItemString(exdict, "ValueError"); | |
+ imp_PyExc_IOError = PyDict_GetItemString(exdict, "IOError"); | |
Py_XINCREF(imp_PyExc_AttributeError); | |
Py_XINCREF(imp_PyExc_IndexError); | |
Py_XINCREF(imp_PyExc_KeyboardInterrupt); | |
Py_XINCREF(imp_PyExc_TypeError); | |
Py_XINCREF(imp_PyExc_ValueError); | |
+ Py_XINCREF(imp_PyExc_IOError); | |
Py_XDECREF(exmod); | |
} | |
#endif /* DYNAMIC_PYTHON */ | |
diff --git a/src/if_python3.c b/src/if_python3.c | |
index 7f3f0f2..e4ec059 100644 | |
--- a/src/if_python3.c | |
+++ b/src/if_python3.c | |
@@ -410,7 +410,16 @@ py3_runtime_link_init(char *libname, int verbose) | |
int | |
python3_enabled(int verbose) | |
{ | |
- return py3_runtime_link_init(DYNAMIC_PYTHON3_DLL, verbose) == OK; | |
+ int ret = FAIL; | |
+ int mustfree = FALSE; | |
+ char *s = (char *)vim_getenv((char_u *)"PYTHON3_DLL", &mustfree); | |
+ if (s != NULL) | |
+ ret = py3_runtime_link_init(s, verbose); | |
+ if (mustfree) | |
+ vim_free(s); | |
+ if (ret == FAIL) | |
+ ret = py3_runtime_link_init(DYNAMIC_PYTHON3_DLL, verbose); | |
+ return (ret == OK); | |
} | |
/* Load the standard Python exceptions - don't import the symbols from the | |
diff --git a/src/if_ruby.c b/src/if_ruby.c | |
index 3f3e1e0..859d996 100644 | |
--- a/src/if_ruby.c | |
+++ b/src/if_ruby.c | |
@@ -18,6 +18,16 @@ | |
# include "auto/config.h" | |
#endif | |
+#if defined(FEAT_RUBY19) && !defined(FEAT_RUBY19_COMPILING) | |
+#define ex_ruby ex_ruby18 | |
+#define ex_rubydo ex_ruby18do | |
+#define ex_rubyfile ex_ruby18file | |
+#define ruby_buffer_free ruby18_buffer_free | |
+#define ruby_enabled ruby18_enabled | |
+#define ruby_end ruby18_end | |
+#define ruby_window_free ruby18_window_free | |
+#endif | |
+ | |
#ifdef _WIN32 | |
# if !defined(DYNAMIC_RUBY_VER) || (DYNAMIC_RUBY_VER < 18) | |
# define NT | |
@@ -235,11 +245,16 @@ static void ruby_vim_init(void); | |
# define rb_enc_str_new dll_rb_enc_str_new | |
# define rb_intern2 dll_rb_intern2 | |
# define rb_const_remove dll_rb_const_remove | |
-# define Init_prelude dll_Init_prelude | |
# define rb_sprintf dll_rb_sprintf | |
# define ruby_init_stack dll_ruby_init_stack | |
#endif | |
+#ifdef FEAT_GUI_MACVIM | |
+# define rb_fix2int dll_rb_fix2int | |
+# define rb_num2int dll_rb_num2int | |
+# define rb_num2uint dll_rb_num2uint | |
+#endif | |
+ | |
/* | |
* Pointers for dynamic link | |
*/ | |
@@ -276,6 +291,11 @@ static VALUE (*dll_rb_int2inum) (long); | |
static VALUE (*dll_rb_lastline_get) (void); | |
static void (*dll_rb_lastline_set) (VALUE); | |
static void (*dll_rb_load_protect) (VALUE, int, int*); | |
+#if defined(__LP64__) || defined(FEAT_GUI_MACVIM) | |
+static long (*dll_rb_fix2int) (VALUE); | |
+static long (*dll_rb_num2int) (VALUE); | |
+static unsigned long (*dll_rb_num2uint) (VALUE); | |
+#endif | |
static long (*dll_rb_num2long) (VALUE); | |
static unsigned long (*dll_rb_num2ulong) (VALUE); | |
static VALUE (*dll_rb_obj_alloc) (VALUE); | |
@@ -325,7 +345,6 @@ static int (*dll_rb_enc_find_index) (const char*); | |
static rb_encoding* (*dll_rb_enc_find) (const char*); | |
static VALUE (*dll_rb_enc_str_new) (const char*, long, rb_encoding*); | |
static ID (*dll_rb_intern2) (const char*, long); | |
-static void (*dll_Init_prelude) (void); | |
static VALUE (*dll_rb_const_remove) (VALUE, ID); | |
static VALUE (*dll_rb_sprintf) (const char*, ...); | |
static void (*ruby_init_stack)(VALUE*); | |
@@ -385,6 +404,11 @@ static struct | |
{"rb_lastline_get", (RUBY_PROC*)&dll_rb_lastline_get}, | |
{"rb_lastline_set", (RUBY_PROC*)&dll_rb_lastline_set}, | |
{"rb_load_protect", (RUBY_PROC*)&dll_rb_load_protect}, | |
+#if defined(__LP64__) || defined(FEAT_GUI_MACVIM) | |
+ {"rb_fix2int", (RUBY_PROC*)&dll_rb_fix2int}, | |
+ {"rb_num2int", (RUBY_PROC*)&dll_rb_num2int}, | |
+ {"rb_num2uint", (RUBY_PROC*)&dll_rb_num2uint}, | |
+#endif | |
{"rb_num2long", (RUBY_PROC*)&dll_rb_num2long}, | |
{"rb_num2ulong", (RUBY_PROC*)&dll_rb_num2ulong}, | |
{"rb_obj_alloc", (RUBY_PROC*)&dll_rb_obj_alloc}, | |
@@ -437,7 +461,6 @@ static struct | |
{"rb_enc_str_new", (RUBY_PROC*)&dll_rb_enc_str_new}, | |
{"rb_intern2", (RUBY_PROC*)&dll_rb_intern2}, | |
{"rb_const_remove", (RUBY_PROC*)&dll_rb_const_remove}, | |
- {"Init_prelude", (RUBY_PROC*)&dll_Init_prelude}, | |
{"rb_sprintf", (RUBY_PROC*)&dll_rb_sprintf}, | |
{"ruby_init_stack", (RUBY_PROC*)&dll_ruby_init_stack}, | |
#endif | |
@@ -500,7 +523,16 @@ ruby_runtime_link_init(char *libname, int verbose) | |
ruby_enabled(verbose) | |
int verbose; | |
{ | |
- return ruby_runtime_link_init(DYNAMIC_RUBY_DLL, verbose) == OK; | |
+ int ret = FAIL; | |
+ int mustfree = FALSE; | |
+ char *s = (char *)vim_getenv((char_u *)"RUBY_DLL", &mustfree); | |
+ if (s != NULL) | |
+ ret = ruby_runtime_link_init(s, verbose); | |
+ if (mustfree) | |
+ vim_free(s); | |
+ if (ret == FAIL) | |
+ ret = ruby_runtime_link_init(DYNAMIC_RUBY_DLL, verbose); | |
+ return (ret == OK); | |
} | |
#endif /* defined(DYNAMIC_RUBY) || defined(PROTO) */ | |
@@ -679,7 +711,6 @@ static int ensure_ruby_initialized(void) | |
/* This avoids the error "Encoding::ConverterNotFoundError: code | |
* converter not found (UTF-16LE to ASCII-8BIT)". */ | |
rb_define_module("Gem"); | |
- Init_prelude(); | |
rb_const_remove(rb_cObject, rb_intern2("TMP_RUBY_PREFIX", 15)); | |
#endif | |
ruby_vim_init(); | |
@@ -1325,3 +1356,93 @@ static void ruby_vim_init(void) | |
rb_define_virtual_variable("$curbuf", buffer_s_current, 0); | |
rb_define_virtual_variable("$curwin", window_s_current, 0); | |
} | |
+ | |
+#if defined(FEAT_RUBY19) && !defined(FEAT_RUBY19_COMPILING) | |
+ | |
+#undef ex_ruby | |
+#undef ex_rubydo | |
+#undef ex_rubyfile | |
+#undef ruby_buffer_free | |
+#undef ruby_enabled | |
+#undef ruby_end | |
+#undef ruby_window_free | |
+ | |
+enum { | |
+ DYNAMIC_RUBY_NOT_INITIALIZED, | |
+ DYNAMIC_RUBY_NOT_AVAILABLE, | |
+ DYNAMIC_RUBY_VER18, | |
+ DYNAMIC_RUBY_VER19, | |
+}; | |
+ | |
+static int dynamic_ruby_version = DYNAMIC_RUBY_NOT_INITIALIZED; | |
+ | |
+static int ensure_ruby19_initialized(void) | |
+{ | |
+ if (dynamic_ruby_version == DYNAMIC_RUBY_NOT_INITIALIZED) { | |
+ if (ruby19_enabled(FALSE) == TRUE) | |
+ dynamic_ruby_version = DYNAMIC_RUBY_VER19; | |
+ else if (ruby18_enabled(FALSE) == TRUE) | |
+ dynamic_ruby_version = DYNAMIC_RUBY_VER18; | |
+ else | |
+ dynamic_ruby_version = DYNAMIC_RUBY_NOT_AVAILABLE; | |
+ } | |
+ return dynamic_ruby_version; | |
+} | |
+ | |
+void ex_ruby(exarg_T *eap) | |
+{ | |
+ switch (ensure_ruby19_initialized()) { | |
+ case DYNAMIC_RUBY_VER18: ex_ruby18(eap); return; | |
+ case DYNAMIC_RUBY_VER19: ex_ruby19(eap); return; | |
+ } | |
+} | |
+ | |
+void ex_rubydo(exarg_T *eap) | |
+{ | |
+ switch (ensure_ruby19_initialized()) { | |
+ case DYNAMIC_RUBY_VER18: ex_ruby18do(eap); return; | |
+ case DYNAMIC_RUBY_VER19: ex_ruby19do(eap); return; | |
+ } | |
+} | |
+ | |
+void ex_rubyfile(exarg_T *eap) | |
+{ | |
+ switch (ensure_ruby19_initialized()) { | |
+ case DYNAMIC_RUBY_VER18: ex_ruby18file(eap); return; | |
+ case DYNAMIC_RUBY_VER19: ex_ruby19file(eap); return; | |
+ } | |
+} | |
+ | |
+void ruby_buffer_free(buf_T *buf) | |
+{ | |
+ switch (dynamic_ruby_version) { | |
+ case DYNAMIC_RUBY_VER18: ruby18_buffer_free(buf); return; | |
+ case DYNAMIC_RUBY_VER19: ruby19_buffer_free(buf); return; | |
+ } | |
+} | |
+ | |
+int ruby_enabled(int verbose) | |
+{ | |
+ switch (ensure_ruby19_initialized()) { | |
+ case DYNAMIC_RUBY_VER18: return TRUE; | |
+ case DYNAMIC_RUBY_VER19: return TRUE; | |
+ default: return FALSE; | |
+ } | |
+} | |
+ | |
+void ruby_end() | |
+{ | |
+ switch (dynamic_ruby_version) { | |
+ case DYNAMIC_RUBY_VER18: ruby18_end(); return; | |
+ case DYNAMIC_RUBY_VER19: ruby19_end(); return; | |
+ } | |
+} | |
+ | |
+void ruby_window_free(win_T *win) | |
+{ | |
+ switch (dynamic_ruby_version) { | |
+ case DYNAMIC_RUBY_VER18: ruby18_window_free(win); return; | |
+ case DYNAMIC_RUBY_VER19: ruby19_window_free(win); return; | |
+ } | |
+} | |
+#endif | |
diff --git a/src/if_ruby19.c b/src/if_ruby19.c | |
new file mode 100644 | |
index 0000000..fdc9706 | |
--- /dev/null | |
+++ b/src/if_ruby19.c | |
@@ -0,0 +1,20 @@ | |
+#define FEAT_RUBY19_COMPILING | |
+ | |
+#define DYNAMIC_RUBY_DLL DYNAMIC_RUBY19_DLL | |
+#define DYNAMIC_RUBY_VER DYNAMIC_RUBY19_VER | |
+#define RUBY_VERSION RUBY19_VERSION | |
+ | |
+#define dll_rb_cFalseClass dll_rb19_cFalseClass | |
+#define dll_rb_cFixnum dll_rb19_cFixnum | |
+#define dll_rb_cNilClass dll_rb19_cNilClass | |
+#define dll_rb_cSymbol dll_rb19_cSymbol | |
+#define dll_rb_cTrueClass dll_rb19_cTrueClass | |
+#define ex_ruby ex_ruby19 | |
+#define ex_rubydo ex_ruby19do | |
+#define ex_rubyfile ex_ruby19file | |
+#define ruby_buffer_free ruby19_buffer_free | |
+#define ruby_enabled ruby19_enabled | |
+#define ruby_end ruby19_end | |
+#define ruby_window_free ruby19_window_free | |
+ | |
+#include "if_ruby.c" | |
diff --git a/src/main.c b/src/main.c | |
index fc29258..4276518 100644 | |
--- a/src/main.c | |
+++ b/src/main.c | |
@@ -273,16 +273,6 @@ main | |
TIME_MSG("NetBeans debug wait"); | |
#endif | |
-#if defined(HAVE_LOCALE_H) || defined(X_LOCALE) | |
- /* | |
- * Setup to use the current locale (for ctype() and many other things). | |
- * NOTE: Translated messages with encodings other than latin1 will not | |
- * work until set_init_1() has been called! | |
- */ | |
- init_locale(); | |
- TIME_MSG("locale set"); | |
-#endif | |
- | |
#ifdef FEAT_GUI | |
gui.dofork = TRUE; /* default is to use fork() */ | |
#endif | |
@@ -305,6 +295,16 @@ main | |
TIME_MSG("GUI prepared"); | |
#endif | |
+#if defined(HAVE_LOCALE_H) || defined(X_LOCALE) | |
+ /* | |
+ * Setup to use the current locale (for ctype() and many other things). | |
+ * NOTE: Translated messages with encodings other than latin1 will not | |
+ * work until set_init_1() has been called! | |
+ */ | |
+ init_locale(); | |
+ TIME_MSG("locale set"); | |
+#endif | |
+ | |
#ifdef FEAT_CLIPBOARD | |
clip_init(FALSE); /* Initialise clipboard stuff */ | |
TIME_MSG("clipboard setup"); | |
diff --git a/src/mbyte.c b/src/mbyte.c | |
index 1b3a903..378a8bc 100644 | |
--- a/src/mbyte.c | |
+++ b/src/mbyte.c | |
@@ -4270,6 +4270,7 @@ init_preedit_start_col(void) | |
static int im_is_active = FALSE; /* IM is enabled for current mode */ | |
static int preedit_is_active = FALSE; | |
+static int im_preedit_start = 0; /* start offset in characters */ | |
static int im_preedit_cursor = 0; /* cursor offset in characters */ | |
static int im_preedit_trailing = 0; /* number of characters after cursor */ | |
@@ -4299,6 +4300,15 @@ im_set_active(int active) | |
if (im_is_active != was_active) | |
xim_reset(); | |
} | |
+# else /* FEAT_GUI_MACVIM */ | |
+ void | |
+im_set_active(int active) | |
+{ | |
+ if (gui.in_use) | |
+ gui_im_set_active(active); | |
+ else | |
+ uimfep_set_active(active); | |
+} | |
# endif | |
void | |
@@ -4619,7 +4629,7 @@ im_preedit_abandon_macvim() | |
im_preedit_changed_cb(GtkIMContext *context, gpointer data UNUSED) | |
# else | |
void | |
-im_preedit_changed_macvim(char *preedit_string, int cursor_index) | |
+im_preedit_changed_macvim(char *preedit_string, int start_index, int cursor_index) | |
# endif | |
{ | |
# ifndef FEAT_GUI_MACVIM | |
@@ -4635,6 +4645,8 @@ im_preedit_changed_macvim(char *preedit_string, int cursor_index) | |
gtk_im_context_get_preedit_string(context, | |
&preedit_string, NULL, | |
&cursor_index); | |
+# else | |
+ im_preedit_start = start_index; | |
# endif | |
#ifdef XIM_DEBUG | |
@@ -4807,7 +4819,10 @@ im_get_feedback_attr(int col) | |
return char_attr; | |
# else | |
- return HL_UNDERLINE; | |
+ if (col >= im_preedit_start && col < im_preedit_cursor) | |
+ return HL_THICKUNDERLINE; | |
+ else | |
+ return HL_UNDERLINE; | |
# endif | |
} | |
@@ -5176,6 +5191,15 @@ im_get_status(void) | |
#endif | |
return im_is_active; | |
} | |
+# else /* FEAT_GUI_MACVIM */ | |
+ int | |
+im_get_status(void) | |
+{ | |
+ if (gui.in_use) | |
+ return gui_im_get_status(); | |
+ else | |
+ return uimfep_get_status(); | |
+} | |
# endif | |
int | |
@@ -6221,10 +6245,10 @@ uimfep_set_active(int active) | |
{ | |
int mustfree = 0; | |
char_u *setmode; | |
- setmode = vim_getenv("UIM_FEP_SETMODE", &mustfree); | |
+ setmode = vim_getenv((char_u *)"UIM_FEP_SETMODE", &mustfree); | |
if (setmode != NULL) | |
{ | |
- FILE *fp = fopen(setmode, "w"); | |
+ FILE *fp = fopen((char *)setmode, "w"); | |
if (fp) | |
{ | |
fprintf(fp, "%d\n", active ? uimfep_lastmode : 0); | |
@@ -6242,13 +6266,13 @@ uimfep_get_status(void) | |
int mustfree = 0; | |
int mode = 0; | |
char_u *getmode; | |
- getmode = vim_getenv("UIM_FEP_GETMODE", &mustfree); | |
+ getmode = vim_getenv((char_u *)"UIM_FEP_GETMODE", &mustfree); | |
if (getmode != NULL) | |
{ | |
- FILE *fp = fopen(getmode, "r"); | |
+ FILE *fp = fopen((char *)getmode, "r"); | |
if (fp) | |
{ | |
- char_u buf[99]; | |
+ char buf[99]; | |
if (fgets(buf, sizeof(buf), fp)) | |
mode = atoi(buf); | |
fclose(fp); | |
@@ -6266,13 +6290,27 @@ uimfep_get_status(void) | |
void | |
im_set_active(int active) | |
{ | |
+# if defined(FEAT_GUI_MAC) || defined(FEAT_GUI_MACVIM) | |
+ if (gui.in_use) | |
+ gui_im_set_active(active); | |
+ else | |
+ uimfep_set_active(active); | |
+# else // FEAT_GUI_MAC || FEAT_GUI_MACVIM | |
uimfep_set_active(active); | |
+# endif // FEAT_GUI_MAC || FEAT_GUI_MACVIM | |
} | |
int | |
im_get_status(void) | |
{ | |
+# if defined(FEAT_GUI_MAC) || defined(FEAT_GUI_MACVIM) | |
+ if (gui.in_use) | |
+ return gui_im_get_status(); | |
+ else | |
+ return uimfep_get_status(); | |
+# else // FEAT_GUI_MAC || FEAT_GUI_MACVIM | |
return uimfep_get_status(); | |
+# endif // FEAT_GUI_MAC || FEAT_GUI_MACVIM | |
} | |
# endif | |
diff --git a/src/netbeans.c b/src/netbeans.c | |
index 47d72e6..c8fe80d 100644 | |
--- a/src/netbeans.c | |
+++ b/src/netbeans.c | |
@@ -780,12 +780,6 @@ netbeans_read() | |
if (sock_select(nbsock) <= 0) | |
return; | |
#endif | |
-#if defined(NB_HAS_GUI) && !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_W32) | |
- /* recursion guard; this will be called from the X event loop at unknown | |
- * moments */ | |
- if (NB_HAS_GUI) | |
- ++level; | |
-#endif | |
/* Allocate a buffer to read into. */ | |
if (buf == NULL) | |
@@ -2813,7 +2807,7 @@ ex_nbstart(eap) | |
{ | |
#ifdef FEAT_GUI | |
# if !defined(FEAT_GUI_X11) && !defined(FEAT_GUI_GTK) \ | |
- && !defined(FEAT_GUI_W32) && !defined(FEAT_GUI_MACVIM) | |
+ && !defined(FEAT_GUI_W32) && !defined(FEAT_GUI_MACVIM) | |
if (gui.in_use) | |
{ | |
EMSG(_("E838: netbeans is not supported with this GUI")); | |
diff --git a/src/option.c b/src/option.c | |
index 310303b..ce213f4 100644 | |
--- a/src/option.c | |
+++ b/src/option.c | |
@@ -342,6 +342,7 @@ static int p_ml; | |
static int p_ma; | |
#ifdef FEAT_GUI_MACVIM | |
static int p_mmta; | |
+static int p_mpfont; | |
#endif | |
static int p_mod; | |
static char_u *p_mps; | |
@@ -1481,6 +1482,14 @@ static struct vimoption | |
{(char_u *)FALSE, (char_u *)0L} | |
#endif | |
SCRIPTID_INIT}, | |
+ {"imdisableactivate", "imda", P_BOOL|P_VI_DEF, | |
+#ifdef USE_IM_CONTROL | |
+ (char_u *)&p_imdisableactivate, PV_NONE, | |
+#else | |
+ (char_u *)NULL, PV_NONE, | |
+#endif | |
+ {(char_u *)FALSE, (char_u *)0L} | |
+ SCRIPTID_INIT}, | |
{"iminsert", "imi", P_NUM|P_VI_DEF, | |
(char_u *)&p_iminsert, PV_IMI, | |
#ifdef B_IMODE_IM | |
@@ -1757,6 +1766,13 @@ static struct vimoption | |
(char_u *)NULL, PV_NONE, | |
#endif | |
{(char_u *)FALSE, (char_u *)0L}}, | |
+ {"macproportionalfont", "mpf", P_BOOL|P_VI_DEF|P_VIM|P_RCLR, | |
+#ifdef FEAT_GUI_MACVIM | |
+ (char_u *)&p_mpfont, PV_NONE, | |
+#else | |
+ (char_u *)NULL, PV_NONE, | |
+#endif | |
+ {(char_u *)FALSE, (char_u *)0L}}, | |
{"magic", NULL, P_BOOL|P_VI_DEF, | |
(char_u *)&p_magic, PV_NONE, | |
{(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, | |
@@ -7810,6 +7826,13 @@ set_bool_option(opt_idx, varp, value, opt_flags) | |
} | |
#endif | |
+#if defined(FEAT_GUI_MACVIM) | |
+ else if ((int *)varp == &p_mpfont) | |
+ { | |
+ gui_macvim_set_proportional_font(p_mpfont); | |
+ } | |
+#endif | |
+ | |
/* when 'textauto' is set or reset also change 'fileformats' */ | |
else if ((int *)varp == &p_ta) | |
set_string_option_direct((char_u *)"ffs", -1, | |
diff --git a/src/option.h b/src/option.h | |
index e58f1da..28eed3e 100644 | |
--- a/src/option.h | |
+++ b/src/option.h | |
@@ -572,6 +572,7 @@ EXTERN char_u *p_imak; /* 'imactivatekey' */ | |
#ifdef USE_IM_CONTROL | |
EXTERN int p_imcmdline; /* 'imcmdline' */ | |
EXTERN int p_imdisable; /* 'imdisable' */ | |
+EXTERN int p_imdisableactivate; /* 'imdisableactivate' */ | |
#endif | |
EXTERN int p_is; /* 'incsearch' */ | |
EXTERN int p_im; /* 'insertmode' */ | |
diff --git a/src/proto.h b/src/proto.h | |
index 289c7cb..beb13fa 100644 | |
--- a/src/proto.h | |
+++ b/src/proto.h | |
@@ -198,6 +198,10 @@ void qsort __ARGS((void *base, size_t elm_count, size_t elm_size, int (*cmp)(con | |
# include "if_ruby.pro" | |
# endif | |
+# ifdef FEAT_RUBY19 | |
+# include "if_ruby19.pro" | |
+# endif | |
+ | |
/* Ugly solution for "BalloonEval" not being defined while it's used in some | |
* .pro files. */ | |
# ifndef FEAT_BEVAL | |
diff --git a/src/proto/gui_macvim.pro b/src/proto/gui_macvim.pro | |
index 111424e..669a884 100644 | |
--- a/src/proto/gui_macvim.pro | |
+++ b/src/proto/gui_macvim.pro | |
@@ -204,6 +204,7 @@ void gui_mch_fuopt_update(void); | |
void gui_macvim_update_modified_flag(); | |
void gui_macvim_add_to_find_pboard(char_u *pat); | |
void gui_macvim_set_antialias(int antialias); | |
+void gui_macvim_set_proportional_font(int proportional_font); | |
int16_t odb_buffer_close(buf_T *buf); | |
int16_t odb_post_buffer_write(buf_T *buf); | |
@@ -215,6 +216,16 @@ int is_valid_macaction(char_u *action); | |
void gui_macvim_wait_for_startup(); | |
void gui_macvim_get_window_layout(int *count, int *layout); | |
+void im_set_position(int row, int col); | |
+void im_set_control(int enable); | |
+#if defined(FEAT_UIMFEP) | |
+void gui_im_set_active(int active); | |
+int gui_im_get_status(void); | |
+#else | |
+void im_set_active(int active); | |
+int im_get_status(void); | |
+#endif | |
+ | |
void | |
gui_mch_find_dialog(exarg_T *eap); | |
void | |
diff --git a/src/proto/if_ruby19.pro b/src/proto/if_ruby19.pro | |
new file mode 100644 | |
index 0000000..48a51e5 | |
--- /dev/null | |
+++ b/src/proto/if_ruby19.pro | |
@@ -0,0 +1,9 @@ | |
+/* if_ruby19.c */ | |
+int ruby19_enabled __ARGS((int verbose)); | |
+void ruby19_end __ARGS((void)); | |
+void ex_ruby19 __ARGS((exarg_T *eap)); | |
+void ex_ruby19do __ARGS((exarg_T *eap)); | |
+void ex_ruby19file __ARGS((exarg_T *eap)); | |
+void ruby19_buffer_free __ARGS((buf_T *buf)); | |
+void ruby19_window_free __ARGS((win_T *win)); | |
+/* vim: set ft=c : */ | |
diff --git a/src/search.c b/src/search.c | |
index c275d76..a1ea081 100644 | |
--- a/src/search.c | |
+++ b/src/search.c | |
@@ -1211,18 +1211,24 @@ init_migemo() | |
return; | |
migemo_tryload = 1; | |
- migemo_object = migemo_open(p_migdict); | |
+ migemo_object = migemo_open((char *)p_migdict); | |
if (!migemo_object) | |
return; | |
- migemo_set_operator(migemo_object, MIGEMO_OPINDEX_OR, "\\|"); | |
- migemo_set_operator(migemo_object, MIGEMO_OPINDEX_NEST_IN, "\\%("); | |
- migemo_set_operator(migemo_object, MIGEMO_OPINDEX_NEST_OUT, "\\)"); | |
- migemo_set_operator(migemo_object, MIGEMO_OPINDEX_NEST_OUT, "\\)"); | |
- migemo_set_operator(migemo_object, MIGEMO_OPINDEX_NEWLINE, "\\_s*"); | |
+ migemo_set_operator(migemo_object, | |
+ MIGEMO_OPINDEX_OR, (char_u *)"\\|"); | |
+ migemo_set_operator(migemo_object, | |
+ MIGEMO_OPINDEX_NEST_IN, (char_u *)"\\%("); | |
+ migemo_set_operator(migemo_object, | |
+ MIGEMO_OPINDEX_NEST_OUT, (char_u *)"\\)"); | |
+ migemo_set_operator(migemo_object, | |
+ MIGEMO_OPINDEX_NEST_OUT, (char_u *)"\\)"); | |
+ migemo_set_operator(migemo_object, | |
+ MIGEMO_OPINDEX_NEWLINE, (char_u *)"\\_s*"); | |
migemo_setproc_int2char(migemo_object, vimigemo_int2char); | |
- migemo_setproc_char2int(migemo_object, vimigemo_char2int); | |
+ migemo_setproc_char2int(migemo_object, | |
+ (MIGEMO_PROC_CHAR2INT)vimigemo_char2int); | |
} | |
void | |
@@ -1248,7 +1254,7 @@ query_migemo(char_u* str) | |
init_migemo(); | |
if (migemo_object) | |
{ | |
- char *query = migemo_query(migemo_object, str); | |
+ char_u *query = migemo_query(migemo_object, str); | |
if (query != NULL) | |
{ | |
@@ -1312,7 +1318,7 @@ searchit_migemo(win, buf, pos, dir, str, count, options, pat_use, stop_lnum, | |
init_migemo(); | |
if (migemo_object) | |
{ | |
- char *query; | |
+ char_u *query; | |
char_u *newstr = NULL; | |
/* Remove backslash in str */ | |
diff --git a/src/tag.c b/src/tag.c | |
index 50c3ce6..92b02de 100644 | |
--- a/src/tag.c | |
+++ b/src/tag.c | |
@@ -1381,6 +1381,9 @@ find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname) | |
int use_cscope = (flags & TAG_CSCOPE); | |
#endif | |
int verbose = (flags & TAG_VERBOSE); | |
+#ifdef FEAT_MBYTE | |
+ int checked_fileenc = FALSE; | |
+#endif | |
help_save = curbuf->b_help; | |
orgpat.pat = pat; | |
@@ -1838,7 +1841,7 @@ line_read_in: | |
} | |
#ifdef FEAT_MBYTE | |
- if (lbuf[0] == '!' && pats == &orgpat | |
+ if (lbuf[0] == '!' && pats == &orgpat && !checked_fileenc | |
&& STRNCMP(lbuf, "!_TAG_FILE_ENCODING\t", 20) == 0) | |
{ | |
/* Convert the search pattern from 'encoding' to the | |
@@ -1858,6 +1861,8 @@ line_read_in: | |
pats->regmatch.rm_ic = orgpat.regmatch.rm_ic; | |
} | |
} | |
+ else | |
+ checked_fileenc = TRUE; | |
/* Prepare for converting a match the other way around. */ | |
convert_setup(&vimconv, lbuf + 20, p_enc); | |
diff --git a/src/version.c b/src/version.c | |
index 8c4d077..a261410 100644 | |
--- a/src/version.c | |
+++ b/src/version.c | |
@@ -528,6 +528,11 @@ static char *(features[]) = | |
#else | |
"-ruby", | |
#endif | |
+#ifdef FEAT_RUBY19 | |
+ "+ruby19/dyn", | |
+#else | |
+ "-ruby19", | |
+#endif | |
#ifdef FEAT_SCROLLBIND | |
"+scrollbind", | |
#else | |
diff --git a/src/vim.h b/src/vim.h | |
index e79ea58..fdbe136 100644 | |
--- a/src/vim.h | |
+++ b/src/vim.h | |
@@ -27,6 +27,13 @@ | |
# endif | |
#endif | |
+#if !defined(FEAT_RUBY) && defined(FEAT_RUBY19) | |
+ Error: !FEAT_RUBY && FEAT_RUBY19 is not supported. | |
+#endif | |
+#if defined(FEAT_RUBY19) && !defined(DYNAMIC_RUBY) | |
+ Error: FEAT_RUBY19 && !DYNAMIC_RUBY is not supported. | |
+#endif | |
+ | |
/* ============ the header file puzzle (ca. 50-100 pieces) ========= */ | |
#ifdef HAVE_CONFIG_H /* GNU autoconf (or something else) was here */ | |
@@ -666,7 +673,12 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); | |
#define HL_UNDERLINE 0x08 | |
#define HL_UNDERCURL 0x10 | |
#define HL_STANDOUT 0x20 | |
-#define HL_ALL 0x3f | |
+#if defined(FEAT_GUI_MACVIM) | |
+# define HL_THICKUNDERLINE 0x40 | |
+# define HL_ALL 0x7f | |
+#else | |
+# define HL_ALL 0x3f | |
+#endif | |
/* special attribute addition: Put message in history */ | |
#define MSG_HIST 0x1000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment