From a2cb20851499e9c00bd3bf642680a9ce3148cae8 Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Thu, 17 Sep 2026 10:15:45 +0200 Subject: gui: name the other copy of a duplicate, and offer to keep this one instead --- internal/engine/facts.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'internal/engine/facts.go') 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 { -- cgit v1.3