diff src/misc1.c @ 6949:1e621b31948b v7.4.793

patch 7.4.793 Problem: Can't specify when not to ring the bell. Solution: Add the 'belloff' option. (Christian Brabandt)
author Bram Moolenaar <bram@vim.org>
date Tue, 21 Jul 2015 17:53:25 +0200
parents 8accadbf0cbd
children e859731ea1cd
line wrap: on
line diff
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -3699,46 +3699,50 @@ beep_flush()
     if (emsg_silent == 0)
     {
 	flush_buffers(FALSE);
-	vim_beep();
-    }
-}
-
-/*
- * give a warning for an error
+	vim_beep(BO_ERROR);
+    }
+}
+
+/*
+ * Give a warning for an error.
  */
     void
-vim_beep()
+vim_beep(val)
+    unsigned val; /* one of the BO_ values, e.g., BO_OPER */
 {
     if (emsg_silent == 0)
     {
-	if (p_vb
+	if (!((bo_flags & val) || (bo_flags & BO_ALL)))
+	{
+	    if (p_vb
 #ifdef FEAT_GUI
-		/* While the GUI is starting up the termcap is set for the GUI
-		 * but the output still goes to a terminal. */
-		&& !(gui.in_use && gui.starting)
-#endif
-		)
-	{
-	    out_str(T_VB);
-	}
-	else
-	{
-#ifdef MSDOS
-	    /*
-	     * The number of beeps outputted is reduced to avoid having to wait
-	     * for all the beeps to finish. This is only a problem on systems
-	     * where the beeps don't overlap.
-	     */
-	    if (beep_count == 0 || beep_count == 10)
-	    {
-		out_char(BELL);
-		beep_count = 1;
+		    /* While the GUI is starting up the termcap is set for the
+		     * GUI but the output still goes to a terminal. */
+		    && !(gui.in_use && gui.starting)
+#endif
+		    )
+	    {
+		out_str(T_VB);
 	    }
 	    else
-		++beep_count;
+	    {
+#ifdef MSDOS
+		/*
+		 * The number of beeps outputted is reduced to avoid having to
+		 * wait for all the beeps to finish. This is only a problem on
+		 * systems where the beeps don't overlap.
+		 */
+		if (beep_count == 0 || beep_count == 10)
+		{
+		    out_char(BELL);
+		    beep_count = 1;
+		}
+		else
+		    ++beep_count;
 #else
-	    out_char(BELL);
-#endif
+		out_char(BELL);
+#endif
+	    }
 	}
 
 	/* When 'verbose' is set and we are sourcing a script or executing a