Remove redundant indentation on last line

Previously, if the selection includes the trailing newline, the line
*after* the selection will be indented, which is not correct.

Introduced in 61e4a73.
This commit is contained in:
Tzu-ping Chung
2015-07-26 22:39:38 +08:00
parent 472b94d6d1
commit 4d988889a9
@@ -387,6 +387,11 @@ static NSString * const kMPBlockquoteLinePattern = @"^((?:\\> ?)+).*$";
totalShift += paddingLength;
[modLines addObject:[padding stringByAppendingString:line]];
}];
if ([modLines.lastObject isEqualToString:padding])
{
[modLines removeLastObject];
[modLines addObject:@""];
}
NSString *processed = [modLines componentsJoinedByString:@"\n"];
[self insertText:processed replacementRange:lineRange];