From efc560bb983f423e2f3af5b61f0993ff80bb525a Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Wed, 8 May 2024 17:26:41 -0400 Subject: [PATCH 1/2] Allow TextLocation to be created --- Sources/Runestone/TextView/Navigation/TextLocation.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sources/Runestone/TextView/Navigation/TextLocation.swift b/Sources/Runestone/TextView/Navigation/TextLocation.swift index df587505c..8b33773b2 100644 --- a/Sources/Runestone/TextView/Navigation/TextLocation.swift +++ b/Sources/Runestone/TextView/Navigation/TextLocation.swift @@ -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 From 8aae0645152a29220f5db17119b077f2f94888f3 Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Fri, 10 May 2024 18:42:06 -0400 Subject: [PATCH 2/2] Fix swift-lint whitespace --- Sources/Runestone/TextView/Navigation/TextLocation.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Runestone/TextView/Navigation/TextLocation.swift b/Sources/Runestone/TextView/Navigation/TextLocation.swift index 8b33773b2..f70a762a0 100644 --- a/Sources/Runestone/TextView/Navigation/TextLocation.swift +++ b/Sources/Runestone/TextView/Navigation/TextLocation.swift @@ -12,7 +12,7 @@ public struct TextLocation: Hashable, Equatable { self.lineNumber = lineNumber self.column = column } - + init(_ linePosition: LinePosition) { self.lineNumber = linePosition.row self.column = linePosition.column