Fix line broke even in mid-word (fix #551)

This commit is contained in:
1024jp 2016-05-05 17:27:22 +09:00
parent 86a256a25e
commit ee41e1e724
2 changed files with 13 additions and 6 deletions

View File

@ -7,6 +7,15 @@ develop
### Fixes
- Fix an issue where wordwrap broke mid-word when a line is indented.
2.5.2 (123)
--------------------------
### Fixes
- Fix an issue where invisible characters could not be hide.
- Fix an issue where application could crash if the “Replace All” button was clicked continuous.
- Fix an issue where application crashed on closing default window size setting window.

View File

@ -125,13 +125,11 @@
// check if the character is the first non-whitespace character after indent
NSString *string = [[self attributedString] string];
while (charIndex > 0) {
unichar character = [string characterAtIndex:charIndex];
for (NSInteger index = charIndex - 1; index >= 0; index--) {
unichar character = [string characterAtIndex:index];
if (character == '\n') { return NO; } // the line ended
if (character != ' ' && character != '\t') { return NO; } // hit to non-indent character
charIndex--;
if (character == '\n') { return NO; } // the line ended before hitting indent chars
if (character != ' ' && character != '\t') { return YES; } // hit to non-indent character
}
return NO;