src/nvim/fileio.c
// Check if any not hidden buffer has been changed.
// Postpone the check if there are characters in the stuff buffer, a global
// command is being executed, a mapping is being executed or an autocommand is
// busy.
// Returns TRUE if some message was written (screen should be redrawn and
// cursor positioned).
Check if any not hidden buffer has been changed.
Postpone the check if there are characters in the stuff buffer, a global
command is being executed, a mapping is being executed or an autocommand is
busy.
Returns TRUE if some message was written (screen should be redrawn and
cursor positioned).
Check if any not hidden buffer has been changed . Postpone the check if there are characters in the stuff buffer a global command is being executed a mapping is being executed or an autocommand is busy . Returns TRUE if some message was written ( screen should be redrawn and cursor positioned ) .
int
check_timestamps(
    int focus                      
)
{
  int didit = 0;
  int n;
  if (no_check_timestamps > 0)
    return FALSE;
  if (focus && did_check_timestamps) {
    need_check_timestamps = TRUE;
    return FALSE;
  }
  if (!stuff_empty() || global_busy || !typebuf_typed()
      || autocmd_busy || curbuf_lock > 0 || allbuf_lock > 0
      ) {
    need_check_timestamps = true;               
  } else {
    no_wait_return++;
    did_check_timestamps = true;
    already_warned = false;
    FOR_ALL_BUFFERS(buf) {
      if (buf->b_nwindows > 0) {
        bufref_T bufref;
        set_bufref(&bufref, buf);
        n = buf_check_timestamp(buf, focus);
        if (didit < n) {
          didit = n;
        }
        if (n > 0 && !bufref_valid(&bufref)) {
          buf = firstbuf;
          continue;
        }
      }
    }
    --no_wait_return;
    need_check_timestamps = FALSE;
    if (need_wait_return && didit == 2) {
      msg_puts("\n");
      ui_flush();
    }
  }
  return didit;
}
int check_timestamps ( int focus ) { int didit = 0 ; int n ; if ( no_check_timestamps > 0 ) return FALSE ; if ( focus && did_check_timestamps ) { need_check_timestamps = TRUE ; return FALSE ; } if ( ! stuff_empty ( ) || global_busy || ! typebuf_typed ( ) || autocmd_busy || curbuf_lock > 0 || allbuf_lock > 0 ) { need_check_timestamps = true ; } else { no_wait_return ++ ; did_check_timestamps = true ; already_warned = false ; FOR_ALL_BUFFERS ( buf ) { if ( buf -> b_nwindows > 0 ) { bufref_T bufref ; set_bufref ( & bufref , buf ) ; n = buf_check_timestamp ( buf , focus ) ; if ( didit < n ) { didit = n ; } if ( n > 0 && ! bufref_valid ( & bufref ) ) { buf = firstbuf ; continue ; } } } -- no_wait_return ; need_check_timestamps = FALSE ; if ( need_wait_return && didit == 2 ) { msg_puts ( " \n " ) ; ui_flush ( ) ; } } return didit ; }
Check if any not hidden buffer has been changed.
Check if any not hidden buffer has been changed .
// called for GUI focus event /* Don't check timestamps while system() or another low-level function may
   * cause us to lose and gain focus. */ /* Avoid doing a check twice.  The OK/Reload dialog can cause a focus
   * event and we would keep on checking if the file is steadily growing.
   * Do check again after typing something. */ // check later // Only check buffers in a window. // Autocommands have removed the buffer, start at the first one again. // make sure msg isn't overwritten