Re: Value of 'v:register' updates too late

2015-08-14 Fir de Conversatie Ingo Karkat
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 11-Aug-2015 15:18, Bram Moolenaar wrote:
 
 Sampo Osmonen wrote:
 
 When you yank something into a named register the value of the
 internal variable 'v:register' doesn't change back to the default
 register after the yank. The next mapping using 'v:register'
 after such yank will see 'v:register' contain the register used
 by the initial yank operation, which contradicts the description
 in ':h v:register'. 'v:register' only gets updated when some
 operation like moving the cursor or changing the window is
 performed after the initial yank.
 
 Example - Vim 7.4 (Windows):
 
 Write some text in the buffer. Type the commands: _dl:echo
 'v:register'
 
 will show '_' as opposed to '', even though the current command
 (':echo') didn't use any register. Moving the cursor after the
 delete and then checking 'v:register' correctly yields ''
 
 This is obviously troublesome for plugins that rely on
 'v:register' to paste something, they end up pasting from the
 blackhole register for example.
 
 It's been like that forever.  I suspect some plugins actually rely
 on v:register to keep its value.  I don't see how a command can
 depend on v:register for a command that doesn't use a register.

This had been reported before:
https://groups.google.com/d/msg/vim_dev/GiIKJLzH-AM/8rvajv8YkMQJ

Many found the current behavior inconsistent and not helpful;
Christian proposed a simple patch, but there has been no follow-up
yet; I can't even find this in the TODO list.

- -- regards, ingo
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.17 (MingW32)

iQEcBAEBAgAGBQJVzd5PAAoJEA7ziXlAzQ/vt8gH/1te09U0mEwtXiyVYYoWN5Tp
hRZb0wu7J4hSAwv/GbtD9AVVTskpjr5ytRzfOm0SBm6RnSUqV8zv0/mWms8CAlnw
n32ICBREqyEEY/lf1mCMHtT8bubk3UpvO7RpgvKerAG4isHD9Nw1011IS7uKbZYy
bG18d9H78Cw2AF1hcHD8lNu0MkUnDd5bJyvyu8SDPhWUW943apPVX57QmVz0e2+0
w6OMvgRfcVKbeTDHH4yniiM1bH/A36dXorci4bWYZWJcV9wuCvArj358HmEzawG8
OK3rHOj51LBibryNDNiZ9M0lc9ktcSsDkdjm1KMjSlPOdNw90nCe50wb15WC3/w=
=+gcY
-END PGP SIGNATURE-

-- 
-- 
You received this message from the vim_dev maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
vim_dev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [BUG] Value of 'v:register' updates too late

2015-08-11 Fir de Conversatie Bram Moolenaar

Sampo Osmonen wrote:

 When you yank something into a named register the value of the internal
 variable 'v:register' doesn't change back to the default register after the
 yank. The next mapping using 'v:register' after such yank will see
 'v:register' contain the register used by the initial yank operation, which
 contradicts the description in ':h v:register'. 'v:register' only gets
 updated when some operation like moving the cursor or changing the window
 is performed after the initial yank.
 
 Example - Vim 7.4 (Windows):
 
 Write some text in the buffer.
 Type the commands:
 _dl:echo 'v:register'
 
 will show '_' as opposed to '', even though the current command (':echo')
 didn't use any register. Moving the cursor after the delete and then
 checking 'v:register' correctly yields ''
 
 This is obviously troublesome for plugins that rely on 'v:register' to
 paste something, they end up pasting from the blackhole register for
 example.

It's been like that forever.  I suspect some plugins actually rely on
v:register to keep its value.  I don't see how a command can depend on
v:register for a command that doesn't use a register.

-- 
WOMAN:   King of the who?
ARTHUR:  The Britons.
WOMAN:   Who are the Britons?
ARTHUR:  Well, we all are. we're all Britons and I am your king.
  The Quest for the Holy Grail (Monty Python)

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the vim_dev maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
vim_dev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.