Skip to content

jumpoptions=view causes unintended viewport scrolling in op-pending mode #20886

@beardedsakimonkey

Description

@beardedsakimonkey

Neovim version (nvim -v)

0.8.0

Vim (not Nvim) behaves the same?

n/a

Operating system/version

macOS 12.6

Terminal name/version

iterm2

$TERM environment variable

tmux-256color

Installation

build from repo

How to reproduce the issue

Create two files:

  1. init.lua:
local function move_line(dir)
    vim.cmd('keepj norm! mv')
    vim.cmd('move ' .. (dir == 'up' and '--' or '+') .. vim.v.count1)
    vim.cmd('keepj norm! =`v')
end

vim.keymap.set('n', '[d', function() move_line('up') end, {})
vim.keymap.set('n', ']d', function() move_line('down') end, {})

vim.opt.jumpoptions = 'view'
  1. test.lua
if true then
    print('hi')
end

Then open neovim (nvim -u init.lua test.lua) and hit ]d in normal mode.

Expected behavior

The viewport should not change position (i.e. no scrolling)
Screen Shot 2022-10-30 at 11 51 38 PM

Actual behavior

The viewport scrolls down a line
Screen Shot 2022-10-30 at 11 51 24 PM

Note that this issue repros similarly when moving a line upwards ([d), but the viewport needs to not be at the top (such that it's possible to scroll up).

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity:lowLow-risk, self-contained. Do NOT ask "can I work on this", just read CONTRIBUTING.md

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions