@@ -97,6 +97,7 @@ export class StickyLineCandidateProvider extends Disposable {
97
97
}
98
98
}
99
99
100
+ // consider the case when index = -length - 1
100
101
private updatedIndex ( index : number ) {
101
102
if ( index === - 1 ) {
102
103
index = 0 ;
@@ -111,10 +112,15 @@ export class StickyLineCandidateProvider extends Disposable {
111
112
return ;
112
113
}
113
114
let lastLine = lastStartLineNumber ;
114
- const childrenStartLines = outlineModel . children . map ( child => child . range ?. startLineNumber as number ) ;
115
+ const childrenStartLines = outlineModel . children . filter ( child => { return child . range ?. startLineNumber !== child . range ?. endLineNumber ; } ) . map ( child => child . range ?. startLineNumber as number ) ;
116
+ console . log ( 'childrenStartLines : ' , childrenStartLines ) ;
117
+ console . log ( 'range : ' , range ) ;
118
+ console . log ( 'start lines : ' , childrenStartLines ) ;
119
+ console . log ( 'b1 ' , binarySearch ( childrenStartLines , range . startLineNumber , ( a : number , b : number ) => { return a - b ; } ) ) ;
120
+ console . log ( 'b2 ' , binarySearch ( childrenStartLines , range . startLineNumber + depth , ( a : number , b : number ) => { return a - b ; } ) ) ;
115
121
const indexLower = this . updatedIndex ( binarySearch ( childrenStartLines , range . startLineNumber , ( a : number , b : number ) => { return a - b ; } ) ) ;
116
122
const indexUpper = this . updatedIndex ( binarySearch ( childrenStartLines , range . startLineNumber + depth , ( a : number , b : number ) => { return a - b ; } ) ) ;
117
-
123
+ console . log ( 'indexLower : ' , indexLower , ' and indexUpper : ' , indexUpper ) ;
118
124
for ( let i = indexLower ; i <= indexUpper ; i ++ ) {
119
125
const child = outlineModel . children [ i ] ;
120
126
if ( child . range ) {
@@ -134,6 +140,7 @@ export class StickyLineCandidateProvider extends Disposable {
134
140
public getCandidateStickyLinesIntersecting ( range : StickyRange ) : StickyLineCandidate [ ] {
135
141
let stickyLineCandidates : StickyLineCandidate [ ] = [ ] ;
136
142
this . getCandidateStickyLinesIntersectingFromOutline ( range , this . _outlineModel as StickyOutlineElement , stickyLineCandidates , 0 , - 1 ) ;
143
+ console . log ( 'stickyLineCandidates : ' , stickyLineCandidates ) ;
137
144
const hiddenRanges : Range [ ] | undefined = this . _editor . _getViewModel ( ) ?. getHiddenAreas ( ) ;
138
145
if ( hiddenRanges ) {
139
146
for ( const hiddenRange of hiddenRanges ) {
0 commit comments