Skip to content

Commit

Permalink
Fix trailing whitespace on list item clearance
Browse files Browse the repository at this point in the history
  • Loading branch information
uranusjr committed Aug 4, 2014
1 parent 3e31a25 commit d97a680
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions MacDown/Code/Extension/NSTextView+Autocomplete.m
Original file line number Diff line number Diff line change
Expand Up @@ -503,15 +503,19 @@ - (BOOL)completeNextListItem
return YES;
}

// Has indent and matching list item. Accept it.
NSString *it = [NSString stringWithFormat:@"%@%@", indent, t];

// Has indent and matching list item. Accept it.
r = NSMakeRange(location, it.length);
if (contentLength > location + it.length
&& [[content substringWithRange:r] isEqualToString:it])
return YES;

// Insert completion for normal cases.
[self insertText:[NSString stringWithFormat:@"%@ ", it]];
if (t.length)
it = [NSString stringWithFormat:@"%@ ", it];
else
[self insertText:it];
return YES;
}

Expand Down

0 comments on commit d97a680

Please sign in to comment.