@@ -165,21 +165,21 @@ const Editor = (() => {
165165 } ,
166166
167167 // Backspace: delete empty pair, or snap indent to previous tab stop.
168- backspace : ( text , caret ) => {
169- if ( caret === 0 ) return null ;
170- if ( PAIRS [ text [ caret - 1 ] ] === text [ caret ] ) {
171- return {
172- text : text . slice ( 0 , caret - 1 ) + text . slice ( caret + 1 ) ,
173- caret : caret - 1 ,
174- } ;
175- }
176- const lineStart = text . lastIndexOf ( '\n' , caret - 1 ) + 1 ;
177- const before = text . slice ( lineStart , caret ) ;
178- if ( ! before . length || ! / ^ [ \t ] + $ / . test ( before ) ) return null ;
179- const prevStop = Math . floor ( ( before . length - 1 ) / TAB_SIZE ) * TAB_SIZE ;
180- const del = before . length - prevStop ;
181- return { text : text . slice ( 0 , caret - del ) + text . slice ( caret ) , caret : caret - del } ;
182- } ,
168+ backspace : ( text , caret ) => {
169+ if ( caret === 0 ) return null ;
170+ if ( PAIRS [ text [ caret - 1 ] ] === text [ caret ] ) {
171+ return {
172+ text : text . slice ( 0 , caret - 1 ) + text . slice ( caret + 1 ) ,
173+ caret : caret - 1 ,
174+ } ;
175+ }
176+ const lineStart = text . lastIndexOf ( '\n' , caret - 1 ) + 1 ;
177+ const before = text . slice ( lineStart , caret ) ;
178+ if ( ! before . length || ! / ^ [ \t \u00a0 ] + $ / . test ( before ) ) return null ;
179+ const prevStop = Math . floor ( ( before . length - 1 ) / TAB_SIZE ) * TAB_SIZE ;
180+ const del = before . length - prevStop ;
181+ return { text : text . slice ( 0 , caret - del ) + text . slice ( caret ) , caret : caret - del } ;
182+ } ,
183183 } ;
184184
185185 const jar = CodeJar ( el . ed ,
0 commit comments