|
Karsten Hopp |
91ff59 |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
91ff59 |
Subject: Patch 7.4.232
|
|
Karsten Hopp |
91ff59 |
Fcc: outbox
|
|
Karsten Hopp |
91ff59 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
91ff59 |
Mime-Version: 1.0
|
|
Karsten Hopp |
91ff59 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
91ff59 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
91ff59 |
------------
|
|
Karsten Hopp |
91ff59 |
|
|
Karsten Hopp |
91ff59 |
Patch 7.4.232
|
|
Karsten Hopp |
91ff59 |
Problem: ":%s/\n//" uses a lot of memory. (Aidan Marlin)
|
|
Karsten Hopp |
91ff59 |
Solution: Turn this into a join command. (Christian Brabandt)
|
|
Karsten Hopp |
91ff59 |
Files: src/ex_cmds.c, src/ex_docmd.c, src/proto/ex_docmd.pro
|
|
Karsten Hopp |
91ff59 |
|
|
Karsten Hopp |
91ff59 |
|
|
Karsten Hopp |
91ff59 |
*** ../vim-7.4.231/src/ex_cmds.c 2014-03-23 15:12:29.919264336 +0100
|
|
Karsten Hopp |
91ff59 |
--- src/ex_cmds.c 2014-04-01 17:37:59.560901015 +0200
|
|
Karsten Hopp |
91ff59 |
***************
|
|
Karsten Hopp |
91ff59 |
*** 4420,4425 ****
|
|
Karsten Hopp |
91ff59 |
--- 4420,4450 ----
|
|
Karsten Hopp |
91ff59 |
endcolumn = (curwin->w_curswant == MAXCOL);
|
|
Karsten Hopp |
91ff59 |
}
|
|
Karsten Hopp |
91ff59 |
|
|
Karsten Hopp |
91ff59 |
+ /* Recognize ":%s/\n//" and turn it into a join command, which is much
|
|
Karsten Hopp |
91ff59 |
+ * more efficient.
|
|
Karsten Hopp |
91ff59 |
+ * TODO: find a generic solution to make line-joining operations more
|
|
Karsten Hopp |
91ff59 |
+ * efficient, avoid allocating a string that grows in size.
|
|
Karsten Hopp |
91ff59 |
+ */
|
|
Karsten Hopp |
91ff59 |
+ if (STRCMP(pat, "\\n") == 0 && STRLEN(pat) == 2
|
|
Karsten Hopp |
91ff59 |
+ && *sub == NUL
|
|
Karsten Hopp |
91ff59 |
+ && (*cmd == NUL || (cmd[1] == NUL && (*cmd == 'g' || *cmd == 'l'
|
|
Karsten Hopp |
91ff59 |
+ || *cmd == 'p' || *cmd == '#'))))
|
|
Karsten Hopp |
91ff59 |
+ {
|
|
Karsten Hopp |
91ff59 |
+ curwin->w_cursor.lnum = eap->line1;
|
|
Karsten Hopp |
91ff59 |
+ if (*cmd == 'l')
|
|
Karsten Hopp |
91ff59 |
+ eap->flags = EXFLAG_LIST;
|
|
Karsten Hopp |
91ff59 |
+ else if (*cmd == '#')
|
|
Karsten Hopp |
91ff59 |
+ eap->flags = EXFLAG_NR;
|
|
Karsten Hopp |
91ff59 |
+ else if (*cmd == 'p')
|
|
Karsten Hopp |
91ff59 |
+ eap->flags = EXFLAG_PRINT;
|
|
Karsten Hopp |
91ff59 |
+
|
|
Karsten Hopp |
91ff59 |
+ (void)do_join(eap->line2 - eap->line1 + 1, FALSE, TRUE, FALSE);
|
|
Karsten Hopp |
91ff59 |
+ sub_nlines = sub_nsubs = eap->line2 - eap->line1 + 1;
|
|
Karsten Hopp |
91ff59 |
+ (void)do_sub_msg(FALSE);
|
|
Karsten Hopp |
91ff59 |
+ ex_may_print(eap);
|
|
Karsten Hopp |
91ff59 |
+ return;
|
|
Karsten Hopp |
91ff59 |
+ }
|
|
Karsten Hopp |
91ff59 |
+
|
|
Karsten Hopp |
91ff59 |
/*
|
|
Karsten Hopp |
91ff59 |
* Find trailing options. When '&' is used, keep old options.
|
|
Karsten Hopp |
91ff59 |
*/
|
|
Karsten Hopp |
91ff59 |
*** ../vim-7.4.231/src/ex_docmd.c 2014-03-25 13:03:44.937793766 +0100
|
|
Karsten Hopp |
91ff59 |
--- src/ex_docmd.c 2014-04-01 17:31:59.708905965 +0200
|
|
Karsten Hopp |
91ff59 |
***************
|
|
Karsten Hopp |
91ff59 |
*** 316,322 ****
|
|
Karsten Hopp |
91ff59 |
static void ex_operators __ARGS((exarg_T *eap));
|
|
Karsten Hopp |
91ff59 |
static void ex_put __ARGS((exarg_T *eap));
|
|
Karsten Hopp |
91ff59 |
static void ex_copymove __ARGS((exarg_T *eap));
|
|
Karsten Hopp |
91ff59 |
- static void ex_may_print __ARGS((exarg_T *eap));
|
|
Karsten Hopp |
91ff59 |
static void ex_submagic __ARGS((exarg_T *eap));
|
|
Karsten Hopp |
91ff59 |
static void ex_join __ARGS((exarg_T *eap));
|
|
Karsten Hopp |
91ff59 |
static void ex_at __ARGS((exarg_T *eap));
|
|
Karsten Hopp |
91ff59 |
--- 316,321 ----
|
|
Karsten Hopp |
91ff59 |
***************
|
|
Karsten Hopp |
91ff59 |
*** 8683,8689 ****
|
|
Karsten Hopp |
91ff59 |
/*
|
|
Karsten Hopp |
91ff59 |
* Print the current line if flags were given to the Ex command.
|
|
Karsten Hopp |
91ff59 |
*/
|
|
Karsten Hopp |
91ff59 |
! static void
|
|
Karsten Hopp |
91ff59 |
ex_may_print(eap)
|
|
Karsten Hopp |
91ff59 |
exarg_T *eap;
|
|
Karsten Hopp |
91ff59 |
{
|
|
Karsten Hopp |
91ff59 |
--- 8682,8688 ----
|
|
Karsten Hopp |
91ff59 |
/*
|
|
Karsten Hopp |
91ff59 |
* Print the current line if flags were given to the Ex command.
|
|
Karsten Hopp |
91ff59 |
*/
|
|
Karsten Hopp |
91ff59 |
! void
|
|
Karsten Hopp |
91ff59 |
ex_may_print(eap)
|
|
Karsten Hopp |
91ff59 |
exarg_T *eap;
|
|
Karsten Hopp |
91ff59 |
{
|
|
Karsten Hopp |
91ff59 |
*** ../vim-7.4.231/src/proto/ex_docmd.pro 2013-08-10 13:37:10.000000000 +0200
|
|
Karsten Hopp |
91ff59 |
--- src/proto/ex_docmd.pro 2014-04-01 17:31:59.708905965 +0200
|
|
Karsten Hopp |
91ff59 |
***************
|
|
Karsten Hopp |
91ff59 |
*** 54,57 ****
|
|
Karsten Hopp |
91ff59 |
--- 54,58 ----
|
|
Karsten Hopp |
91ff59 |
int put_line __ARGS((FILE *fd, char *s));
|
|
Karsten Hopp |
91ff59 |
void dialog_msg __ARGS((char_u *buff, char *format, char_u *fname));
|
|
Karsten Hopp |
91ff59 |
char_u *get_behave_arg __ARGS((expand_T *xp, int idx));
|
|
Karsten Hopp |
91ff59 |
+ void ex_may_print __ARGS((exarg_T *eap));
|
|
Karsten Hopp |
91ff59 |
/* vim: set ft=c : */
|
|
Karsten Hopp |
91ff59 |
*** ../vim-7.4.231/src/version.c 2014-04-01 14:08:14.689074130 +0200
|
|
Karsten Hopp |
91ff59 |
--- src/version.c 2014-04-01 17:33:03.920905082 +0200
|
|
Karsten Hopp |
91ff59 |
***************
|
|
Karsten Hopp |
91ff59 |
*** 736,737 ****
|
|
Karsten Hopp |
91ff59 |
--- 736,739 ----
|
|
Karsten Hopp |
91ff59 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
91ff59 |
+ /**/
|
|
Karsten Hopp |
91ff59 |
+ 232,
|
|
Karsten Hopp |
91ff59 |
/**/
|
|
Karsten Hopp |
91ff59 |
|
|
Karsten Hopp |
91ff59 |
--
|
|
Karsten Hopp |
91ff59 |
hundred-and-one symptoms of being an internet addict:
|
|
Karsten Hopp |
91ff59 |
16. You step out of your room and realize that your parents have moved and
|
|
Karsten Hopp |
91ff59 |
you don't have a clue when it happened.
|
|
Karsten Hopp |
91ff59 |
|
|
Karsten Hopp |
91ff59 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
91ff59 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
91ff59 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
91ff59 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|