File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -23,14 +23,18 @@ pub fn list_all_file_items(path: &Path) -> Vec<String> {
2323const MAX_LINE_LENGTH : usize = 600 ;
2424
2525pub fn get_file_items ( current_line : & str , root_folder : & str ) -> Vec < ( String , usize ) > {
26- if current_line. len ( ) >= MAX_LINE_LENGTH {
26+ if current_line. len ( ) > MAX_LINE_LENGTH {
2727 return Vec :: new ( ) ;
2828 }
2929
30+ let indices: Vec < usize > = current_line. char_indices ( ) . map ( |( i, _) | i) . collect ( ) ;
3031 let mut file_items = Vec :: new ( ) ;
3132 for ( j, _) in current_line. char_indices ( ) . filter ( |& ( _, ch) | ch == '/' || ch == '\\' ) {
32- for i in 0 ..j {
33- let p = & current_line[ i..j] ;
33+ for & i in indices. iter ( ) {
34+ if i > j {
35+ continue ;
36+ }
37+ let p = & current_line[ i..j+1 ] ;
3438
3539 for base in [ root_folder, "" ] . iter ( ) . map ( PathBuf :: from) {
3640 let path = base. join ( p) ;
You can’t perform that action at this time.
0 commit comments