aboutsummaryrefslogtreecommitdiff
path: root/internal/engine/facts.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/engine/facts.go')
-rw-r--r--internal/engine/facts.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/engine/facts.go b/internal/engine/facts.go
index 641f1ef..ce05df4 100644
--- a/internal/engine/facts.go
+++ b/internal/engine/facts.go
@@ -158,6 +158,10 @@ type facts struct {
// could not read), so (matched) is unknown while none has matched.
undecided bool
+ // dupOriginal is the file a (duplicate) test last matched against,
+ // absolute, for a front end that offers to act on the other copy.
+ dupOriginal string
+
contentDone bool // extraction was attempted
contentErr error // why it failed
partialErr error // extract.ErrPartial: a keyword not found may be in the unread part
@@ -290,9 +294,17 @@ func (f *facts) Duplicate(dirs []string) (string, bool, error) {
if !isDup {
return "", false, nil
}
+ // The absolute path is kept for a front end that has to act on the
+ // other copy - the window offers to keep this one instead - while the
+ // reason text stays as it reads best (plan 21).
+ f.dupOriginal = orig
return displayOriginal(orig, root), true, nil
}
+// DuplicateOriginal is the file the last (duplicate) test matched against,
+// absolute; "" when none did.
+func (f *facts) DuplicateOriginal() string { return f.dupOriginal }
+
// displayOriginal reports orig relative to root when it lies inside root,
// else home-abbreviated (xdg.Abbrev), as every other user-visible path is.
func displayOriginal(orig, root string) string {