File tree Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -324,27 +324,22 @@ static bufsize_t scan_to_closing_backticks(subject *subj,
324
324
}
325
325
326
326
// Destructively modify string, converting newlines to
327
- // spaces or removing them if they're adjacent to spaces,
328
- // then removing a single leading + trailing space.
327
+ // spaces, then removing a single leading + trailing space.
329
328
static void S_normalize_code (cmark_strbuf * s ) {
330
- bool last_char_was_space = false;
331
329
bufsize_t r , w ;
332
330
333
331
for (r = 0 , w = 0 ; r < s -> size ; ++ r ) {
334
332
switch (s -> ptr [r ]) {
335
333
case '\r' :
334
+ if (s -> ptr [r + 1 ] != '\n' ) {
335
+ s -> ptr [w ++ ] = ' ' ;
336
+ }
336
337
break ;
337
338
case '\n' :
338
- if (!last_char_was_space && !cmark_isspace (s -> ptr [r + 1 ])) {
339
- s -> ptr [w ++ ] = ' ' ;
340
- last_char_was_space = true;
341
- } else {
342
- last_char_was_space = false;
343
- }
339
+ s -> ptr [w ++ ] = ' ' ;
344
340
break ;
345
341
default :
346
342
s -> ptr [w ++ ] = s -> ptr [r ];
347
- last_char_was_space = (s -> ptr [r ] == ' ' );
348
343
}
349
344
}
350
345
You can’t perform that action at this time.
0 commit comments