Insert blockquote prefix for blank lines too

Similar logic to blank-line indentation. See 61e4a73 and 4d98888.

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:
Tzu-ping Chung
2015-07-26 22:42:48 +08:00
parent 4d988889a9
commit 8291dd4ec6
@@ -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];