Skip to content

Commit

Permalink
Update to latest Neon
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmassicotte committed Feb 20, 2024
1 parent 9d65be9 commit 3307809
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Edit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -4363,7 +4363,7 @@
repositoryURL = "https://github.com/ChimeHQ/Neon.git";
requirement = {
kind = revision;
revision = e49e0c2595be56d28d82ed711b2dcac1fc60379a;
revision = 7b6651b781e7079c31c107fc8f75a0be935dbbba;
};
};
C9409C642A98CC9800B5D898 /* XCRemoteSwiftPackageReference "Outline" */ = {
Expand Down
4 changes: 2 additions & 2 deletions Edit/Modules/Highlighting/TextViewSystemNeonInterface.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ extension TextViewSystemNeonInterface: TextSystemInterface {
}
}

public var visibleRange: NSRange {
textSystem.textLayout.visibleRange()
public var visibleSet: IndexSet {
textSystem.textLayout.visibleSet()
}

public var content: some VersionedContent {
Expand Down
13 changes: 7 additions & 6 deletions Edit/Modules/TextSystem/TextLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public struct TextLayout {
}

public let visibleRect: () -> NSRect
public let visibleRange: () -> NSRange
public let visibleSet: () -> IndexSet
public let lineFragmentsInRect: (NSRect) -> [LineFragment]
public let lineFragmentsInRange: (NSRange) -> [LineFragment]
}
Expand Down Expand Up @@ -108,15 +108,15 @@ extension TextLayout {
visibleRect: {
textLayoutManager.textViewportLayoutController.viewportBounds
},
visibleRange: {
visibleSet: {
guard
let contentManager = textLayoutManager.textContentManager,
let textRange = textLayoutManager.textViewportLayoutController.viewportRange
else {
return .zero
return IndexSet()
}

return NSRange(textRange, provider: contentManager)
return IndexSet(NSRange(textRange, provider: contentManager))
},
lineFragmentsInRect: { rect in
guard let contentManager = textLayoutManager.textContentManager else { return [] }
Expand Down Expand Up @@ -166,16 +166,17 @@ extension TextLayout {
visibleRect: {
container.textView!.visibleRect
},
visibleRange: {
visibleSet: {
let view = container.textView!

let origin = view.textContainerOrigin
let offsetRect = view.visibleRect.offsetBy(dx: -origin.x, dy: -origin.y)

let glyphRange = layoutManager.glyphRange(forBoundingRect: offsetRect, in: container)

return layoutManager.characterRange(forGlyphRange: glyphRange, actualGlyphRange: nil)
let range = layoutManager.characterRange(forGlyphRange: glyphRange, actualGlyphRange: nil)

return IndexSet(range)
},
lineFragmentsInRect: { rect in
return []
Expand Down

0 comments on commit 3307809

Please sign in to comment.