To: vim-dev@vim.org Subject: Patch 6.2.374 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.2.374 Problem: ":echo "hello" | silent normal n" removes the "hello" message. (Servatius Brandt) Solution: Don't echo the search string when ":silent" was used. Also don't show the mode. In general: don't clear to the end of the screen. Files: src/gui.c, src/message.c, src/os_unix.c, src/proto/message.pro, src/screen.c, src/search.c, src/window.c *** ../vim-6.2.373/src/gui.c Tue Mar 16 20:54:00 2004 --- src/gui.c Wed Mar 17 20:50:46 2004 *************** *** 4200,4206 **** { /* Clear the command. Needed for when forking+exiting, to avoid part * of the argument ending up after the shell prompt. */ ! msg_clr_eos(); gui_start(); } if (!ends_excmd(*eap->arg)) --- 4206,4212 ---- { /* Clear the command. Needed for when forking+exiting, to avoid part * of the argument ending up after the shell prompt. */ ! msg_clr_eos_force(); gui_start(); } if (!ends_excmd(*eap->arg)) *** ../vim-6.2.373/src/message.c Thu Feb 19 15:14:04 2004 --- src/message.c Wed Mar 17 20:56:44 2004 *************** *** 151,158 **** msg_start(); msg_outtrans_attr(s, attr); ! if (msg_silent == 0) ! msg_clr_eos(); retval = msg_end(); if (keep && retval && vim_strsize(s) < (int)(Rows - cmdline_row - 1) --- 151,157 ---- msg_start(); msg_outtrans_attr(s, attr); ! msg_clr_eos(); retval = msg_end(); if (keep && retval && vim_strsize(s) < (int)(Rows - cmdline_row - 1) *************** *** 2343,2353 **** /* * Clear from current message position to end of screen. * Note: msg_col is not updated, so we remember the end of the message * for msg_check(). */ void ! msg_clr_eos() { if (msg_use_printf()) { --- 2346,2367 ---- /* * Clear from current message position to end of screen. + * Skip this when ":silent" was used, no need to clear for redirection. + */ + void + msg_clr_eos() + { + if (msg_silent == 0) + msg_clr_eos_force(); + } + + /* + * Clear from current message position to end of screen. * Note: msg_col is not updated, so we remember the end of the message * for msg_check(). */ void ! msg_clr_eos_force() { if (msg_use_printf()) { *************** *** 2385,2391 **** { msg_row = cmdline_row; msg_col = 0; ! msg_clr_eos(); } /* --- 2399,2405 ---- { msg_row = cmdline_row; msg_col = 0; ! msg_clr_eos_force(); } /* *** ../vim-6.2.373/src/os_unix.c Thu Mar 11 20:55:09 2004 --- src/os_unix.c Wed Mar 17 20:53:10 2004 *************** *** 2580,2587 **** } else { ! restore_cterm_colors(); /* get original colors back */ ! msg_clr_eos(); /* clear the rest of the display */ windgoto((int)Rows - 1, 0); /* may have moved the cursor */ } } --- 2580,2587 ---- } else { ! restore_cterm_colors(); /* get original colors back */ ! msg_clr_eos_force(); /* clear the rest of the display */ windgoto((int)Rows - 1, 0); /* may have moved the cursor */ } } *** ../vim-6.2.373/src/proto/message.pro Mon Feb 2 12:53:51 2004 --- src/proto/message.pro Wed Mar 17 21:00:50 2004 *************** *** 42,47 **** --- 42,48 ---- void msg_moremsg __ARGS((int full)); void repeat_message __ARGS((void)); void msg_clr_eos __ARGS((void)); + void msg_clr_eos_force __ARGS((void)); void msg_clr_cmdline __ARGS((void)); int msg_end __ARGS((void)); void msg_check __ARGS((void)); *** ../vim-6.2.373/src/screen.c Wed Mar 17 14:08:56 2004 --- src/screen.c Wed Mar 17 21:00:25 2004 *************** *** 7858,7864 **** * Call char_avail() only when we are going to show something, because * it takes a bit of time. */ ! if (!redrawing() || (char_avail() && !KeyTyped)) { redraw_cmdline = TRUE; /* show mode later */ return 0; --- 7858,7864 ---- * Call char_avail() only when we are going to show something, because * it takes a bit of time. */ ! if (!redrawing() || (char_avail() && !KeyTyped) || msg_silent != 0) { redraw_cmdline = TRUE; /* show mode later */ return 0; *************** *** 8006,8013 **** msg_col = 0; need_wait_return = nwr_save; /* never ask for hit-return for this */ } ! else if (clear_cmdline) /* just clear anything */ ! msg_clr_cmdline(); /* will reset clear_cmdline */ #ifdef FEAT_CMDL_INFO # ifdef FEAT_VISUAL --- 8006,8014 ---- msg_col = 0; need_wait_return = nwr_save; /* never ask for hit-return for this */ } ! else if (clear_cmdline && msg_silent == 0) ! /* Clear the whole command line. Will reset "clear_cmdline". */ ! msg_clr_cmdline(); #ifdef FEAT_CMDL_INFO # ifdef FEAT_VISUAL *** ../vim-6.2.373/src/search.c Fri Mar 12 21:13:03 2004 --- src/search.c Wed Mar 17 20:27:36 2004 *************** *** 1066,1072 **** pat = p; /* put pat after search command */ } ! if ((options & SEARCH_ECHO) && messaging() && !cmd_silent) { char_u *msgbuf; char_u *trunc; --- 1066,1073 ---- pat = p; /* put pat after search command */ } ! if ((options & SEARCH_ECHO) && messaging() ! && !cmd_silent && msg_silent == 0) { char_u *msgbuf; char_u *trunc; *** ../vim-6.2.373/src/window.c Wed Mar 17 19:57:01 2004 --- src/window.c Wed Mar 17 20:55:02 2004 *************** *** 1006,1012 **** { msg_row = Rows - 1; msg_col = sc_col; ! msg_clr_eos(); /* Old command/ruler may still be there -- webb */ comp_col(); msg_row = Rows - 1; msg_col = 0; /* put position back at start of line */ --- 1006,1012 ---- { msg_row = Rows - 1; msg_col = sc_col; ! msg_clr_eos_force(); /* Old command/ruler may still be there */ comp_col(); msg_row = Rows - 1; msg_col = 0; /* put position back at start of line */ *** ../vim-6.2.373/src/version.c Wed Mar 17 19:57:01 2004 --- src/version.c Wed Mar 17 22:11:22 2004 *************** *** 639,640 **** --- 639,642 ---- { /* Add new patch number below this line */ + /**/ + 374, /**/ -- CVS sux, men don't like commitment /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///