Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into swiftui
Browse files Browse the repository at this point in the history
  • Loading branch information
nighthawk committed Jun 18, 2024
2 parents 48fac3d + 1fad339 commit 2fa9f3d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Sources/Runestone/Library/UITextInput+Helpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import UIKit
extension UITextInput where Self: NSObject {
var sbs_textSelectionDisplayInteraction: UITextSelectionDisplayInteraction? {
let interactionAssistantKey = "int" + "ssAnoitcare".reversed() + "istant"
let selectionViewManagerKey = "les_".reversed() + "ection" + "reganaMweiV".reversed()
let selectionViewManagerKey: String = "les_".reversed() + "ection" + "reganaMweiV".reversed()
guard responds(to: Selector(interactionAssistantKey)) else {
return nil
}
Expand Down
6 changes: 6 additions & 0 deletions Sources/Runestone/TextView/Navigation/TextLocation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ public struct TextLocation: Hashable, Equatable {
/// Column in the line.
public let column: Int

/// Initializes TextLocation from the given line and column
public init (lineNumber: Int, column: Int) {
self.lineNumber = lineNumber
self.column = column
}

init(_ linePosition: LinePosition) {
self.lineNumber = linePosition.row
self.column = linePosition.column
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ final class TreeSitterInternalLanguageMode: InternalLanguageMode {
private let lineManager: LineManager
private let rootLanguageLayer: TreeSitterLanguageLayer
private let operationQueue = OperationQueue()
private let parseLock = NSLock()

init(language: TreeSitterInternalLanguage, languageProvider: TreeSitterLanguageProvider?, stringView: StringView, lineManager: LineManager) {
self.stringView = stringView
Expand All @@ -37,7 +38,9 @@ final class TreeSitterInternalLanguageMode: InternalLanguageMode {
}

func parse(_ text: NSString) {
rootLanguageLayer.parse(text)
parseLock.withLock {
rootLanguageLayer.parse(text)
}
}

func parse(_ text: NSString, completion: @escaping ((Bool) -> Void)) {
Expand Down

0 comments on commit 2fa9f3d

Please sign in to comment.