From 3e5e6df475ae757574cfb7453edf129777e4904b Mon Sep 17 00:00:00 2001 From: Khan Winter <35942988+thecoolwinter@users.noreply.github.com> Date: Sat, 15 Jun 2024 19:56:38 -0500 Subject: [PATCH] Update CodeEditSourceEditor.swift --- .../CodeEditSourceEditor.swift | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Sources/CodeEditSourceEditor/CodeEditSourceEditor/CodeEditSourceEditor.swift b/Sources/CodeEditSourceEditor/CodeEditSourceEditor/CodeEditSourceEditor.swift index 5107fd496..516e965c7 100644 --- a/Sources/CodeEditSourceEditor/CodeEditSourceEditor/CodeEditSourceEditor.swift +++ b/Sources/CodeEditSourceEditor/CodeEditSourceEditor/CodeEditSourceEditor.swift @@ -253,6 +253,15 @@ public struct CodeEditSourceEditor: NSViewControllerRepresentable { return } + updateControllerParams(controller: controller) + + controller.reloadUI() + return + } + + /// Update the parameters of the controller. + /// - Parameter controller: The controller to update. + func updateControllerParams(controller: TextViewController) { if controller.font != font { controller.font = font } @@ -296,11 +305,11 @@ public struct CodeEditSourceEditor: NSViewControllerRepresentable { } controller.bracketPairHighlight = bracketPairHighlight - - controller.reloadUI() - return } + /// Checks if the controller needs updating. + /// - Parameter controller: The controller to check. + /// - Returns: True, if the controller's parameters should be updated. func paramsAreEqual(controller: NSViewControllerType) -> Bool { controller.font == font && controller.isEditable == isEditable &&