Skip to content

Commit

Permalink
Merge branch 'release/1.5.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
usami-k committed May 10, 2014
2 parents 4a5e74d + 6aa9a33 commit ce2b9fd
Show file tree
Hide file tree
Showing 42 changed files with 437 additions and 368 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<div id="contents">
<h1>Discover CotEditor</h1>
<p>CotEditor is a Cocoa text editor designed for editing plain text files such as web pages (HTML), program source codes (Perl, Python, etc.), or TeX sources. CotEditor offers a lot of useful features that are not available in Mac OS X's TextEdit. You'll find some of them below.</p>
<p>CotEditor is a Cocoa text editor designed for editing plain text files such as web pages (HTML), program source codes (Perl, Python, etc.), or TeX sources. CotEditor offers a lot of useful features that are not available in OS X's TextEdit. You'll find some of them below.</p>

<div class="topic_box">
<h2>Powerful find and replace</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ <h1>Format preferences</h1>
<dd>Turn this option on if you want to add a BOM (Byte Order Mark) to any file you save as UTF-8.<br />
UTF-8 with BOM can be problematic in some cases, so use this option with care. Leaving this option off is recommended unless you have a specific need for it.</dd>

<dt>On file opening</dt>
<dt>Opening Files</dt>
<dd>You can set the default character encoding used when opening an existing file. Auto-Detect will do fine for most cases.</dd>
<dd><dl>
<dt>Refer to encoding declaration</dt>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ <h1>General preferences</h1>
<dd><dl>
<dt>Automatically check for updates</dt>
<dd>When this option is selected, CotEditor checks the existence of the new version via internet automatically on launch. Then if the new one has been released, CotEditor notifies the information on the panel. You can also set the frequency of this checking here.</dd>

<dt>Open a new document</dt>
<dd>When this option is selected, a new blank document will be opened when you launch CotEditor.</dd>
</dl></dd>

<dt>Application</dt>
Expand All @@ -45,15 +48,8 @@ <h1>General preferences</h1>

<dt>Check spelling as you type</dt>
<dd>This option allows you to automatically check your spelling as you type.</dd>
</dl></dd>

<dt>Open a new document</dt>
<dd>You can set the timing to open a new blank document.</dd>
<dd><dl>
<dt>On launch</dt>
<dd>When this option is selected, a new blank document will be opened when you launch CotEditor.</dd>

<dt>With reopen AppleEvent</dt>
<dt>Open a new document when CotEditor becomes active</dt>
<dd>With this option selected, a new blank document will be opened when you click CotEditor's icon in the Dock and you had no window already open.</dd>
</dl></dd>
</dl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ <h1>Print preferences</h1>
<dd>You can either use the document's font or specify another font for printing purpose.</dd>

<dt>Color</dt>
<dd>To print a file with syntax coloring enabled, select the &ldquo;Same as document's setting&rdquo; option here.</dd>
<dd>To print a file with syntax coloring enabled, select the Same as document's setting option here.</dd>

<dt>Line numbers</dt>
<dd>You can choose between No Print, Same as document's setting, and Print.</dd>
<dd>You can choose between Don't Print, Same as document's setting, and Print.</dd>

<dt>Invisibles</dt>
<dd>You can choose between No Print, Same as document's setting, and Print All.</dd>
<dd>You can choose between Don't Print, Same as document's setting, and Print All.</dd>

<dt>Header and Footer</dt>
<dd>You can configure whether to print, what to print, whether to add separators, and where to print.</dd>
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<div id="contents">
<h1>CotEditor について</h1>
<p>CotEditor は Web ページ (HTML)、Perl や Python などのプログラム、TeX のソースといったプレーンテキストの編集に特化したテキストエディタです。CotEditor には Mac OS X 付属のテキストエディットにはない多くの便利な機能があります。このページではその一部をご紹介しましょう。</p>
<p>CotEditor は Web ページ (HTML)、Perl や Python などのプログラム、TeX のソースといったプレーンテキストの編集に特化したテキストエディタです。CotEditor には OS X 付属のテキストエディットにはない多くの便利な機能があります。このページではその一部をご紹介しましょう。</p>

<div class="topic_box">
<h2>強力な検索/置換機能</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ <h1>環境設定:フォーマット</h1>
<dd>エンコーディングを「UTF-8」で保存するとき、冒頭に識別のための「BOM」を追加します。<br />
用途によっては読み込めないなどの問題が起きることがありますので取扱には注意してください。特に必要がなければオフのままの使用をお勧めします。</dd>

<dt>ファイルオープン時</dt>
<dt>ファイルを開くとき</dt>
<dd>既存のファイルを開くときに使用する文字エンコーディングを設定します。通常は「自動認識」でよいでしょう。</dd>
<dd><ul>
<li>「自動認識」以外の文字エンコーディングを選択した場合にファイルの文字エンコーディングと一致しないときは、開いた後に手動で変更して再解釈させる必要があります。</li>
</ul></dd>
<dd><dl>
<dt>エンコーディング宣言を参照する</dt>
<dt>エンコーディング宣言を参照</dt>
<dd>テキスト中に書かれたエンコーディング指定タグを参照します。<br />
認識できるのは、優先順位順に &quot;<code>charset=</code>&quot; 、&quot;<code>encoding=</code>&quot; 、&quot;<code>@charset</code>&quot; です。<br />
くわしくは<a href="../pgs/about_autodetect_charset.html">「charset=」「encoding=」「@charset」タグによる自動認識</a>を参照してください。</dd>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ <h1>環境設定:一般</h1>
<dd><dl>
<dt>自動的にアップデートを確認</dt>
<dd>オンにすると、起動時に CotEditor の新しいバージョンがリリースされているかをインターネット経由で自動で確認します。新しいバージョンがある場合は、その情報をパネルで通知します。確認する頻度も指定できます。</dd>
<dt>新規書類を開く</dt>
<dd>オンの場合、起動時に空の書類ウインドウを開きます。</dd>
</dl></dd>

<dt>アプリケーション</dt>
Expand All @@ -37,23 +39,16 @@ <h1>環境設定:一般</h1>
<dt>コンテキストメニューにスクリプトメニューを追加</dt>
<dd>オンにすると、スクリプトメニュー項目を展開してコンテキストメニューに追加します。</dd>

<dt>ファイル保存時に拡張子 “txt” をつける</dt>
<dd>オンにすると、新規書類保存時にセーブパネルのファイル名に拡張子 “txt” が追加されます。</dd>
<dt>ファイル保存時に拡張子“txt”をつける</dt>
<dd>オンにすると、新規書類保存時にセーブパネルのファイル名に拡張子“txt”が追加されます。</dd>

<dt>改行コードを文字としてカウント</dt>
<dd>オンにすると、書類情報及びステータスバー上に表示する文字数は改行コードを含んだものになります。</dd>

<dt>入力中に自動スペルチェック</dt>
<dd>オンの場合、テキスト入力中に自動的にスペルチェックされます。</dd>
</dl></dd>

<dt>新規書類オープン</dt>
<dd>空の書類ウインドウを自動で開くタイミングを設定します。</dd>
<dd><dl>
<dt>起動時</dt>
<dd>オンの場合、起動時に空の書類ウインドウを開きます。</dd>

<dt>リオープンイベント時</dt>
<dt>CotEditor がアクティブになるとき新規書類を開く</dt>
<dd>オンの場合、Dock の CotEditor アイコンをクリックしたときに書類が開かれていなければ、空の書類ウインドウを開きます。</dd>
</dl></dd>
</dl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ <h1>環境設定:プリント</h1>
<dd>シンタックスのカラーリングも印刷するには、「書類の設定と同じ」を選択します。</dd>

<dt>行番号</dt>
<dd>プリントしない/書類の設定と同じ/プリントするから選択できます</dd>
<dd>プリントしない/書類の設定と同じ/プリントから選択できます</dd>

<dt>不可視文字</dt>
<dd>プリントしない/書類の設定と同じ/プリントするから選択できます</dd>
<dd>プリントしない/書類の設定と同じ/すべてプリントから選択できます</dd>

<dt>ヘッダ、フッタ</dt>
<dd>プリントの有無、プリント内容、区切り線のプリントの有無、プリント位置を設定できます。</dd>
Expand Down
4 changes: 2 additions & 2 deletions CotEditor/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.5.1</string>
<string>1.5.2</string>
<key>CFBundleSignature</key>
<string>cEd1</string>
<key>CFBundleVersion</key>
<string>1.5.1</string>
<string>1.5.2</string>
<key>NSAppleScriptEnabled</key>
<true/>
<key>NSHumanReadableCopyright</key>
Expand Down
2 changes: 2 additions & 0 deletions CotEditor/KeyBindings/DefaultMenuKeyBindings.plist
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@
<string>inputBackSlash:</string>
<key>^@h</key>
<string>editColorCode:</string>
<key>^@f</key>
<string>toggleFullScreen:</string>
<key>^~@</key>
<string>focusPrevSplitTextView:</string>
<key>^~@</key>
Expand Down
61 changes: 34 additions & 27 deletions CotEditor/Sources/CEEditorView.m
Original file line number Diff line number Diff line change
Expand Up @@ -598,54 +598,61 @@ - (void)alertForNotWritable
- (void)updateDocumentInfoStringWithDrawerForceUpdate:(BOOL)doUpdate
// ------------------------------------------------------
{
BOOL shouldUpdateStatusBar = [[self statusBar] showStatusBar];
BOOL shouldUpdateDrawer = (doUpdate) ? YES : [[self windowController] needsInfoDrawerUpdate];
BOOL updatesStatusBar = [[self statusBar] showStatusBar];
BOOL updatesDrawer = (doUpdate) ? YES : [[self windowController] needsInfoDrawerUpdate];

if (!shouldUpdateStatusBar && !shouldUpdateDrawer) { return; }
if (!updatesStatusBar && !updatesDrawer) { return; }

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSSpellChecker *spellChecker = [NSSpellChecker sharedSpellChecker];
NSString *theString = ([self lineEndingCharacter] == OgreCrLfNewlineCharacter) ? [self stringForSave] : [self string];
NSString *wholeString = ([self lineEndingCharacter] == OgreCrLfNewlineCharacter) ? [self stringForSave] : [self string];
NSString *singleCharInfo = nil;
NSRange selectedRange = [self selectedRange];
NSUInteger numberOfLines = 0, currentLine = 0, length = [theString length];
NSUInteger numberOfLines = 0, currentLine = 0, length = [wholeString length];
NSUInteger numberOfSelectedLines = 0;
NSUInteger lineStart = 0, column = 0, index = 0;
NSUInteger numberOfSelectedWords = 0, numberOfWords = 0;
BOOL isSelected = (selectedRange.length > 0);
BOOL hasSelection = (selectedRange.length > 0);

// IM で変換途中の文字列は選択範囲としてカウントしない (2007.05.20)
if ([[self textView] hasMarkedText]) {
selectedRange.length = 0;
}

if (length > 0) {
lineStart = [theString lineRangeForRange:selectedRange].location;
lineStart = [wholeString lineRangeForRange:selectedRange].location;
column = selectedRange.location - lineStart;

for (index = 0, numberOfLines = 0; index < length; numberOfLines++) {
if (index <= selectedRange.location) {
currentLine = numberOfLines + 1;
}
index = NSMaxRange([theString lineRangeForRange:NSMakeRange(index, 0)]);
index = NSMaxRange([wholeString lineRangeForRange:NSMakeRange(index, 0)]);
}

numberOfWords = [spellChecker countWordsInString:theString language:nil];
if (isSelected) {
NSString *selectedString = [theString substringWithRange:selectedRange];
numberOfSelectedLines = [[selectedString componentsSeparatedByString:@"\n"] count];
numberOfSelectedWords = [spellChecker countWordsInString:selectedString language:nil];
// 単語数カウント
if (updatesDrawer || [defaults boolForKey:k_key_showStatusBarWords]) {
numberOfWords = [spellChecker countWordsInString:wholeString language:nil];
if (hasSelection) {
numberOfSelectedWords = [spellChecker countWordsInString:[self substringWithSelection]
language:nil];
}
}
if (hasSelection) {
numberOfSelectedLines = [[[self substringWithSelection] componentsSeparatedByString:@"\n"] count];
}

// 改行コードをカウントしない場合は再計算
if (![[NSUserDefaults standardUserDefaults] boolForKey:k_key_countLineEndingAsChar]) {
NSString *locStr = [theString substringToIndex:selectedRange.location];
if (![defaults boolForKey:k_key_countLineEndingAsChar]) {
NSString *locStr = [wholeString substringToIndex:selectedRange.location];

selectedRange.location = [[OGRegularExpression chomp:locStr] length];
selectedRange.length = [[OGRegularExpression chomp:[self substringWithSelection]] length];
length = [[OGRegularExpression chomp:theString] length];
length = [[OGRegularExpression chomp:wholeString] length];
}
}

if (shouldUpdateStatusBar) {
if (updatesStatusBar) {
[[self statusBar] setLinesInfo:numberOfLines];
[[self statusBar] setSelectedLinesInfo:numberOfSelectedLines];
[[self statusBar] setCharsInfo:length];
Expand All @@ -657,45 +664,45 @@ - (void)updateDocumentInfoStringWithDrawerForceUpdate:(BOOL)doUpdate
[[self statusBar] setColumnInfo:column];
[[self statusBar] updateLeftField];
}
if (shouldUpdateDrawer) {
if (updatesDrawer) {
NSString *linesInfo, *charsInfo, *selectInfo, *wordsInfo, *byteLengthInfo;

if (selectedRange.length == 2) {
unichar firstChar = [theString characterAtIndex:selectedRange.location];
unichar secondChar = [theString characterAtIndex:selectedRange.location + 1];
unichar firstChar = [wholeString characterAtIndex:selectedRange.location];
unichar secondChar = [wholeString characterAtIndex:selectedRange.location + 1];
if (CFStringIsSurrogateHighCharacter(firstChar) && CFStringIsSurrogateLowCharacter(secondChar)) {
UTF32Char pair = CFStringGetLongCharacterForSurrogatePair(firstChar, secondChar);
singleCharInfo = [NSString stringWithFormat:@"U+%04tX", pair];
}
}
if (selectedRange.length == 1) {
unichar character = [theString characterAtIndex:selectedRange.location];
unichar character = [wholeString characterAtIndex:selectedRange.location];
singleCharInfo = [NSString stringWithFormat:@"U+%.4X", character];
}
NSUInteger byteLength = [theString lengthOfBytesUsingEncoding:[[self document] encodingCode]];
NSUInteger selectedByteLength = [[theString substringWithRange:selectedRange]
NSUInteger byteLength = [wholeString lengthOfBytesUsingEncoding:[[self document] encodingCode]];
NSUInteger selectedByteLength = [[wholeString substringWithRange:selectedRange]
lengthOfBytesUsingEncoding:[[self document] encodingCode]];

linesInfo = [NSString stringWithFormat:@"%tu", numberOfLines];
if (isSelected) {
if (hasSelection) {
linesInfo = [linesInfo stringByAppendingFormat:@" (%tu)", numberOfSelectedLines];
}
[[self windowController] setLinesInfo:linesInfo];

charsInfo = [NSString stringWithFormat:@"%tu", length];
if (isSelected) {
if (hasSelection) {
charsInfo = [charsInfo stringByAppendingFormat:@" (%tu)", selectedRange.length];
}
[[self windowController] setCharsInfo:charsInfo];

byteLengthInfo = [NSString stringWithFormat:@"%tu", byteLength];
if (isSelected) {
if (hasSelection) {
byteLengthInfo = [byteLengthInfo stringByAppendingFormat:@" (%tu)", selectedByteLength];
}
[[self windowController] setByteLengthInfo:byteLengthInfo];

wordsInfo = [NSString stringWithFormat:@"%tu", numberOfWords];
if (isSelected) {
if (hasSelection) {
wordsInfo = [wordsInfo stringByAppendingFormat:@" (%tu)", numberOfSelectedWords];
}
[[self windowController] setWordsInfo:wordsInfo];
Expand Down
2 changes: 1 addition & 1 deletion CotEditor/Sources/CEPrintPanelAccessoryController.m
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ -(NSArray *)localizedSummaryItems

switch ([self colorMode]) {
case CEBlackColorPrint:
description = @"Black Text";
description = @"Black and White";
break;
case CESameAsDocumentColorPrint:
description = @"Same as Document's Setting";
Expand Down
6 changes: 5 additions & 1 deletion CotEditor/Sources/CEScriptManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,13 @@ - (IBAction)openScriptFolder:(id)sender
- (IBAction)copySampleScriptToUserDomain:(id)sender
// ------------------------------------------------------
{
NSURL *sourceURL = [[NSBundle mainBundle] URLForResource:@"SampleScripts" withExtension:nil];
NSURL *sourceURL = [[NSBundle mainBundle] URLForResource:@"SampleScript" withExtension:nil];
NSURL *destURL = [[self scriptDirectoryURL] URLByAppendingPathComponent:@"SampleScript"];

if (![sourceURL checkResourceIsReachableAndReturnError:nil]) {
return;
}

if (![destURL checkResourceIsReachableAndReturnError:nil]) {
BOOL success = [[NSFileManager defaultManager] copyItemAtURL:sourceURL toURL:destURL error:nil];

Expand Down
Loading

0 comments on commit ce2b9fd

Please sign in to comment.