mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
[ASTextNode] Fix text node truncation (#1863)
* Before truncate a text storage in ASTextKitContext reset the text storage to original value * Fix ASTextNode tests We should pass in the constrained size in both cases and the sizes should be the same. We adjust the calculated size in ASTextNode to be a bit narrower in the second case if we truncate again with the calculated size as constrained size it will truncate more and the resulting size will shrink.
This commit is contained in:
committed by
appleguy
parent
38fab7cd94
commit
6238e5edbd
@@ -10,6 +10,8 @@
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
typedef NSTextStorage *(^ASTextKitContextTextStorageCreationBlock)(NSAttributedString *attributedString);
|
||||
|
||||
/**
|
||||
A threadsafe container for the TextKit components that ASTextKit uses to lay out and truncate its text.
|
||||
|
||||
@@ -30,10 +32,19 @@
|
||||
constrainedSize:(CGSize)constrainedSize
|
||||
layoutManagerCreationBlock:(NSLayoutManager * (^)(void))layoutCreationBlock
|
||||
layoutManagerDelegate:(id<NSLayoutManagerDelegate>)layoutManagerDelegate
|
||||
textStorageCreationBlock:(NSTextStorage * (^)(NSAttributedString *attributedString))textStorageCreationBlock;
|
||||
textStorageCreationBlock:(ASTextKitContextTextStorageCreationBlock)textStorageCreationBlock;
|
||||
|
||||
/**
|
||||
Set the constrained size for the text context.
|
||||
*/
|
||||
@property (nonatomic, assign, readwrite) CGSize constrainedSize;
|
||||
|
||||
/**
|
||||
Resets the text storage to the original value in case it was truncated before. This method is called within
|
||||
a locked context.
|
||||
*/
|
||||
- (void)resetTextStorage;
|
||||
|
||||
/**
|
||||
All operations on TextKit values MUST occur within this locked context. Simultaneous access (even non-mutative) to
|
||||
TextKit components may cause crashes.
|
||||
|
||||
Reference in New Issue
Block a user