home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / old / 5.6.048 < prev    next >
Encoding:
Internet Message Format  |  2000-04-01  |  9.5 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 5.6.048
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. ------------
  6.  
  7. Patch 5.6.048
  8. Problem:    CTRL-R in Command-line mode is documented to insert text as typed,
  9.         but inserts text literally.
  10. Solution:   Make CTRL-R insert text as typed, use CTRL-R CTRL-R to insert
  11.         literally.  This is consistent with Insert mode.  But characters
  12.         that end Command-line mode are inserted literally.
  13. Files:        runtime/doc/index.txt, runtime/doc/cmdline.txt, src/ex_getln.c,
  14.         src/ops.c, src/proto/ops.pro
  15.  
  16.  
  17. *** ../vim-5.6.47/runtime/doc/index.txt    Sun Jan 16 14:12:56 2000
  18. --- runtime/doc/index.txt    Sat Apr  1 20:57:07 2000
  19. ***************
  20. *** 1,4 ****
  21. ! *index.txt*     For Vim version 5.6.  Last change: 2000 Jan 01
  22.   
  23.   
  24.             VIM REFERENCE MANUAL    by Bram Moolenaar
  25. --- 1,4 ----
  26. ! *index.txt*     For Vim version 5.6.  Last change: 2000 Apr 01
  27.   
  28.   
  29.             VIM REFERENCE MANUAL    by Bram Moolenaar
  30. ***************
  31. *** 831,838 ****
  32.   |c_CTRL-P|    CTRL-P        after using 'wildchar' with multiple matches:
  33.                   go to previous match, otherwise: same as <Up>
  34.   |c_CTRL-Q|    CTRL-Q        same as CTRL-V (used for terminal control flow)
  35. ! |c_CTRL-R|    CTRL-R {0-9a-z"%#*:=}
  36. !                 insert the contents of a register
  37.           CTRL-S        (used for terminal control flow)
  38.   |c_CTRL-U|    CTRL-U        remove all characters
  39.   |c_CTRL-V|    CTRL-V        insert next non-digit literally, insert three
  40. --- 831,842 ----
  41.   |c_CTRL-P|    CTRL-P        after using 'wildchar' with multiple matches:
  42.                   go to previous match, otherwise: same as <Up>
  43.   |c_CTRL-Q|    CTRL-Q        same as CTRL-V (used for terminal control flow)
  44. ! |c_CTRL-R|    CTRL-R {0-9a-z"%#*:= CTRL-F CTRL-P CTRL-W CTRL-A}
  45. !                 insert the contents of a register or object
  46. !                 under the cursor as if typed
  47. ! |c_CTRL-R_CTRL-R| CTRL-R CTRL-R {0-9a-z"%#*:= CTRL-F CTRL-P CTRL-W CTRL-A}
  48. !                 insert the contents of a register or object
  49. !                 under the cursor literally
  50.           CTRL-S        (used for terminal control flow)
  51.   |c_CTRL-U|    CTRL-U        remove all characters
  52.   |c_CTRL-V|    CTRL-V        insert next non-digit literally, insert three
  53. *** ../vim-5.6.47/runtime/doc/cmdline.txt    Sun Jan 16 14:12:53 2000
  54. --- runtime/doc/cmdline.txt    Sat Apr  1 21:11:03 2000
  55. ***************
  56. *** 1,4 ****
  57. ! *cmdline.txt*   For Vim version 5.6.  Last change: 2000 Jan 09
  58.   
  59.   
  60.             VIM REFERENCE MANUAL    by Bram Moolenaar
  61. --- 1,4 ----
  62. ! *cmdline.txt*   For Vim version 5.6.  Last change: 2000 Apr 01
  63.   
  64.   
  65.             VIM REFERENCE MANUAL    by Bram Moolenaar
  66. ***************
  67. *** 119,126 ****
  68.           Insert the contents of a numbered or named register.  Between
  69.           typing CTRL-R and the second character '"' will be displayed
  70.           to indicate that you are expected to enter the name of a
  71. !         register.  The text is inserted as if you typed it, but
  72. !         mappings and abbreviations are not used.  Special registers:
  73.               '"'    the unnamed register, containing the text of
  74.                   the last delete or yank
  75.               '%'    the current file name
  76. --- 119,132 ----
  77.           Insert the contents of a numbered or named register.  Between
  78.           typing CTRL-R and the second character '"' will be displayed
  79.           to indicate that you are expected to enter the name of a
  80. !         register.
  81. !         The text is inserted as if you typed it, but mappings and
  82. !         abbreviations are not used.  Characters that end the command
  83. !         line are inserted literally (<Esc>, <CR>, <NL>, <C-C>).  A
  84. !         <BS> or CTRL-W could still end the command line though, and
  85. !         remaining characters will then be interpreted in another mode,
  86. !         which might not be what you intended.
  87. !         Special registers:
  88.               '"'    the unnamed register, containing the text of
  89.                   the last delete or yank
  90.               '%'    the current file name
  91. ***************
  92. *** 147,152 ****
  93. --- 153,166 ----
  94.           CTRL-F and CTRL-P: {only when +file_in_path feature is
  95.           included}
  96.   
  97. +                     *c_CTRL-R_CTRL-R* *c_<C-R>_<C-R>*
  98. + CTRL-R CTRL-R {0-9a-z"%#:-=. CTRL-F CTRL-P CTRL-W CTRL-A}
  99. +         Insert register or object under the cursor.  Works like
  100. +         |c_CTRL-R| but inserts the text literally.  For example, if
  101. +         register a contains "xy^Hz" (where ^H is a backspace),
  102. +         "CTRL-R a" will insert "xz" while "CTRL-R CTRL-R a" will
  103. +         insert "xy^Hz".
  104.   CTRL-J                        *c_CTRL-J* *c_<NL>* *c_<CR>*
  105.   <CR> or <NL>    start entered command
  106.                               *c_<Esc>*
  107. *** ../vim-5.6.47/src/ex_getln.c    Sat Mar 25 17:13:09 2000
  108. --- src/ex_getln.c    Sat Apr  1 20:30:58 2000
  109. ***************
  110. *** 726,732 ****
  111.   #endif
  112.           putcmdline('"');
  113.           ++no_mapping;
  114. !         c = safe_vgetc();
  115.           --no_mapping;
  116.   #ifdef WANT_EVAL
  117.           /*
  118. --- 726,734 ----
  119.   #endif
  120.           putcmdline('"');
  121.           ++no_mapping;
  122. !         i = c = safe_vgetc(); /* CTRL-R <char> */
  123. !         if (c == Ctrl('R'))
  124. !             c = safe_vgetc(); /* CTRL-R CTRL-R <char> */
  125.           --no_mapping;
  126.   #ifdef WANT_EVAL
  127.           /*
  128. ***************
  129. *** 754,760 ****
  130.           }
  131.   #endif
  132.           if (c != ESC)        /* use ESC to cancel inserting register */
  133. !             cmdline_paste(c);
  134.           redrawcmd();
  135.           goto cmdline_changed;
  136.   
  137. --- 756,762 ----
  138.           }
  139.   #endif
  140.           if (c != ESC)        /* use ESC to cancel inserting register */
  141. !             cmdline_paste(c, i == Ctrl('R'));
  142.           redrawcmd();
  143.           goto cmdline_changed;
  144.   
  145. ***************
  146. *** 826,835 ****
  147.               goto cmdline_not_changed;   /* Ignore mouse */
  148.   # ifdef USE_GUI
  149.           if (gui.in_use)
  150. !             cmdline_paste('*');
  151.           else
  152.   # endif
  153. !             cmdline_paste(0);
  154.           redrawcmd();
  155.           goto cmdline_changed;
  156.   
  157. --- 828,837 ----
  158.               goto cmdline_not_changed;   /* Ignore mouse */
  159.   # ifdef USE_GUI
  160.           if (gui.in_use)
  161. !             cmdline_paste('*', TRUE);
  162.           else
  163.   # endif
  164. !             cmdline_paste(0, TRUE);
  165.           redrawcmd();
  166.           goto cmdline_changed;
  167.   
  168. *** ../vim-5.6.47/src/ops.c    Mon Dec 13 16:07:36 1999
  169. --- src/ops.c    Sat Apr  1 21:08:46 2000
  170. ***************
  171. *** 86,91 ****
  172. --- 86,92 ----
  173.   static int    put_in_typebuf __ARGS((char_u *s, int colon));
  174.   static void    stuffescaped __ARGS((char_u *arg));
  175.   static int    get_spec_reg __ARGS((int regname, char_u **argp, int *allocated, int errmsg));
  176. + static void    cmdline_paste_str __ARGS((char_u *s, int literally));
  177.   static void    free_yank __ARGS((long));
  178.   static void    free_yank_all __ARGS((void));
  179.   static void    block_prep __ARGS((OPARG *oap, struct block_def *, linenr_t, int));
  180. ***************
  181. *** 1171,1178 ****
  182.    * return FAIL for failure, OK otherwise
  183.    */
  184.       int
  185. ! cmdline_paste(regname)
  186.       int regname;
  187.   {
  188.       long    i;
  189.       char_u    *arg;
  190. --- 1172,1180 ----
  191.    * return FAIL for failure, OK otherwise
  192.    */
  193.       int
  194. ! cmdline_paste(regname, literally)
  195.       int regname;
  196. +     int literally;    /* Insert text literally instead of "as typed" */
  197.   {
  198.       long    i;
  199.       char_u    *arg;
  200. ***************
  201. *** 1198,1207 ****
  202.       {
  203.       if (arg == NULL)
  204.           return FAIL;
  205. !     i = put_on_cmdline(arg, -1, TRUE);
  206.       if (allocated)
  207.           vim_free(arg);
  208. !     return (int)i;
  209.       }
  210.   
  211.       get_yank_register(regname, FALSE);
  212. --- 1200,1209 ----
  213.       {
  214.       if (arg == NULL)
  215.           return FAIL;
  216. !     cmdline_paste_str(arg, literally);
  217.       if (allocated)
  218.           vim_free(arg);
  219. !     return (int)OK;
  220.       }
  221.   
  222.       get_yank_register(regname, FALSE);
  223. ***************
  224. *** 1210,1222 ****
  225.   
  226.       for (i = 0; i < y_current->y_size; ++i)
  227.       {
  228. !     put_on_cmdline(y_current->y_array[i], -1, FALSE);
  229.   
  230.       /* insert ^M between lines and after last line if type is MLINE */
  231.       if (y_current->y_type == MLINE || i < y_current->y_size - 1)
  232. !         put_on_cmdline((char_u *)"\r", 1, FALSE);
  233.       }
  234.       return OK;
  235.   }
  236.   
  237.   /*
  238. --- 1212,1252 ----
  239.   
  240.       for (i = 0; i < y_current->y_size; ++i)
  241.       {
  242. !     cmdline_paste_str(y_current->y_array[i], literally);
  243.   
  244.       /* insert ^M between lines and after last line if type is MLINE */
  245.       if (y_current->y_type == MLINE || i < y_current->y_size - 1)
  246. !         cmdline_paste_str((char_u *)"\r", literally);
  247.       }
  248.       return OK;
  249. + }
  250. + /*
  251. +  * Put a string on the command line.
  252. +  * When "literally" is TRUE, insert literally.
  253. +  * When "literally" is FALSE, insert as typed, but don't leave the command
  254. +  * line.
  255. +  */
  256. +     static void
  257. + cmdline_paste_str(s, literally)
  258. +     char_u    *s;
  259. +     int        literally;
  260. + {
  261. +     if (literally)
  262. +     put_on_cmdline(s, -1, TRUE);
  263. +     else
  264. +     while (*s)
  265. +     {
  266. +         if (*s == Ctrl('V') && s[1])
  267. +         stuffcharReadbuff(*s++);
  268. +         else if (*s == ESC || *s == Ctrl('C') || *s == CR || *s == NL
  269. + #ifdef UNIX
  270. +             || *s == intr_char
  271. + #endif
  272. +             || (*s == Ctrl('\\') && s[1] == Ctrl('N')))
  273. +         stuffcharReadbuff(Ctrl('V'));
  274. +         stuffcharReadbuff(*s++);
  275. +     }
  276.   }
  277.   
  278.   /*
  279. *** ../vim-5.6.47/src/proto/ops.pro    Sun Jan 16 14:22:46 2000
  280. --- src/proto/ops.pro    Sat Apr  1 20:59:39 2000
  281. ***************
  282. *** 13,19 ****
  283.   int do_record __ARGS((int c));
  284.   int do_execreg __ARGS((int regname, int colon, int addcr));
  285.   int insert_reg __ARGS((int regname, int literally));
  286. ! int cmdline_paste __ARGS((int regname));
  287.   int op_delete __ARGS((OPARG *oap));
  288.   int op_replace __ARGS((OPARG *oap, int c));
  289.   void op_tilde __ARGS((OPARG *oap));
  290. --- 13,19 ----
  291.   int do_record __ARGS((int c));
  292.   int do_execreg __ARGS((int regname, int colon, int addcr));
  293.   int insert_reg __ARGS((int regname, int literally));
  294. ! int cmdline_paste __ARGS((int regname, int literally));
  295.   int op_delete __ARGS((OPARG *oap));
  296.   int op_replace __ARGS((OPARG *oap, int c));
  297.   void op_tilde __ARGS((OPARG *oap));
  298. *** ../vim-5.6.47/src/version.c    Fri Mar 31 19:36:49 2000
  299. --- src/version.c    Sat Apr  1 21:12:33 2000
  300. ***************
  301. *** 420,421 ****
  302. --- 420,423 ----
  303.   {   /* Add new patch number below this line */
  304. + /**/
  305. +     48,
  306.   /**/
  307.  
  308. -- 
  309. It is illegal for a driver to be blindfolded while operating a vehicle.
  310.         [real standing law in Alabama, United States of America]
  311.  
  312. /-/-- Bram Moolenaar --- Bram@moolenaar.net --- http://www.moolenaar.net --\-\
  313. \-\-- Vim: http://www.vim.org ---- ICCF Holland: http://www.vim.org/iccf --/-/
  314.