Skip to content

When moving vertically (j, k) cursor changes column on tab indentation change #10009

@NanoUser3000

Description

@NanoUser3000

Describe the bug
When moving cursor up and down in normal mode with different amount of tabs between lines, the cursor changes columns. For what I have seen, it treats the tab as if it has width 1 (it is 4 in my setup), and indeed changing tab display size to 1 makes the cursor move preserving the column.

I will add, that the tabs are only present because I'm programming in Go, and have formatting running on write – and Go formatting is strict about using tabs. I hope this issue can be resolved, so I don't need to search for workarounds.

To Reproduce
Steps to reproduce the behavior:

  1. Open a buffer and paste
func calcExprCallback(e *Expr, valuation func(rune) bool, cb func(*Expr)) {
	// maybe make a interface? todo?
	switch e.Kind {
	case KindLiteral:
		// e.value = e.value
	case KindVariable:
		e.Value = valuation(e.Name)
	case KindNegation:

Make sure that the indents are tabs, not spaces. Change Tab Display Size to anything from 2-8, the more the more visible the phenomenon is.

  1. Place the cursor on first capital E
  2. Press j a few times, then j, k
  3. See jumping between columns, when the amount of tabs is different between lines: on the more indented line the cursor jumps more to the right. For each 4-wide tab it moves 3 to the right. (for N: N-1)
    Expected behavior
    The cursor moves up and down in a straight line

Screenshots
Below, I start at E and just press j a few times:
Image
Image
Image
Image
Image

Environment (please complete the following information):

  • Extension (VsCodeVim) version: 1.32.4 (which is latest when I look at github tags, note: I don't have auto update on)
  • VSCode version: 1.120.0
  • OS: Ubuntu 24.04.4 LTS

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions