Thanks to visit codestin.com
Credit goes to github.com

Skip to content

:drop on unopen file adds extra jump to jumplist #9775

@abdelhakeem

Description

@abdelhakeem
  • nvim --version:

NVIM v0.3.4
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/bin/cc -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -Wconversion -O2 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -Wno-array-bounds -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/build/neovim/src/build/config -I/build/neovim/src/neovim-0.3.4/src -I/usr/include -I/build/neovim/src/build/src/nvim/auto -I/build/neovim/src/build/include
Compiled by builduser

Features: +acl +iconv +jemalloc +tui
See ":help feature-compile"

system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

  • Operating system/version:

4.20.11-arch2-1-ARCH #1 SMP PREEMPT Fri Feb 22 13:09:33 UTC 2019

  • Terminal name/version:

# GNOME Terminal 3.30.2 using VTE 0.54.3 +GNUTLS

  • $TERM: xterm-256color

Issue

When a file is not open in a window and is to be edited in the current window, :drop adds an extra jump, which is a duplicate of the current position, at the tail of the jumplist.
This makes it necessary to press <CTRL-O> twice to go back to the previous cursor position.

Steps to reproduce using nvim -u NORC

Given the following two files:

#file1
file1 contents

#file2
file2 contents

The following does not work as expected:

nvim -u NORC file1
:drop file2
<CTRL-O>

Actual behaviour

nvim -u NORC file1
:clearjumps
:drop file2
:jumps

 jump line  col file/text
   2     1    0 file1
   1     1    0 file2 contents
>

Expected behaviour

nvim -u NORC file1
:clearjumps
:drop file2
:jumps

 jump line  col file/text
   1     1    0 file1
>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug-vimwrong behavior inherited from vimcoreNvim core functionality or code

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions