consult-gh icon indicating copy to clipboard operation
consult-gh copied to clipboard

When a file is previewed and then selected, a new copy is downloaded instead of opening the same preview buffer

Open armindarvish opened this issue 7 months ago • 0 comments

Describe the bug* Previewing a file (or code search result) and then opening it creates two copy of the files and two buffers).

To Reproduce Steps to reproduce the behavior:

  1. M-x consult-gh-find-file
  2. search for a repo, and file
  3. once you have a list of files, get a preview
  4. select the same file

Expected behavior If a file is already previewed, selecting it should just reload that same buffer (i.e. the same temporary file) at least within the same consult-gh-find-file call, there is no need to create two different copies of the same file.

Screenshots Screen Recording 2023-11-14 at 8 12 55 AM

Additional context This is happening because of the way temporary file names are created. Essentially both preview and view actions are making a unique filepath and therefore end up creating two unique files. The filepath should be shared between the two.

armindarvish avatar Nov 14 '23 16:11 armindarvish