Fix updating file mapping

This commit is contained in:
1024jp 2022-05-07 02:33:30 +09:00
parent 0c45e3a865
commit bb236d9cc6
6 changed files with 22 additions and 8 deletions

View File

@ -2,7 +2,7 @@
Change Log
==========================
4.2.0 (unreleased)
4.2.0-rc.3 (unreleased)
--------------------------
### Improvements
@ -12,6 +12,7 @@ Change Log
### Fixes
- Fix an issue that the changes of syntax styles after the launch were not applied to the file mapping.
- [rc] Fix an issue that some UI states were not restored from the last session.

View File

@ -15,9 +15,9 @@
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1lj-uv-tp6">
<rect key="frame" x="310" y="13" width="76" height="27"/>
<rect key="frame" x="328" y="13" width="58" height="27"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="64" id="6wx-JO-VXi"/>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="44" id="6wx-JO-VXi"/>
</constraints>
<buttonCell key="cell" type="push" title="Close" bezelStyle="rounded" alignment="center" controlSize="small" borderStyle="border" inset="2" id="1021">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@ -53,6 +53,9 @@ DQ
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystem"/>
</buttonCell>
<connections>
<action selector="openHelpAnchor:" target="foX-H3-gAp" id="b7D-T5-bd8"/>
</connections>
</button>
<stackView distribution="fillEqually" orientation="vertical" alignment="leading" spacing="19" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" horizontalClippingResistancePriority="750" verticalClippingResistancePriority="750" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="QlX-zU-Kbs">
<rect key="frame" x="20" y="44" width="360" height="362"/>
@ -132,7 +135,7 @@ DQ
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="w8q-3P-Q1e">
<rect key="frame" x="90.5" y="1" width="97" height="16"/>
<rect key="frame" x="91" y="1" width="97" height="16"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" id="bkQ-4g-uet">
@ -300,7 +303,7 @@ DQ
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="FdF-7h-gtp">
<rect key="frame" x="90.5" y="1" width="97" height="16"/>
<rect key="frame" x="91" y="1" width="97" height="16"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" id="Qt3-S7-Bpi">
@ -468,7 +471,7 @@ DQ
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="SjR-UH-naJ">
<rect key="frame" x="92.5" y="1" width="97" height="16"/>
<rect key="frame" x="93" y="1" width="97" height="16"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" id="85I-66-i9l">

View File

@ -77,6 +77,7 @@
<h2>Fixes</h2>
<ul>
<li>Fix an issue that the changes of syntax styles after the launch were not applied to the file mapping.</li>
<li><span class="trivial">trivial</span>: Fix an issue that the Script menu appeared in the shortcut menu even when no script exists.</li>
</ul>
</section>

View File

@ -77,6 +77,7 @@
<h2>修正</h2>
<ul>
<li>アプリケーション起動後に加えられたシンタックススタイルの変更がファイル関連付けに反映されていなかった不具合を修正</li>
<li><span class="trivial">trivial</span>: スクリプトメニューが空のときもコンテキストメニューにスクリプトサブメニューが現れていた不具合を修正</li>
</ul>
</section>

View File

@ -128,7 +128,7 @@ final class FormatPaneController: NSViewController, NSMenuItemValidation, NSTabl
// append target setting name to menu titles
switch menuItem.action {
case #selector(openSyntaxMappingConflictSheet(_:)):
return SyntaxManager.shared.mappingConflicts.contains { !$0.value.isEmpty }
return !SyntaxManager.shared.mappingConflicts.isEmpty
case #selector(duplicateSyntaxStyle(_:)):
if let name = representedSettingName, !isContextualMenu {

View File

@ -79,6 +79,8 @@ final class SyntaxManager: SettingFileManaging {
.filenames: [:],
.interpreters: [:]]
private var settingUpdateObserver: AnyCancellable?
// MARK: -
@ -98,6 +100,10 @@ final class SyntaxManager: SettingFileManaging {
// cache user styles
self.checkUserSettings()
// update also .mappingTables
self.settingUpdateObserver = self.didUpdateSetting
.sink { [weak self] _ in self?.checkUserSettings() }
}
@ -243,7 +249,9 @@ final class SyntaxManager: SettingFileManaging {
/// conflicted maps
var mappingConflicts: [SyntaxKey: [String: [SettingName]]] {
return self.mappingTables.mapValues { $0.filter { $0.value.count > 1 } }
self.mappingTables
.mapValues { $0.filter { $0.value.count > 1 } }
.filter { !$0.value.isEmpty }
}