mirror of
https://github.com/MacDownApp/macdown.git
synced 2026-06-16 12:44:38 +00:00
Insert blockquote prefix for blank lines too
Similar logic to blank-line indentation. See61e4a73and4d98888. Fix #383. Side effect: This patch also make list item insertion work with empty lines - a backward-incompatible behaviAoural change. But this seems to be what people want, so let's roll with it for now. We can always change this later if reports appear.
This commit is contained in:
@@ -339,15 +339,18 @@ static NSString * const kMPBlockquoteLinePattern = @"^((?:\\> ?)+).*$";
|
||||
[lines enumerateObjectsUsingBlock:^(id obj, NSUInteger index, BOOL *stop) {
|
||||
NSString *line = obj;
|
||||
if (line.length)
|
||||
{
|
||||
totalShift += prefixLength;
|
||||
if (!isMarked)
|
||||
line = [prefix stringByAppendingString:line];
|
||||
else
|
||||
line = [line substringFromIndex:prefixLength];
|
||||
}
|
||||
if (!isMarked)
|
||||
line = [prefix stringByAppendingString:line];
|
||||
else
|
||||
line = [line substringFromIndex:prefixLength];
|
||||
[modLines addObject:line];
|
||||
}];
|
||||
if ([modLines.lastObject isEqualToString:prefix])
|
||||
{
|
||||
[modLines removeLastObject];
|
||||
[modLines addObject:@""];
|
||||
}
|
||||
NSString *processed = [modLines componentsJoinedByString:@"\n"];
|
||||
[self insertText:processed replacementRange:lineRange];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user