Improve loads of fancy things in relation to the mouse pointer

This commit is contained in:
2026-10-07 13:02:52 +02:00
parent ed5a227c9d
commit a0b3ef9975
25 changed files with 334 additions and 89 deletions
@@ -458,7 +458,7 @@ import Testing
#expect(h.store.mode(for: "README.md") == .preview)
}
@Test func aClickOnAMarkedLineOpensTheDiffOnHeadVersusDiskAtThatLine() {
@Test func showDiffOnAMarkedLineOpensTheDiffOnHeadVersusDiskAtThatLine() {
let h = EditorHarness(files: ["a.php": "new"])
h.git.change("a.php", makeDiff(original: "old", updated: "new"))
h.store.open("a.php", OpenOptions(side: .unstaged))
@@ -553,16 +553,29 @@ import Testing
#expect(h.store.passOnSelectionRequest(anchor: .zero) == nil)
}
@Test func theRightClickMenuIsPassOnThenCopyReference() {
@Test func theRightClickMenuIsPassOnThenCopyReferenceWithoutAHeader() {
let h = EditorHarness(files: ["src/a.php": "x"])
let menu = h.store.contextMenuRequest(reference: AgentReference(path: "src/a.php", startLine: 42), code: nil, anchor: .zero)
#expect(menu.header == "src/a.php:42")
#expect(menu.header == "")
#expect(menu.entries == [
.action(.passOnReference("src/a.php:42", code: nil), label: "Pass on reference"),
.action(.copyReference("src/a.php:42"), label: "Copy reference"),
])
}
@Test func aMarkedLineAddsShowDiffBelowASeparator() {
let h = EditorHarness(files: ["src/a.php": "x"])
let menu = h.store.contextMenuRequest(reference: AgentReference(path: "src/a.php", startLine: 42), code: nil,
showDiffLine: 42, anchor: .zero)
#expect(menu.header == "")
#expect(menu.entries == [
.action(.passOnReference("src/a.php:42", code: nil), label: "Pass on reference"),
.action(.copyReference("src/a.php:42"), label: "Copy reference"),
.separator,
.action(.showDiff("src/a.php", line: 42), label: "Show diff"),
])
}
@Test func anEmptyNotePassesTheBareReference() {
#expect(PassOn.compose(note: " ", reference: "src/a.php:42") == "src/a.php:42")
}