Skip to content

setpos() does not set position for non-current buffer #7784

@noscript

Description

@noscript

Describe the bug
setpos() ignores bufnum argument and sets the position for the current buffer instead.

To Reproduce

  1. Run VIM: vim -g -u NONE +'h options.txt | split | h eval.txt'
  2. List buffers:
:ls!
  1  a   "[No Name]"                    line 1
  2u#a-  "options.txt"                  line 1
  3u%a-  "eval.txt"                     line 1
  1. Set the cursor for non-current buffer 2 to line 100:
call setpos('.', [2, 100, 1, 1])
  1. List buffers again:
:ls!
  1  a   "[No Name]"                    line 1
  2u#a-  "options.txt"                  line 1
  3u%a-  "eval.txt"                     line 100

Expected behavior
Buffer 2 cursor position is on line 100.

Actual behavior
Current buffer 3 cursor position is on line 100.

Environment

  • Vim version: 8.1.2466
  • OS: Ubuntu 20.04
  • Terminal: GUI

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions