File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -37,8 +37,12 @@ class EditTextView: NSTextView, NSTextFinderClient {
3737 }
3838
3939 override func becomeFirstResponder( ) -> Bool {
40- if let note = EditTextView . note, note. container == . encryptedTextPack {
41- return false
40+ if let note = EditTextView . note {
41+ if note. container == . encryptedTextPack {
42+ return false
43+ }
44+
45+ removeHighlight ( )
4246 }
4347
4448 return super. becomeFirstResponder ( )
@@ -1467,7 +1471,12 @@ class EditTextView: NSTextView, NSTextFinderClient {
14671471
14681472 public func scrollToCursor( ) {
14691473 let cursorRange = NSMakeRange ( self . selectedRange ( ) . location, 0 )
1470- scrollRangeToVisible ( cursorRange)
1474+
1475+ // DispatchQueue fixes rare bug when textStorage invalidation not working (blank page instead text)
1476+
1477+ DispatchQueue . main. asyncAfter ( deadline: . now( ) + 0.1 ) {
1478+ self . scrollRangeToVisible ( cursorRange)
1479+ }
14711480 }
14721481
14731482 public func hasFocus( ) -> Bool {
You can’t perform that action at this time.
0 commit comments