@@ -3776,25 +3776,42 @@ do_put(regname, dir, count, flags)
37763776 */
37773777 if (y_type == MCHAR && y_size == 1 )
37783778 {
3779- totlen = count * yanklen ;
3780- if (totlen )
3781- {
3782- oldp = ml_get (lnum );
3783- newp = alloc_check ((unsigned )(STRLEN (oldp ) + totlen + 1 ));
3784- if (newp == NULL )
3785- goto end ; /* alloc() will give error message */
3786- mch_memmove (newp , oldp , (size_t )col );
3787- ptr = newp + col ;
3788- for (i = 0 ; i < count ; ++ i )
3779+ do {
3780+ totlen = count * yanklen ;
3781+ if (totlen > 0 )
37893782 {
3790- mch_memmove (ptr , y_array [0 ], (size_t )yanklen );
3791- ptr += yanklen ;
3783+ oldp = ml_get (lnum );
3784+ newp = alloc_check ((unsigned )(STRLEN (oldp ) + totlen + 1 ));
3785+ if (newp == NULL )
3786+ goto end ; /* alloc() gave an error message */
3787+ mch_memmove (newp , oldp , (size_t )col );
3788+ ptr = newp + col ;
3789+ for (i = 0 ; i < count ; ++ i )
3790+ {
3791+ mch_memmove (ptr , y_array [0 ], (size_t )yanklen );
3792+ ptr += yanklen ;
3793+ }
3794+ STRMOVE (ptr , oldp + col );
3795+ ml_replace (lnum , newp , FALSE);
3796+ /* Place cursor on last putted char. */
3797+ if (lnum == curwin -> w_cursor .lnum )
3798+ curwin -> w_cursor .col += (colnr_T )(totlen - 1 );
37923799 }
3793- STRMOVE (ptr , oldp + col );
3794- ml_replace (lnum , newp , FALSE);
3795- /* Put cursor on last putted char. */
3796- curwin -> w_cursor .col += (colnr_T )(totlen - 1 );
3797- }
3800+ #ifdef FEAT_VISUAL
3801+ if (VIsual_active )
3802+ lnum ++ ;
3803+ #endif
3804+ } while (
3805+ #ifdef FEAT_VISUAL
3806+ VIsual_active && lnum <= curbuf -> b_visual .vi_end .lnum
3807+ #else
3808+ FALSE /* stop after 1 paste */
3809+ #endif
3810+ );
3811+ #ifdef FEAT_VISUAL
3812+ VIsual_active = FALSE;
3813+ #endif
3814+
37983815 curbuf -> b_op_end = curwin -> w_cursor ;
37993816 /* For "CTRL-O p" in Insert mode, put cursor after last char */
38003817 if (totlen && (restart_edit != 0 || (flags & PUT_CURSEND )))
0 commit comments