mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 04:57:03 +00:00
Merge pull request #3244 from daboe01/textview-stalenes-fix
Fixed: CPLayoutManager false-positive layout rescue on zero-length-delta edits
This commit is contained in:
@@ -72,6 +72,7 @@ _oncontextmenuhandler = function () { return false; };
|
||||
|
||||
BOOL _isValidatingLayoutAndGlyphs;
|
||||
CPRange _removeInvalidLineFragmentsRange;
|
||||
CPRange _lastEditedRange;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,6 +97,7 @@ _oncontextmenuhandler = function () { return false; };
|
||||
_textContainers = [[CPMutableArray alloc] init];
|
||||
_textStorage = [[CPTextStorage alloc] init];
|
||||
_typesetter = [CPTypesetter sharedSystemTypesetter];
|
||||
_lastEditedRange = nil;
|
||||
|
||||
[_textStorage addLayoutManager:self];
|
||||
}
|
||||
@@ -370,6 +372,16 @@ _oncontextmenuhandler = function () { return false; };
|
||||
l = _lineFragmentsForRescue.length,
|
||||
newTargetLine = startLineForDOMRemoval + removalSkip;
|
||||
|
||||
// Ensure that the remaining lines we are attempting to rescue
|
||||
// start after the end of the edited region.
|
||||
if (newTargetLine < l && _lastEditedRange)
|
||||
{
|
||||
var firstRescuedLineNewLocation = _lineFragmentsForRescue[newTargetLine]._range.location + rangeOffset;
|
||||
|
||||
if (firstRescuedLineNewLocation < CPMaxRange(_lastEditedRange))
|
||||
return NO;
|
||||
}
|
||||
|
||||
for (; newTargetLine < l; newTargetLine++)
|
||||
{
|
||||
_lineFragmentsForRescue[newTargetLine]._isInvalid = NO; // protect them from final removal
|
||||
@@ -441,6 +453,8 @@ _oncontextmenuhandler = function () { return false; };
|
||||
{
|
||||
var actualRange = CPMakeRange(CPNotFound,0);
|
||||
|
||||
_lastEditedRange = CPMakeRangeCopy(charRange);
|
||||
|
||||
[self invalidateLayoutForCharacterRange:invalidatedRange isSoft:NO actualCharacterRange:actualRange];
|
||||
[self invalidateDisplayForGlyphRange:actualRange];
|
||||
[self _validateLayoutAndGlyphs];
|
||||
|
||||
Reference in New Issue
Block a user