There are two problems in block insert mode (<C-V> + I).

1. When CTRL-C is used in block insert mode, text is inserted to first
   line only even if multi-line was selected.

For example, when there are three lines and type "1G<C-V>jjIxxx<C-C>"
1: aaa        1: xxxaaa
2: bbb   ->   2: bbb
3: ccc        3: ccc

Please see op_insert() function in ops.c.  After invoking edit(),
got_int is TRUE when CTRL-C was used.  Then u_save() returns FAIL and
block_insert() is not invoked.  Thus text is not inserted to other line.

op_insert() in ops.c:
2466                 /* block handled here */
2467                 if (u_save(oap->start.lnum,
2468                                          (linenr_T)(oap->end.lnum + 1)) == 
OK)
2469                     block_insert(oap, ins_text, (oap->op_type == 
OP_INSERT),
2470                                                                          
&bd);

u_savecommon() in undo.c:
 504             fast_breakcheck();
 505             if (got_int)
 506             {
 507                 u_freeentry(uep, i);
 508                 return FAIL;
 509             }


2. When CTRL-C is used in block insert mode, extra undo is added.
   This happens when using GUI.

For example, type "<C-V>Ixxx<C-C>" and do undo:
        insert        undo        undo
  1:      ->  1: xxx   -> 1: xxx   ->  1:

In CUI:
        insert        undo
  1:      ->  1: xxx   -> 1:

This is stacktrace explaining how extra undo is added.

#0  u_sync (force=0) at undo.c:1261
#1  0x080c5c02 in may_sync_undo () at getchar.c:1241
#2  0x080c5bb9 in gotchars (s=0x81fa761 "Ixxx\003", len=-1) at getchar.c:1216
#3  0x080c6981 in vgetorpeek (advance=0) at getchar.c:1966
#4  0x080c673f in vpeekc () at getchar.c:1747
#5  0x080c67b5 in char_avail () at getchar.c:1797
#6  0x081030af in update_mouseshape (shape_idx=-1) at misc2.c:3410
#7  0x081920dc in setmouse () at term.c:3322
#8  0x0806c7a4 in ins_esc (count=0xbfbfe308, cmdchar=0, nomove=0)
    at edit.c:7781
#9  0x080629e8 in edit (cmdchar=0, startln=0, count=-1) at edit.c:921
#10 0x0811f66e in op_insert (oap=0xbfbfe530, count1=1) at ops.c:2425
#11 0x081108ca in do_pending_operator (cap=0xbfbfe4c0, old_col=0, gui_yank=0)
    at normal.c:1985
#12 0x0810f37d in normal_cmd (oap=0xbfbfe530, toplevel=1) at normal.c:1163
#13 0x080d6cf9 in main_loop (cmdwin=0, noexmode=0) at main.c:1154
#14 0x080d685b in main (argc=3, argv=0xbfbfe6fc) at main.c:934


-- 
Yukihiro Nakadaira - [EMAIL PROTECTED]

Reply via email to