Files
helder/Sources/HelderCore/Session/EditorPosition.swift
T

45 lines
1.3 KiB
Swift

import Foundation
/// Caret position shown in the status bar; 1-based.
public struct Cursor: Sendable, Equatable {
public var path: String
public var line: Int
public var column: Int
public init(path: String, line: Int, column: Int) {
self.path = path
self.line = line
self.column = column
}
}
/// A line-range selection in a read-only pane; `anchor` is where the drag started.
public struct LineSelection: Sendable, Equatable {
public var path: String
public var start: Int
public var end: Int
public var anchor: Int
public init(path: String, start: Int, end: Int, anchor: Int) {
self.path = path
self.start = min(start, end)
self.end = max(start, end)
self.anchor = anchor
}
public var reference: AgentReference { AgentReference(path: path, startLine: start, endLine: end) }
}
/// How a file is opened: from a git row (`side`), at a line (search hit, symbol), or straight into Diff.
public struct OpenOptions: Sendable, Equatable {
public var side: DiffSide?
public var line: Int?
public var showDiff: Bool
public init(side: DiffSide? = nil, line: Int? = nil, showDiff: Bool = false) {
self.side = side
self.line = line
self.showDiff = showDiff
}
}