Skip to content
Snippets Groups Projects
Commit c0f3cfd2 authored by George Nachman's avatar George Nachman
Browse files

Untested. Add unicode 9 support

parent 6cd1515b
No related branches found
No related tags found
No related merge requests found
Showing
with 784 additions and 397 deletions
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10116" systemVersion="15C50" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10116"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
<capability name="box content view" minToolsVersion="7.0"/>
</dependencies>
<objects>
Loading
Loading
@@ -2983,11 +2983,11 @@ DQ
<point key="canvasLocation" x="1031.5" y="300"/>
</customView>
<customView id="0rQ-EK-tyN" userLabel="Prefs - Profiles - Terminal" customClass="iTermSizeRememberingView">
<rect key="frame" x="0.0" y="0.0" width="578" height="533"/>
<rect key="frame" x="0.0" y="0.0" width="578" height="544"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<popUpButton verticalHuggingPriority="750" id="2390">
<rect key="frame" x="166" y="374" width="331" height="26"/>
<rect key="frame" x="166" y="385" width="331" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="clipping" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" id="2427">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
Loading
Loading
@@ -3000,7 +3000,7 @@ DQ
</connections>
</popUpButton>
<textField verticalHuggingPriority="750" id="2391">
<rect key="frame" x="27" y="378" width="136" height="19"/>
<rect key="frame" x="27" y="389" width="136" height="19"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Character Encoding:" id="2426">
<font key="font" metaFont="system"/>
Loading
Loading
@@ -3009,7 +3009,7 @@ DQ
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" id="2393">
<rect key="frame" x="23" y="352" width="142" height="17"/>
<rect key="frame" x="23" y="363" width="142" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="left" title="Report Terminal Type:" id="2424">
<font key="font" metaFont="system"/>
Loading
Loading
@@ -3018,7 +3018,7 @@ DQ
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" id="2400">
<rect key="frame" x="21" y="483" width="144" height="19"/>
<rect key="frame" x="21" y="494" width="144" height="19"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Scrollback Lines:" id="2417">
<font key="font" metaFont="system"/>
Loading
Loading
@@ -3027,7 +3027,7 @@ DQ
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" id="2401">
<rect key="frame" x="168" y="483" width="171" height="22"/>
<rect key="frame" x="168" y="494" width="171" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" drawsBackground="YES" id="2416">
<font key="font" metaFont="system"/>
Loading
Loading
@@ -3040,7 +3040,7 @@ DQ
</connections>
</textField>
<comboBox verticalHuggingPriority="750" id="2405">
<rect key="frame" x="168" y="346" width="329" height="26"/>
<rect key="frame" x="168" y="357" width="329" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<comboBoxCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" title="vt100" drawsBackground="YES" completes="NO" numberOfVisibleItems="7" id="2412">
<font key="font" metaFont="system"/>
Loading
Loading
@@ -3063,7 +3063,7 @@ DQ
</connections>
</comboBox>
<textField verticalHuggingPriority="750" id="2434">
<rect key="frame" x="19" y="513" width="125" height="17"/>
<rect key="frame" x="19" y="524" width="125" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Scrollback Buffer" id="2435">
<font key="font" metaFont="systemBold"/>
Loading
Loading
@@ -3072,7 +3072,7 @@ DQ
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" id="2436">
<rect key="frame" x="19" y="406" width="136" height="17"/>
<rect key="frame" x="19" y="417" width="136" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Terminal Emulation" id="2437">
<font key="font" metaFont="systemBold"/>
Loading
Loading
@@ -3081,7 +3081,7 @@ DQ
</textFieldCell>
</textField>
<button id="5154">
<rect key="frame" x="21" y="459" width="391" height="18"/>
<rect key="frame" x="21" y="470" width="391" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<string key="toolTip">When using a program like tmux, which shows a status bar at the bottom of the screen, history is not normally saved. This allows such history to be saved but with a performance penalty.</string>
<buttonCell key="cell" type="check" title="Save lines to scrollback when an app status bar is present" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="5155">
Loading
Loading
@@ -3094,7 +3094,7 @@ DQ
</connections>
</button>
<button id="5758">
<rect key="frame" x="21" y="439" width="391" height="18"/>
<rect key="frame" x="21" y="450" width="391" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Save lines to scrollback in alternate screen mode" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="5759">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
Loading
Loading
@@ -3106,7 +3106,7 @@ DQ
</connections>
</button>
<textField verticalHuggingPriority="750" id="Fzk-rB-88j">
<rect key="frame" x="45" y="324" width="120" height="17"/>
<rect key="frame" x="45" y="335" width="120" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="left" title="ENQ Answer Back:" id="Lrt-Oz-1A8">
<font key="font" metaFont="system"/>
Loading
Loading
@@ -3115,7 +3115,7 @@ DQ
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" id="tcJ-V2-9Fd" userLabel="ENQ Answer Back text field">
<rect key="frame" x="168" y="321" width="326" height="22"/>
<rect key="frame" x="168" y="332" width="326" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" continuous="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" drawsBackground="YES" id="UkZ-8d-b91">
<font key="font" metaFont="system"/>
Loading
Loading
@@ -3151,6 +3151,19 @@ DQ
<outlet property="nextKeyView" destination="5081" id="5277"/>
</connections>
</button>
<button id="ajt-kG-p4I">
<rect key="frame" x="21" y="311" width="457" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<string key="toolTip">Apps (such as your shell or your editor) expect each character to have a particular “width,” between 0 and 2 cells. If the app and the terminal emulator have different width tables, rendering problems ensue. Notably, Unicode 8 defines most Emoji to be 1 cell wide. Most fonts render them as two cells wide. Unicode 9 fixes this. If your apps have been updated for Unicode 9, you should enable this.</string>
<buttonCell key="cell" type="check" title="Use Unicode version 9 character widths (requires updated applications)" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="5IL-Lg-bXE">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="settingChanged:" target="gMD-DK-gev" id="Tc3-SE-3jl"/>
<outlet property="nextKeyView" destination="5081" id="hVw-Zk-eFF"/>
</connections>
</button>
<button id="2403">
<rect key="frame" x="283" y="176" width="160" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
Loading
Loading
@@ -3329,7 +3342,7 @@ DQ
</connections>
</button>
<button id="3647">
<rect key="frame" x="345" y="485" width="151" height="18"/>
<rect key="frame" x="345" y="496" width="151" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Unlimited scrollback" bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="3648">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
Loading
Loading
@@ -3341,7 +3354,7 @@ DQ
</connections>
</button>
</subviews>
<point key="canvasLocation" x="521" y="-164.5"/>
<point key="canvasLocation" x="530" y="-271"/>
</customView>
<customView id="ayN-Cl-pQs" userLabel="Prefs - Profiles - Session" customClass="iTermSizeRememberingView">
<rect key="frame" x="0.0" y="0.0" width="559" height="420"/>
Loading
Loading
Loading
Loading
@@ -16,6 +16,8 @@
#import "VT100Screen.h"
#import "iTermSelection.h"
 
static const NSInteger kUnicodeVersion = 9;
// This macro can be used in tests to document a known bug. The first expression would evaluate to
// true if the bug were fixed. Until then, the second expression unfortunately does evaluate to true.
#define ITERM_TEST_KNOWN_BUG(expressionThatShouldBeTrue, expressionThatIsTrue) \
Loading
Loading
@@ -434,7 +436,8 @@ NSLog(@"Known bug: %s should be true, but %s is.", #expressionThatShouldBeTrue,
NO,
NULL,
NULL,
NO);
NO,
kUnicodeVersion);
return data;
}
 
Loading
Loading
Loading
Loading
@@ -16,6 +16,8 @@
#import <OCHamcrest/OCHamcrest.h>
#import <OCMockito/OCMockito.h>
 
static const NSInteger kUnicodeVersion = 9;
@interface iTermTextExtractorTest : XCTestCase<iTermTextDataSource>
 
@end
Loading
Loading
@@ -295,7 +297,8 @@
NO,
NULL,
NULL,
NO);
NO,
kUnicodeVersion);
screen_char_t *buffer = data.mutableBytes;
// Turn replacement characters into tab fillers. StringToScreenChars removes private range codes.
buffer[2].code = 0xf001;
Loading
Loading
@@ -335,7 +338,8 @@
NO,
NULL,
NULL,
NO);
NO,
kUnicodeVersion);
screen_char_t *buffer = data.mutableBytes;
// Turn replacement characters into tab fillers. StringToScreenChars removes private range codes.
buffer[2].code = 0xf001;
Loading
Loading
@@ -379,7 +383,8 @@
NO,
NULL,
NULL,
NO);
NO,
kUnicodeVersion);
return len;
}
}
Loading
Loading
@@ -418,7 +423,8 @@
NO,
NULL,
NULL,
NO);
NO,
kUnicodeVersion);
_buffer[len].code = EOL_SOFT;
}
Loading
Loading
Loading
Loading
@@ -151,6 +151,7 @@
#define KEY_VISUAL_BELL @"Visual Bell"
#define KEY_FLASHING_BELL @"Flashing Bell"
#define KEY_XTERM_MOUSE_REPORTING @"Mouse Reporting"
#define KEY_UNICODE_VERSION @"Unicode Version"
#define KEY_DISABLE_SMCUP_RMCUP @"Disable Smcup Rmcup"
#define KEY_ALLOW_TITLE_REPORTING @"Allow Title Reporting"
#define KEY_ALLOW_TITLE_SETTING @"Allow Title Setting"
Loading
Loading
@@ -202,6 +203,9 @@
// Dynamic Profiles (not in prefs ui)
#define KEY_DYNAMIC_PROFILE_PARENT_NAME @"Dynamic Profile Parent Name"
 
// Posted when a session's unicode version changes.
extern NSString *const iTermUnicodeVersionDidChangeNotification;
// Minimum time between sending anti-idle codes. "1" otherwise results in a flood.
extern const NSTimeInterval kMinimumAntiIdlePeriod;
 
Loading
Loading
Loading
Loading
@@ -45,6 +45,7 @@ static NSString *const kLineBufferTruncatedKey = @"Truncated";
static NSString *const kLineBufferMayHaveDWCKey = @"May Have Double Width Character";
 
static const int kLineBufferVersion = 1;
static const NSInteger kUnicodeVersion = 9;
 
@implementation LineBuffer {
// An array of LineBlock*s.
Loading
Loading
@@ -1144,7 +1145,7 @@ static int RawNumLines(LineBuffer* buffer, int width) {
fg.backgroundColorMode = ColorModeAlternate;
bg.backgroundColor = ALTSEM_REVERSED_DEFAULT;
bg.backgroundColorMode = ColorModeAlternate;
StringToScreenChars(message, buffer, fg, bg, &len, NO, NULL, NULL, NO);
StringToScreenChars(message, buffer, fg, bg, &len, NO, NULL, NULL, NO, kUnicodeVersion);
[self appendLine:buffer
length:0
partial:NO
Loading
Loading
Loading
Loading
@@ -13,12 +13,12 @@
// See EastAsianWidth.txt in Unicode 6.0.
 
// Full-width characters.
+ (instancetype)fullWidthCharacterSet;
+ (instancetype)fullWidthCharacterSetForUnicodeVersion:(NSInteger)version;
 
// Ambiguous-width characters.
+ (instancetype)ambiguousWidthCharacterSet;
+ (instancetype)ambiguousWidthCharacterSetForUnicodeVersion:(NSInteger)version;
 
// Zero-width spaces.
+ (instancetype)zeroWidthSpaceCharacterSet;
+ (instancetype)zeroWidthSpaceCharacterSetForUnicodeVersion:(NSInteger)version;
 
@end
This diff is collapsed.
Loading
Loading
@@ -55,7 +55,8 @@ int decode_utf8_char(const unsigned char * restrict datap,
 
+ (NSString *)stringWithInt:(int)num;
+ (BOOL)isDoubleWidthCharacter:(int)unicode
ambiguousIsDoubleWidth:(BOOL)ambiguousIsDoubleWidth;
ambiguousIsDoubleWidth:(BOOL)ambiguousIsDoubleWidth
unicodeVersion:(NSInteger)version;
+ (NSString *)stringWithLongCharacter:(UTF32Char)longCharacter;
 
// Returns the current string on the pasteboard (if any).
Loading
Loading
Loading
Loading
@@ -43,18 +43,19 @@
}
 
+ (BOOL)isDoubleWidthCharacter:(int)unicode
ambiguousIsDoubleWidth:(BOOL)ambiguousIsDoubleWidth {
ambiguousIsDoubleWidth:(BOOL)ambiguousIsDoubleWidth
unicodeVersion:(NSInteger)version {
if (unicode <= 0xa0 ||
(unicode > 0x452 && unicode < 0x1100)) {
// Quickly cover the common cases.
return NO;
}
 
if ([[NSCharacterSet fullWidthCharacterSet] longCharacterIsMember:unicode]) {
if ([[NSCharacterSet fullWidthCharacterSetForUnicodeVersion:version] longCharacterIsMember:unicode]) {
return YES;
}
if (ambiguousIsDoubleWidth &&
[[NSCharacterSet ambiguousWidthCharacterSet] longCharacterIsMember:unicode]) {
[[NSCharacterSet ambiguousWidthCharacterSetForUnicodeVersion:version] longCharacterIsMember:unicode]) {
return YES;
}
return NO;
Loading
Loading
Loading
Loading
@@ -77,6 +77,9 @@
#include <unistd.h>
#import <CoreFoundation/CoreFoundation.h>
 
static const NSInteger kMinimumUnicodeVersion = 8;
static const NSInteger kMaximumUnicodeVersion = 9;
// The format for a user defaults key that recalls if the user has already been pestered about
// outdated key mappings for a give profile. The %@ is replaced with the profile's GUID.
static NSString *const kAskAboutOutdatedKeyMappingKeyFormat = @"AskAboutOutdatedKeyMappingForGuid%@";
Loading
Loading
@@ -371,6 +374,9 @@ static const NSTimeInterval kBackgroundUpdateCadence = 1;
// Estimates throughput for adaptive framerate.
iTermThroughputEstimator *_throughputEstimator;
// Current unicode version.
NSInteger _unicodeVersion;
}
 
+ (void)registerSessionInArrangement:(NSDictionary *)arrangement {
Loading
Loading
@@ -2773,6 +2779,8 @@ ITERM_WEAKLY_REFERENCEABLE
inProfile:aDict]];
[self setXtermMouseReporting:[iTermProfilePreferences boolForKey:KEY_XTERM_MOUSE_REPORTING
inProfile:aDict]];
[self setUnicodeVersion:[iTermProfilePreferences boolForKey:KEY_UNICODE_VERSION
inProfile:aDict]];
[_terminal setDisableSmcupRmcup:[iTermProfilePreferences boolForKey:KEY_DISABLE_SMCUP_RMCUP
inProfile:aDict]];
[_screen setAllowTitleReporting:[iTermProfilePreferences boolForKey:KEY_ALLOW_TITLE_REPORTING
Loading
Loading
@@ -3174,12 +3182,20 @@ ITERM_WEAKLY_REFERENCEABLE
[_textview setUseItalicFont:italicFlag];
}
 
- (void)setTreatAmbiguousWidthAsDoubleWidth:(BOOL)set
{
- (void)setTreatAmbiguousWidthAsDoubleWidth:(BOOL)set {
_treatAmbiguousWidthAsDoubleWidth = set;
_tmuxController.ambiguousIsDoubleWidth = set;
}
 
- (void)setUnicodeVersion:(NSInteger)version {
[self setSessionSpecificProfileValues:@{ KEY_UNICODE_VERSION: @(version) }];
[[NSNotificationCenter defaultCenter] postNotificationName:iTermUnicodeVersionDidChangeNotification
object:nil];
_unicodeVersion = version;
_tmuxController.unicodeVersion = version;
}
- (void)setXtermMouseReporting:(BOOL)set
{
_xtermMouseReporting = set;
Loading
Loading
@@ -4071,6 +4087,7 @@ ITERM_WEAKLY_REFERENCEABLE
_tmuxController = [[TmuxController alloc] initWithGateway:_tmuxGateway
clientName:[self preferredTmuxClientName]];
_tmuxController.ambiguousIsDoubleWidth = _treatAmbiguousWidthAsDoubleWidth;
_tmuxController.unicodeVersion = _unicodeVersion;
NSSize theSize;
Profile *tmuxBookmark = [_delegate tmuxBookmark];
theSize.width = MAX(1, [[tmuxBookmark objectForKey:KEY_COLUMNS] intValue]);
Loading
Loading
@@ -5759,6 +5776,10 @@ ITERM_WEAKLY_REFERENCEABLE
}
}
 
- (NSInteger)textViewUnicodeVersion {
return _unicodeVersion;
}
- (void)sendEscapeSequence:(NSString *)text
{
if (_exited) {
Loading
Loading
@@ -7172,6 +7193,16 @@ ITERM_WEAKLY_REFERENCEABLE
return [iTermProfilePreferences boolForKey:KEY_REDUCE_FLICKER inProfile:self.profile];
}
 
- (NSInteger)screenUnicodeVersion {
return _unicodeVersion;
}
- (void)screenSetUnicodeVersion:(NSInteger)unicodeVersion {
if (unicodeVersion >= kMinimumUnicodeVersion && unicodeVersion <= kMaximumUnicodeVersion) {
[self setUnicodeVersion:unicodeVersion];
}
}
#pragma mark - Announcements
 
- (BOOL)hasAnnouncementWithIdentifier:(NSString *)identifier {
Loading
Loading
Loading
Loading
@@ -165,6 +165,8 @@ typedef NS_ENUM(NSInteger, PTYTextViewSelectionExtensionUnit) {
// Update the text view's frame needed.
- (void)textViewResizeFrameIfNeeded;
 
- (NSInteger)textViewUnicodeVersion;
@end
 
@interface PTYTextView : NSView <
Loading
Loading
Loading
Loading
@@ -5622,7 +5622,8 @@ static double EuclideanDistance(NSPoint p1, NSPoint p2) {
[_delegate textViewAmbiguousWidthCharsAreDoubleWidth],
NULL,
NULL,
[_delegate textViewUseHFSPlusMapping]);
[_delegate textViewUseHFSPlusMapping],
[_delegate textViewUnicodeVersion]);
 
// Count how many additional cells are needed due to double-width chars
// that span line breaks being wrapped to the next line.
Loading
Loading
Loading
Loading
@@ -34,6 +34,7 @@
IBOutlet NSButton *_setLocaleVars;
IBOutlet NSButton *_forceCommandPromptToFirstColumn;
IBOutlet NSButton *_showMarkIndicators;
IBOutlet NSButton *_unicodeVersion9;
 
IBOutlet NSPanel *_filterAlertsPanel;
IBOutlet NSButton *_bellAlert;
Loading
Loading
@@ -43,6 +44,11 @@
IBOutlet NSButton *_terminalGeneratedAlerts;
}
 
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super dealloc];
}
- (void)awakeFromNib {
PreferenceInfo *info;
info = [self defineControl:_numScrollbackLines
Loading
Loading
@@ -90,6 +96,19 @@
key:KEY_ANSWERBACK_STRING
type:kPreferenceInfoTypeStringTextField];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(unicodeVersionDidChange) name:iTermUnicodeVersionDidChangeNotification object:nil];
info = [self defineControl:_unicodeVersion9
key:KEY_UNICODE_VERSION
type:kPreferenceInfoTypeCheckbox];
info.onUpdate = ^BOOL() {
_unicodeVersion9.state = [self integerForKey:KEY_UNICODE_VERSION] == 9 ? NSOnState : NSOffState;
return YES;
};
info.customSettingChangedHandler = ^(id sender) {
const NSInteger version = (_unicodeVersion9.state == NSOnState) ? 9 : 8;
[self setInteger:version forKey:KEY_UNICODE_VERSION];
};
[self defineControl:_xtermMouseReporting
key:KEY_XTERM_MOUSE_REPORTING
type:kPreferenceInfoTypeCheckbox];
Loading
Loading
// -*- mode:objc -*-
/*
** ScreenChar.h
**
Loading
Loading
@@ -381,7 +380,8 @@ void StringToScreenChars(NSString *s,
BOOL ambiguousIsDoubleWidth,
int *cursorIndex,
BOOL *foundDwc,
BOOL useHFSPlusMapping);
BOOL useHFSPlusMapping,
NSInteger unicodeVersion);
 
// Copy attributes from fg and bg, and zero out other fields. Text attributes like bold, italic, etc.
// come from fg.
Loading
Loading
Loading
Loading
@@ -523,10 +523,11 @@ void StringToScreenChars(NSString *s,
BOOL ambiguousIsDoubleWidth,
int* cursorIndex,
BOOL *foundDwc,
BOOL useHFSPlusMapping) {
BOOL useHFSPlusMapping,
NSInteger unicodeVersion) {
__block NSInteger j = 0;
__block BOOL foundCursor = NO;
NSCharacterSet *zeroWidthSpaces = [NSCharacterSet zeroWidthSpaceCharacterSet];
NSCharacterSet *zeroWidthSpaces = [NSCharacterSet zeroWidthSpaceCharacterSetForUnicodeVersion:unicodeVersion];
[s enumerateComposedCharacters:^(NSRange range,
unichar baseBmpChar,
NSString *composedOrNonBmpChar,
Loading
Loading
@@ -560,7 +561,8 @@ void StringToScreenChars(NSString *s,
buf[j].complexChar = NO;
 
isDoubleWidth = [NSString isDoubleWidthCharacter:baseBmpChar
ambiguousIsDoubleWidth:ambiguousIsDoubleWidth];
ambiguousIsDoubleWidth:ambiguousIsDoubleWidth
unicodeVersion:unicodeVersion];
} else {
SetComplexCharInScreenChar(buf + j, composedOrNonBmpChar, useHFSPlusMapping);
UTF32Char baseChar = [composedOrNonBmpChar characterAtIndex:0];
Loading
Loading
@@ -568,7 +570,8 @@ void StringToScreenChars(NSString *s,
baseChar = DecodeSurrogatePair(baseChar, [composedOrNonBmpChar characterAtIndex:1]);
}
isDoubleWidth = [NSString isDoubleWidthCharacter:baseChar
ambiguousIsDoubleWidth:ambiguousIsDoubleWidth];
ambiguousIsDoubleWidth:ambiguousIsDoubleWidth
unicodeVersion:unicodeVersion];
}
 
// Append a DWC_RIGHT if the base character is double-width.
Loading
Loading
Loading
Loading
@@ -38,6 +38,7 @@ extern NSString *const kTmuxControllerSessionWasRenamed;
@property(nonatomic, copy) NSString *sessionName;
@property(nonatomic, retain) NSArray *sessions;
@property(nonatomic, assign) BOOL ambiguousIsDoubleWidth;
@property(nonatomic, assign) NSInteger unicodeVersion;
@property(nonatomic, readonly) NSString *clientName;
@property(nonatomic, readonly) int sessionId;
@property(nonatomic, readonly) BOOL hasOutstandingWindowResize;
Loading
Loading
Loading
Loading
@@ -139,6 +139,7 @@ static NSString *kListWindowsFormat = @"\"#{session_name}\t#{window_id}\t"
[pendingWindowOpens_ addObject:n];
TmuxWindowOpener *windowOpener = [TmuxWindowOpener windowOpener];
windowOpener.ambiguousIsDoubleWidth = ambiguousIsDoubleWidth_;
windowOpener.unicodeVersion = self.unicodeVersion;
windowOpener.windowIndex = windowIndex;
windowOpener.name = name;
windowOpener.size = size;
Loading
Loading
@@ -161,6 +162,7 @@ static NSString *kListWindowsFormat = @"\"#{session_name}\t#{window_id}\t"
DLog(@"setLayoutInTab:%@ toLayout:%@ zoomed:%@", tab, layout, zoomed);
TmuxWindowOpener *windowOpener = [TmuxWindowOpener windowOpener];
windowOpener.ambiguousIsDoubleWidth = ambiguousIsDoubleWidth_;
windowOpener.unicodeVersion = self.unicodeVersion;
windowOpener.layout = layout;
windowOpener.maxHistory =
MAX([[gateway_ delegate] tmuxBookmarkSize].height,
Loading
Loading
Loading
Loading
@@ -11,6 +11,7 @@
 
+ (instancetype)sharedInstance;
- (NSArray<NSData *> *)parseDumpHistoryResponse:(NSString *)response
ambiguousIsDoubleWidth:(BOOL)ambiguousIsDoubleWidth;
ambiguousIsDoubleWidth:(BOOL)ambiguousIsDoubleWidth
unicodeVersion:(NSInteger)unicodeVersion;
 
@end
Loading
Loading
@@ -25,7 +25,7 @@
- (NSData *)dataForHistoryLine:(NSString *)hist
withTerminal:(VT100Terminal *)terminal
ambiguousIsDoubleWidth:(BOOL)ambiguousIsDoubleWidth
{
unicodeVersion:(NSInteger)unicodeVersion {
screen_char_t *screenChars;
NSMutableData *result = [NSMutableData data];
NSData *histData = [hist dataUsingEncoding:NSUTF8StringEncoding];
Loading
Loading
@@ -56,7 +56,8 @@
ambiguousIsDoubleWidth,
NULL,
NULL,
NO);
NO,
unicodeVersion);
if ([token isAscii] && [terminal charset]) {
ConvertCharsToGraphicsCharset(screenChars, len);
}
Loading
Loading
@@ -75,7 +76,7 @@
// with the last element in each being the newline. Returns nil on error.
- (NSArray *)parseDumpHistoryResponse:(NSString *)response
ambiguousIsDoubleWidth:(BOOL)ambiguousIsDoubleWidth
{
unicodeVersion:(NSInteger)unicodeVersion {
if (![response length]) {
return [NSArray array];
}
Loading
Loading
@@ -86,7 +87,8 @@
for (NSString *line in lines) {
NSData *data = [self dataForHistoryLine:line
withTerminal:terminal
ambiguousIsDoubleWidth:ambiguousIsDoubleWidth];
ambiguousIsDoubleWidth:ambiguousIsDoubleWidth
unicodeVersion:unicodeVersion];
if (!data) {
return nil;
}
Loading
Loading
Loading
Loading
@@ -34,6 +34,7 @@ extern NSString *const kTmuxWindowOpenerWindowOptionStyleValueFullScreen;
@property (nonatomic, assign) BOOL ambiguousIsDoubleWidth;
// Nil means make no change, otherwise is a bool.
@property (nonatomic, retain) NSNumber *zoomed;
@property (nonatomic, assign) NSInteger unicodeVersion;
 
// Maps a window ID as a string to a dictionary of window flags (see WindowFlag constants above).
@property (nonatomic, retain) NSDictionary *windowOptions;
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment