Skip to content

Commit

Permalink
Merge branch 'release/2.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
usami-k committed Mar 1, 2015
2 parents 28136f8 + ba6d0ff commit 15239af
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 25 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
Change Log
==========================

2.1.1
--------------------------

### Fixes

- Fix an issue where octal file permisson in the document inspector was wrong.
- Fix an issue where application could hang up on text editing.
- Improve general stability.



2.1.0
--------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,26 @@ <h1>Release Notes</h1>



<article>
<header>
<h1>CotEditor 2.1.1</h1>
<p>release: <time>2015-03-01</time></p>
</header>


<section>
<h2>Fixes</h2>

<ul>
<li>Fix an issue where octal file permisson in the document inspector was wrong.</li>
<li>Fix an issue where application could hang up on text editing.</li>
<li>Improve general stability.</li>
</ul>
</section>
</article>



<article>
<header>
<h1>CotEditor 2.1.0</h1>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,26 @@
<h1>リリースノート</h1>



<article>
<header>
<h1>CotEditor 2.1.1</h1>
<p>リリース: <time>2015-03-01</time></p>
</header>


<section>
<h2>バグフィックス</h2>

<ul>
<li>書類情報のファイルパーミッション8進数表現が間違っていた不具合を修正</li>
<li>テキスト編集時にアプリケーションがハングすることがあった不具合を修正</li>
<li>安定性の向上</li>
</ul>
</section>
</article>


<article>
<header>
<h1>CotEditor 2.1.0</h1>
Expand Down
4 changes: 2 additions & 2 deletions CotEditor/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -953,11 +953,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.1</string>
<string>2.1.1</string>
<key>CFBundleSignature</key>
<string>cEd1</string>
<key>CFBundleVersion</key>
<string>2.1.0</string>
<string>2.1.1</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
<key>NSAppleScriptEnabled</key>
Expand Down
64 changes: 45 additions & 19 deletions CotEditor/Sources/CEDocument.m
Original file line number Diff line number Diff line change
Expand Up @@ -1081,16 +1081,19 @@ - (void)applyLineEndingToView
- (NSData *)forceReadDataFromURL:(NSURL *)url
// ------------------------------------------------------
{
NSData *data = nil;
NSString *convertedPath = @([[url path] UTF8String]);
NSTask *task = [[NSTask alloc] init];

[task setLaunchPath:@"/usr/libexec/authopen"];
[task setArguments:@[convertedPath]];
[task setStandardOutput:[NSPipe pipe]];

[task launch];
NSData *data = [NSData dataWithData:[[[task standardOutput] fileHandleForReading] readDataToEndOfFile]];
[task waitUntilExit];
@synchronized(self) {
[task setLaunchPath:@"/usr/libexec/authopen"];
[task setArguments:@[convertedPath]];
[task setStandardOutput:[NSPipe pipe]];

[task launch];
data = [NSData dataWithData:[[[task standardOutput] fileHandleForReading] readDataToEndOfFile]];
[task waitUntilExit];
}

int status = [task terminationStatus];

Expand Down Expand Up @@ -1429,7 +1432,15 @@ - (BOOL)forceWriteToURL:(NSURL *)url ofType:(NSString *)typeName forSaveOperatio

// Finder Lock がかかってたなら、再びかける
if (isFinderLockOn) {
BOOL lockSuccess = [[NSFileManager defaultManager] setAttributes:@{NSFileImmutable:@YES} ofItemAtPath:[url path] error:nil];
__block BOOL lockSuccess = NO;
NSFileCoordinator *coordinator = [[NSFileCoordinator alloc] initWithFilePresenter:self];
[coordinator coordinateWritingItemAtURL:url options:0
error:nil
byAccessor:^(NSURL *newURL)
{
lockSuccess = [[NSFileManager defaultManager] setAttributes:@{NSFileImmutable:@YES} ofItemAtPath:[newURL path] error:nil];
}];

success = (success && lockSuccess);
}

Expand Down Expand Up @@ -1484,25 +1495,40 @@ - (NSString *)convertCharacterString:(NSString *)string encoding:(NSStringEncodi
- (BOOL)canUnlockFileAtURL:(NSURL *)url isLocked:(BOOL *)isLocked lockAgain:(BOOL)lockAgain
// ------------------------------------------------------
{
__block BOOL isFinderLocked = NO;
BOOL success = NO;
NSError *error = nil;
NSFileManager *fileManager = [NSFileManager defaultManager];
BOOL isFinderLocked = [[fileManager attributesOfItemAtPath:[url path] error:nil] fileIsImmutable];

if (isFinderLocked) {
// Finder Lock がかかっていれば、解除
BOOL success = [fileManager setAttributes:@{NSFileImmutable:@NO} ofItemAtPath:[url path] error:nil];
if (success) {
if (lockAgain) {
// フラグが立っていたなら、再びかける
[fileManager setAttributes:@{NSFileImmutable:@YES} ofItemAtPath:[url path] error:nil];

@synchronized(self) {
NSFileCoordinator *coordinator = [[NSFileCoordinator alloc] initWithFilePresenter:self];
[coordinator coordinateReadingItemAtURL:url options:NSFileCoordinatorReadingWithoutChanges
error:&error
byAccessor:^(NSURL *newURL)
{
isFinderLocked = [[fileManager attributesOfItemAtPath:[newURL path] error:nil] fileIsImmutable];
}];

if (isFinderLocked) {
// unlock file once
success = [fileManager setAttributes:@{NSFileImmutable:@NO} ofItemAtPath:[url path] error:nil];
if (success) {
// lock file again if needed
if (lockAgain) {
[fileManager setAttributes:@{NSFileImmutable:@YES} ofItemAtPath:[url path] error:nil];
}
}
} else {
return NO;
// no-lock file is always treated as success
success = YES;
}
}

if (isLocked) {
*isLocked = isFinderLocked;
}
return YES;

return success;
}


Expand Down
6 changes: 3 additions & 3 deletions CotEditor/Sources/CEDocumentAnalyzer.m
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ - (void)updateFileInfo
self.fileSize = [attrs fileSize] ? [byteFormatter stringFromByteCount:[attrs fileSize]] : nil;
self.filePath = [[document fileURL] path];
self.owner = [attrs fileOwnerAccountName];
self.permission = [attrs filePosixPermissions] ? [NSString stringWithFormat:@"%tu (%@)",
[attrs filePosixPermissions],
self.permission = [attrs filePosixPermissions] ? [NSString stringWithFormat:@"%lo (%@)",
(unsigned long)[attrs filePosixPermissions],
humanReadablePermission([attrs filePosixPermissions])] : nil;
self.writable = [document isWritable];

Expand Down Expand Up @@ -277,7 +277,7 @@ - (void)updateEditorInfo:(BOOL)needsAll


#pragma mark Plivate methods

// ------------------------------------------------------
/// format count number with selection
- (NSString *)formatCount:(NSUInteger)count selected:(NSUInteger)selectedCount
Expand Down
2 changes: 1 addition & 1 deletion CotEditor/Sources/CEEditorWrapper.m
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ - (void)doColoringNow

// 選択領域(編集場所)が見えないときは編集場所周辺を更新
if (!NSLocationInRange(selectedRange.location, visibleRange)) {
NSUInteger location = MAX((NSInteger)selectedRange.location - visibleRange.length, 0);
NSUInteger location = MAX((NSInteger)(selectedRange.location - visibleRange.length), 0);
NSInteger maxLength = [[textView string] length] - location;
NSUInteger length = MIN(selectedRange.length + visibleRange.length, maxLength);

Expand Down

0 comments on commit 15239af

Please sign in to comment.