Re: Patch 7.3.1200

2013-06-24 Fir de Conversatie h_east
Hi Bram,

2013/6/16(Sun) 00:55:06 UTC+9 Bram Moolenaar:
> Patch 7.3.1200
> 
> Problem:When calling setline() from Insert mode, using CTRL-R =, undo does
> 
>   not work properly. (Israel Chauca)
> 
> Solution:   Sync undo after evaluating the expression. (Christian Brabandt)
> 
> Files:src/edit.c, src/testdir/test61.in, src/testdir/test61.ok

This patch works fine on new buffer or existing file(one line) editing.
However, This patch seems incomplete when existing file(two or more lines) 
editing.

How to reproduce.

1.
$ echo -e "\n" > foo
$ od -t x1c foo
000  0a  0a
 \n  \n
002
$ vim -N -u NONE --noplugin foo

2. input below.
iao1a2=setline('.','1234')

3. Contents of the buffer

a
120
34



4. undo (first time)

a
12
34



5. undo (second time)

a
1  <=== ?
34



6. undo (third time)

a
34  <--- ??





Best regards,
Hirohito Higashi

-- 
-- 
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.




Patch 7.3.1200

2013-06-15 Fir de Conversatie Bram Moolenaar

Patch 7.3.1200
Problem:When calling setline() from Insert mode, using CTRL-R =, undo does
not work properly. (Israel Chauca)
Solution:   Sync undo after evaluating the expression. (Christian Brabandt)
Files:  src/edit.c, src/testdir/test61.in, src/testdir/test61.ok


*** ../vim-7.3.1199/src/edit.c  2013-06-08 18:19:39.0 +0200
--- src/edit.c  2013-06-15 17:31:18.0 +0200
***
*** 8126,8135 
  --no_mapping;
  
  #ifdef FEAT_EVAL
! /*
!  * Don't call u_sync() while getting the expression,
!  * evaluating it or giving an error message for it!
!  */
  ++no_u_sync;
  if (regname == '=')
  {
--- 8126,8133 
  --no_mapping;
  
  #ifdef FEAT_EVAL
! /* Don't call u_sync() while typing the expression or giving an error
!  * message for it. Only call it explicitly. */
  ++no_u_sync;
  if (regname == '=')
  {
***
*** 8142,8147 
--- 8140,8148 
if (im_on)
im_set_active(TRUE);
  # endif
+   if (regname == '=')
+   /* sync undo, so the effect of e.g., setline() can be undone */
+   u_sync(TRUE);
  }
  if (regname == NUL || !valid_yank_reg(regname, FALSE))
  {
*** ../vim-7.3.1199/src/testdir/test61.in   2010-09-14 12:47:30.0 
+0200
--- src/testdir/test61.in   2013-06-15 17:25:53.0 +0200
***
*** 84,89 
--- 84,99 
  ggO--- :0put b
  ggO--- :0put a
  ggO--- :w >>test.out
+ :so small.vim
+ :set nocp
+ :enew!
+ oa 
+ :set ul=100
+ ob 
+ :set ul=100
+ o1 a2 =setline('.','1234')
+ 
+  uu:%w >>test.out
  :qa!
  ENDTEST
  
*** ../vim-7.3.1199/src/testdir/test61.ok   2010-08-15 21:57:29.0 
+0200
--- src/testdir/test61.ok   2013-06-15 17:25:53.0 +0200
***
*** 41,43 
--- 41,46 
  two
  two
  three
+ 
+ a
+ b
*** ../vim-7.3.1199/src/version.c   2013-06-15 17:06:31.0 +0200
--- src/version.c   2013-06-15 17:39:37.0 +0200
***
*** 730,731 
--- 730,733 
  {   /* Add new patch number below this line */
+ /**/
+ 1200,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
217. Your sex life has drastically improved...so what if it's only cyber-sex!

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