Improve loads of fancy things in relation to the mouse pointer
This commit is contained in:
@@ -270,7 +270,7 @@ public final class EditorStore {
|
||||
track { await $0.load(path, discardEdits: false) }
|
||||
}
|
||||
|
||||
/// A click on a marked line in Actual: the Diff opens on HEAD vs disk, centred on that line.
|
||||
/// Show diff on a marked line in Actual: the Diff opens on HEAD vs disk, centred on that line.
|
||||
public func openDiff(atLine line: Int) {
|
||||
guard let path = activePath, diff(for: path) != nil else { return }
|
||||
let current = mode(for: path)
|
||||
@@ -308,9 +308,11 @@ public final class EditorStore {
|
||||
return PassOnRequest(reference: selection.reference.description, code: code, anchor: anchor)
|
||||
}
|
||||
|
||||
/// The right-click menu for a line or selection in the code: exactly Pass on and Copy reference.
|
||||
public func contextMenuRequest(reference: AgentReference, code: String?, anchor: CGPoint) -> ContextMenuRequest {
|
||||
let target = ContextTarget.editor(reference: reference, code: code)
|
||||
/// The right-click menu for a line or selection in the code: Pass on and Copy reference, plus Show diff
|
||||
/// when `showDiffLine` names a marked line.
|
||||
public func contextMenuRequest(reference: AgentReference, code: String?, showDiffLine: Int? = nil,
|
||||
anchor: CGPoint) -> ContextMenuRequest {
|
||||
let target = ContextTarget.editor(reference: reference, code: code, showDiffLine: showDiffLine)
|
||||
return ContextMenuRequest(target: target, header: ContextActions.header(for: target, projectName: PathUtils.basename(root)),
|
||||
entries: ContextActions.entries(for: target), anchor: anchor)
|
||||
}
|
||||
|
||||
@@ -93,6 +93,8 @@ extension WorkspaceModel {
|
||||
overlay.present(.passOn(PassOnRequest(reference: reference, code: code, anchor: anchor)))
|
||||
case let .passOnFileName(name):
|
||||
overlay.present(.passOn(PassOnRequest(reference: name, anchor: anchor)))
|
||||
case let .bouwen(name):
|
||||
passToAgent("/bouwen \(name)", toast: "/bouwen \(name)")
|
||||
case let .newFile(directory):
|
||||
overlay.present(.namePrompt(NamePromptRequest(purpose: .newFile(inDirectory: directory), anchor: anchor)))
|
||||
case let .newFolder(directory):
|
||||
@@ -102,6 +104,8 @@ extension WorkspaceModel {
|
||||
initialName: PathUtils.basename(path), anchor: anchor)))
|
||||
case let .openDiff(path):
|
||||
open(path, OpenOptions(showDiff: true))
|
||||
case let .showDiff(path, line):
|
||||
if editor?.activePath == path { editor?.openDiff(atLine: line) }
|
||||
case let .copyTerminalSelection(kind):
|
||||
if let text = terminal.selection(kind) { app.system.copy(text) }
|
||||
case let .pasteIntoTerminal(kind):
|
||||
|
||||
Reference in New Issue
Block a user