[vim/vim] getreg('abcde') returns the contents of register a (#7814)

42 views
Skip to first unread message

Timothée Sterle

unread,
Feb 10, 2021, 3:19:52 PM2/10/21
to vim/vim, Subscribed

Describe the bug
When calling getreg(), if the {regname} string is longer than one character, Vim only reads the first character and silently ignores the rest of the string

To Reproduce
Detailed steps to reproduce the behavior:

  1. Run vim --clean (or gvim --clean, etc.)
  2. :call setreg('a', 'this is a test string')
  3. :echo getreg('abcde')
  4. Vim prints this is a test string

Expected behavior
If this behavior is not intended, throw an error to let the user know this is not a valid register name.
If this is indeed the intended behavior, maybe it should be documented in :help?

Environment

  • Vim version: 8.2.2493
  • OS: Solus 4.2 Fortitude
  • Terminal: Konsole

Additional context
This also affects setreg(), getregtype() and getreginfo()


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Bram Moolenaar

unread,
Feb 10, 2021, 4:24:31 PM2/10/21
to vim/vim, Subscribed

Closed #7814 via 418a29f.

Reply all
Reply to author
Forward
0 new messages