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

Vim: Selection misses 1 character in Normal Mode #8492

Closed
1 task done
hamza72x opened this issue Feb 27, 2024 · 4 comments · Fixed by #11329
Closed
1 task done

Vim: Selection misses 1 character in Normal Mode #8492

hamza72x opened this issue Feb 27, 2024 · 4 comments · Fixed by #11329
Labels
defect [core label] vim

Comments

@hamza72x
Copy link
Contributor

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

In Vim (Normal Mode) - selecting the block of code misses one character always.
In insert mode, it works fine.

Check Following Screencast for explanation.

Environment

Zed: v0.123.6 (Zed)
OS: macOS 14.3.1
Memory: 16 GiB
Architecture: aarch64

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

zed_wrong_selection.mp4

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.

No response

@hamza72x hamza72x added admin read Pending admin review defect [core label] triage Maintainer needs to classify the issue labels Feb 27, 2024
@JosephTLyons JosephTLyons added vim and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Feb 27, 2024
@bobby-burns
Copy link

After doing more testing, this happens only when using the mouse and selecting upward.

I feel as if this is a bias issue, because it seem's like this problem appeared when visual mode was being implemented, and was only fixed for vim motions. It is described in a comment in vim/src/visual.rs:83

I will look further for a fix or a direct cause.

@ConradIrwin
Copy link
Collaborator

@bobby-burns happy to work with you on this if you'd like too: https://calendly.com/conradirwin/pairing; but I think you're right.

The tricky thing may be knowing that the selection was recently created from a mouse event; but we may also be able to reasonable assume that's the only way to jump from normal mode to visual mode without using a vim command...

@hamza72x
Copy link
Contributor Author

@bobby-burns this also happens in plain horizontal selection as well.

@danielzsh
Copy link
Contributor

danielzsh commented Mar 22, 2024

@bobby-burns this also happens in plain horizontal selection as well.

I think he means selecting to the left ("upwards"), and not necessarily selecting across rows.

EDIT: this dual behavior occurs only when the initially selected character is at the end of the line; we should probably consider implementing something similar for Zed as well.

I think we also need to consider what the intended behavior should be.

Screen.Recording.2024-03-22.at.11.23.06.AM.mov

This video demonstrates VSCode's behavior with Vim mode, which, despite the . being selected in both circumstances initially, it is included in the first selection and not the second (likely because the mouse is initially shifted slightly to the left in the latter situation).

ConradIrwin added a commit that referenced this issue May 3, 2024
ConradIrwin added a commit that referenced this issue May 3, 2024
Fixes: #8492

Release Notes:

- vim: Fixed last character of reversed mouse selections (#8492)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect [core label] vim
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants