We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6f32016 commit 4ee6bd6Copy full SHA for 4ee6bd6
1 file changed
Sources/CodeEditSourceEditor/SourceEditor/SourceEditor.swift
@@ -138,6 +138,10 @@ public struct SourceEditor: NSViewControllerRepresentable {
138
if context.coordinator.isUpdateFromTextView {
139
context.coordinator.isUpdateFromTextView = false
140
} else {
141
+ // Update text if it changed externally (e.g. switching files)
142
+ if case .binding(let binding) = text, controller.textView.string != binding.wrappedValue {
143
+ controller.textView.setText(binding.wrappedValue)
144
+ }
145
context.coordinator.isUpdatingFromRepresentable = true
146
updateControllerWithState(state, controller: controller)
147
context.coordinator.isUpdatingFromRepresentable = false
0 commit comments