Discussion:
Unnamed register only contains the last deleted text when appending deleted text to a register
Wolfgang Jeltsch
2017-04-10 10:05:24 UTC
Permalink
Hi!

The Vim documentation says the following under “quote_quote” about the
Vim fills this register with text deleted with the “d”, “c”, “s”, “x”
commands or copied with the yank “y” command, regardless of whether
or not a specific register was used (e.g. "xdd). This is like the
unnamed register is pointing to the last used register. Thus when
appending using an uppercase register name, the unnamed register
contains the same text as the named register.
However, the part with uppercase register names does not work for me
when deleting. I only get the last deleted text into the unnamed
register. For example, when I enter "add and then "Add, register a
contains both deleted lines, but the unnamed register only contains the
last one, although it should contain the same text as register a.
However, things work as expected with the yank (y) command.

I asked on StackExchange why this is and several people told me that
this seemed like a bug to them. So is this a bug? If not, why is Vim
behaving like this?

All the best,
Wolfgang
--
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Ben Fritz
2017-04-10 14:46:38 UTC
Permalink
Hi!
The Vim documentation says the following under “quote_quote” about the
Vim fills this register with text deleted with the “d”, “c”, “s”, “x”
commands or copied with the yank “y” command, regardless of whether
or not a specific register was used (e.g. "xdd). This is like the
unnamed register is pointing to the last used register. Thus when
appending using an uppercase register name, the unnamed register
contains the same text as the named register.
However, the part with uppercase register names does not work for me
when deleting. I only get the last deleted text into the unnamed
register. For example, when I enter "add and then "Add, register a
contains both deleted lines, but the unnamed register only contains the
last one, although it should contain the same text as register a.
However, things work as expected with the yank (y) command.
I asked on StackExchange why this is and several people told me that
this seemed like a bug to them. So is this a bug? If not, why is Vim
behaving like this?
All the best,
Wolfgang
I can't reproduce this in 8.0.427 64-bit gvim on Windows. What version of Vim are you using? Does it do the same thing without your configuration loaded, e.g. when launching with "gvim -N -u NONE -i NONE"?
--
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Wolfgang Jeltsch
2017-04-10 15:15:42 UTC
Permalink
Post by Ben Fritz
Post by Wolfgang Jeltsch
Hi!
The Vim documentation says the following under “quote_quote” about
Vim fills this register with text deleted with the “d”, “c”, “s”,
“x” commands or copied with the yank “y” command, regardless of
whether or not a specific register was used (e.g. "xdd). This is
like the unnamed register is pointing to the last used register.
Thus when appending using an uppercase register name, the unnamed
register contains the same text as the named register.
However, the part with uppercase register names does not work for me
when deleting. I only get the last deleted text into the unnamed
register. For example, when I enter "add and then "Add, register a
contains both deleted lines, but the unnamed register only contains
the last one, although it should contain the same text as
register a. However, things work as expected with the yank (y)
command.
I asked on StackExchange why this is and several people told me that
this seemed like a bug to them. So is this a bug? If not, why is Vim
behaving like this?
All the best,
Wolfgang
I can't reproduce this in 8.0.427 64-bit gvim on Windows. What version
of Vim are you using? Does it do the same thing without your
configuration loaded, e.g. when launching with "gvim -N -u NONE -i
NONE"?
Yes, the behavior is the same with “gvim -N -u NONE -i NONE”. I use
Vim 7.4 including patches 1–1689 on Ubuntu 16.04 LTS.

All the best,
Wolfgang
--
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Ben Fritz
2017-04-10 15:32:19 UTC
Permalink
Post by Ben Fritz
I can't reproduce this in 8.0.427 64-bit gvim on Windows. What version
of Vim are you using? Does it do the same thing without your
configuration loaded, e.g. when launching with "gvim -N -u NONE -i
NONE"?
Yes, the behavior is the same with “gvim -N -u NONE -i NONE”. I use
Vim 7.4 including patches 1–1689 on Ubuntu 16.04 LTS.
My mistake. I CAN reproduce the issue, I tested the wrong thing. Sorry about that! I also see that pasting from the unnamed register, after a series of deletes into an UPPERCASE named register, pastes only the last delete instead of the entire named register.

I agree it looks like a bug, and it looks like it's been around for a while now!

At least, the help text doesn't match the actual behavior. I think the behavior described in the help text would be more useful than the actual behavior.
--
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Wolfgang Jeltsch
2017-04-10 15:41:17 UTC
Permalink
Post by Ben Fritz
My mistake. I CAN reproduce the issue, I tested the wrong thing. Sorry
about that! I also see that pasting from the unnamed register, after a
series of deletes into an UPPERCASE named register, pastes only the
last delete instead of the entire named register.
I agree it looks like a bug, and it looks like it's been around for a while now!
At least, the help text doesn't match the actual behavior. I think the
behavior described in the help text would be more useful than the
actual behavior.
I also think that the behavior described in the help text would be more
useful.

Should I file a bug report somewhere?

All the best,
Wolfgang
--
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Ben Fritz
2017-04-10 20:47:07 UTC
Permalink
Post by Wolfgang Jeltsch
Post by Ben Fritz
My mistake. I CAN reproduce the issue, I tested the wrong thing. Sorry
about that! I also see that pasting from the unnamed register, after a
series of deletes into an UPPERCASE named register, pastes only the
last delete instead of the entire named register.
I agree it looks like a bug, and it looks like it's been around for a while now!
At least, the help text doesn't match the actual behavior. I think the
behavior described in the help text would be more useful than the
actual behavior.
I also think that the behavior described in the help text would be more
useful.
Should I file a bug report somewhere?
Posting to this list should be enough.
--
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Bram Moolenaar
2017-04-11 20:37:13 UTC
Permalink
Post by Ben Fritz
Post by Wolfgang Jeltsch
Post by Ben Fritz
My mistake. I CAN reproduce the issue, I tested the wrong thing. Sorry
about that! I also see that pasting from the unnamed register, after a
series of deletes into an UPPERCASE named register, pastes only the
last delete instead of the entire named register.
I agree it looks like a bug, and it looks like it's been around for a
while now!
At least, the help text doesn't match the actual behavior. I think the
behavior described in the help text would be more useful than the
actual behavior.
I also think that the behavior described in the help text would be more
useful.
Should I file a bug report somewhere?
Posting to this list should be enough.
I have added an item in the todo list:

Unnamed register only contains the last deleted text when appending deleted
text to a register. (Wolfgang Jeltsch, reproduced by Ben Fritz, 2017 Apr 10)
--
Luxury. We used to have to get out of the lake at three o'clock in the
morning, clean the lake, eat a handful of hot gravel, go to work at the
mill every day for tuppence a month, come home, and Dad would beat us
around the head and neck with a broken bottle, if we were LUCKY!

/// Bram Moolenaar -- ***@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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Christian Brabandt
2017-06-27 10:38:47 UTC
Permalink
Post by Bram Moolenaar
Unnamed register only contains the last deleted text when appending deleted
text to a register. (Wolfgang Jeltsch, reproduced by Ben Fritz, 2017 Apr 10)
Here is a patch. The problem is, that in op_delete() we are
unconditionally resetting y_previous to point to register 1. This
shouldn't happen, if we are appending to an existing register.

I added a test, so that the behaviour can be verified.

Best,
Christian
--
Wir haben nicht mehr Recht, GlÃŒck zu empfangen, ohne es zu schaffen,
als Reichtum zu genießen, ohne ihn zu produzieren.
-- George Bernard Shaw
--
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Bram Moolenaar
2017-06-27 13:39:38 UTC
Permalink
Post by Christian Brabandt
Post by Bram Moolenaar
Unnamed register only contains the last deleted text when appending deleted
text to a register. (Wolfgang Jeltsch, reproduced by Ben Fritz, 2017 Apr 10)
Here is a patch. The problem is, that in op_delete() we are
unconditionally resetting y_previous to point to register 1. This
shouldn't happen, if we are appending to an existing register.
I added a test, so that the behaviour can be verified.
Thanks.

I'm slightly worried that other people will now complain...
Well, we'll see.
--
From "know your smileys":
(:-# Said something he shouldn't have

/// Bram Moolenaar -- ***@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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...