<commit_before>Class {
	#name : #BrTextEditorLineSplitterExamples,
	#superclass : #Object,
	#category : 'Brick-Editor-Examples'
}

{ #category : #'examples - split' }
BrTextEditorLineSplitterExamples >> beReplaceTextAttribute [
	<gtExample>
	^ BrTextAdornmentDynamicAttribute new
		beReplace;
		stencil: [ BlElement new 
			size: 10@10; 
			background: Color lightGray ]
]

{ #category : #'examples - split' }
BrTextEditorLineSplitterExamples >> split_BeReplacedTextAtribute_FollowedByLf [
	<gtExample>
	| aText aSplitter aStream aTextAttribute theAttributes |

	aTextAttribute := self beReplaceTextAttribute.
	aText := 'Hello' asRopedText attribute: aTextAttribute.
	
	self assert: aText size equals: 5.
	theAttributes := (aText from: aText size to: aText size) iterator attributes.
	self assert: theAttributes size equals: 1.
	self assert: theAttributes first equals: aTextAttribute.

	aText insertText: String lf at: aText size.
	self assert: aText size equals: 6.
	theAttributes := (aText from: aText size to: aText size) iterator attributes.
	self assert: theAttributes size equals: 1.
	self assert: theAttributes first equals: aTextAttribute.
	
	aSplitter := self textLineSplitter.
	aStream := self textSegmentStream.

	aSplitter split: aText in: aStream.

	self assert: aStream segments size equals: 2.
	self assert: aStream segments first textStart equals: 0.
	self assert: aStream segments first textEnd equals: 5.
	
	self assert: aStream segments second textStart equals: 6.
	self assert: aStream segments second textEnd equals: 6.

	^ aStream
]

{ #category : #'examples - split' }
BrTextEditorLineSplitterExamples >> split_Cr [
	<gtExample>
	| aText aSplitter aStream |
<commit_msg>fix example of split_BeReplacedTextAtribute_FollowedByLf<commit_after>Class {
	#name : #BrTextEditorLineSplitterExamples,
	#superclass : #Object,
	#category : 'Brick-Editor-Examples'
}

{ #category : #'examples - split' }
BrTextEditorLineSplitterExamples >> beReplaceTextAttribute [
	<gtExample>
	^ BrTextAdornmentDynamicAttribute new
		beReplace;
		stencil: [ BlElement new 
			size: 10@10; 
			background: Color lightGray ]
]

{ #category : #'examples - split' }
BrTextEditorLineSplitterExamples >> split_BeReplacedTextAtribute_FollowedByLf [
	<gtExample>
	| aText aSplitter aStream aTextAttribute theAttributes |

	aTextAttribute := self beReplaceTextAttribute.
	aText := 'Hello' asRopedText attribute: aTextAttribute.
	
	self assert: aText size equals: 5.
	theAttributes := (aText from: aText size to: aText size) iterator attributes.
	self assert: theAttributes size equals: 1.
	self assert: theAttributes first equals: aTextAttribute.

	aText insertString: String lf at: aText size.
	self assert: aText size equals: 6.
	theAttributes := (aText from: aText size to: aText size) iterator attributes.
	self assert: theAttributes size equals: 1.
	self assert: theAttributes first equals: aTextAttribute.
	
	aSplitter := self textLineSplitter.
	aStream := self textSegmentStream.

	aSplitter split: aText in: aStream.

	self assert: aStream segments size equals: 2.
	self assert: aStream segments first textStart equals: 0.
	self assert: aStream segments first textEnd equals: 5.
	
	self assert: aStream segments second textStart equals: 6.
	self assert: aStream segments second textEnd equals: 6.

	^ aStream
]

{ #category : #'examples - split' }
BrTextEditorLineSplitterExamples >> split_Cr [
	<gtExample>
	| aText aSplitter aStream |

{'fraction_non_alphanumeric': 0.08272647829886397, 'fraction_numerical': 0.007573550830177687, 'mean_word_length': 5.003496503496503, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5829118', 'n_tokens_mistral': 1118, 'n_tokens_neox': 1038, 'n_words': 335}