Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: viminfo-file-marks are duplicated (since 7.4.1925) #5733

Open
inkarkat opened this issue Mar 4, 2020 · 0 comments
Open

Regression: viminfo-file-marks are duplicated (since 7.4.1925) #5733

inkarkat opened this issue Mar 4, 2020 · 0 comments

Comments

@inkarkat
Copy link

inkarkat commented Mar 4, 2020

Describe the bug
From :help viminfo-file-marks:

If the current cursor position is already present in '0 to '9, it is moved to '0, to avoid having the same position twice.

However, when I run :marks, I often see several duplicate entries (apparently resulting from quitting Vim with the same last file and location). This also got asked about on Stack Overflow.

To Reproduce
Detailed steps to reproduce the behavior:

$ rm /tmp/viminfo; for cmd in help\ {let,viminfo-file-marks,let,viminfo-file-marks}\|qa marks; do vim -u NONE -U NONE -i /tmp/viminfo -c "$cmd"; done

mark line  col file/text
'      1    0
0   1552    7 /usr/local/share/vim/vim82/doc/starting.txt
1  11405   29 /usr/local/share/vim/vim82/doc/eval.txt
2  11405   29 /usr/local/share/vim/vim82/doc/eval.txt
3   1552    7 /usr/local/share/vim/vim82/doc/starting.txt
4  11405   29 /usr/local/share/vim/vim82/doc/eval.txt
"      1    0

Expected behavior

If deduplication would happen (as described in the help), I'd expect this:

mark line  col file/text
'      1    0
0   1552    7 /usr/local/share/vim/vim82/doc/starting.txt
1  11405   29 /usr/local/share/vim/vim82/doc/eval.txt
"      1    0

In fact, that behavior is still present in Vim 7.4:

mark line  col file/text
'      1    0
0   1443    7 /usr/share/vim/vim74/doc/starting.txt
1   8086   29 /usr/share/vim/vim74/doc/eval.txt
"      1    0

A bisect shows that this change is the culprit:

commit 2d35899
Author: Bram Moolenaar Bram@vim.org
Date: Sun Jun 12 21:20:54 2016 +0200

patch 7.4.1925
Problem:    Viminfo does not merge file marks properly.
Solution:   Use a timestamp.  Add the :clearjumps command.

Environment (please complete the following information):

  • Vim version Vim 8.2.346, also Vim 8.0/1.
  • OS: Ubuntu 16.04 LTS 64-bit

Additional context

This is the script I've used for bisecting:

#!/bin/bash

rm /tmp/viminfo; for cmd in help\ {let,let,let,let,let,let,let,let,viminfo-file-marks,let,viminfo-file-marks}\|qa "if line(\"'3\") | cquit! | else | quitall! | endif"
do
    command vim -u NONE -U NONE -i /tmp/viminfo --cmd "set viminfo='100" -c "$cmd"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant