Workadound toggleInspector(_:)

This commit is contained in:
1024jp 2023-08-15 18:44:14 +09:00
parent 14add4e03c
commit e792140549
6 changed files with 25 additions and 2 deletions

View File

@ -15,6 +15,7 @@ Change Log
- Fix an issue that the rectangular selection could not add an insertion point at the empty last line.
- Fix an issue that the line was not highlighted when one of multiple insertion points locates at the empty last line.
- Fix an issue that the current line highlight did not update when some editor setting was changed.
- Workaround an issue the toggle inspector command is disabled in macOS 14.

View File

@ -1236,6 +1236,7 @@ CA
<outlet property="snippetMenu" destination="dZy-7n-iCq" id="3hf-hr-ScA"/>
<outlet property="syntaxStylesMenu" destination="304" id="kdn-rP-dcP"/>
<outlet property="themesMenu" destination="165-HJ-Xty" id="R7w-wo-SVO"/>
<outlet property="toggleInspectorItem" destination="I2p-KB-gxR" id="pdk-TB-Z7O"/>
</connections>
</customObject>
<customObject id="1Vq-aI-bgB" customClass="NSFontManager"/>

View File

@ -72,6 +72,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet private weak var themesMenu: NSMenu?
@IBOutlet private weak var normalizationMenu: NSMenu?
@IBOutlet private weak var snippetMenu: NSMenu?
@IBOutlet private weak var toggleInspectorItem: NSMenuItem?
#if DEBUG
@ -156,6 +157,12 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
item.toolTip = form.localizedDescription
return item
}
// temporary workaround for macOS 14
if #available(macOS 14, *) {
self.toggleInspectorItem?.action = #selector(WindowContentViewController.toggleInspector_)
}
}

View File

@ -372,7 +372,11 @@ extension DocumentWindowController: NSToolbarDelegate {
item.label = String(localized: "Inspector")
item.toolTip = String(localized: "Show document information")
item.image = NSImage(systemSymbolName: "info.circle", accessibilityDescription: item.label)
item.action = #selector(WindowContentViewController.toggleInspector)
if #available(macOS 14, *) {
item.action = #selector(WindowContentViewController.toggleInspector_)
} else {
item.action = #selector(WindowContentViewController.toggleInspector)
}
item.visibilityPriority = .high
return item

View File

@ -239,6 +239,7 @@ final class KeyBindingManager: SettingManaging {
#selector((any SyntaxHolder).changeSyntaxStyle),
#selector((any ThemeHolder).changeTheme),
#selector(Document.changeLineEnding(_:)),
#selector(WindowContentViewController.toggleInspector_),
#selector(DocumentViewController.changeTabWidth),
#selector((any SnippetInsertable).insertSnippet),
#selector(ScriptManager.launchScript),

View File

@ -80,7 +80,7 @@ final class WindowContentViewController: NSSplitViewController {
// disable toggling inspector in the tab overview mode
switch item.action {
case #selector(toggleInspector):
case #selector(toggleInspector), #selector(toggleInspector_):
(item as? NSMenuItem)?.title = self.isInspectorShown
? String(localized: "Hide Inspector")
: String(localized: "Show Inspector")
@ -135,6 +135,15 @@ final class WindowContentViewController: NSSplitViewController {
}
/// Toggle visibility of the inspector (workaround for macOS 14).
@IBAction func toggleInspector_(_ sender: Any?) {
NSAnimationContext.current.withAnimation {
self.isInspectorShown.toggle()
}
}
/// Toggle visibility of the document inspector pane.
@IBAction func getInfo(_ sender: Any?) {