Re: getregtype() works differently from what is documented for empty or unknown register

2014-01-05 Fir de Conversatie Bram Moolenaar

Yukihiro Nakadaira wrote:

 According to :help getregtype(), it returns 0 for empty or unknown
 register.  But it returns  for empty register.  And it returns unnamed
 register's type for unknown register.
 
 Steps to reproduce:
   $ vim -u NONE -i NONE
   : test for empty register
   :echo getregtype('a') is ''
   : test for unknown register
   :echo getregtype('^') is ''
   :call setreg('', 'v')
   :echo getregtype('^') is ''
 
 Result:
   1
   1
   0
 
 Expected:
   1
   1
   1
 
 
 I think it should be fixed as following.  Please check it.

Thanks, I'll check it out.

-- 
hundred-and-one symptoms of being an internet addict:
97. Your mother tells you to remember something, and you look for
a File/Save command.

 /// 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/groups/opt_out.


getregtype() works differently from what is documented for empty or unknown register

2013-12-26 Fir de Conversatie Yukihiro Nakadaira
According to :help getregtype(), it returns 0 for empty or unknown
register.  But it returns  for empty register.  And it returns unnamed
register's type for unknown register.

Steps to reproduce:
  $ vim -u NONE -i NONE
  : test for empty register
  :echo getregtype('a') is ''
  : test for unknown register
  :echo getregtype('^') is ''
  :call setreg('', 'v')
  :echo getregtype('^') is ''

Result:
  1
  1
  0

Expected:
  1
  1
  1


I think it should be fixed as following.  Please check it.


diff -r 2f856c7c1d43 runtime/doc/eval.txt
--- a/runtime/doc/eval.txtSun Dec 15 10:02:33 2013 +0100
+++ b/runtime/doc/eval.txtThu Dec 26 21:40:45 2013 +0900
@@ -3460,7 +3460,7 @@
 vfor |characterwise| text
 Vfor |linewise| text
 CTRL-V{width}for |blockwise-visual| text
-0for an empty or unknown register
+for an empty or unknown register
 CTRL-V is one character with value 0x16.
 If {regname} is not specified, |v:register| is used.

diff -r 2f856c7c1d43 src/ops.c
--- a/src/ops.cSun Dec 15 10:02:33 2013 +0100
+++ b/src/ops.cThu Dec 26 21:40:45 2013 +0900
@@ -6240,7 +6240,9 @@
 regname = may_get_selection(regname);
 #endif

-/* Should we check for a valid name? */
+if (regname != NUL  !valid_yank_reg(regname, FALSE))
+return MAUTO;
+
 get_yank_register(regname, FALSE);

 if (y_current-y_array != NULL)


-- 
Yukihiro Nakadaira - yukihiro.nakada...@gmail.com

-- 
-- 
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/groups/opt_out.