示例#1
0
文件: ui.c 项目: KillTheMule/neovim
void ui_line(ScreenGrid *grid, int row, int startcol, int endcol, int clearcol,
             int clearattr, bool wrap)
{
  LineFlags flags = wrap ? kLineFlagWrap : 0;
  if (startcol == -1) {
    startcol = 0;
    flags |= kLineFlagInvalid;
  }

  size_t off = grid->line_offset[row] + (size_t)startcol;

  ui_call_raw_line(grid->handle, row, startcol, endcol, clearcol, clearattr,
                   flags, (const schar_T *)grid->chars + off,
                   (const sattr_T *)grid->attrs + off);

  if (p_wd) {  // 'writedelay': flush & delay each time.
    int old_row = cursor_row, old_col = cursor_col;
    handle_T old_grid = cursor_grid_handle;
    // If 'writedelay' is active, set the cursor to indicate what was drawn.
    ui_grid_cursor_goto(grid->handle, row, MIN(clearcol, (int)Columns-1));
    ui_flush();
    uint64_t wd = (uint64_t)labs(p_wd);
    os_microdelay(wd * 1000u, true);
    ui_grid_cursor_goto(old_grid, old_row, old_col);
  }
}
示例#2
0
文件: time.c 项目: Blazers007/neovim
/// Sleeps for a certain amount of milliseconds
///
/// @param milliseconds Number of milliseconds to sleep
/// @param ignoreinput If true, allow a SIGINT to interrupt us
void os_delay(uint64_t milliseconds, bool ignoreinput)
{
  if (ignoreinput) {
    if (milliseconds > INT_MAX) {
      milliseconds = INT_MAX;
    }
    event_poll_until((int)milliseconds, got_int);
  } else {
    os_microdelay(milliseconds * 1000);
  }
}
示例#3
0
文件: time.c 项目: SLieng/nvm
/// Sleeps for `ms` milliseconds.
///
/// @param ms          Number of milliseconds to sleep
/// @param ignoreinput If true, only SIGINT (CTRL-C) can interrupt.
void os_delay(uint64_t ms, bool ignoreinput)
{
  if (ignoreinput) {
    if (ms > INT_MAX) {
      ms = INT_MAX;
    }
    LOOP_PROCESS_EVENTS_UNTIL(&main_loop, NULL, (int)ms, got_int);
  } else {
    os_microdelay(ms * 1000u, ignoreinput);
  }
}
示例#4
0
文件: ui.c 项目: qvacua/neovim
void ui_line(int row, int startcol, int endcol, int clearcol, int clearattr,
             bool wrap)
{
  size_t off = LineOffset[row]+(size_t)startcol;
  UI_CALL(raw_line, 1, row, startcol, endcol, clearcol, clearattr, wrap,
          (const schar_T *)ScreenLines+off, (const sattr_T *)ScreenAttrs+off);
  if (p_wd) {  // 'writedelay': flush & delay each time.
    int old_row = row, old_col = col;
    // If'writedelay is active, we set the cursor to highlight what was drawn
    ui_cursor_goto(row, MIN(clearcol, (int)Columns-1));
    ui_flush();
    uint64_t wd = (uint64_t)labs(p_wd);
    os_microdelay(wd * 1000u, true);
    ui_cursor_goto(old_row, old_col);
  }
}
示例#5
0
文件: time.c 项目: 1100110/neovim
/// Sleeps for a certain amount of milliseconds
///
/// @param milliseconds Number of milliseconds to sleep
/// @param ignoreinput If true, allow a SIGINT to interrupt us
void os_delay(uint64_t milliseconds, bool ignoreinput)
{
  os_microdelay(milliseconds * 1000, ignoreinput);
}
示例#6
0
文件: os_unix.c 项目: RichiH/neovim
/*
 * Write s[len] to the screen.
 */
void mch_write(char_u *s, int len)
{
  ignored = (int)write(1, (char *)s, len);
  if (p_wd)             /* Unix is too fast, slow down a bit more */
    os_microdelay(p_wd, false);
}