mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-05-28 00:21:57 +02:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4dd200f7ac | |||
| ff28b66f41 | |||
| d23c46d07e |
+15
-34
@@ -1,8 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11762" systemVersion="15G1611" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
|
||||
<dependencies>
|
||||
<deployment version="1050" identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9531"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11762"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="MMPreferenceController">
|
||||
@@ -13,7 +14,7 @@
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<userDefaultsController representsSharedInstance="YES" id="58" userLabel="Shared Defaults"/>
|
||||
<customView id="115" userLabel="General">
|
||||
<rect key="frame" x="0.0" y="0.0" width="483" height="290"/>
|
||||
@@ -24,7 +25,7 @@
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<popUpButtonCell key="cell" type="push" title="Keep MacVim Running" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" inset="2" selectedItem="960" id="979">
|
||||
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
<font key="font" metaFont="menu"/>
|
||||
<menu key="menu" title="OtherViews" id="959">
|
||||
<items>
|
||||
<menuItem title="Keep MacVim Running" state="on" id="960"/>
|
||||
@@ -51,7 +52,7 @@
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<popUpButtonCell key="cell" type="push" title="and set the arglist" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" inset="2" selectedItem="436" id="978">
|
||||
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
<font key="font" metaFont="menu"/>
|
||||
<menu key="menu" title="OtherViews" id="429">
|
||||
<items>
|
||||
<menuItem title="with a tab for each file" tag="3" id="430"/>
|
||||
@@ -180,12 +181,12 @@
|
||||
</textField>
|
||||
</subviews>
|
||||
</customView>
|
||||
<customView id="620" userLabel="Advanced">
|
||||
<rect key="frame" x="0.0" y="0.0" width="483" height="318"/>
|
||||
<customView misplaced="YES" id="620" userLabel="Advanced">
|
||||
<rect key="frame" x="0.0" y="0.0" width="483" height="222"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<subviews>
|
||||
<textField verticalHuggingPriority="750" id="826">
|
||||
<rect key="frame" x="17" y="170" width="449" height="56"/>
|
||||
<rect key="frame" x="17" y="74" width="449" height="56"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" id="993">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
@@ -195,7 +196,7 @@
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<button id="817">
|
||||
<rect key="frame" x="18" y="228" width="133" height="18"/>
|
||||
<rect key="frame" x="18" y="132" width="133" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" title="Enable Quickstart" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="992">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
@@ -207,7 +208,7 @@
|
||||
</connections>
|
||||
</button>
|
||||
<textField verticalHuggingPriority="750" id="815">
|
||||
<rect key="frame" x="17" y="252" width="449" height="28"/>
|
||||
<rect key="frame" x="17" y="156" width="449" height="28"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" id="991">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
@@ -217,7 +218,7 @@
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<button id="782">
|
||||
<rect key="frame" x="18" y="282" width="174" height="18"/>
|
||||
<rect key="frame" x="18" y="186" width="174" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" title="Use Core Text renderer" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="990">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
@@ -228,28 +229,7 @@
|
||||
<binding destination="58" name="value" keyPath="values.MMRenderer" id="1000"/>
|
||||
</connections>
|
||||
</button>
|
||||
<textField verticalHuggingPriority="750" id="1001">
|
||||
<rect key="frame" x="17" y="74" width="444" height="70"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" id="1004">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<string key="title">This option causes marked text to be rendered like normal text which is very convenient when using a complex input method (e.g. Kotoeri). However, it has some known limitations which may be circumvented by disabling this option (e.g. mapping to "dead keys" may not work). Note that without this option the Core Text renderer will not draw marked text at all.</string>
|
||||
<color key="textColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<button id="1013">
|
||||
<rect key="frame" x="18" y="146" width="174" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" title="Draw marked text inline" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="1014">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<binding destination="58" name="value" keyPath="values.MMUseInlineIm" id="1016"/>
|
||||
</connections>
|
||||
</button>
|
||||
<textField verticalHuggingPriority="750" id="1017">
|
||||
<textField verticalHuggingPriority="750" misplaced="YES" id="1017">
|
||||
<rect key="frame" x="17" y="20" width="415" height="28"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" id="1020">
|
||||
@@ -259,7 +239,7 @@
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<button id="1028">
|
||||
<button misplaced="YES" id="1028">
|
||||
<rect key="frame" x="18" y="50" width="388" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" title="Prefer native full-screen support (requires Mac OS X 10.7)" bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="1029">
|
||||
@@ -271,6 +251,7 @@
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<point key="canvasLocation" x="54.5" y="-249"/>
|
||||
</customView>
|
||||
</objects>
|
||||
</document>
|
||||
|
||||
Binary file not shown.
@@ -227,9 +227,6 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
[NSNumber numberWithBool:NO], MMVerticalSplitKey,
|
||||
[NSNumber numberWithInt:0], MMPreloadCacheSizeKey,
|
||||
[NSNumber numberWithInt:0], MMLastWindowClosedBehaviorKey,
|
||||
#ifdef INCLUDE_OLD_IM_CODE
|
||||
[NSNumber numberWithBool:YES], MMUseInlineImKey,
|
||||
#endif // INCLUDE_OLD_IM_CODE
|
||||
[NSNumber numberWithBool:NO], MMSuppressTerminationAlertKey,
|
||||
[NSNumber numberWithBool:YES], MMNativeFullScreenKey,
|
||||
[NSNumber numberWithDouble:0.25], MMFullScreenFadeTimeKey,
|
||||
|
||||
@@ -2092,6 +2092,8 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
|
||||
[self setImState:NO];
|
||||
} else if (BackingPropertiesChangedMsgID == msgid) {
|
||||
[self redrawScreen];
|
||||
} else if (RedrawBlockMsgID == msgid) {
|
||||
[self handleRedrawBlock:data];
|
||||
} else {
|
||||
ASLogWarn(@"Unknown message received (msgid=%d)", msgid);
|
||||
}
|
||||
@@ -3008,6 +3010,17 @@ extern GuiFont gui_mch_retain_font(GuiFont font);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)handleRedrawBlock:(NSData *)data
|
||||
{
|
||||
const void *bytes = [data bytes];
|
||||
int row1 = *((int*)bytes); bytes += sizeof(int);
|
||||
int col1 = *((int*)bytes); bytes += sizeof(int);
|
||||
int row2 = *((int*)bytes); bytes += sizeof(int);
|
||||
int col2 = *((int*)bytes);
|
||||
|
||||
gui_redraw_block(row1, col1, row2, col2, GUI_MON_NOCLEAR);
|
||||
}
|
||||
|
||||
#ifdef FEAT_BEVAL
|
||||
- (void)bevalCallback:(id)sender
|
||||
{
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
int maxRows, maxColumns;
|
||||
NSColor *defaultBackgroundColor;
|
||||
NSColor *defaultForegroundColor;
|
||||
int defaultBackgroundHexColor;
|
||||
int defaultForegroundHexColor;
|
||||
NSSize cellSize;
|
||||
NSFont *font;
|
||||
NSFont *fontWide;
|
||||
@@ -51,6 +53,12 @@
|
||||
void *trackingRectUserData_;
|
||||
NSTrackingRectTag lastToolTipTag_;
|
||||
NSString* toolTip_;
|
||||
|
||||
NSUInteger markedRangeLength;
|
||||
int markedTextStartRow;
|
||||
int markedTextStartColumn;
|
||||
int markedTextEndRow;
|
||||
int markedTextEndColumn;
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(NSRect)frame;
|
||||
@@ -87,8 +95,10 @@
|
||||
- (void)setLigatures:(BOOL)state;
|
||||
- (void)setThinStrokes:(BOOL)state;
|
||||
- (void)setImControl:(BOOL)enable;
|
||||
- (void)setInlineIm:(BOOL)enable;
|
||||
- (void)activateIm:(BOOL)enable;
|
||||
- (void)checkImState;
|
||||
- (void)clearMarkedText;
|
||||
- (BOOL)convertPoint:(NSPoint)point toRow:(int *)row column:(int *)column;
|
||||
- (NSRect)rectForRow:(int)row column:(int)column numRows:(int)nr
|
||||
numColumns:(int)nc;
|
||||
|
||||
@@ -205,6 +205,13 @@ defaultAdvanceForFont(NSFont *font)
|
||||
if (defaultBackgroundColor != bgColor) {
|
||||
[defaultBackgroundColor release];
|
||||
defaultBackgroundColor = bgColor ? [bgColor retain] : nil;
|
||||
if (bgColor) {
|
||||
defaultBackgroundHexColor =
|
||||
(int)(bgColor.blueComponent * 0xff) |
|
||||
((int)(bgColor.greenComponent * 0xff) << 8) |
|
||||
((int)(bgColor.redComponent * 0xff) << 16) |
|
||||
(0xff << 24);
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: The default foreground color isn't actually used for anything, but
|
||||
@@ -213,6 +220,13 @@ defaultAdvanceForFont(NSFont *font)
|
||||
if (defaultForegroundColor != fgColor) {
|
||||
[defaultForegroundColor release];
|
||||
defaultForegroundColor = fgColor ? [fgColor retain] : nil;
|
||||
if (fgColor) {
|
||||
defaultForegroundHexColor =
|
||||
(int)(fgColor.blueComponent * 0xff) |
|
||||
((int)(fgColor.greenComponent * 0xff) << 8) |
|
||||
((int)(fgColor.redComponent * 0xff) << 16) |
|
||||
(0xff << 24);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -425,6 +439,11 @@ defaultAdvanceForFont(NSFont *font)
|
||||
[helper setImControl:enable];
|
||||
}
|
||||
|
||||
- (void)setInlineIm:(BOOL)enable
|
||||
{
|
||||
[helper setInlineIm:enable];
|
||||
}
|
||||
|
||||
- (void)activateIm:(BOOL)enable
|
||||
{
|
||||
[helper activateIm:enable];
|
||||
@@ -494,6 +513,23 @@ defaultAdvanceForFont(NSFont *font)
|
||||
[helper setMarkedText:text selectedRange:range];
|
||||
}
|
||||
|
||||
- (void)clearMarkedText
|
||||
{
|
||||
if (![helper inlineIm]) {
|
||||
[self redrawMarkedTextBlock];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)redrawMarkedTextBlock
|
||||
{
|
||||
NSMutableData *data = [NSMutableData data];
|
||||
[data appendBytes:&markedTextStartRow length:sizeof(int)];
|
||||
[data appendBytes:&markedTextStartColumn length:sizeof(int)];
|
||||
[data appendBytes:&markedTextEndRow length:sizeof(int)];
|
||||
[data appendBytes:&markedTextEndColumn length:sizeof(int)];
|
||||
[[self vimController] sendMessage:RedrawBlockMsgID data:data];
|
||||
}
|
||||
|
||||
- (void)unmarkText
|
||||
{
|
||||
[helper unmarkText];
|
||||
@@ -647,6 +683,40 @@ defaultAdvanceForFont(NSFont *font)
|
||||
|
||||
[drawData removeAllObjects];
|
||||
}
|
||||
|
||||
if ([helper hasMarkedText] && ![helper inlineIm]) {
|
||||
NSString *text = [[helper markedText] string];
|
||||
// Draw marked text
|
||||
CFStringRef sref = (__bridge CFStringRef)text;
|
||||
CFIndex unilength = CFStringGetLength(sref);
|
||||
const UniChar *unichars = CFStringGetCharactersPtr(sref);
|
||||
UniChar *buffer = NULL;
|
||||
if (unichars == NULL) {
|
||||
buffer = malloc(unilength * sizeof(UniChar));
|
||||
CFStringGetCharacters(sref, CFRangeMake(0, unilength), buffer);
|
||||
unichars = buffer;
|
||||
}
|
||||
|
||||
int row = [helper preEditRow];
|
||||
int col = [helper preEditColumn];
|
||||
|
||||
markedTextStartRow = row;
|
||||
markedTextEndRow = row;
|
||||
markedTextStartColumn = col;
|
||||
markedTextEndColumn = col + unilength * 2;
|
||||
|
||||
[self drawString:unichars length:unilength
|
||||
atRow:row column:col cells:(unilength * 2)
|
||||
withFlags:(DRAW_WIDE|DRAW_UNDERL)
|
||||
foregroundColor:defaultForegroundHexColor
|
||||
backgroundColor:defaultBackgroundHexColor
|
||||
specialColor:defaultForegroundHexColor];
|
||||
|
||||
if (buffer) {
|
||||
free(buffer);
|
||||
buffer = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)performBatchDrawWithData:(NSData *)data
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
- (void)setLigatures:(BOOL)ligatures;
|
||||
- (void)setThinStrokes:(BOOL)thinStrokes;
|
||||
- (void)setImControl:(BOOL)enable;
|
||||
- (void)setInlineIm:(BOOL)enable;
|
||||
- (void)activateIm:(BOOL)enable;
|
||||
- (void)checkImState;
|
||||
|
||||
@@ -74,4 +75,5 @@
|
||||
- (void)deleteSign:(NSString *)signName;
|
||||
- (void)setToolTipAtMousePoint:(NSString *)string;
|
||||
- (void)setCGLayerEnabled:(BOOL)enabled;
|
||||
- (void)clearMarkedText;
|
||||
@end
|
||||
|
||||
+11
-6
@@ -322,6 +322,11 @@
|
||||
[helper setImControl:enable];
|
||||
}
|
||||
|
||||
- (void)setInlineIm:(BOOL)enable
|
||||
{
|
||||
[helper setInlineIm:enable];
|
||||
}
|
||||
|
||||
- (void)activateIm:(BOOL)enable
|
||||
{
|
||||
[helper activateIm:enable];
|
||||
@@ -557,8 +562,7 @@
|
||||
numInvertRects = 0;
|
||||
}
|
||||
|
||||
#ifdef INCLUDE_OLD_IM_CODE
|
||||
if ([self hasMarkedText] && ![helper useInlineIm]) {
|
||||
if ([self hasMarkedText] && ![helper inlineIm]) {
|
||||
shouldDrawInsertionPoint = YES;
|
||||
MMTextStorage *ts = (MMTextStorage*)[self textStorage];
|
||||
NSSize inset = [self textContainerInset];
|
||||
@@ -616,7 +620,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // INCLUDE_OLD_IM_CODE
|
||||
|
||||
if (shouldDrawInsertionPoint) {
|
||||
MMTextStorage *ts = (MMTextStorage*)[self textStorage];
|
||||
@@ -626,9 +629,8 @@
|
||||
ipRect.origin.x += [self textContainerOrigin].x;
|
||||
ipRect.origin.y += [self textContainerOrigin].y;
|
||||
|
||||
#ifdef INCLUDE_OLD_IM_CODE
|
||||
// Draw insertion point inside marked text.
|
||||
if ([self hasMarkedText] && ![helper useInlineIm]) {
|
||||
if ([self hasMarkedText] && ![helper inlineIm]) {
|
||||
NSFont *theFont = [[self markedTextAttributes]
|
||||
valueForKey:NSFontAttributeName];
|
||||
if (theFont == [ts font])
|
||||
@@ -640,7 +642,6 @@
|
||||
([helper imRange].location +
|
||||
[helper imRange].length);
|
||||
}
|
||||
#endif // INCLUDE_OLD_IM_CODE
|
||||
|
||||
if (MMInsertionPointHorizontal == insertionPointShape) {
|
||||
int frac = ([ts cellSize].height * insertionPointFraction + 99)/100;
|
||||
@@ -730,6 +731,10 @@
|
||||
[helper unmarkText];
|
||||
}
|
||||
|
||||
- (void)clearMarkedText
|
||||
{
|
||||
}
|
||||
|
||||
- (NSRect)firstRectForCharacterRange:(NSRange)range
|
||||
{
|
||||
return [helper firstRectForCharacterRange:range];
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
NSMutableAttributedString *markedText;
|
||||
int preEditRow;
|
||||
int preEditColumn;
|
||||
BOOL inlineIm;
|
||||
BOOL imControl;
|
||||
BOOL imState;
|
||||
TISInputSourceRef lastImSource;
|
||||
@@ -90,7 +91,8 @@
|
||||
- (NSRect)firstRectForCharacterRange:(NSRange)range;
|
||||
- (void)setImControl:(BOOL)enable;
|
||||
- (void)activateIm:(BOOL)enable;
|
||||
- (BOOL)useInlineIm;
|
||||
- (void)setInlineIm:(BOOL)enable;
|
||||
- (BOOL)inlineIm;
|
||||
- (void)checkImState;
|
||||
|
||||
@end
|
||||
|
||||
@@ -213,6 +213,7 @@ KeyboardInputSourcesEqual(TISInputSourceRef a, TISInputSourceRef b)
|
||||
// called the input manager expects the marked text to be unmarked
|
||||
// automatically, hence the explicit unmarkText: call here.
|
||||
[self unmarkText];
|
||||
[textView clearMarkedText];
|
||||
}
|
||||
|
||||
// NOTE: 'string' is either an NSString or an NSAttributedString. Since we
|
||||
@@ -317,6 +318,7 @@ KeyboardInputSourcesEqual(TISInputSourceRef a, TISInputSourceRef b)
|
||||
// marked text moves outside the view as a result of scrolling.
|
||||
[self sendMarkedText:nil position:0];
|
||||
[self unmarkText];
|
||||
[textView clearMarkedText];
|
||||
[[NSTextInputContext currentInputContext] discardMarkedText];
|
||||
}
|
||||
|
||||
@@ -616,7 +618,7 @@ KeyboardInputSourcesEqual(TISInputSourceRef a, TISInputSourceRef b)
|
||||
ASLogDebug(@"text='%@' range=%@", text, NSStringFromRange(range));
|
||||
[self unmarkText];
|
||||
|
||||
if ([self useInlineIm]) {
|
||||
if (inlineIm) {
|
||||
if ([text isKindOfClass:[NSAttributedString class]])
|
||||
text = [text string];
|
||||
|
||||
@@ -629,7 +631,6 @@ KeyboardInputSourcesEqual(TISInputSourceRef a, TISInputSourceRef b)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef INCLUDE_OLD_IM_CODE
|
||||
if (!(text && [text length] > 0))
|
||||
return;
|
||||
|
||||
@@ -669,7 +670,6 @@ KeyboardInputSourcesEqual(TISInputSourceRef a, TISInputSourceRef b)
|
||||
}
|
||||
|
||||
[textView setNeedsDisplay:YES];
|
||||
#endif // INCLUDE_OLD_IM_CODE
|
||||
}
|
||||
|
||||
- (void)unmarkText
|
||||
@@ -813,14 +813,14 @@ KeyboardInputSourcesEqual(TISInputSourceRef a, TISInputSourceRef b)
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)useInlineIm
|
||||
- (void)setInlineIm:(BOOL)enable
|
||||
{
|
||||
#ifdef INCLUDE_OLD_IM_CODE
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
return [ud boolForKey:MMUseInlineImKey];
|
||||
#else
|
||||
return YES;
|
||||
#endif // INCLUDE_OLD_IM_CODE
|
||||
inlineIm = enable;
|
||||
}
|
||||
|
||||
- (BOOL)inlineIm
|
||||
{
|
||||
return inlineIm;
|
||||
}
|
||||
|
||||
- (void)checkImState
|
||||
@@ -1064,7 +1064,7 @@ KeyboardInputSourcesEqual(TISInputSourceRef a, TISInputSourceRef b)
|
||||
|
||||
- (void)sendMarkedText:(NSString *)text position:(int32_t)pos
|
||||
{
|
||||
if (![self useInlineIm])
|
||||
if (!inlineIm)
|
||||
return;
|
||||
|
||||
NSMutableData *data = [NSMutableData data];
|
||||
|
||||
@@ -833,6 +833,10 @@ static BOOL isUnsafeMessage(int msgid);
|
||||
[[[windowController vimView] textView] activateIm:YES];
|
||||
} else if (DeactivateKeyScriptMsgID == msgid) {
|
||||
[[[windowController vimView] textView] activateIm:NO];
|
||||
} else if (EnableInlineImMsgID == msgid) {
|
||||
[[[windowController vimView] textView] setInlineIm:YES];
|
||||
} else if (DisableInlineImMsgID == msgid) {
|
||||
[[[windowController vimView] textView] setInlineIm:NO];
|
||||
} else if (EnableImControlMsgID == msgid) {
|
||||
[[[windowController vimView] textView] setImControl:YES];
|
||||
} else if (DisableImControlMsgID == msgid) {
|
||||
|
||||
@@ -251,6 +251,9 @@ enum {
|
||||
DisableLigaturesMsgID,
|
||||
EnableThinStrokesMsgID,
|
||||
DisableThinStrokesMsgID,
|
||||
EnableInlineImMsgID,
|
||||
DisableInlineImMsgID,
|
||||
RedrawBlockMsgID,
|
||||
LastMsgID // NOTE: MUST BE LAST MESSAGE IN ENUM!
|
||||
};
|
||||
|
||||
|
||||
@@ -105,6 +105,9 @@ char *MessageStrings[] =
|
||||
"DisableLigaturesMsgID",
|
||||
"EnableThinStrokesMsgID",
|
||||
"DisableThinStrokesMsgID",
|
||||
"EnableInlineImMsgID",
|
||||
"DisableInlineImMsgID",
|
||||
"RedrawBlockMsgID",
|
||||
"END OF MESSAGE IDs" // NOTE: Must be last!
|
||||
};
|
||||
|
||||
|
||||
@@ -13,10 +13,6 @@
|
||||
#import "MacVim.h"
|
||||
|
||||
|
||||
// TODO: Remove this when the inline IM code has been tested
|
||||
#define INCLUDE_OLD_IM_CODE
|
||||
|
||||
|
||||
// NSUserDefaults keys
|
||||
extern NSString *MMTabMinWidthKey;
|
||||
extern NSString *MMTabMaxWidthKey;
|
||||
@@ -45,9 +41,6 @@ extern NSString *MMOpenLayoutKey;
|
||||
extern NSString *MMVerticalSplitKey;
|
||||
extern NSString *MMPreloadCacheSizeKey;
|
||||
extern NSString *MMLastWindowClosedBehaviorKey;
|
||||
#ifdef INCLUDE_OLD_IM_CODE
|
||||
extern NSString *MMUseInlineImKey;
|
||||
#endif // INCLUDE_OLD_IM_CODE
|
||||
extern NSString *MMSuppressTerminationAlertKey;
|
||||
extern NSString *MMNativeFullScreenKey;
|
||||
extern NSString *MMUseMouseTimeKey;
|
||||
|
||||
@@ -41,9 +41,6 @@ NSString *MMOpenLayoutKey = @"MMOpenLayout";
|
||||
NSString *MMVerticalSplitKey = @"MMVerticalSplit";
|
||||
NSString *MMPreloadCacheSizeKey = @"MMPreloadCacheSize";
|
||||
NSString *MMLastWindowClosedBehaviorKey = @"MMLastWindowClosedBehavior";
|
||||
#ifdef INCLUDE_OLD_IM_CODE
|
||||
NSString *MMUseInlineImKey = @"MMUseInlineIm";
|
||||
#endif // INCLUDE_OLD_IM_CODE
|
||||
NSString *MMSuppressTerminationAlertKey = @"MMSuppressTerminationAlert";
|
||||
NSString *MMNativeFullScreenKey = @"MMNativeFullScreen";
|
||||
NSString *MMUseMouseTimeKey = @"MMUseMouseTime";
|
||||
|
||||
@@ -264,6 +264,8 @@ gui_mch_init(void)
|
||||
gui_mch_adjust_charheight();
|
||||
gui_mch_adjust_charwidth();
|
||||
|
||||
gui_macvim_set_imstyle(p_imst);
|
||||
|
||||
if (!MMNoMRU && GARGCOUNT > 0) {
|
||||
// Add files passed on command line to MRU.
|
||||
NSMutableArray *filenames = [NSMutableArray array];
|
||||
@@ -1331,6 +1333,15 @@ im_get_status(void)
|
||||
|
||||
|
||||
|
||||
void
|
||||
gui_macvim_set_imstyle(long imstyle)
|
||||
{
|
||||
int msgid = imstyle == IM_ON_THE_SPOT ?
|
||||
EnableInlineImMsgID : DisableInlineImMsgID;
|
||||
[[MMBackend sharedInstance] queueMessage:msgid properties:nil];
|
||||
}
|
||||
|
||||
|
||||
|
||||
// -- Find & Replace dialog -------------------------------------------------
|
||||
|
||||
|
||||
@@ -9085,6 +9085,9 @@ set_num_option(
|
||||
{
|
||||
if (p_imst != IM_ON_THE_SPOT && p_imst != IM_OVER_THE_SPOT)
|
||||
errmsg = e_invarg;
|
||||
# ifdef FEAT_GUI_MACVIM
|
||||
gui_macvim_set_imstyle(p_imst);
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -235,6 +235,8 @@ gui_mch_find_dialog(exarg_T *eap);
|
||||
gui_mch_replace_dialog(exarg_T *eap);
|
||||
void
|
||||
im_set_control(int enable);
|
||||
void
|
||||
gui_macvim_set_imstyle(long imstyle);
|
||||
|
||||
void *
|
||||
gui_macvim_add_channel(channel_T *channel, ch_part_T part);
|
||||
|
||||
Reference in New Issue
Block a user