From 81e23a9a9e90d52b5b407f60d378731875aaea6b Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Mon, 13 May 2024 00:34:05 -0400 Subject: [PATCH] Allow TextLocation to be created (#372) --- 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..f70a762a0 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