Scroll editor before showing character inspector

This commit is contained in:
1024jp 2020-05-25 22:42:37 +09:00
parent da90ac0660
commit 02a1c3e8d6
4 changed files with 12 additions and 7 deletions

View File

@ -9,6 +9,10 @@ Change Log
- [beta] Add missing localizations for French.
### Fixes
- Fix an issue in the character inspector where the inspector was not shown when the target character is hidden due to scroll.
3.9.0-rc (419)

View File

@ -82,6 +82,7 @@
<li>Fix an issue where the outline menu could select the wrong item while typing.</li>
<li>Fix an issue where the line numbers could be shifted when printing vertical text orientation documents.</li>
<li>Fix an issue where line endings could remain when deleting duplicate lines with multiple selections.</li>
<li>Fix an issue in the character inspector where the inspector was not shown when the target character is hidden due to scroll.</li>
<li>Fix an issue in the line number view where the line number of the current line was not bolded under a specific condition.</li>
<li>Fix an issue in scripting with AppleScript/JXA where the application crashed by performing <code>string in ...</code> command.</li>
<li>Fix an issue in scripting with AppleScript/JXA where the contents of a document can rarely be overwritten with the contents of another document window under very specific conditions.</li>

View File

@ -82,6 +82,7 @@
<li>テキスト入力中にアウトラインメニューが1つずれた項目を現在の項目として選択することがあった不具合を修正</li>
<li>縦書きでプリントしたときに行番号表示位置がずれることがあった不具合を修正</li>
<li>複数の選択範囲がある状態で重複した行を削除したときに改行コードだけが残ることがあった不具合を修正</li>
<li>スクロールで対象文字が隠れていると文字インスペクタが表示されなかった不具合を修正</li>
<li>特定の条件下で現在行の行番号が太字にならなかった行番号ビューの不具合を修正</li>
<li><code>string in ...</code>コマンドを実行するとアプリケーションがクラッシュしたAppleScript/JXAの不具合を修正</li>
<li>スクリプト経由で開いた書類の内容がまれに既に開いているウインドウに反映されてしまったAppleScript/JXAの不具合を修正</li>

View File

@ -1131,7 +1131,8 @@ final class EditorTextView: NSTextView, Themable, CurrentLineHighlighting, URLDe
return !self.selectedRange.isEmpty
case #selector(showSelectionInfo):
return (self.string as NSString).substring(with: self.selectedRange).compareCount(with: 1) == .equal
return !self.hasMultipleInsertions &&
(self.string as NSString).substring(with: self.selectedRange).compareCount(with: 1) == .equal
case #selector(toggleComment):
if let menuItem = item as? NSMenuItem {
@ -1344,16 +1345,14 @@ final class EditorTextView: NSTextView, Themable, CurrentLineHighlighting, URLDe
selectedString = selectedString.replacingLineEndings(with: documentLineEnding)
}
guard
let characterInfo = try? CharacterInfo(string: selectedString),
let selectedRect = self.boundingRect(for: self.selectedRange)
else { return }
guard let characterInfo = try? CharacterInfo(string: selectedString) else { return }
let popoverController = CharacterPopoverController.instantiate(for: characterInfo)
let positioningRect = self.boundingRect(for: self.selectedRange)?.insetBy(dx: -4, dy: -4) ?? .zero
let positioningRect = self.convertToLayer(selectedRect).offsetBy(dx: 0, dy: -4)
popoverController.showPopover(relativeTo: positioningRect, of: self)
self.scrollRangeToVisible(self.selectedRange)
self.showFindIndicator(for: self.selectedRange)
popoverController.showPopover(relativeTo: positioningRect, of: self)
}