Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yanking to a given line number is not respected in find-in-project results #21608

Open
1 task done
AaronFeickert opened this issue Dec 5, 2024 · 3 comments
Open
1 task done
Labels

Comments

@AaronFeickert
Copy link
Contributor

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

When yanking (in Vim normal mode) to a given line number while viewing a find-in-project search result containing multiple results, individual files' line numberings are not respected.

Here's an example test file:
Screenshot 2024-12-05 at 15 04 20

Suppose I perform a find-in-project search for test:
Screenshot 2024-12-05 at 15 26 55

Next, I navigate the cursor to line 6 (Quux) in Vim normal mode and enter y8G.

I would expect three lines to be yanked: lines 6, 7, and 8. Instead, Zed reaches across both results, yanking lines 6 through 15.

It appears that Zed is not interpreting the range 8G with respect to the original file (and the line numbers that appear in the search results), but instead is interpreting the range with respect to a different numbering for the entire result buffer. That is, it counts lines 6 through 10 as the "first" five lines, and lines 13 through 15 as the "remaining" three lines in the 8G range.

Environment

Zed: v0.164.2 (Zed)
OS: macOS 15.1.1
Memory: 18 GiB
Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

Zed.log

@AaronFeickert AaronFeickert added admin read Pending admin review bug [core label] triage Maintainer needs to classify the issue labels Dec 5, 2024
@notpeter notpeter added vim multi-buffer and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Dec 5, 2024
@ConradIrwin
Copy link
Member

Your interpretation of what's happening is correct. In this case you expected it to yank out of the original buffer instead?

I'm not sure what the "right" thing to do is; internally Zed thinks of a multibuffer as just one big file, but it is confusing to have the line-numbers from the original files when using something like this.

@AaronFeickert
Copy link
Contributor Author

@ConradIrwin: Right, I would expect the lines from the original buffer to be used, especially since the original buffer's line numbers are used in the multibuffer.

I think the Right Thing would be always to use an original buffer's data, but acknowledge that this seems likely to break the "multibuffers are still buffers" architecture you indicate. After some head scratching, I can't think of a use case where'd you want the "secret internal" multibuffer line numbering to be used instead.

@ConradIrwin
Copy link
Member

I think relative line numbers could still make sense, but it looks like they're not implemented in a useful way in multi buffers either 🤦 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants