From 285fafc46459eaaa7661b1c4d23ba8db78092b3f Mon Sep 17 00:00:00 2001 From: daboe01 Date: Wed, 28 Sep 2016 20:34:46 +0200 Subject: [PATCH] rtf parser fix + formatting --- AppKit/CPTextView/CPTextView.j | 5 ++--- AppKit/CPTextView/_CPRTFParser.j | 5 ++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/AppKit/CPTextView/CPTextView.j b/AppKit/CPTextView/CPTextView.j index d566b05a3..e8f4459a5 100644 --- a/AppKit/CPTextView/CPTextView.j +++ b/AppKit/CPTextView/CPTextView.j @@ -929,7 +929,6 @@ var kDelegateRespondsTo_textShouldBeginEditing - (void)mouseDown:(CPEvent)event { [_CPNativeInputManager cancelCurrentInputSessionIfNeeded]; - [_caret setVisibility:NO]; _startTrackingLocation = [self _characterIndexFromEvent:event]; @@ -946,12 +945,12 @@ var kDelegateRespondsTo_textShouldBeginEditing originPoint.x += _textContainerOrigin.x; originPoint.y += _textContainerOrigin.y; - dragPlaceholder._DOMElement.style.opacity = '0.5'; + dragPlaceholder._DOMElement.style.opacity = '0.4'; var attributes = [_textStorage attributesAtIndex:_selectionRange.location effectiveRange:nil]; [dragPlaceholder setFont:[attributes objectForKey:CPFontAttributeName]]; [dragPlaceholder setTextColor:[attributes objectForKey:CPForegroundColorAttributeName]]; var effectiveRange = CPIntersectionRange(CPMakeRange(_selectionRange.location, 10), _selectionRange), - placeholderString = [[self stringValue] substringWithRange:effectiveRange]; + placeholderString = [[self stringValue] substringWithRange:effectiveRange]; if (_selectionRange.length > 10) placeholderString += '...'; diff --git a/AppKit/CPTextView/_CPRTFParser.j b/AppKit/CPTextView/_CPRTFParser.j index a94081c8d..ec76b0a1e 100644 --- a/AppKit/CPTextView/_CPRTFParser.j +++ b/AppKit/CPTextView/_CPRTFParser.j @@ -514,6 +514,9 @@ var kRgsymRtf = { return [self _applyPropChange:sym parameter:param]; case kRTFParserType_char: + if((param + '').length) + _currentParseIndex -= (param + '').length; + return [self _checkChar:sym parameter:param]; case kRTFParserType_dest: @@ -785,4 +788,4 @@ var kRgsymRtf = { return _result; } -@end \ No newline at end of file +@end