To: vim-dev@vim.org Subject: patch 5.4.48 Fcc: outbox From: Bram Moolenaar ------------ Patch 5.4.48 Problem: A paste with the mouse in Insert mode was not repeated exactly the same with ".". For example, when 'autoindent' is set and pasting text with leading indent. (Perry) Solution: Add the CTRL-R CTRL-O r and CTRL-R CTRL-P r commands in Insert mode, which insert the contents of a register literally. Files: src/edit.c, src/normal.c, runtime/doc/insert.txt *** ../vim-5.4.47/src/edit.c Sun Aug 22 23:08:15 1999 --- src/edit.c Fri Aug 27 22:37:44 1999 *************** *** 4424,4431 **** ins_reg() { int need_redraw = FALSE; ! int cc; ! int literally = FALSE; /* * If we are going to wait for a character, show a '"'. --- 4424,4431 ---- ins_reg() { int need_redraw = FALSE; ! int regname; ! int literally = 0; /* * If we are going to wait for a character, show a '"'. *************** *** 4447,4461 **** * deleted when ESC is hit. */ ++no_mapping; ! cc = safe_vgetc(); ! if (cc == Ctrl('R')) { ! literally = TRUE; ! cc = safe_vgetc(); } --no_mapping; #ifdef HAVE_LANGMAP ! LANGMAP_ADJUST(cc, TRUE); #endif #ifdef WANT_EVAL --- 4447,4465 ---- * deleted when ESC is hit. */ ++no_mapping; ! regname = safe_vgetc(); ! if (regname == Ctrl('R') || regname == Ctrl('O') || regname == Ctrl('P')) { ! /* Get a third key for literal register insertion */ ! literally = regname; ! #ifdef CMDLINE_INFO ! add_to_showcmd_c(literally); ! #endif ! regname = safe_vgetc(); } --no_mapping; #ifdef HAVE_LANGMAP ! LANGMAP_ADJUST(regname, TRUE); #endif #ifdef WANT_EVAL *************** *** 4464,4477 **** * evaluating it or giving an error message for it! */ ++no_u_sync; ! if (cc == '=') ! cc = get_expr_register(); ! if (cc == NUL) need_redraw = TRUE; /* remove the '"' */ else { #endif ! if (insert_reg(cc, literally) == FAIL) { vim_beep(); need_redraw = TRUE; /* remove the '"' */ --- 4468,4491 ---- * evaluating it or giving an error message for it! */ ++no_u_sync; ! if (regname == '=') ! regname = get_expr_register(); ! if (regname == NUL) need_redraw = TRUE; /* remove the '"' */ else { #endif ! if (literally == Ctrl('O') || literally == Ctrl('P')) ! { ! /* Append the command to the redo buffer. */ ! AppendCharToRedobuff(Ctrl('R')); ! AppendCharToRedobuff(literally); ! AppendCharToRedobuff(regname); ! ! do_put(regname, BACKWARD, 1L, ! (literally == Ctrl('P') ? PUT_FIXINDENT : 0) | PUT_CURSEND); ! } ! else if (insert_reg(regname, literally) == FAIL) { vim_beep(); need_redraw = TRUE; /* remove the '"' */ *** ../vim-5.4.47/src/normal.c Sun Aug 22 14:14:53 1999 --- src/normal.c Fri Aug 27 21:31:01 1999 *************** *** 2154,2163 **** { do_put(regname, BACKWARD, 1L, fix_indent | PUT_CURSEND); ! /* Repeat it with CTRL-R CTRL-R x. Not exactly the same, ! * but mostly works fine. */ ! AppendCharToRedobuff(Ctrl('R')); AppendCharToRedobuff(Ctrl('R')); AppendCharToRedobuff(regname == 0 ? '"' : regname); } } --- 2154,2162 ---- { do_put(regname, BACKWARD, 1L, fix_indent | PUT_CURSEND); ! /* Repeat it with CTRL-R CTRL-O r or CTRL-R CTRL-P r */ AppendCharToRedobuff(Ctrl('R')); + AppendCharToRedobuff(fix_indent ? Ctrl('P') : Ctrl('O')); AppendCharToRedobuff(regname == 0 ? '"' : regname); } } *** ../vim-5.4.47/runtime/doc/insert.txt Tue Aug 10 16:10:19 1999 --- runtime/doc/insert.txt Fri Aug 27 21:54:53 1999 *************** *** 1,4 **** ! *insert.txt* For Vim version 5.4. Last change: 1999 Aug 04 VIM REFERENCE MANUAL by Bram Moolenaar --- 1,4 ---- ! *insert.txt* For Vim version 5.4. Last change: 1999 Aug 27 VIM REFERENCE MANUAL by Bram Moolenaar *************** *** 122,130 **** > CTRL-R a results in "ac". > CTRL-R CTRL-R a results in "ab^Hc". Options 'textwidth', 'formatoptions', etc. still apply. If ! you also want to avoid these, use ""xP", where 'x' is the ! name of the register. However, this cannot be used to replace ! text. The '.' register (last inserted text) is still inserted as typed. {not in Vi} --- 122,143 ---- > CTRL-R a results in "ac". > CTRL-R CTRL-R a results in "ab^Hc". Options 'textwidth', 'formatoptions', etc. still apply. If ! you also want to avoid these, use "r", see below. ! The '.' register (last inserted text) is still inserted as ! typed. {not in Vi} ! ! CTRL-R CTRL-O {0-9a-z"%#/:.-=} *i_CTRL-R_CTRL-O* *i__* ! Insert the contents of a register literally and don't ! auto-indent. Does the same as pasting with the mouse ! |_* ! Insert the contents of a register literally and fix the ! indent, like |[|. ! Does not replace characters! The '.' register (last inserted text) is still inserted as typed. {not in Vi} *** ../vim-5.4.47/src/version.h Thu Aug 26 20:45:29 1999 --- src/version.h Fri Aug 27 22:39:41 1999 *************** *** 19,26 **** #define VIM_VERSION_MINOR_STR "4" #define VIM_VERSION_BUILD 57 #define VIM_VERSION_BUILD_STR "57" ! #define VIM_VERSION_PATCHLEVEL 47 ! #define VIM_VERSION_PATCHLEVEL_STR "47" /* * VIM_VERSION_NODOT is used for the runtime directory name. --- 19,26 ---- #define VIM_VERSION_MINOR_STR "4" #define VIM_VERSION_BUILD 57 #define VIM_VERSION_BUILD_STR "57" ! #define VIM_VERSION_PATCHLEVEL 48 ! #define VIM_VERSION_PATCHLEVEL_STR "48" /* * VIM_VERSION_NODOT is used for the runtime directory name. *************** *** 30,35 **** */ #define VIM_VERSION_NODOT "vim54" #define VIM_VERSION_SHORT "5.4" ! #define VIM_VERSION_MEDIUM "5.4.47" ! #define VIM_VERSION_LONG "VIM - Vi IMproved 5.4.47 (1999 Aug 26)" ! #define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 5.4.47 (1999 Aug 26, compiled " --- 30,35 ---- */ #define VIM_VERSION_NODOT "vim54" #define VIM_VERSION_SHORT "5.4" ! #define VIM_VERSION_MEDIUM "5.4.48" ! #define VIM_VERSION_LONG "VIM - Vi IMproved 5.4.48 (1999 Aug 27)" ! #define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 5.4.48 (1999 Aug 27, compiled " -- A cow comes flying over the battlements, lowing aggressively. The cow lands on GALAHAD'S PAGE, squashing him completely. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\-- \ \ www.vim.org/iccf www.moolenaar.net www.vim.org / /