[vim/vim] Visual Block Highlight Includes Whitespace (Unsure If Bug) (Issue #11338)

41 views
Skip to first unread message

Alexander Wang

unread,
Oct 10, 2022, 8:39:46 PM10/10/22
to vim/vim, Subscribed

Steps to reproduce

  1. Take the following line of text for example: String foo = "foobarbaz" ;
  2. Move the cursor to the middle of foobarbaz, and then type va"
  3. Take a second example, where the text is String foo = "foobarbaz";
  4. Move the cursor to the middle of foobarbaz, and then type va".

Expected behaviour

  1. In the first example, I expect only "foobarbaz" to be highlighted. However, the trailing whitespace between the " and ; is also highlighted.
    image

  2. In the second example, I expect only "foobarbaz" to be highlighted. However, the trailing whitespace before the = and " is also highlighted.
    image

To be honest, I'm not sure whether this is a bug or not. I did some searching online to find out more about this behavior, but was not able to find what I was looking for. I decided that it would be best to open an issue here to see if this is expected behavior or not.

I came across the same behavior on NVIM v0.7.2 and VSCodeVim/Vim v.1.24.1. Only on IdeaVim 1.11.1, did I see the behavior I was expecting. My impression was that this command was supposed to only highlight the text + specified character, rather than include the whitespace around it.

I also find it strange that only trailing or preceding whitespace is be included, rather than both. When there is trailing whitespace, only that is included; otherwise, the preceding whitespace is included.

Specifically, this happens for va", va', va`. This does not happen for va(, va{, va[, va<.

I would greatly appreciate it if somebody could get back to me and inform me whether this is a bug, or expected behavior. If it is a bug, I would be glad to work on a fix and contribute to Vim!

Version of Vim

9.0

Environment

Operating System: Fedora Linux 36 (Workstation Edition)
Terminal: GNOME Terminal 3.44.1
Value of $TERM: xterm-256color
Shell: zsh 5.8.1

Logs and stack traces

No response


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/11338@github.com>

Alexander Wang

unread,
Oct 10, 2022, 8:41:44 PM10/10/22
to vim/vim, Subscribed

Closed #11338 as completed.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/11338/issue_event/7557934795@github.com>

Alexander Wang

unread,
Oct 10, 2022, 8:41:45 PM10/10/22
to vim/vim, Subscribed

Well, I should have read the manual first. This is actually expected behavior, and what I want would be something like v2i", to highlight the quotes without the whitespace. While I'm still curious as to why this behavior exists, I understand this is not a bug. I will close my issue.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/11338/1273947157@github.com>

Reply all
Reply to author
Forward
0 new messages