Skip to content

Commit

Permalink
Merge branch 'release/2.1.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
usami-k committed Mar 26, 2015
2 parents 953373f + 4e4e9c4 commit ad09ea6
Show file tree
Hide file tree
Showing 20 changed files with 261 additions and 35 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@
Change Log
==========================

develop
--------------------------

### Additions/Changes

- Revert find panel behavior to select always whole text in find field when the panel is called.


### Fixes

- Fix line number drawing with large line numbers.
- Fix an issue where the external modification notification did not work.
- Improve general stability.



2.1.2
--------------------------

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



<article>
<header>
<h1>CotEditor 2.1.3</h1>
<p>release: <time>2015-03-26</time></p>
</header>


<section>
<h2>Additions/Changes</h2>

<ul>
<li>Revert find panel behavior to select always whole text in find field when the panel is called.</li>
</ul>
</section>


<section>
<h2>Fixes</h2>

<ul>
<li>Fix line number drawing with large line numbers.</li>
<li>Fix an issue where the external modification notification did not work.</li>
<li>Improve general stability.</li>
</ul>
</section>
</article>



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



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


<section>
<h2>機能改善/仕様変更</h2>

<ul>
<li>検索パネルを呼び出した時に検索文字列を全選択する仕様を復帰</li>
</ul>
</section>


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

<ul>
<li>行番号の桁数が大きいときの行番号描画を修正</li>
<li>外部プロセスによる編集の通知が機能していなかった不具合を修正</li>
<li>安定性の向上</li>
</ul>
</section>
</article>



<article>
<header>
<h1>CotEditor 2.1.2</h1>
Expand All @@ -41,7 +70,7 @@ <h2>機能改善/仕様変更</h2>
<li>環境設定の「“¥”と“\”のキーを入れ替える」オプションが検索パネルのテキストフィールドにも適用されるように改良</li>
<li>正規表現検索の「エスケープ文字」オプションを削除</li>
</ul></li>
<li>取り扱えるエンコーディングに「キリル文字 (Windows)」を追加<</li>
<li>取り扱えるエンコーディングに「キリル文字 (Windows)」を追加</li>
<li><code>cot</code> コマンドの呼び出しパフォーマンスを改善</li>
</ul>
</section>
Expand Down Expand Up @@ -95,7 +124,7 @@ <h2>新機能</h2>
<ul>
<li>この機能は実際のファイルを自動で変更するものではありません。変更をファイルに反映させるには引き続き手動で「保存」を実行する必要があります。</li>
</ul></li>
<li>AppleScript の documment オブジェクトに <code>tab width</code> プロパティを追加</li>
<li>AppleScript の document オブジェクトに <code>tab width</code> プロパティを追加</li>
<li>CotEditor スクリプトが最前面書類の絶対パスを引数として受け取るように</li>
<li>OS X のサービス機能 “選択範囲を含む新規書類を CotEditor で開く” と “ファイルを CotEditor で開く” を追加</li>
<li>“Erlang”と “Julia” シンタックス定義を追加</li>
Expand Down
6 changes: 6 additions & 0 deletions CotEditor/CotEditor.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
2A7CF2401A573CEB00D09249 /* FindPanel.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2A7CF23E1A573CEB00D09249 /* FindPanel.xib */; };
2A7CF2431A5747EC00D09249 /* CEFindPanelController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A7CF2421A5747EC00D09249 /* CEFindPanelController.m */; };
2A84C7C21A48F3150013EE83 /* CEPreferencesWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A84C7C11A48F3150013EE83 /* CEPreferencesWindow.m */; };
2A8663DD18C9F6B700A6F9CC /* NSData+MD5.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A8663DC18C9F6B700A6F9CC /* NSData+MD5.m */; };
2A8711681986DAEC009FA1C0 /* NSString+MD5.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A8711671986DAEC009FA1C0 /* NSString+MD5.m */; };
2A94A45A18D08D52009FA90D /* NSWindow+ScriptingSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A94A45918D08D52009FA90D /* NSWindow+ScriptingSupport.m */; };
2A94A45E18D0B562009FA90D /* CEOpacityPanelController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A94A45C18D0B562009FA90D /* CEOpacityPanelController.m */; };
Expand Down Expand Up @@ -358,6 +359,8 @@
2A7CF2421A5747EC00D09249 /* CEFindPanelController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CEFindPanelController.m; sourceTree = "<group>"; };
2A84C7C01A48F3150013EE83 /* CEPreferencesWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CEPreferencesWindow.h; sourceTree = "<group>"; };
2A84C7C11A48F3150013EE83 /* CEPreferencesWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CEPreferencesWindow.m; sourceTree = "<group>"; };
2A8663DB18C9F6B600A6F9CC /* NSData+MD5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+MD5.h"; sourceTree = "<group>"; };
2A8663DC18C9F6B700A6F9CC /* NSData+MD5.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+MD5.m"; sourceTree = "<group>"; };
2A8711661986DAEC009FA1C0 /* NSString+MD5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+MD5.h"; sourceTree = "<group>"; };
2A8711671986DAEC009FA1C0 /* NSString+MD5.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+MD5.m"; sourceTree = "<group>"; };
2A94A45818D08D51009FA90D /* NSWindow+ScriptingSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSWindow+ScriptingSupport.h"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -757,6 +760,8 @@
2A63122919C25CF80088C5C6 /* CEHexColorTransformer.m */,
2AD5322819779FD000A925CA /* CELineHeightTransformer.h */,
2AD5322919779FD000A925CA /* CELineHeightTransformer.m */,
2A8663DB18C9F6B600A6F9CC /* NSData+MD5.h */,
2A8663DC18C9F6B700A6F9CC /* NSData+MD5.m */,
2A8711661986DAEC009FA1C0 /* NSString+MD5.h */,
2A8711671986DAEC009FA1C0 /* NSString+MD5.m */,
2AC75C061A2AF47E00C7DB0A /* NSString+CENewLine.h */,
Expand Down Expand Up @@ -1480,6 +1485,7 @@
2AB432741915D6AA00835004 /* NSString+ComposedCharacter.m in Sources */,
2A2BDF0D198A899E0029848B /* NSString+JapaneseTransform.m in Sources */,
2A8711681986DAEC009FA1C0 /* NSString+MD5.m in Sources */,
2A8663DD18C9F6B700A6F9CC /* NSData+MD5.m in Sources */,
2AC75C081A2AF47F00C7DB0A /* NSString+CENewLine.m in Sources */,
2A1068C31A745FCE001DB9AA /* NSURL+AppleTextEncoding.m in Sources */,
2A40D7CD1A23FBE200721EB4 /* openDictionary.applescript in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0600"
LastUpgradeVersion = "0620"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -48,7 +48,8 @@
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8D15AC270486D014006FF6A4"
Expand All @@ -66,7 +67,8 @@
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8D15AC270486D014006FF6A4"
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.2</string>
<string>2.1.3</string>
<key>CFBundleSignature</key>
<string>cEd1</string>
<key>CFBundleVersion</key>
<string>2.1.2</string>
<string>2.1.3</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
<key>NSAppleScriptEnabled</key>
Expand Down
1 change: 1 addition & 0 deletions CotEditor/Sources/CEAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ + (void)initialize
CEDefaultNotifyEditByAnotherKey: @YES,
CEDefaultColoringRangeBufferLengthKey: @5000,
CEDefaultLargeFileAlertThresholdKey: @(100 * pow(1024, 2)), // 100 MB
CEDefaultAutosavingDelayKey: @5.0,
};
[[NSUserDefaults standardUserDefaults] registerDefaults:defaults];

Expand Down
42 changes: 33 additions & 9 deletions CotEditor/Sources/CEDocument.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#import "CESyntaxManager.h"
#import "CEUtils.h"
#import "NSURL+AppleTextEncoding.h"
#import "NSData+MD5.h"
#import "constants.h"


Expand All @@ -58,6 +59,7 @@ @interface CEDocument ()
@property (nonatomic) BOOL needsShowUpdateAlertWithBecomeKey;
@property (nonatomic, getter=isRevertingForExternalFileUpdate) BOOL revertingForExternalFileUpdate;
@property (nonatomic) BOOL didAlertNotWritable; // 文書が読み込み専用のときにその警告を表示したかどうか
@property (nonatomic, copy) NSString *fileMD5;
@property (nonatomic, copy) NSString *fileContentString; // string that is read from the document file
@property (nonatomic) CEODBEventSender *ODBEventSender;
@property (nonatomic) BOOL shouldSaveXattr;
Expand Down Expand Up @@ -265,12 +267,12 @@ - (BOOL)writeSafelyToURL:(NSURL *)url ofType:(NSString *)typeName forSaveOperati
if (saveOperation == NSSaveAsOperation) {
[self setSyntaxStyleWithFileName:[url lastPathComponent] coloring:YES];
}

// 保持しているファイル情報/表示する文書情報を更新
[self getFileAttributes];

// 外部エディタプロトコル(ODB Editor Suite)のファイル更新通知送信
if (saveOperation != NSAutosaveElsewhereOperation) {
// 保持しているファイル情報/表示する文書情報を更新
[self getFileAttributes];

// 外部エディタプロトコル(ODB Editor Suite)のファイル更新通知送信
[[self ODBEventSender] sendModifiedEventWithURL:url operation:saveOperation];
}

Expand Down Expand Up @@ -543,17 +545,31 @@ -(BOOL)validateToolbarItem:(NSToolbarItem *)item
- (void)presentedItemDidChange
// ------------------------------------------------------
{
// check modification date of represented file
__block NSDate *contentModificationDate;
// ファイルのmodificationDateがドキュメントのmodificationDateと同じ場合は無視
NSFileCoordinator *coordinator = [[NSFileCoordinator alloc] initWithFilePresenter:self];
__block NSDate *fileModificationDate;
[coordinator coordinateReadingItemAtURL:[self fileURL] options:NSFileCoordinatorReadingWithoutChanges
error:nil byAccessor:^(NSURL *newURL)
{
[newURL getResourceValue:&contentModificationDate forKey:NSURLContentModificationDateKey error:nil];
NSDictionary *fileAttrs = [[NSFileManager defaultManager] attributesOfItemAtPath:[newURL path] error:nil];
fileModificationDate = [fileAttrs fileModificationDate];
}];
if ([fileModificationDate isEqualToDate:[self fileModificationDate]]) { return; }

// ignore if contents wasn't changed.
if ([contentModificationDate isEqualToDate:[self fileModificationDate]]) { return; }
// ファイルのMD5ハッシュが保持しているものと同じ場合は編集されていないと認識させた上で無視
__block NSString *MD5;
[coordinator coordinateReadingItemAtURL:[self fileURL] options:NSFileCoordinatorReadingWithoutChanges
error:nil byAccessor:^(NSURL *newURL)
{
MD5 = [[NSData dataWithContentsOfURL:newURL] MD5];
}];
if ([MD5 isEqualToString:[self fileMD5]]) {
// documentの保持しているfileModificationDateを書き換える (2014-03 by 1024jp)
// ここだけで無視してもファイル保存時にアラートが出るのことへの対策
[self setFileModificationDate:fileModificationDate];

return;
}

// notify about external file update
[self setNeedsShowUpdateAlertWithBecomeKey:YES];
Expand Down Expand Up @@ -1148,6 +1164,9 @@ - (BOOL)readFromURL:(NSURL *)url encoding:(NSStringEncoding)encoding
return NO;
}

// presentedItemDidChangeにて内容の同一性を比較するためにファイルのMD5を保存する
[self setFileMD5:[data MD5]];

// try reading the `com.apple.TextEncoding` extended attribute
NSStringEncoding xattrEncoding = [url getAppleTextEncoding];

Expand Down Expand Up @@ -1454,6 +1473,11 @@ - (BOOL)forceWriteToURL:(NSURL *)url ofType:(NSString *)typeName forSaveOperatio
}];

if (success) {
if (saveOperation != NSAutosaveElsewhereOperation) {
// presentedItemDidChange にて内容の同一性を比較するためにファイルの MD5 を保存する
[self setFileMD5:[data MD5]];
}

// クリエータなどを設定
[coordinator coordinateWritingItemAtURL:url options:0
error:nil
Expand Down
6 changes: 1 addition & 5 deletions CotEditor/Sources/CEDocumentController.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@
#import "constants.h"


// constant
static const NSTimeInterval kAutosavingDelay = 5.0;


@interface CEDocumentController ()

@property (nonatomic) BOOL showsHiddenFiles;
Expand Down Expand Up @@ -68,7 +64,7 @@ - (instancetype)init
if (self) {
_accessorySelectedEncoding = (NSStringEncoding)[[NSUserDefaults standardUserDefaults] integerForKey:CEDefaultEncodingInOpenKey];

[self setAutosavingDelay:kAutosavingDelay];
[self setAutosavingDelay:(NSTimeInterval)[[NSUserDefaults standardUserDefaults] doubleForKey:CEDefaultAutosavingDelayKey]];
}
return self;
}
Expand Down
5 changes: 5 additions & 0 deletions CotEditor/Sources/CEFindPanelController.m
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,11 @@ - (IBAction)showFindPanel:(id)sender
}

// select text in find text field
if ([[self findPanel] firstResponder] == [[self findPanel] initialFirstResponder]) {
// force reset firstResponder to invoke becomeFirstResponder in CEFindPanelTextView every time
// -> `becomeFirstResponder` will not be called on `makeFirstResponder:` if it given object is alrady set as first responder.
[[self findPanel] makeFirstResponder:nil];
}
[[self findPanel] makeFirstResponder:[[self findPanel] initialFirstResponder]];

[super showFindPanel:sender];
Expand Down
3 changes: 1 addition & 2 deletions CotEditor/Sources/CEFindPanelLayoutManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,8 @@ - (void)drawGlyphsForGlyphRange:(NSRange)glyphsToShow atPoint:(NSPoint)origin
// ------------------------------------------------------
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
BOOL showInvisibles = [defaults boolForKey:CEDefaultShowInvisiblesKey];

if (showInvisibles) {
if ([defaults boolForKey:CEDefaultShowInvisiblesKey]) {
NSTextView *textView = [self firstTextView];
NSString *completeStr = [[self textStorage] string];
NSUInteger lengthToRedraw = NSMaxRange(glyphsToShow);
Expand Down
23 changes: 18 additions & 5 deletions CotEditor/Sources/CELineNumberView.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
#import "constants.h"


const CGFloat kMinVerticalThickness = 32.0;
static const CGFloat kMinVerticalThickness = 32.0;
static const NSUInteger kMinNumberOfDigits = 3;


@interface CELineNumberView ()
Expand Down Expand Up @@ -86,6 +87,17 @@ - (instancetype)initWithScrollView:(NSScrollView *)scrollView orientation:(NSRul
}


// ------------------------------------------------------
/// setup initial size
- (void)viewDidMoveToSuperview
// ------------------------------------------------------
{
[super viewDidMoveToSuperview];

[self setRuleThickness:kMinVerticalThickness];
}


// ------------------------------------------------------
/// clean up
- (void)dealloc
Expand Down Expand Up @@ -158,7 +170,7 @@ - (void)drawHashMarksAndLabelsInRect:(NSRect)rect
CGFloat charWidth = advance.width;

// prepare frame width
CGFloat width = kMinVerticalThickness;
CGFloat width = [self ruleThickness];

// adjust drawing coordinate
NSPoint relativePoint = [self convertPoint:NSZeroPoint fromView:[self textView]];
Expand Down Expand Up @@ -237,11 +249,12 @@ - (void)drawHashMarksAndLabelsInRect:(NSRect)rect
CGContextShowGlyphsAtPositions(context, glyphs, positions, digit); // draw line number
}

CGContextRestoreGState(context);

// adjust thickness
CGFloat requiredWidth = MAX(numberOfDigits(lineNum) * charWidth + 3 * kLineNumPadding, kMinVerticalThickness);
NSUInteger length = MAX(numberOfDigits(lineNum), kMinNumberOfDigits);
CGFloat requiredWidth = MAX(length * charWidth + 3 * kLineNumPadding, kMinVerticalThickness);
[self setRuleThickness:ceil(requiredWidth)];

CGContextRestoreGState(context);
}


Expand Down
Loading

0 comments on commit ad09ea6

Please sign in to comment.