Skip to content

Commit ea64083

Browse files
committed
BlRunRopedText>>#iterator:to: returns empty iterator for empty texts [feenkcom/gtoolkit#5196]
1 parent a445fbe commit ea64083

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

‎src/Bloc-Text-Rope/BlRunRopedText.class.st‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,8 @@ BlRunRopedText >> iterator: aFromIndex to: aToIndex [
512512
assert: [ aFromIndex > 0 or: [ aFromIndex = 0 and: [ aToIndex = 0 ] ] ]
513513
description: [ 'Start and end must be positive or both zero' ].
514514

515+
self ifEmpty: [ ^ BlEmptyTextIterator new ].
516+
515517
^ BlRunRopedTextIterator text: self from: aFromIndex to: aToIndex
516518
]
517519

‎src/Bloc-Text/BlEmptyTextIterator.class.st‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ BlEmptyTextIterator >> hasPrevious [
4646
^ false
4747
]
4848

49+
{ #category : #'iterator - enumeration' }
50+
BlEmptyTextIterator >> nextLineIndicesDo: aBlock [
51+
"do nothing"
52+
53+
54+
]
55+
4956
{ #category : #'iterator - accessing' }
5057
BlEmptyTextIterator >> position [
5158
"Return current iterator position within a text"
@@ -61,6 +68,11 @@ BlEmptyTextIterator >> position: anInteger [
6168
self error: 'Cannot position a BlEmptyTextIterator' ]
6269
]
6370

71+
{ #category : #'iterator - enumeration' }
72+
BlEmptyTextIterator >> selectAttributes: aBlock [
73+
^ #()
74+
]
75+
6476
{ #category : #accessing }
6577
BlEmptyTextIterator >> text [
6678
"Return an original text that I iterate over"

0 commit comments

Comments
 (0)