Patch 8.0.0683
Problem: When using a visual bell there is no delay, causing the flash to
be very short, possibly unnoticeable. Also, the flash and the
beep can lockup the UI when repeated often.
Solution: Do the delay in Vim or flush the output before the delay. Limit the
bell to once per half a second. (Ozaki Kiichi, closes #1789)
Files: src/misc1.c, src/proto/term.pro, src/term.c
*** ../vim-8.0.0682/src/misc1.c 2017-04-21 23:18:22.246279788 +0200
--- src/misc1.c 2017-06-27 16:47:43.933101233 +0200
***************
*** 3685,3700 ****
{
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
- out_char(BELL);
}
/* When 'verbose' is set and we are sourcing a script or executing a
--- 3685,3714 ----
{
if (!((bo_flags & val) || (bo_flags & BO_ALL)))
{
! #ifdef ELAPSED_FUNC
! static int did_init = FALSE;
! static ELAPSED_TYPE start_tv;
!
! /* Only beep once per half a second, otherwise a sequence of beeps
! * would freeze Vim. */
! if (!did_init || ELAPSED_FUNC(start_tv) > 500)
! {
! did_init = TRUE;
! ELAPSED_INIT(start_tv);
! #endif
! 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_cf(T_VB);
! else
! out_char(BELL);
! #ifdef ELAPSED_FUNC
! }
#endif
}
/* When 'verbose' is set and we are sourcing a script or executing a
*** ../vim-8.0.0682/src/proto/term.pro 2017-04-04 22:41:04.732342875 +0200
--- src/proto/term.pro 2017-06-24 19:50:11.733759537 +0200
***************
*** 16,21 ****
--- 16,22 ----
void out_trash(void);
void out_char(unsigned c);
void out_str_nf(char_u *s);
+ void out_str_cf(char_u *s);
void out_str(char_u *s);
void term_windgoto(int row, int col);
void term_cursor_right(int i);
*** ../vim-8.0.0682/src/term.c 2017-06-23 23:00:03.933758799 +0200
--- src/term.c 2017-06-27 16:46:45.661553209 +0200
***************
*** 2514,2519 ****
--- 2514,2588 ----
#endif
/*
+ * A conditional-flushing out_str, mainly for visualbell.
+ * Handles a delay internally, because termlib may not respect the delay or do
+ * it at the wrong time.
+ * Note: Only for terminal strings.
+ */
+ void
+ out_str_cf(char_u *s)
+ {
+ if (s != NULL && *s)
+ {
+ char_u *p;
+
+ #ifdef FEAT_GUI
+ /* Don't use tputs() when GUI is used, ncurses crashes. */
+ if (gui.in_use)
+ {
+ out_str_nf(s);
+ return;
+ }
+ #endif
+ if (out_pos > OUT_SIZE - 20)
+ out_flush();
+ #ifdef HAVE_TGETENT
+ for (p = s; *s; ++s)
+ {
+ /* flush just before delay command */
+ if (*s == '$' && *(s + 1) == '<')
+ {
+ char_u save_c = *s;
+ int duration = atoi((char *)s + 2);
+
+ *s = NUL;
+ tputs((char *)p, 1, TPUTSFUNCAST out_char_nf);
+ *s = save_c;
+ out_flush();
+ #ifdef ELAPSED_FUNC
+ /* Only sleep here if we can limit this happening in
+ * vim_beep(). */
+ p = vim_strchr(s, '>');
+ if (p == NULL || duration <= 0)
+ {
+ /* can't parse the time, don't sleep here */
+ p = s;
+ }
+ else
+ {
+ ++p;
+ do_sleep(duration);
+ }
+ #else
+ /* Rely on the terminal library to sleep. */
+ p = s;
+ #endif
+ break;
+ }
+ }
+ tputs((char *)p, 1, TPUTSFUNCAST out_char_nf);
+ #else
+ while (*s)
+ out_char_nf(*s++);
+ #endif
+
+ /* For testing we write one string at a time. */
+ if (p_wd)
+ out_flush();
+ }
+ }
+
+ /*
* out_str(s): Put a character string a byte at a time into the output buffer.
* If HAVE_TGETENT is defined use the termcap parser. (jw)
* This should only be used for writing terminal codes, not for outputting
*** ../vim-8.0.0682/src/version.c 2017-06-27 15:43:46.270992389 +0200
--- src/version.c 2017-06-27 17:07:27.171922346 +0200
***************
*** 766,767 ****
--- 766,769 ----
{ /* Add new patch number below this line */
+ /**/
+ 683,
/**/
--
>From "know your smileys":
*<|:-) Santa Claus (Ho Ho Ho)
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.