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

Improvements to double width character cache.

- Enable it for nightly build users
- 1% of lookups are checked for correctness, leaving a crashlog on failure
- Clear the DWC cache when dropping a line. I beleive this was the cause of the assertions in beta 6 and 7.
- Make the check for nightly build faster
parent a15db16e
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -7199,7 +7199,8 @@
DevelopmentTeam = H7V7XYVQ7D;
};
874206460564169600CFC3F1 = {
ProvisioningStyle = Manual;
DevelopmentTeam = H7V7XYVQ7D;
ProvisioningStyle = Automatic;
};
A66717851DCE36C3000CE608 = {
DevelopmentTeam = H7V7XYVQ7D;
Loading
Loading
@@ -8976,10 +8977,10 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_WARN_INT_CONVERSION = YES;
CODE_SIGN_IDENTITY = "Developer ID Application: GEORGE NACHMAN (H7V7XYVQ7D)";
CODE_SIGN_IDENTITY = "Mac Developer";
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = YES;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = H7V7XYVQ7D;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)",
Loading
Loading
@@ -10157,11 +10158,11 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_WARN_INT_CONVERSION = YES;
CODE_SIGN_IDENTITY = "Developer ID Application: GEORGE NACHMAN (H7V7XYVQ7D)";
CODE_SIGN_IDENTITY = "Mac Developer";
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = H7V7XYVQ7D;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)",
Loading
Loading
@@ -10228,10 +10229,10 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_WARN_INT_CONVERSION = YES;
CODE_SIGN_IDENTITY = "Developer ID Application: GEORGE NACHMAN (H7V7XYVQ7D)";
CODE_SIGN_IDENTITY = "Mac Developer";
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = YES;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = H7V7XYVQ7D;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)",
Loading
Loading
@@ -79,11 +79,6 @@
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
<AdditionalOption
key = "NSZombieEnabled"
value = "YES"
isEnabled = "YES">
</AdditionalOption>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
Loading
Loading
Loading
Loading
@@ -7,6 +7,8 @@
//
 
#import "LineBlock.h"
#import "DebugLogging.h"
#import "FindContext.h"
#import "LineBufferHelpers.h"
#import "NSBundle+iTerm.h"
Loading
Loading
@@ -14,6 +16,7 @@
#import "iTermAdvancedSettingsModel.h"
 
static BOOL gEnableDoubleWidthCharacterLineCache = NO;
static BOOL gUseCachingNumberOfLines = NO;
 
NSString *const kLineBlockRawBufferKey = @"Raw Buffer";
NSString *const kLineBlockBufferStartOffsetKey = @"Buffer Start Offset";
Loading
Loading
@@ -92,6 +95,7 @@ void EnableDoubleWidthCharacterLineCache() {
if ([iTermAdvancedSettingsModel dwcLineCache] ||
[NSBundle it_isNightlyBuild]) {
gEnableDoubleWidthCharacterLineCache = YES;
gUseCachingNumberOfLines = YES;
}
});
 
Loading
Loading
@@ -560,12 +564,25 @@ int OffsetOfWrappedLine(screen_char_t* p, int n, int length, int width, BOOL may
 
int spans;
#warning I think the cache was causing crashes in OffsetOfWrappedLine later in this function. See if that is true in beta 8.
const BOOL useCache = NO;
const BOOL useCache = gUseCachingNumberOfLines;
if (useCache && _mayHaveDoubleWidthCharacter) {
LineBlockMetadata *metadata = &metadata_[i];
if (metadata->width_for_number_of_wrapped_lines == width &&
metadata->number_of_wrapped_lines > 0) {
spans = metadata->number_of_wrapped_lines;
#warning Remove this when I feel confident it is correct
if (arc4random_uniform(100) == 0) {
// Correctness checking code follows. Remove this for speed when I think it's correct.
int referenceSpans = NumberOfFullLines(buffer_start + prev,
length,
width,
_mayHaveDoubleWidthCharacter);
if (spans != referenceSpans) {
ILog(@"Metadata gives number of wrapped lines = %@ for width %@ while reference = %@", @(metadata->number_of_wrapped_lines), @(width), @(referenceSpans));
assert(false);
}
}
} else {
spans = NumberOfFullLines(buffer_start + prev,
length,
Loading
Loading
@@ -829,6 +846,7 @@ int OffsetOfWrappedLine(screen_char_t* p, int n, int length, int width, BOOL may
int initialOffset = start_offset;
for (i = first_entry; i < cll_entries; ++i) {
int cll = cumulative_line_lengths[i] - start_offset;
LineBlockMetadata *metadata = &metadata_[i];
length = cll - prev;
// Get the number of full-length wrapped lines in this raw line. If there
// were only single-width characters the formula would be:
Loading
Loading
@@ -858,6 +876,12 @@ int OffsetOfWrappedLine(screen_char_t* p, int n, int length, int width, BOOL may
buffer_start += prev + offset;
start_offset = buffer_start - raw_buffer;
first_entry = i;
metadata->number_of_wrapped_lines = 0;
if (gEnableDoubleWidthCharacterLineCache) {
[metadata_[i].double_width_characters release];
metadata_[i].double_width_characters = nil;
}
*charsDropped = start_offset - initialOffset;
 
#ifdef TEST_LINEBUFFER_SANITY
Loading
Loading
Loading
Loading
@@ -11,8 +11,13 @@
@implementation NSBundle (iTerm)
 
+ (BOOL)it_isNightlyBuild {
NSString *testingFeed = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"SUFeedURLForTesting"];
return [testingFeed containsString:@"nightly"];
static dispatch_once_t onceToken;
static BOOL result;
dispatch_once(&onceToken, ^{
NSString *testingFeed = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"SUFeedURLForTesting"];
result = [testingFeed containsString:@"nightly"];
});
return result;
}
 
+ (BOOL)it_isEarlyAdopter {
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