diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7df916493e..4e2ff4d796 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,28 @@
Change Log
==========================
+2.1.2
+--------------------------
+
+### Additions/Changes
+
+- Change place to create backup files (Now, backup files are always created in `~/Library/Autosave Information/`).
+- Improve find panel:
+ - Add scroll bars to the text fields.
+ - Show invisible characters in text fields.
+ - Now, “Swap Yen and backslash keys” option is also applied to the fields in the find panel.
+ - Remove “Escape Character” option for regular expression search.
+- Add “Cyrillic (Windows)” to the encoding list.
+- Optimize launching speed of `cot` command-line tool.
+
+
+### Fixes
+
+- Fix an issue where application could hang up on saving backup file.
+- Fix an issue where unwanted find panel was shown when perform “Use Selection for Find” or “Use Selection for Replace” action.
+
+
+
2.1.1
--------------------------
diff --git a/CotEditor/Base.lproj/FindPanel.xib b/CotEditor/Base.lproj/FindPanel.xib
index 882cde4e1b..dc995a9e62 100644
--- a/CotEditor/Base.lproj/FindPanel.xib
+++ b/CotEditor/Base.lproj/FindPanel.xib
@@ -15,7 +15,7 @@
-
+
@@ -27,48 +27,89 @@
-
-
-
-
-
-
-
-
-
-
-
-
- Replace
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Find
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
- Find
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Replace
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
+
@@ -657,7 +679,7 @@
-
+
diff --git a/CotEditor/CotEditor.help/Contents/Resources/en.lproj/pgs/releasenotes.html b/CotEditor/CotEditor.help/Contents/Resources/en.lproj/pgs/releasenotes.html
index 85ede0f818..77c1479912 100644
--- a/CotEditor/CotEditor.help/Contents/Resources/en.lproj/pgs/releasenotes.html
+++ b/CotEditor/CotEditor.help/Contents/Resources/en.lproj/pgs/releasenotes.html
@@ -23,6 +23,42 @@
Release Notes
+
+
+ CotEditor 2.1.2
+ release:
+
+
+
+
+Additions/Changes
+
+
+ - Change place to create backup files (Now, backup files are always created in
~/Library/Autosave Information/
).
+ - Improve find panel:
+ - Add scroll bars to the text fields.
+ - Show invisible characters in text fields.
+ - Now, “Swap ¥ and \ keys” option is also applied to the fields in the find panel.
+ - Remove “Escape Character” option for regular expression search.
+
+ - Add “Cyrillic (Windows)” to the encoding list.
+ - Optimize launching speed of
cot
command-line tool.
+
+
+
+
+
+Fixes
+
+
+ - Fix an issue where application could hang up on saving backup file.
+ - Fix an issue where unwanted find panel was shown when perform “Use Selection for Find” or “Use Selection for Replace” action.
+
+
+
+
+
+
CotEditor 2.1.1
diff --git a/CotEditor/CotEditor.help/Contents/Resources/ja.lproj/pgs/releasenotes.html b/CotEditor/CotEditor.help/Contents/Resources/ja.lproj/pgs/releasenotes.html
index e35fa6a283..67b95bfa99 100644
--- a/CotEditor/CotEditor.help/Contents/Resources/ja.lproj/pgs/releasenotes.html
+++ b/CotEditor/CotEditor.help/Contents/Resources/ja.lproj/pgs/releasenotes.html
@@ -23,6 +23,42 @@ リリースノート
+
+
+ CotEditor 2.1.2
+ リリース:
+
+
+
+
+機能改善/仕様変更
+
+
+ - バックアップファイルの作成場所を変更 (バックアップファイルは常に
~/Library/Autosave Information/
に作成されるようになりました)
+ - 検索パネルの改良:
+ - テキストフィールドにスクロールバーを追加
+ - テキストフィールドで不可視文字を表示
+ - 環境設定の「“¥”と“\”のキーを入れ替える」オプションが検索パネルのテキストフィールドにも適用されるように改良
+ - 正規表現検索の「エスケープ文字」オプションを削除
+
+ - 取り扱えるエンコーディングに「キリル文字 (Windows)」を追加<
+ cot
コマンドの呼び出しパフォーマンスを改善
+
+
+
+
+
+バグフィックス
+
+
+ - 「選択範囲を検索に使用」もしくは「選択範囲を置換に使用」アクションで検索パネルが表示された不具合を修正
+ - バックアップファイル作成時にアプリケーションがハングすることがあった不具合を修正
+
+
+
+
+
+
CotEditor 2.1.1
@@ -42,6 +78,7 @@ バグフィックス
+
CotEditor 2.1.0
diff --git a/CotEditor/CotEditor.xcodeproj/project.pbxproj b/CotEditor/CotEditor.xcodeproj/project.pbxproj
index 7832dc2d15..d67e08e037 100644
--- a/CotEditor/CotEditor.xcodeproj/project.pbxproj
+++ b/CotEditor/CotEditor.xcodeproj/project.pbxproj
@@ -24,7 +24,6 @@
25B2C24407FA68D100F4EFC7 /* CEBorderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 25B2C24207FA68D100F4EFC7 /* CEBorderView.m */; };
25B2C24D07FA6BC400F4EFC7 /* CETextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 25B2C24B07FA6BC400F4EFC7 /* CETextView.m */; };
2A009ACB1A57BA8B00C3D542 /* CETextFinder.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A009ACA1A57BA8B00C3D542 /* CETextFinder.m */; };
- 2A009ACE1A587B3100C3D542 /* CEFindTextFieldCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A009ACD1A587B3100C3D542 /* CEFindTextFieldCell.m */; };
2A009AD11A58ED1D00C3D542 /* CEFindResultViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A009AD01A58ED1D00C3D542 /* CEFindResultViewController.m */; };
2A009ADA1A5AAE8000C3D542 /* CEFindPanelSplitView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A009AD91A5AAE8000C3D542 /* CEFindPanelSplitView.m */; };
2A07202B18E0E1C2006F3A43 /* CEPrintPanelAccessoryController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A07202A18E0E1C2006F3A43 /* CEPrintPanelAccessoryController.m */; };
@@ -123,6 +122,9 @@
2AD318C31A462C30001B8112 /* CEIntegrationPaneController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2AD318C21A462C30001B8112 /* CEIntegrationPaneController.m */; };
2AD4599B19DDCF6600A20FBB /* CEScriptMenuItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 2AD4599A19DDCF6600A20FBB /* CEScriptMenuItem.m */; };
2AD5322A19779FD000A925CA /* CELineHeightTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 2AD5322919779FD000A925CA /* CELineHeightTransformer.m */; };
+ 2AD67C241AA7285F0078BB95 /* CEFindPanelTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2AD67C231AA7285F0078BB95 /* CEFindPanelTextView.m */; };
+ 2AD67C2A1AA75E7F0078BB95 /* CEFindPanelTextClipView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2AD67C291AA75E7F0078BB95 /* CEFindPanelTextClipView.m */; };
+ 2AD67C2F1AA7651B0078BB95 /* CEFindPanelLayoutManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 2AD67C2E1AA7651B0078BB95 /* CEFindPanelLayoutManager.m */; };
2AD84CAA1966314100DE49BD /* CEODBEventSender.m in Sources */ = {isa = PBXBuildFile; fileRef = 2AD84CA91966314100DE49BD /* CEODBEventSender.m */; };
2AE2E9D519D2CF00000D66A9 /* CEEncodingManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 2AE2E9D419D2CF00000D66A9 /* CEEncodingManager.m */; };
2AE356461A86D32500E29FEF /* CEClipView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2AE356451A86D32500E29FEF /* CEClipView.m */; };
@@ -246,8 +248,6 @@
25B2C24B07FA6BC400F4EFC7 /* CETextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CETextView.m; sourceTree = ""; };
2A009AC91A57BA8B00C3D542 /* CETextFinder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CETextFinder.h; sourceTree = ""; };
2A009ACA1A57BA8B00C3D542 /* CETextFinder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CETextFinder.m; sourceTree = ""; };
- 2A009ACC1A587B3100C3D542 /* CEFindTextFieldCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CEFindTextFieldCell.h; sourceTree = ""; };
- 2A009ACD1A587B3100C3D542 /* CEFindTextFieldCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CEFindTextFieldCell.m; sourceTree = ""; };
2A009ACF1A58ED1D00C3D542 /* CEFindResultViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CEFindResultViewController.h; sourceTree = ""; };
2A009AD01A58ED1D00C3D542 /* CEFindResultViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CEFindResultViewController.m; sourceTree = ""; };
2A009AD81A5AAE7F00C3D542 /* CEFindPanelSplitView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CEFindPanelSplitView.h; sourceTree = ""; };
@@ -484,6 +484,12 @@
2AD488721A085D8B00B795CB /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/SyntaxEditSheet.strings; sourceTree = ""; };
2AD5322819779FD000A925CA /* CELineHeightTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CELineHeightTransformer.h; sourceTree = ""; };
2AD5322919779FD000A925CA /* CELineHeightTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CELineHeightTransformer.m; sourceTree = ""; };
+ 2AD67C221AA7285F0078BB95 /* CEFindPanelTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CEFindPanelTextView.h; sourceTree = ""; };
+ 2AD67C231AA7285F0078BB95 /* CEFindPanelTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CEFindPanelTextView.m; sourceTree = ""; };
+ 2AD67C281AA75E7F0078BB95 /* CEFindPanelTextClipView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CEFindPanelTextClipView.h; sourceTree = ""; };
+ 2AD67C291AA75E7F0078BB95 /* CEFindPanelTextClipView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CEFindPanelTextClipView.m; sourceTree = ""; };
+ 2AD67C2D1AA7651B0078BB95 /* CEFindPanelLayoutManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CEFindPanelLayoutManager.h; sourceTree = ""; };
+ 2AD67C2E1AA7651B0078BB95 /* CEFindPanelLayoutManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CEFindPanelLayoutManager.m; sourceTree = ""; };
2AD84CA81966314100DE49BD /* CEODBEventSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CEODBEventSender.h; sourceTree = ""; };
2AD84CA91966314100DE49BD /* CEODBEventSender.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CEODBEventSender.m; sourceTree = ""; };
2AE2E9D319D2CF00000D66A9 /* CEEncodingManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CEEncodingManager.h; sourceTree = ""; };
@@ -605,8 +611,8 @@
children = (
2A009AD81A5AAE7F00C3D542 /* CEFindPanelSplitView.h */,
2A009AD91A5AAE8000C3D542 /* CEFindPanelSplitView.m */,
- 2A009ACC1A587B3100C3D542 /* CEFindTextFieldCell.h */,
- 2A009ACD1A587B3100C3D542 /* CEFindTextFieldCell.m */,
+ 2AD67C281AA75E7F0078BB95 /* CEFindPanelTextClipView.h */,
+ 2AD67C291AA75E7F0078BB95 /* CEFindPanelTextClipView.m */,
);
name = Views;
sourceTree = "";
@@ -1038,6 +1044,10 @@
2A7CF2421A5747EC00D09249 /* CEFindPanelController.m */,
2A009ACF1A58ED1D00C3D542 /* CEFindResultViewController.h */,
2A009AD01A58ED1D00C3D542 /* CEFindResultViewController.m */,
+ 2AD67C221AA7285F0078BB95 /* CEFindPanelTextView.h */,
+ 2AD67C231AA7285F0078BB95 /* CEFindPanelTextView.m */,
+ 2AD67C2D1AA7651B0078BB95 /* CEFindPanelLayoutManager.h */,
+ 2AD67C2E1AA7651B0078BB95 /* CEFindPanelLayoutManager.m */,
2A009ADB1A5AB96F00C3D542 /* Views */,
);
name = "Text Finder";
@@ -1413,6 +1423,7 @@
8CB0122E07CA0EFA00221EDC /* CEToolbarController.m in Sources */,
258D708A07D456DF0062A3E5 /* CETextSelection.m in Sources */,
8CC1925707E2D84500B54AE4 /* CEDocument+ScriptingSupport.m in Sources */,
+ 2AD67C241AA7285F0078BB95 /* CEFindPanelTextView.m in Sources */,
2A63122E19C2D30C0088C5C6 /* CEThemeViewController.m in Sources */,
8CC1961D07E2E54E00B54AE4 /* CEScriptManager.m in Sources */,
2AACC9591942A82900E3FF63 /* CEIndicatorSheetController.m in Sources */,
@@ -1430,10 +1441,11 @@
2A07202B18E0E1C2006F3A43 /* CEPrintPanelAccessoryController.m in Sources */,
2A3A759419E77D66001DAB88 /* CEMigrationWindowController.m in Sources */,
2A51793A1A40A3B500A3F852 /* CEShortcutKeyField.m in Sources */,
+ 2AD67C2A1AA75E7F0078BB95 /* CEFindPanelTextClipView.m in Sources */,
+ 2AD67C2F1AA7651B0078BB95 /* CEFindPanelLayoutManager.m in Sources */,
2A7846DE18FE0C0C006BDF00 /* CETheme.m in Sources */,
2A68F93818FB04F400673440 /* CEMenuItemCell.m in Sources */,
2AB432711912AF7200835004 /* CEGlyphPopoverController.m in Sources */,
- 2A009ACE1A587B3100C3D542 /* CEFindTextFieldCell.m in Sources */,
2AE356461A86D32500E29FEF /* CEClipView.m in Sources */,
2AFFB71B18D7F18300118477 /* CEGoToSheetController.m in Sources */,
2A3FB2AD18ECEFF200D9CB2C /* CESyntaxEditSheetController.m in Sources */,
diff --git a/CotEditor/Info.plist b/CotEditor/Info.plist
index 0194854646..4681155995 100644
--- a/CotEditor/Info.plist
+++ b/CotEditor/Info.plist
@@ -953,11 +953,11 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 2.1.1
+ 2.1.2
CFBundleSignature
cEd1
CFBundleVersion
- 2.1.1
+ 2.1.2
LSApplicationCategoryType
public.app-category.productivity
NSAppleScriptEnabled
diff --git a/CotEditor/Sources/CEDocument.m b/CotEditor/Sources/CEDocument.m
index 4f30308393..ee689bd712 100644
--- a/CotEditor/Sources/CEDocument.m
+++ b/CotEditor/Sources/CEDocument.m
@@ -55,8 +55,8 @@ @interface CEDocument ()
@property (nonatomic) CEPrintPanelAccessoryController *printPanelAccessoryController;
-@property (atomic) BOOL needsShowUpdateAlertWithBecomeKey;
-@property (atomic, getter=isRevertingForExternalFileUpdate) BOOL revertingForExternalFileUpdate;
+@property (nonatomic) BOOL needsShowUpdateAlertWithBecomeKey;
+@property (nonatomic, getter=isRevertingForExternalFileUpdate) BOOL revertingForExternalFileUpdate;
@property (nonatomic) BOOL didAlertNotWritable; // 文書が読み込み専用のときにその警告を表示したかどうか
@property (nonatomic, copy) NSString *fileContentString; // string that is read from the document file
@property (nonatomic) CEODBEventSender *ODBEventSender;
@@ -224,6 +224,29 @@ - (NSData *)dataOfType:(NSString *)typeName error:(NSError *__autoreleasing *)ou
}
+// ------------------------------------------------------
+/// modify place to create backup file
+- (void)saveToURL:(NSURL *)url ofType:(NSString *)typeName forSaveOperation:(NSSaveOperationType)saveOperation completionHandler:(void (^)(NSError *))completionHandler
+// ------------------------------------------------------
+{
+ // save backup file always in `~/Library/Autosaved Information/` direcotory
+ // (The default backup URL is the same directory as the fileURL.)
+ if (saveOperation == NSAutosaveElsewhereOperation && [self fileURL]) {
+ NSURL *autosaveDirectoryURL = [[NSFileManager defaultManager] URLForDirectory:NSAutosavedInformationDirectory
+ inDomain:NSUserDomainMask
+ appropriateForURL:nil
+ create:YES
+ error:nil];
+ NSString *baseFileName = [[self fileURL] lastPathComponent];
+ NSString *fileName = [NSString stringWithFormat:@"%@ (%p)", [baseFileName stringByDeletingPathExtension], self]; // append a unique string to avoid overwriting another backup file with the same file name.
+
+ url = [[autosaveDirectoryURL URLByAppendingPathComponent:fileName] URLByAppendingPathExtension:[baseFileName pathExtension]];
+ }
+
+ [super saveToURL:url ofType:typeName forSaveOperation:saveOperation completionHandler:completionHandler];
+}
+
+
// ------------------------------------------------------
/// ファイルの保存(保存処理で包括的に呼ばれる)
- (BOOL)writeSafelyToURL:(NSURL *)url ofType:(NSString *)typeName forSaveOperation:(NSSaveOperationType)saveOperation error:(NSError *__autoreleasing *)outError
@@ -247,7 +270,9 @@ - (BOOL)writeSafelyToURL:(NSURL *)url ofType:(NSString *)typeName forSaveOperati
[self getFileAttributes];
// 外部エディタプロトコル(ODB Editor Suite)のファイル更新通知送信
- [[self ODBEventSender] sendModifiedEventWithURL:url operation:saveOperation];
+ if (saveOperation != NSAutosaveElsewhereOperation) {
+ [[self ODBEventSender] sendModifiedEventWithURL:url operation:saveOperation];
+ }
// changeCountを更新
[self updateChangeCountWithToken:token forSaveOperation:saveOperation];
@@ -1081,23 +1106,30 @@ - (void)applyLineEndingToView
- (NSData *)forceReadDataFromURL:(NSURL *)url
// ------------------------------------------------------
{
- NSData *data = nil;
- NSString *convertedPath = @([[url path] UTF8String]);
- NSTask *task = [[NSTask alloc] init];
-
- @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];
- }
+ __block BOOL success = NO;
+ __block NSData *data = nil;
- int status = [task terminationStatus];
+ NSFileCoordinator *coordinator = [[NSFileCoordinator alloc] initWithFilePresenter:self];
+ [coordinator coordinateReadingItemAtURL:url options:0
+ error:nil
+ byAccessor:^(NSURL *newURL)
+ {
+ NSString *convertedPath = @([[newURL path] UTF8String]);
+ NSTask *task = [[NSTask alloc] init];
+
+ [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];
+ success = (status == 0);
+ }];
- return (status == 0) ? data : nil;
+ return success ? data : nil;
}
@@ -1375,7 +1407,7 @@ - (BOOL)acceptSaveDocumentWithIANACharSetName
- (BOOL)forceWriteToURL:(NSURL *)url ofType:(NSString *)typeName forSaveOperation:(NSSaveOperationType)saveOperation
// ------------------------------------------------------
{
- BOOL success = NO;
+ __block BOOL success = NO;
NSData *data = [self dataOfType:typeName error:nil];
if (!data) { return NO; }
@@ -1398,25 +1430,31 @@ - (BOOL)forceWriteToURL:(NSURL *)url ofType:(NSString *)typeName forSaveOperatio
return NO;
}
+ NSFileCoordinator *coordinator = [[NSFileCoordinator alloc] initWithFilePresenter:self];
+
// "authopen" コマンドを使って保存
- NSString *convertedPath = @([[url path] UTF8String]);
- NSTask *task = [[NSTask alloc] init];
-
- [task setLaunchPath:@"/usr/libexec/authopen"];
- [task setArguments:@[@"-c", @"-w", convertedPath]];
- [task setStandardInput:[NSPipe pipe]];
-
- [task launch];
- [[[task standardInput] fileHandleForWriting] writeData:data];
- [[[task standardInput] fileHandleForWriting] closeFile];
- [task waitUntilExit];
-
- int status = [task terminationStatus];
- success = (status == 0);
+ [coordinator coordinateWritingItemAtURL:url options:0
+ error:nil
+ byAccessor:^(NSURL *newURL)
+ {
+ NSString *convertedPath = @([[newURL path] UTF8String]);
+ NSTask *task = [[NSTask alloc] init];
+
+ [task setLaunchPath:@"/usr/libexec/authopen"];
+ [task setArguments:@[@"-c", @"-w", convertedPath]];
+ [task setStandardInput:[NSPipe pipe]];
+
+ [task launch];
+ [[[task standardInput] fileHandleForWriting] writeData:data];
+ [[[task standardInput] fileHandleForWriting] closeFile];
+ [task waitUntilExit];
+
+ int status = [task terminationStatus];
+ success = (status == 0);
+ }];
if (success) {
// クリエータなどを設定
- NSFileCoordinator *coordinator = [[NSFileCoordinator alloc] initWithFilePresenter:self];
[coordinator coordinateWritingItemAtURL:url options:0
error:nil
byAccessor:^(NSURL *newURL)
@@ -1433,7 +1471,6 @@ - (BOOL)forceWriteToURL:(NSURL *)url ofType:(NSString *)typeName forSaveOperatio
// Finder Lock がかかってたなら、再びかける
if (isFinderLockOn) {
__block BOOL lockSuccess = NO;
- NSFileCoordinator *coordinator = [[NSFileCoordinator alloc] initWithFilePresenter:self];
[coordinator coordinateWritingItemAtURL:url options:0
error:nil
byAccessor:^(NSURL *newURL)
@@ -1496,32 +1533,35 @@ - (BOOL)canUnlockFileAtURL:(NSURL *)url isLocked:(BOOL *)isLocked lockAgain:(BOO
// ------------------------------------------------------
{
__block BOOL isFinderLocked = NO;
- BOOL success = NO;
+ __block BOOL success = NO;
NSError *error = nil;
NSFileManager *fileManager = [NSFileManager defaultManager];
- @synchronized(self) {
- NSFileCoordinator *coordinator = [[NSFileCoordinator alloc] initWithFilePresenter:self];
- [coordinator coordinateReadingItemAtURL:url options:NSFileCoordinatorReadingWithoutChanges
+ 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) {
+ [coordinator coordinateWritingItemAtURL:url options:0
error:&error
byAccessor:^(NSURL *newURL)
{
- isFinderLocked = [[fileManager attributesOfItemAtPath:[newURL path] error:nil] fileIsImmutable];
+ // unlock file once
+ success = [fileManager setAttributes:@{NSFileImmutable:@NO} ofItemAtPath:[newURL path] error:nil];
+ if (success) {
+ // lock file again if needed
+ if (lockAgain) {
+ [fileManager setAttributes:@{NSFileImmutable:@YES} ofItemAtPath:[newURL path] error:nil];
+ }
+ }
}];
-
- 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 {
- // no-lock file is always treated as success
- success = YES;
- }
+ } else {
+ // no-lock file is always treated as success
+ success = YES;
}
if (isLocked) {
diff --git a/CotEditor/Sources/CEFindPanelController.m b/CotEditor/Sources/CEFindPanelController.m
index 7da4fedd47..22c74cc86e 100644
--- a/CotEditor/Sources/CEFindPanelController.m
+++ b/CotEditor/Sources/CEFindPanelController.m
@@ -37,6 +37,7 @@
// constants
static const CGFloat kDefaultResultViewHeight = 200.0;
static const NSUInteger kMaxHistorySize = 20;
+static NSString *const kEscapeCharacter = @"\\";
@interface CEFindPanelController ()
@@ -48,7 +49,6 @@ @interface CEFindPanelController () NSAppKitVersionNumber10_9) {
+ color = [NSColor tertiaryLabelColor];
+ } else {
+ color = [NSColor colorWithCalibratedWhite:0.0 alpha:0.25];
+ }
+
+ NSFont *font = [[self firstTextView] font];
+ font = [font screenFont] ? : font;
+ NSDictionary *attributes = @{NSFontAttributeName: font,
+ NSForegroundColorAttributeName: color};
+ NSFont *fullwidthFont = [[NSFont fontWithName:@"HiraKakuProN-W3" size:[font pointSize]] screenFont] ? : font;
+ NSDictionary *fullwidthAttributes = @{NSFontAttributeName: fullwidthFont,
+ NSForegroundColorAttributeName: color};
+
+ BOOL showsSpace = [defaults boolForKey:CEDefaultShowInvisibleSpaceKey];
+ BOOL showsTab = [defaults boolForKey:CEDefaultShowInvisibleTabKey];
+ BOOL showsNewLine = [defaults boolForKey:CEDefaultShowInvisibleNewLineKey];
+ BOOL showsFullwidthSpace = [defaults boolForKey:CEDefaultShowInvisibleFullwidthSpaceKey];
+ BOOL showsOtherInvisibles = [defaults boolForKey:CEDefaultShowOtherInvisibleCharsKey];
+
+ unichar spaceChar = [CEUtils invisibleSpaceChar:[defaults integerForKey:CEDefaultInvisibleSpaceKey]];
+ NSAttributedString *space = [[NSAttributedString alloc] initWithString:[NSString stringWithCharacters:&spaceChar length:1]
+ attributes:attributes];
+
+ unichar tabChar = [CEUtils invisibleTabChar:[defaults integerForKey:CEDefaultInvisibleTabKey]];
+ NSAttributedString *tab = [[NSAttributedString alloc] initWithString:[NSString stringWithCharacters:&tabChar length:1]
+ attributes:attributes];
+
+ unichar newLineChar = [CEUtils invisibleNewLineChar:[defaults integerForKey:CEDefaultInvisibleNewLineKey]];
+ NSAttributedString *newLine = [[NSAttributedString alloc] initWithString:[NSString stringWithCharacters:&newLineChar length:1]
+ attributes:attributes];
+
+ unichar fullwidthSpaceChar = [CEUtils invisibleFullwidthSpaceChar:[defaults integerForKey:CEDefaultInvisibleFullwidthSpaceKey]];
+ NSAttributedString *fullwidthSpace = [[NSAttributedString alloc] initWithString:[NSString stringWithCharacters:&fullwidthSpaceChar length:1]
+ attributes:fullwidthAttributes];
+
+ for (NSUInteger glyphIndex = glyphsToShow.location; glyphIndex < lengthToRedraw; glyphIndex++) {
+ NSUInteger charIndex = [self characterIndexForGlyphAtIndex:glyphIndex];
+ unichar character = [completeStr characterAtIndex:charIndex];
+
+ if (showsSpace && ((character == ' ') || (character == 0x00A0))) {
+ NSPoint pointToDraw = [self pointToDrawGlyphAtIndex:glyphIndex adjust:inset];
+ [space drawAtPoint:pointToDraw];
+
+ } else if (showsTab && (character == '\t')) {
+ NSPoint pointToDraw = [self pointToDrawGlyphAtIndex:glyphIndex adjust:inset];
+ [tab drawAtPoint:pointToDraw];
+
+ } else if (showsNewLine && (character == '\n')) {
+ NSPoint pointToDraw = [self pointToDrawGlyphAtIndex:glyphIndex adjust:inset];
+ [newLine drawAtPoint:pointToDraw];
+
+ } else if (showsFullwidthSpace && (character == 0x3000)) { // Fullwidth-space (JP)
+ NSPoint pointToDraw = [self pointToDrawGlyphAtIndex:glyphIndex adjust:inset];
+ [fullwidthSpace drawAtPoint:pointToDraw];
+
+ } else if (showsOtherInvisibles && ([self glyphAtIndex:glyphIndex] == NSControlGlyph)) {
+ NSFont *replaceFont = [NSFont fontWithName:@"Lucida Grande" size:[font pointSize]];
+ NSGlyph replaceGlyph = [replaceFont glyphWithName:@"replacement"];
+ NSUInteger charLength = CFStringIsSurrogateHighCharacter(character) ? 2 : 1;
+ NSRange charRange = NSMakeRange(charIndex, charLength);
+ NSString *baseStr = [completeStr substringWithRange:charRange];
+ NSGlyphInfo *glyphInfo = [NSGlyphInfo glyphInfoWithGlyph:replaceGlyph forFont:replaceFont baseString:baseStr];
+
+ if (glyphInfo) {
+ NSDictionary *replaceAttrs = @{NSGlyphInfoAttributeName: glyphInfo,
+ NSFontAttributeName: replaceFont,
+ NSForegroundColorAttributeName: color};
+ NSDictionary *attrs = [[self textStorage] attributesAtIndex:charIndex effectiveRange:NULL];
+ if (attrs[NSGlyphInfoAttributeName] == nil) {
+ [[self textStorage] addAttributes:replaceAttrs range:charRange];
+ }
+ }
+ }
+ }
+ }
+
+ [super drawGlyphsForGlyphRange:glyphsToShow atPoint:origin];
+}
+
+
+// ------------------------------------------------------
+/// fix vertical glyph location for mixed font
+- (NSPoint)locationForGlyphAtIndex:(NSUInteger)glyphIndex
+// ------------------------------------------------------
+{
+ NSPoint point = [super locationForGlyphAtIndex:glyphIndex];
+ point.y = [[NSFont systemFontOfSize:[self fontSize]] ascender];
+
+ return point;
+}
+
+
+// ------------------------------------------------------
+/// fix line height for mixed font
+- (void)setLineFragmentRect:(NSRect)fragmentRect forGlyphRange:(NSRange)glyphRange usedRect:(NSRect)usedRect
+// ------------------------------------------------------
+{
+ static const CGFloat kLineSpacing = 4.0;
+ CGFloat lineHeight = [self fontSize] + kLineSpacing;
+
+ fragmentRect.size.height = lineHeight;
+ usedRect.size.height = lineHeight;
+
+ [super setLineFragmentRect:fragmentRect forGlyphRange:glyphRange usedRect:usedRect];
+}
+
+
+
+#pragma mark Private Methods
+
+//------------------------------------------------------
+/// calculate point to draw invisible character
+- (NSPoint)pointToDrawGlyphAtIndex:(NSUInteger)glyphIndex adjust:(NSSize)size
+//------------------------------------------------------
+{
+ NSPoint drawPoint = [self locationForGlyphAtIndex:glyphIndex];
+ NSPoint lineOrigin = [self lineFragmentRectForGlyphAtIndex:glyphIndex effectiveRange:NULL].origin;
+
+ drawPoint.x += size.width;
+ drawPoint.y = lineOrigin.y + size.height;
+
+ return drawPoint;
+}
+
+@end
diff --git a/CotEditor/Sources/CEFindPanelTextClipView.h b/CotEditor/Sources/CEFindPanelTextClipView.h
new file mode 100644
index 0000000000..51553074f4
--- /dev/null
+++ b/CotEditor/Sources/CEFindPanelTextClipView.h
@@ -0,0 +1,35 @@
+/*
+ ==============================================================================
+ CEFindPanelTextClipView
+
+ CotEditor
+ http://coteditor.com
+
+ Created on 2015-03-05 by 1024jp
+ encoding="UTF-8"
+ ------------------------------------------------------------------------------
+
+ © 2015 1024jp
+
+ This program is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any later
+ version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ ==============================================================================
+ */
+
+@import Cocoa;
+
+
+@interface CEFindPanelTextClipView : NSClipView
+
+@end
diff --git a/CotEditor/Sources/CEFindTextFieldCell.m b/CotEditor/Sources/CEFindPanelTextClipView.m
similarity index 76%
rename from CotEditor/Sources/CEFindTextFieldCell.m
rename to CotEditor/Sources/CEFindPanelTextClipView.m
index 46e43fea6b..ed7d339aa7 100644
--- a/CotEditor/Sources/CEFindTextFieldCell.m
+++ b/CotEditor/Sources/CEFindPanelTextClipView.m
@@ -1,11 +1,11 @@
/*
==============================================================================
- CEFindTextFieldCell
+ CEFindPanelTextClipView
CotEditor
http://coteditor.com
- Created on 2015-01-03 by 1024jp
+ Created on 2015-03-05 by 1024jp
encoding="UTF-8"
------------------------------------------------------------------------------
@@ -27,24 +27,24 @@
==============================================================================
*/
-#import "CEFindTextFieldCell.h"
+#import "CEFindPanelTextClipView.h"
-@implementation CEFindTextFieldCell
+@implementation CEFindPanelTextClipView
#pragma mark Superclass Methods
// ------------------------------------------------------
-/// add left padding for history popup
-- (NSRect)drawingRectForBounds:(NSRect)theRect
+/// add left padding for popup button
+- (void)setFrame:(NSRect)frame
// ------------------------------------------------------
{
- const CGFloat padding = 28;
+ const CGFloat padding = 28.0;
- theRect.size.width -= padding;
- theRect.origin.x += padding;
+ frame.origin.x += padding;
+ frame.size.width -= padding;
- return [super drawingRectForBounds:theRect];
+ [super setFrame:frame];
}
@end
diff --git a/CotEditor/Sources/CEFindTextFieldCell.h b/CotEditor/Sources/CEFindPanelTextView.h
similarity index 90%
rename from CotEditor/Sources/CEFindTextFieldCell.h
rename to CotEditor/Sources/CEFindPanelTextView.h
index 08b009edc0..26f9dfbb05 100644
--- a/CotEditor/Sources/CEFindTextFieldCell.h
+++ b/CotEditor/Sources/CEFindPanelTextView.h
@@ -1,11 +1,11 @@
/*
==============================================================================
- CEFindTextFieldCell
+ CEFindPanelTextView
CotEditor
http://coteditor.com
- Created on 2015-01-03 by 1024jp
+ Created on 2015-03-04 by 1024jp
encoding="UTF-8"
------------------------------------------------------------------------------
@@ -30,6 +30,6 @@
@import Cocoa;
-@interface CEFindTextFieldCell : NSTextFieldCell
+@interface CEFindPanelTextView : NSTextView
@end
diff --git a/CotEditor/Sources/CEFindPanelTextView.m b/CotEditor/Sources/CEFindPanelTextView.m
new file mode 100644
index 0000000000..e2bf31fae5
--- /dev/null
+++ b/CotEditor/Sources/CEFindPanelTextView.m
@@ -0,0 +1,152 @@
+/*
+ ==============================================================================
+ CEFindPanelTextView
+
+ CotEditor
+ http://coteditor.com
+
+ Created on 2015-03-04 by 1024jp
+ encoding="UTF-8"
+ ------------------------------------------------------------------------------
+
+ © 2015 1024jp
+
+ This program is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option) any later
+ version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ ==============================================================================
+ */
+
+#import "CEFindPanelTextView.h"
+#import "CEFindPanelLayoutManager.h"
+#import "CEFindPanelController.h"
+#import "constants.h"
+
+
+@interface CEFindPanelTextView ()
+
+@property (nonatomic) IBOutlet CEFindPanelController *findPanelController;
+
+@end
+
+
+
+
+#pragma mark -
+
+@implementation CEFindPanelTextView
+
+#pragma mark Superclass Methods
+
+// ------------------------------------------------------
+/// initialize instance
+- (instancetype)initWithCoder:(NSCoder *)coder
+// ------------------------------------------------------
+{
+ self = [super initWithCoder:coder];
+ if (self) {
+ // set system font (standard NSTextField behavior)
+ NSFont *font = [NSFont systemFontOfSize:[NSFont systemFontSize]];
+ [self setFont:font];
+
+ // set inset a bit like NSTextField (horizontal inset is added in CEFindPanelTextClipView)
+ [self setTextContainerInset:NSMakeSize(0.0, 2.0)];
+
+ // avoid wrapping
+ [[self textContainer] setWidthTracksTextView:NO];
+ [[self textContainer] setContainerSize:NSMakeSize(CGFLOAT_MAX, CGFLOAT_MAX)];
+ [self setHorizontallyResizable:YES];
+
+ // disable automatic text substitutions
+ if ([self respondsToSelector:@selector(setAutomaticQuoteSubstitutionEnabled:)]) { // only on OS X 10.9 and later
+ [self setAutomaticQuoteSubstitutionEnabled:NO];
+ [self setAutomaticDashSubstitutionEnabled:NO];
+ }
+ [self setAutomaticTextReplacementEnabled:NO];
+ [self setAutomaticSpellingCorrectionEnabled:NO];
+ [self setSmartInsertDeleteEnabled:NO];
+
+ // set subclassed layout manager for invisible characters
+ CEFindPanelLayoutManager *layoutManager = [[CEFindPanelLayoutManager alloc] init];
+ [[self textContainer] replaceLayoutManager:layoutManager];
+ }
+ return self;
+}
+
+
+// ------------------------------------------------------
+/// view is on focus
+- (BOOL)becomeFirstResponder
+// ------------------------------------------------------
+{
+ // select whole string on focus (standard NSTextField behavior)
+ [self setSelectedRange:NSMakeRange(0, [[self string] length])];
+
+ return [super becomeFirstResponder];
+}
+
+
+// ------------------------------------------------------
+/// view dismiss focus
+- (BOOL)resignFirstResponder
+// ------------------------------------------------------
+{
+ // clear current selection (standard NSTextField behavior)
+ [self setSelectedRange:NSMakeRange(0, 0)];
+ return [super resignFirstResponder];
+}
+
+
+// ------------------------------------------------------
+/// swap '¥' with '\' if needed
+- (void)insertText:(id)aString replacementRange:(NSRange)replacementRange
+// ------------------------------------------------------
+{
+ NSString *string = ([aString isKindOfClass:[NSAttributedString class]]) ? [aString string] : aString;
+
+ // swap '¥' with '\' if needed
+ if ([[NSUserDefaults standardUserDefaults] boolForKey:CEDefaultSwapYenAndBackSlashKey] && ([string length] == 1)) {
+ NSString *yen = [NSString stringWithCharacters:&kYenMark length:1];
+
+ if ([string isEqualToString:@"\\"]) {
+ string = yen;
+ } else if ([string isEqualToString:yen]) {
+ string = @"\\";
+ }
+ }
+
+ [super insertText:string replacementRange:replacementRange];
+}
+
+
+// ------------------------------------------------------
+/// jump to the next responder with tab key (standard NSTextField behavior)
+- (void)insertTab:(id)sender
+// ------------------------------------------------------
+{
+ [[self window] makeFirstResponder:[self nextKeyView]];
+}
+
+
+// ------------------------------------------------------
+/// perform Find Next with return
+- (void)insertNewline:(id)sender
+// ------------------------------------------------------
+{
+ // -> do nothing if no findpanelController is connected (standard NSTextField behavior)
+ if ([self findPanelController]) {
+ [[self findPanelController] findNext:self];
+ }
+}
+
+@end
diff --git a/CotEditor/Sources/CESyntaxParser.m b/CotEditor/Sources/CESyntaxParser.m
index c3fe020194..dd769a8d76 100644
--- a/CotEditor/Sources/CESyntaxParser.m
+++ b/CotEditor/Sources/CESyntaxParser.m
@@ -65,11 +65,11 @@ @interface CESyntaxParser ()
@property (nonatomic) CELayoutManager *layoutManager;
@property (nonatomic) BOOL hasSyntaxHighlighting;
-@property (atomic, copy) NSDictionary *coloringDictionary;
-@property (atomic, copy) NSDictionary *simpleWordsCharacterSets;
-@property (atomic, copy) NSDictionary *pairedQuoteTypes; // dict for quote pair to extract with comment
-@property (atomic, copy) NSArray *cacheColorings; // extracted results cache of the last whole string coloring
-@property (atomic, copy) NSString *cacheHash; // MD5 hash
+@property (nonatomic, copy) NSDictionary *coloringDictionary;
+@property (nonatomic, copy) NSDictionary *simpleWordsCharacterSets;
+@property (nonatomic, copy) NSDictionary *pairedQuoteTypes; // dict for quote pair to extract with comment
+@property (nonatomic, copy) NSArray *cacheColorings; // extracted results cache of the last whole string coloring
+@property (nonatomic, copy) NSString *cacheHash; // MD5 hash
@property (atomic) CEIndicatorSheetController *indicatorController;
diff --git a/CotEditor/Sources/CETextFinder.m b/CotEditor/Sources/CETextFinder.m
index 4edbe80b7b..83aa9b2dfe 100644
--- a/CotEditor/Sources/CETextFinder.m
+++ b/CotEditor/Sources/CETextFinder.m
@@ -52,7 +52,6 @@ + (void)initialize
CEDefaultReplaceHistoryKey: @[],
CEDefaultFindRegexSyntaxKey: @([OGRegularExpression defaultSyntax]),
CEDefaultFindOptionsKey: @(OgreCaptureGroupOption),
- CEDefaultFindEscapeCharacterKey: [OGRegularExpression defaultEscapeCharacter],
CEDefaultFindUsesRegularExpressionKey: @NO,
CEDefaultFindInSelectionKey: @NO,
CEDefaultFindIsWrapKey: @YES,
diff --git a/CotEditor/Sources/constants.h b/CotEditor/Sources/constants.h
index 68bb4bdd11..9f8df5758e 100644
--- a/CotEditor/Sources/constants.h
+++ b/CotEditor/Sources/constants.h
@@ -193,7 +193,6 @@ extern NSString *const CEDefaultPrintColorIndexKey;
extern NSString *const CEDefaultFindHistoryKey;
extern NSString *const CEDefaultReplaceHistoryKey;
extern NSString *const CEDefaultFindRegexSyntaxKey;
-extern NSString *const CEDefaultFindEscapeCharacterKey;
extern NSString *const CEDefaultFindUsesRegularExpressionKey;
extern NSString *const CEDefaultFindInSelectionKey;
extern NSString *const CEDefaultFindIsWrapKey;
diff --git a/CotEditor/Sources/constants.m b/CotEditor/Sources/constants.m
index 59237e3f00..6c80301379 100644
--- a/CotEditor/Sources/constants.m
+++ b/CotEditor/Sources/constants.m
@@ -197,7 +197,6 @@ BOOL CEIsAlmostEqualCGFloats(CGFloat float1, CGFloat float2) {
NSString *const CEDefaultFindHistoryKey = @"findHistory";
NSString *const CEDefaultReplaceHistoryKey = @"replaceHistory";
NSString *const CEDefaultFindRegexSyntaxKey = @"findRegexSynatx";
-NSString *const CEDefaultFindEscapeCharacterKey = @"findEscapeCharacter";
NSString *const CEDefaultFindUsesRegularExpressionKey = @"findUsesRegularExpression";
NSString *const CEDefaultFindInSelectionKey = @"findInSelection";
NSString *const CEDefaultFindIsWrapKey = @"findIsWrap";
@@ -453,6 +452,7 @@ BOOL CEIsAlmostEqualCGFloats(CGFloat float1, CGFloat float2) {
kCFStringEncodingISOLatinGreek, // Greek (ISO 8859-7)
kCFStringEncodingMacCyrillic, // Cyrillic (Mac OS)
kCFStringEncodingISOLatinCyrillic, // Cyrillic (ISO 8859-5)
+ kCFStringEncodingWindowsCyrillic, // Cyrillic (Windows)
kCFStringEncodingMacCentralEurRoman, // Central European (Mac OS)
kCFStringEncodingMacTurkish, // Turkish (Mac OS)
kCFStringEncodingMacIcelandic, // Icelandic (Mac OS)
@@ -470,7 +470,6 @@ BOOL CEIsAlmostEqualCGFloats(CGFloat float1, CGFloat float2) {
kCFStringEncodingNonLossyASCII, // Non-lossy ASCII
kCFStringEncodingInvalidId, // ----------
- // Encodings available 10.4 and later (CotEditor added in 0.8.0)
kCFStringEncodingUTF16BE, // Unicode (UTF-16BE)
kCFStringEncodingUTF16LE, // Unicode (UTF-16LE)
kCFStringEncodingUTF32, // Unicode (UTF-32)
@@ -492,6 +491,7 @@ BOOL CEIsAlmostEqualCGFloats(CGFloat float1, CGFloat float2) {
kCFStringEncodingISOLatinGreek, // Greek (ISO 8859-7)
kCFStringEncodingMacCyrillic, // Cyrillic (Mac OS)
kCFStringEncodingISOLatinCyrillic, // Cyrillic (ISO 8859-5)
+ kCFStringEncodingWindowsCyrillic, // Cyrillic (Windows)
kCFStringEncodingMacCentralEurRoman, // Central European (Mac OS)
kCFStringEncodingISOLatin2, // Central European (ISO Latin 2)
kCFStringEncodingISOLatin3, // Western (ISO Latin 3)
diff --git a/CotEditor/cot/cot.m b/CotEditor/cot/cot.m
index 3339063dab..7b99e41a2f 100644
--- a/CotEditor/cot/cot.m
+++ b/CotEditor/cot/cot.m
@@ -143,7 +143,7 @@ int main(int argc, const char * argv[])
}
// read piped text if exists
- NSString *input;
+ NSString *input = nil;
if (!isatty(fileno(stdin))) {
NSFileHandle *inputHandler = [NSFileHandle fileHandleWithStandardInput];
NSData *data = [inputHandler availableData];
@@ -195,10 +195,12 @@ int main(int argc, const char * argv[])
[[CotEditor documents] addObject:document];
}
- document = document ? : [[CotEditor documents] firstObject];
-
// jump to location
- if (document && (arguments[kLineOption] || arguments[kColumnOption])) {
+ if (arguments[kLineOption] || arguments[kColumnOption]) {
+ document = document ? : [[CotEditor documents] firstObject];
+
+ if (!document) { exit(0); }
+
NSInteger line = [arguments[kLineOption] integerValue]; // 1 based
NSInteger column = [arguments[kColumnOption] integerValue];
diff --git a/CotEditor/ja.lproj/FindPanel.strings b/CotEditor/ja.lproj/FindPanel.strings
index 7ca0da7c52..8351268e6e 100644
--- a/CotEditor/ja.lproj/FindPanel.strings
+++ b/CotEditor/ja.lproj/FindPanel.strings
@@ -15,10 +15,10 @@
/* Class = "NSPanel"; title = "Find & Replace"; ObjectID = "Wal-Sg-6d6"; */
"Wal-Sg-6d6.title" = "検索と置換";
-/* Class = "IBBindingConnection"; ibShadowedIsNilPlaceholder = "Find"; ObjectID = "KFJ-K2-zGh"; */
-"KFJ-K2-zGh.ibShadowedIsNilPlaceholder" = "検索";
-/* Class = "IBBindingConnection"; ibShadowedIsNilPlaceholder = "Replace"; ObjectID = "rCp-kT-O6b"; */
-"rCp-kT-O6b.ibShadowedIsNilPlaceholder" = "置換";
+/* Class = "IBBindingConnection"; ibShadowedIsNilPlaceholder = "Find"; ObjectID = "oNs-q5-oCH"; */
+"oNs-q5-oCH.ibShadowedIsNilPlaceholder" = "検索";
+/* Class = "IBBindingConnection"; ibShadowedIsNilPlaceholder = "Replace"; ObjectID = "zd8-iN-ws4"; */
+"zd8-iN-ws4.ibShadowedIsNilPlaceholder" = "置換";
/* Class = "NSButtonCell"; title = "Regular Expression"; ObjectID = "brT-HP-GVL"; */
"brT-HP-GVL.title" = "正規表現";
@@ -101,11 +101,6 @@
/* Class = "NSMenuItem"; title = "Ruby"; ObjectID = "NPK-8x-xDg"; */
"NPK-8x-xDg.title" = "Ruby";
-/* Class = "NSMenuItem"; title = "Escape Character"; ObjectID = "r68-46-LBY"; */
-"r68-46-LBY.title" = "エスケープ文字";
-/* Class = "NSMenu"; title = "Escape Character"; ObjectID = "OVR-vE-lYb"; */
-"OVR-vE-lYb.title" = "エスケープ文字";
-
/* Class = "NSMenuItem"; title = "Single Line"; ObjectID = "UQ6-Up-xWI"; */
"UQ6-Up-xWI.title" = "単一行";
/* Class = "NSMenuItem"; title = "Multiline"; ObjectID = "kPN-Hy-ym0"; */
diff --git a/CotEditor/zh-Hans.lproj/FindPanel.strings b/CotEditor/zh-Hans.lproj/FindPanel.strings
index 3c9931c443..ee7a2ae1cd 100644
--- a/CotEditor/zh-Hans.lproj/FindPanel.strings
+++ b/CotEditor/zh-Hans.lproj/FindPanel.strings
@@ -16,10 +16,10 @@
/* Class = "NSPanel"; title = "Find & Replace"; ObjectID = "Wal-Sg-6d6"; */
"Wal-Sg-6d6.title" = "查找 & 替换";
-/* Class = "IBBindingConnection"; ibShadowedIsNilPlaceholder = "Find"; ObjectID = "KFJ-K2-zGh"; */
-"KFJ-K2-zGh.ibShadowedIsNilPlaceholder" = "查找";
-/* Class = "IBBindingConnection"; ibShadowedIsNilPlaceholder = "Replace"; ObjectID = "rCp-kT-O6b"; */
-"rCp-kT-O6b.ibShadowedIsNilPlaceholder" = "替换";
+/* Class = "IBBindingConnection"; ibShadowedIsNilPlaceholder = "Find"; ObjectID = "oNs-q5-oCH"; */
+"oNs-q5-oCH.ibShadowedIsNilPlaceholder" = "查找";
+/* Class = "IBBindingConnection"; ibShadowedIsNilPlaceholder = "Replace"; ObjectID = "zd8-iN-ws4"; */
+"zd8-iN-ws4.ibShadowedIsNilPlaceholder" = "替换";
/* Class = "NSButtonCell"; title = "Regular Expression"; ObjectID = "brT-HP-GVL"; */
"brT-HP-GVL.title" = "正则表达式";
@@ -102,11 +102,6 @@
/* Class = "NSMenuItem"; title = "Ruby"; ObjectID = "NPK-8x-xDg"; */
"NPK-8x-xDg.title" = "Ruby";
-/* Class = "NSMenuItem"; title = "Escape Character"; ObjectID = "r68-46-LBY"; */
-"r68-46-LBY.title" = "字符转换";
-/* Class = "NSMenu"; title = "Escape Character"; ObjectID = "OVR-vE-lYb"; */
-"OVR-vE-lYb.title" = "字符转换";
-
/* Class = "NSMenuItem"; title = "Single Line"; ObjectID = "UQ6-Up-xWI"; */
"UQ6-Up-xWI.title" = "单行";
/* Class = "NSMenuItem"; title = "Multiline"; ObjectID = "kPN-Hy-ym0"; */