Skip to content

Commit 0a7299c

Browse files
committed
Update text first
During ’updateNS/UIView’, do update the text first, as this triggers rebuilding the line map and should, thus, happen before other information is updates (such as, e.g., messages).
1 parent 59aa89c commit 0a7299c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Sources/CodeEditorView/CodeEditor.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,6 @@ extension CodeEditor: UIViewRepresentable {
640640
messages: $messages,
641641
setAction: definitiveSetActions,
642642
setInfo: definitiveSetInfo)
643-
if codeView.lastMessages != messages { codeView.update(messages: messages) }
644643
if text != codeView.text { // Hoping for the string comparison fast path...
645644

646645
if language.languageService !== codeView.language.languageService {
@@ -656,6 +655,7 @@ extension CodeEditor: UIViewRepresentable {
656655
// }
657656

658657
}
658+
if codeView.lastMessages != messages { codeView.update(messages: messages) }
659659
if selection != codeView.selectedRange {
660660
codeView.selectedRange = selection
661661
if let codeStorageDelegate = codeView.optCodeStorage?.delegate as? CodeStorageDelegate
@@ -846,7 +846,6 @@ extension CodeEditor: NSViewRepresentable {
846846
messages: $messages,
847847
setAction: definitiveSetActions,
848848
setInfo: definitiveSetInfo)
849-
if codeView.lastMessages != messages { codeView.update(messages: messages) }
850849
if text != codeView.string { // Hoping for the string comparison fast path...
851850

852851
if language.languageService !== codeView.language.languageService {
@@ -862,6 +861,7 @@ extension CodeEditor: NSViewRepresentable {
862861
}
863862

864863
}
864+
if codeView.lastMessages != messages { codeView.update(messages: messages) }
865865
if selections != codeView.selectedRanges {
866866
codeView.selectedRanges = selections
867867
if let codeStorageDelegate = codeView.optCodeStorage?.delegate as? CodeStorageDelegate

0 commit comments

Comments
 (0)