@@ -2113,13 +2113,21 @@ op_replace(oparg_T *oap, int c)
21132113 size_t oldlen ;
21142114 struct block_def bd ;
21152115 char_u * after_p = NULL ;
2116- int had_ctrl_v_cr = ( c == -1 || c == -2 ) ;
2116+ int had_ctrl_v_cr = FALSE ;
21172117
21182118 if ((curbuf -> b_ml .ml_flags & ML_EMPTY ) || oap -> empty )
21192119 return OK ; /* nothing to do */
21202120
2121- if (had_ctrl_v_cr )
2122- c = (c == -1 ? '\r' : '\n' );
2121+ if (c == REPLACE_CR_NCHAR )
2122+ {
2123+ had_ctrl_v_cr = TRUE;
2124+ c = CAR ;
2125+ }
2126+ else if (c == REPLACE_NL_NCHAR )
2127+ {
2128+ had_ctrl_v_cr = TRUE;
2129+ c = NL ;
2130+ }
21232131
21242132#ifdef FEAT_MBYTE
21252133 if (has_mbyte )
@@ -2207,7 +2215,8 @@ op_replace(oparg_T *oap, int c)
22072215 /* insert pre-spaces */
22082216 vim_memset (newp + bd .textcol , ' ' , (size_t )bd .startspaces );
22092217 /* insert replacement chars CHECK FOR ALLOCATED SPACE */
2210- /* -1/-2 is used for entering CR literally. */
2218+ /* REPLACE_CR_NCHAR/REPLACE_NL_NCHAR is used for entering CR
2219+ * literally. */
22112220 if (had_ctrl_v_cr || (c != '\r' && c != '\n' ))
22122221 {
22132222#ifdef FEAT_MBYTE
@@ -6370,7 +6379,7 @@ write_viminfo_registers(FILE *fp)
63706379 * |{bartype},{flags},{name},{type},
63716380 * {linecount},{width},{timestamp},"line1","line2"
63726381 * flags: REG_PREVIOUS - register is y_previous
6373- * REG_EXEC - used for @@
6382+ * REG_EXEC - used for @@
63746383 */
63756384 if (y_previous == & y_regs [i ])
63766385 flags |= REG_PREVIOUS ;
0 commit comments