Skip to content

Commit

Permalink
Fixed incorrect display update of KParseStatusDecoration
Browse files Browse the repository at this point in the history
  • Loading branch information
rsms committed Apr 23, 2011
1 parent 97a9dbf commit 06a3772
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion resources/style/default.css
Expand Up @@ -89,5 +89,5 @@ meta { font-style: italic; }

/* CSS v2 tests */
value > string { color: red; }
body.json value > string { color: yellow; }
object.json > pair > value > string { color: yellow; }
array.json value > string { color: #ffaa22; }
25 changes: 12 additions & 13 deletions src/KDocument.mm
Expand Up @@ -623,19 +623,17 @@ static void _exploreNode(NSTextStorage *textStorage,
NSRange sourceRange = node->sourceRange();
sourceRange.location += offset;

// CSS style (version 1)
//KStyleElement *style = [[KStyle sharedStyle] styleElementForSymbol:ruleName];
//DLOG("style: %@ -> KStyleElement@%p (%@)",
// ruleName, style, [ruleNamePath componentsJoinedByString:@" > "]);
//style->applyAttributes(textStorage, sourceRange);

// CSS style (version 2)
// CSS style
KStyle *style = [KStyle sharedStyle];
CSSStyle *cssStyle = [style styleForASTNode:node.get()];
KStyleElement *styleElement =
new KStyleElement(node->ruleNameString(), cssStyle, style);
// TODO: cache styleElement on node?
styleElement->applyAttributes(textStorage, sourceRange);
@try {
styleElement->applyAttributes(textStorage, sourceRange, true);
} @catch (NSException *e) {
WLOG("%@", e);
}
delete styleElement;

// Dig down into child nodes
Expand Down Expand Up @@ -1377,11 +1375,6 @@ - (void)textStorageDidProcessEditing:(NSNotification *)notification {
return;
}

// Increment our version
[self willChangeValueForKey:@"version"];
uint64_t version = h_atomic_inc(&version_);
[self didChangeValueForKey:@"version"];

// range that was affected by the edit
NSRange editedRange = [textStorage editedRange];

Expand All @@ -1397,6 +1390,12 @@ - (void)textStorageDidProcessEditing:(NSNotification *)notification {
}
}

// Increment our version. This need to happen after parseEdit since this will
// trigger UI updates (e.g. update KParseStatusDecoration)
[self willChangeValueForKey:@"version"];
uint64_t version = h_atomic_inc(&version_);
[self didChangeValueForKey:@"version"];

// update lineToRangeVec_ (need to run in main)
if ([NSThread isMainThread]) {
[self _updateLinesToRangesInfoForTextStorage:textStorage
Expand Down
1 change: 1 addition & 0 deletions src/KLocationBarController.mm
Expand Up @@ -137,6 +137,7 @@ - (void)contentsDidChange:(CTTabContents*)contents {
if (!h_casid(&currentContents_, contents))
return;
[self recordStateWithContents:contents];
[self contentsDidChange];
}


Expand Down

0 comments on commit 06a3772

Please sign in to comment.