ui: Remove ui_delay, ui_breakcheck and ui_set_shellsize

These functions only used to call another os_* function, so remove them and
replace all occurences in the project.
This commit is contained in:
Thiago de Arruda 2014-11-27 14:10:42 -03:00
parent 541eaf598c
commit 1865b8c1c1
29 changed files with 98 additions and 108 deletions

View File

@ -73,6 +73,8 @@
#include "nvim/undo.h" #include "nvim/undo.h"
#include "nvim/window.h" #include "nvim/window.h"
#include "nvim/os/os.h" #include "nvim/os/os.h"
#include "nvim/os/time.h"
#include "nvim/os/input.h"
#define HAVE_BUFLIST_MATCH #define HAVE_BUFLIST_MATCH
@ -716,7 +718,7 @@ do_bufdel (
} else /* addr_count == 1 */ } else /* addr_count == 1 */
bnr = end_bnr; bnr = end_bnr;
for (; !got_int; ui_breakcheck()) { for (; !got_int; os_breakcheck()) {
/* /*
* delete the current buffer last, otherwise when the * delete the current buffer last, otherwise when the
* current buffer is deleted, the next buffer becomes * current buffer is deleted, the next buffer becomes
@ -1422,7 +1424,7 @@ buflist_new (
EMSG(_("W14: Warning: List of file names overflow")); EMSG(_("W14: Warning: List of file names overflow"));
if (emsg_silent == 0) { if (emsg_silent == 0) {
out_flush(); out_flush();
ui_delay(3000L, true); /* make sure it is noticed */ os_delay(3000L, true); /* make sure it is noticed */
} }
top_file_num = 1; top_file_num = 1;
} }
@ -2162,7 +2164,7 @@ void buflist_list(exarg_T *eap)
: (int64_t)buflist_findlnum(buf)); : (int64_t)buflist_findlnum(buf));
msg_outtrans(IObuff); msg_outtrans(IObuff);
out_flush(); /* output one line at a time */ out_flush(); /* output one line at a time */
ui_breakcheck(); os_breakcheck();
} }
} }
@ -3801,7 +3803,7 @@ do_arg_all (
++autocmd_no_leave; ++autocmd_no_leave;
use_firstwin = FALSE; use_firstwin = FALSE;
} }
ui_breakcheck(); os_breakcheck();
/* When ":tab" was used open a new tab for a new window repeatedly. */ /* When ":tab" was used open a new tab for a new window repeatedly. */
if (had_tab > 0 && tabpage_index(NULL) <= p_tpm) if (had_tab > 0 && tabpage_index(NULL) <= p_tpm)
@ -3965,7 +3967,7 @@ void ex_buffer_all(exarg_T *eap)
#endif #endif
} }
ui_breakcheck(); os_breakcheck();
if (got_int) { if (got_int) {
(void)vgetc(); /* only break the file loading, not the rest */ (void)vgetc(); /* only break the file loading, not the rest */
break; break;

View File

@ -24,6 +24,7 @@
#include "nvim/screen.h" #include "nvim/screen.h"
#include "nvim/strings.h" #include "nvim/strings.h"
#include "nvim/ui.h" #include "nvim/ui.h"
#include "nvim/os/input.h"
typedef int result_T; typedef int result_T;
@ -1659,13 +1660,13 @@ void listdigraphs(void)
printdigraph(&tmp); printdigraph(&tmp);
} }
dp++; dp++;
ui_breakcheck(); os_breakcheck();
} }
dp = (digr_T *)user_digraphs.ga_data; dp = (digr_T *)user_digraphs.ga_data;
for (int i = 0; i < user_digraphs.ga_len && !got_int; ++i) { for (int i = 0; i < user_digraphs.ga_len && !got_int; ++i) {
printdigraph(dp); printdigraph(dp);
ui_breakcheck(); os_breakcheck();
dp++; dp++;
} }
// clear screen, because some digraphs may be wrong, in which case we messed // clear screen, because some digraphs may be wrong, in which case we messed

View File

@ -59,6 +59,8 @@
#include "nvim/undo.h" #include "nvim/undo.h"
#include "nvim/window.h" #include "nvim/window.h"
#include "nvim/os/event.h" #include "nvim/os/event.h"
#include "nvim/os/input.h"
#include "nvim/os/time.h"
/* /*
* definitions used for CTRL-X submode * definitions used for CTRL-X submode
@ -1761,7 +1763,7 @@ static int has_compl_option(int dict_opt)
vim_beep(); vim_beep();
setcursor(); setcursor();
out_flush(); out_flush();
ui_delay(2000L, false); os_delay(2000L, false);
} }
return FALSE; return FALSE;
} }
@ -2005,7 +2007,7 @@ ins_compl_add (
compl_T *match; compl_T *match;
int dir = (cdir == 0 ? compl_direction : cdir); int dir = (cdir == 0 ? compl_direction : cdir);
ui_breakcheck(); os_breakcheck();
if (got_int) if (got_int)
return FAIL; return FAIL;
if (len < 0) if (len < 0)

View File

@ -90,6 +90,7 @@
#include "nvim/api/vim.h" #include "nvim/api/vim.h"
#include "nvim/os/dl.h" #include "nvim/os/dl.h"
#include "nvim/os/event.h" #include "nvim/os/event.h"
#include "nvim/os/input.h"
#define DICT_MAXNEST 100 /* maximum nesting of lists and dicts */ #define DICT_MAXNEST 100 /* maximum nesting of lists and dicts */
@ -17270,7 +17271,7 @@ void ex_function(exarg_T *eap)
msg_putchar(' '); msg_putchar(' ');
msg_prt_line(FUNCLINE(fp, j), FALSE); msg_prt_line(FUNCLINE(fp, j), FALSE);
out_flush(); /* show a line at a time */ out_flush(); /* show a line at a time */
ui_breakcheck(); os_breakcheck();
} }
if (!got_int) { if (!got_int) {
msg_putchar('\n'); msg_putchar('\n');
@ -19295,7 +19296,7 @@ void ex_oldfiles(exarg_T *eap)
msg_outtrans(get_tv_string(&li->li_tv)); msg_outtrans(get_tv_string(&li->li_tv));
msg_putchar('\n'); msg_putchar('\n');
out_flush(); /* output one line at a time */ out_flush(); /* output one line at a time */
ui_breakcheck(); os_breakcheck();
} }
/* Assume "got_int" was set to truncate the listing. */ /* Assume "got_int" was set to truncate the listing. */
got_int = FALSE; got_int = FALSE;

View File

@ -67,6 +67,7 @@
#include "nvim/window.h" #include "nvim/window.h"
#include "nvim/os/os.h" #include "nvim/os/os.h"
#include "nvim/os/shell.h" #include "nvim/os/shell.h"
#include "nvim/os/input.h"
/* /*
* Struct to hold the sign properties. * Struct to hold the sign properties.
@ -1110,7 +1111,7 @@ do_filter (
/* When interrupting the shell command, it may still have produced some /* When interrupting the shell command, it may still have produced some
* useful output. Reset got_int here, so that readfile() won't cancel * useful output. Reset got_int here, so that readfile() won't cancel
* reading. */ * reading. */
ui_breakcheck(); os_breakcheck();
got_int = FALSE; got_int = FALSE;
if (do_out) { if (do_out) {
@ -4560,7 +4561,7 @@ void global_exe(char_u *cmd)
do_cmdline((char_u *)"p", NULL, NULL, DOCMD_NOWAIT); do_cmdline((char_u *)"p", NULL, NULL, DOCMD_NOWAIT);
else else
do_cmdline(cmd, NULL, NULL, DOCMD_NOWAIT); do_cmdline(cmd, NULL, NULL, DOCMD_NOWAIT);
ui_breakcheck(); os_breakcheck();
} }
global_busy = 0; global_busy = 0;

View File

@ -67,6 +67,8 @@
#include "nvim/version.h" #include "nvim/version.h"
#include "nvim/window.h" #include "nvim/window.h"
#include "nvim/os/os.h" #include "nvim/os/os.h"
#include "nvim/os/input.h"
#include "nvim/os/time.h"
#include "nvim/ex_cmds_defs.h" #include "nvim/ex_cmds_defs.h"
static int quitmore = 0; static int quitmore = 0;
@ -4337,7 +4339,7 @@ static void uc_list(char_u *name, size_t name_len)
if (p_verbose > 0) if (p_verbose > 0)
last_set_msg(cmd->uc_scriptID); last_set_msg(cmd->uc_scriptID);
out_flush(); out_flush();
ui_breakcheck(); os_breakcheck();
if (got_int) if (got_int)
break; break;
} }
@ -5459,7 +5461,7 @@ static void ex_print(exarg_T *eap)
if (curbuf->b_ml.ml_flags & ML_EMPTY) if (curbuf->b_ml.ml_flags & ML_EMPTY)
EMSG(_(e_emptybuf)); EMSG(_(e_emptybuf));
else { else {
for (; !got_int; ui_breakcheck()) { for (; !got_int; os_breakcheck()) {
print_line(eap->line1, print_line(eap->line1,
(eap->cmdidx == CMD_number || eap->cmdidx == CMD_pound (eap->cmdidx == CMD_number || eap->cmdidx == CMD_pound
|| (eap->flags & EXFLAG_NR)), || (eap->flags & EXFLAG_NR)),
@ -5586,7 +5588,7 @@ void alist_set(alist_T *al, int count, char_u **files, int use_curbuf, int *fnum
buf_set_name(fnum_list[i], files[i]); buf_set_name(fnum_list[i], files[i]);
alist_add(al, files[i], use_curbuf ? 2 : 1); alist_add(al, files[i], use_curbuf ? 2 : 1);
ui_breakcheck(); os_breakcheck();
} }
free(files); free(files);
} }
@ -5842,7 +5844,7 @@ static void ex_tabs(exarg_T *eap)
vim_snprintf((char *)IObuff, IOSIZE, _("Tab page %d"), tabcount++); vim_snprintf((char *)IObuff, IOSIZE, _("Tab page %d"), tabcount++);
msg_outtrans_attr(IObuff, hl_attr(HLF_T)); msg_outtrans_attr(IObuff, hl_attr(HLF_T));
out_flush(); /* output one line at a time */ out_flush(); /* output one line at a time */
ui_breakcheck(); os_breakcheck();
FOR_ALL_WINDOWS_IN_TAB(wp, tp) { FOR_ALL_WINDOWS_IN_TAB(wp, tp) {
if (got_int) { if (got_int) {
@ -5861,7 +5863,7 @@ static void ex_tabs(exarg_T *eap)
IObuff, IOSIZE, TRUE); IObuff, IOSIZE, TRUE);
msg_outtrans(IObuff); msg_outtrans(IObuff);
out_flush(); /* output one line at a time */ out_flush(); /* output one line at a time */
ui_breakcheck(); os_breakcheck();
} }
} }
} }
@ -6408,8 +6410,8 @@ void do_sleep(long msec)
cursor_on(); cursor_on();
out_flush(); out_flush();
for (done = 0; !got_int && done < msec; done += 1000L) { for (done = 0; !got_int && done < msec; done += 1000L) {
ui_delay(msec - done > 1000L ? 1000L : msec - done, true); os_delay(msec - done > 1000L ? 1000L : msec - done, true);
ui_breakcheck(); os_breakcheck();
} }
} }

View File

@ -1946,7 +1946,7 @@ redraw:
msg_col = 0; msg_col = 0;
if (msg_row < Rows - 1) if (msg_row < Rows - 1)
++msg_row; ++msg_row;
emsg_on_display = FALSE; /* don't want ui_delay() */ emsg_on_display = FALSE; /* don't want os_delay() */
if (got_int) if (got_int)
ga_clear(&line_ga); ga_clear(&line_ga);

View File

@ -65,6 +65,7 @@
#include "nvim/ui.h" #include "nvim/ui.h"
#include "nvim/window.h" #include "nvim/window.h"
#include "nvim/os/os.h" #include "nvim/os/os.h"
#include "nvim/os/input.h"
#include "nvim/os/fs_defs.h" #include "nvim/os/fs_defs.h"
static char_u *ff_expand_buffer = NULL; /* used for expanding filenames */ static char_u *ff_expand_buffer = NULL; /* used for expanding filenames */
@ -607,7 +608,7 @@ char_u *vim_findfile(void *search_ctx_arg)
/* downward search loop */ /* downward search loop */
for (;; ) { for (;; ) {
/* check if user user wants to stop the search*/ /* check if user user wants to stop the search*/
ui_breakcheck(); os_breakcheck();
if (got_int) if (got_int)
break; break;

View File

@ -57,6 +57,8 @@
#include "nvim/undo.h" #include "nvim/undo.h"
#include "nvim/window.h" #include "nvim/window.h"
#include "nvim/os/os.h" #include "nvim/os/os.h"
#include "nvim/os/time.h"
#include "nvim/os/input.h"
#if defined(HAVE_UTIME) && defined(HAVE_UTIME_H) #if defined(HAVE_UTIME) && defined(HAVE_UTIME_H)
# include <utime.h> /* for struct utimbuf */ # include <utime.h> /* for struct utimbuf */
@ -1704,7 +1706,7 @@ rewind_retry:
} }
} }
linerest = (long)(ptr - line_start); linerest = (long)(ptr - line_start);
ui_breakcheck(); os_breakcheck();
} }
failed: failed:
@ -2927,7 +2929,7 @@ buf_write (
"E506: Can't write to backup file (add ! to override)"); "E506: Can't write to backup file (add ! to override)");
break; break;
} }
ui_breakcheck(); os_breakcheck();
if (got_int) { if (got_int) {
errmsg = (char_u *)_(e_interr); errmsg = (char_u *)_(e_interr);
break; break;
@ -3377,7 +3379,7 @@ restore_backup:
s = buffer; s = buffer;
len = 0; len = 0;
ui_breakcheck(); os_breakcheck();
if (got_int) { if (got_int) {
end = 0; /* Interrupted, break loop */ end = 0; /* Interrupted, break loop */
break; break;
@ -4958,7 +4960,7 @@ buf_check_timestamp (
if (emsg_silent == 0) { if (emsg_silent == 0) {
out_flush(); out_flush();
/* give the user some time to think about it */ /* give the user some time to think about it */
ui_delay(1000L, true); os_delay(1000L, true);
/* don't redraw and erase the message */ /* don't redraw and erase the message */
redraw_cmdline = FALSE; redraw_cmdline = FALSE;

View File

@ -1702,14 +1702,14 @@ static int vgetorpeek(int advance)
*/ */
for (;; ) { for (;; ) {
/* /*
* ui_breakcheck() is slow, don't use it too often when * os_breakcheck() is slow, don't use it too often when
* inside a mapping. But call it each time for typed * inside a mapping. But call it each time for typed
* characters. * characters.
*/ */
if (typebuf.tb_maplen) if (typebuf.tb_maplen)
line_breakcheck(); line_breakcheck();
else else
ui_breakcheck(); /* check for CTRL-C */ os_breakcheck(); /* check for CTRL-C */
keylen = 0; keylen = 0;
if (got_int) { if (got_int) {
/* flush all input */ /* flush all input */

View File

@ -43,6 +43,7 @@
#include "nvim/tempfile.h" #include "nvim/tempfile.h"
#include "nvim/ui.h" #include "nvim/ui.h"
#include "nvim/os/os.h" #include "nvim/os/os.h"
#include "nvim/os/input.h"
/* /*
* To implement printing on a platform, the following functions must be * To implement printing on a platform, the following functions must be
@ -724,7 +725,7 @@ void ex_hardcopy(exarg_T *eap)
*/ */
/* Check for interrupt character every page. */ /* Check for interrupt character every page. */
ui_breakcheck(); os_breakcheck();
if (got_int || settings.user_abort) if (got_int || settings.user_abort)
goto print_fail; goto print_fail;

View File

@ -32,6 +32,7 @@
#include "nvim/ui.h" #include "nvim/ui.h"
#include "nvim/window.h" #include "nvim/window.h"
#include "nvim/os/os.h" #include "nvim/os/os.h"
#include "nvim/os/input.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -1735,7 +1736,7 @@ static void cs_print_tags_priv(char **matches, char **cntxts, int num_matches)
if (msg_col) if (msg_col)
msg_putchar('\n'); msg_putchar('\n');
ui_breakcheck(); os_breakcheck();
if (got_int) { if (got_int) {
got_int = FALSE; /* don't print any more matches */ got_int = FALSE; /* don't print any more matches */
break; break;

View File

@ -57,6 +57,7 @@
#include "nvim/ui.h" #include "nvim/ui.h"
#include "nvim/version.h" #include "nvim/version.h"
#include "nvim/window.h" #include "nvim/window.h"
#include "nvim/os/time.h"
#include "nvim/os/input.h" #include "nvim/os/input.h"
#include "nvim/os/os.h" #include "nvim/os/os.h"
#include "nvim/os/signal.h" #include "nvim/os/signal.h"
@ -1608,7 +1609,7 @@ static void check_tty(mparm_T *parmp)
mch_errmsg(_("Vim: Warning: Input is not from a terminal\n")); mch_errmsg(_("Vim: Warning: Input is not from a terminal\n"));
out_flush(); out_flush();
if (scriptin[0] == NULL) if (scriptin[0] == NULL)
ui_delay(2000L, true); os_delay(2000L, true);
TIME_MSG("Warning delay"); TIME_MSG("Warning delay");
} }
} }
@ -1742,7 +1743,7 @@ static void create_windows(mparm_T *parmp)
#endif #endif
dorewind = TRUE; /* start again */ dorewind = TRUE; /* start again */
} }
ui_breakcheck(); os_breakcheck();
if (got_int) { if (got_int) {
(void)vgetc(); /* only break the file loading, not the rest */ (void)vgetc(); /* only break the file loading, not the rest */
break; break;
@ -1832,7 +1833,7 @@ static void edit_buffers(mparm_T *parmp)
arg_had_last = TRUE; arg_had_last = TRUE;
++arg_idx; ++arg_idx;
} }
ui_breakcheck(); os_breakcheck();
if (got_int) { if (got_int) {
(void)vgetc(); /* only break the file loading, not the rest */ (void)vgetc(); /* only break the file loading, not the rest */
break; break;

View File

@ -40,6 +40,7 @@
#include "nvim/term.h" #include "nvim/term.h"
#include "nvim/ui.h" #include "nvim/ui.h"
#include "nvim/os/os.h" #include "nvim/os/os.h"
#include "nvim/os/input.h"
/* /*
* This file contains routines to maintain and manipulate marks. * This file contains routines to maintain and manipulate marks.
@ -811,7 +812,7 @@ void ex_jumps(exarg_T *eap)
curwin->w_jumplist[i].fmark.fnum == curbuf->b_fnum curwin->w_jumplist[i].fmark.fnum == curbuf->b_fnum
? hl_attr(HLF_D) : 0); ? hl_attr(HLF_D) : 0);
free(name); free(name);
ui_breakcheck(); os_breakcheck();
} }
out_flush(); out_flush();
} }
@ -845,7 +846,7 @@ void ex_changes(exarg_T *eap)
name = mark_line(&curbuf->b_changelist[i], 17); name = mark_line(&curbuf->b_changelist[i], 17);
msg_outtrans_attr(name, hl_attr(HLF_D)); msg_outtrans_attr(name, hl_attr(HLF_D));
free(name); free(name);
ui_breakcheck(); os_breakcheck();
} }
out_flush(); out_flush();
} }

View File

@ -459,7 +459,7 @@ int mf_sync(memfile_T *mfp, int flags)
if (os_char_avail()) if (os_char_avail())
break; break;
} else { } else {
ui_breakcheck(); os_breakcheck();
} }
if (got_int) if (got_int)
break; break;

View File

@ -44,6 +44,8 @@
#include "nvim/term.h" #include "nvim/term.h"
#include "nvim/ui.h" #include "nvim/ui.h"
#include "nvim/os/os.h" #include "nvim/os/os.h"
#include "nvim/os/input.h"
#include "nvim/os/time.h"
/* /*
* To be able to scroll back at the "more" and "hit-enter" prompts we need to * To be able to scroll back at the "more" and "hit-enter" prompts we need to
@ -877,7 +879,7 @@ void wait_return(int redraw)
|| c == K_X1MOUSE || c == K_X1MOUSE
|| c == K_X2MOUSE)) || c == K_X2MOUSE))
); );
ui_breakcheck(); os_breakcheck();
/* /*
* Avoid that the mouse-up event causes visual mode to start. * Avoid that the mouse-up event causes visual mode to start.
*/ */

View File

@ -59,6 +59,7 @@
#include "nvim/os/os.h" #include "nvim/os/os.h"
#include "nvim/os/shell.h" #include "nvim/os/shell.h"
#include "nvim/os/input.h" #include "nvim/os/input.h"
#include "nvim/os/time.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS #ifdef INCLUDE_GENERATED_DECLARATIONS
# include "misc1.c.generated.h" # include "misc1.c.generated.h"
@ -1841,7 +1842,7 @@ void changed(void)
* and don't let the emsg() set msg_scroll. */ * and don't let the emsg() set msg_scroll. */
if (need_wait_return && emsg_silent == 0) { if (need_wait_return && emsg_silent == 0) {
out_flush(); out_flush();
ui_delay(2000L, true); os_delay(2000L, true);
wait_return(TRUE); wait_return(TRUE);
msg_scroll = save_msg_scroll; msg_scroll = save_msg_scroll;
} }
@ -2262,7 +2263,7 @@ change_warning (
(void)msg_end(); (void)msg_end();
if (msg_silent == 0 && !silent_mode) { if (msg_silent == 0 && !silent_mode) {
out_flush(); out_flush();
ui_delay(1000L, true); /* give the user time to think about it */ os_delay(1000L, true); /* give the user time to think about it */
} }
curbuf->b_did_warn = true; curbuf->b_did_warn = true;
redraw_cmdline = FALSE; /* don't redraw and erase the message */ redraw_cmdline = FALSE; /* don't redraw and erase the message */
@ -3363,8 +3364,8 @@ void preserve_exit(void)
/* /*
* Check for CTRL-C pressed, but only once in a while. * Check for CTRL-C pressed, but only once in a while.
* Should be used instead of ui_breakcheck() for functions that check for * Should be used instead of os_breakcheck() for functions that check for
* each line in the file. Calling ui_breakcheck() each time takes too much * each line in the file. Calling os_breakcheck() each time takes too much
* time, because it can be a system call. * time, because it can be a system call.
*/ */
@ -3378,7 +3379,7 @@ void line_breakcheck(void)
{ {
if (++breakcheck_count >= BREAKCHECK_SKIP) { if (++breakcheck_count >= BREAKCHECK_SKIP) {
breakcheck_count = 0; breakcheck_count = 0;
ui_breakcheck(); os_breakcheck();
} }
} }
@ -3389,7 +3390,7 @@ void fast_breakcheck(void)
{ {
if (++breakcheck_count >= BREAKCHECK_SKIP * 10) { if (++breakcheck_count >= BREAKCHECK_SKIP * 10) {
breakcheck_count = 0; breakcheck_count = 0;
ui_breakcheck(); os_breakcheck();
} }
} }

View File

@ -60,6 +60,7 @@
#include "nvim/undo.h" #include "nvim/undo.h"
#include "nvim/window.h" #include "nvim/window.h"
#include "nvim/os/event.h" #include "nvim/os/event.h"
#include "nvim/os/time.h"
/* /*
* The Visual area is remembered for reselection. * The Visual area is remembered for reselection.
@ -1008,8 +1009,8 @@ getcount:
cursor_on(); cursor_on();
out_flush(); out_flush();
if (msg_scroll || emsg_on_display) if (msg_scroll || emsg_on_display)
ui_delay(1000L, true); /* wait at least one second */ os_delay(1000L, true); /* wait at least one second */
ui_delay(3000L, false); /* wait up to three seconds */ os_delay(3000L, false); /* wait up to three seconds */
State = save_State; State = save_State;
msg_scroll = false; msg_scroll = false;

View File

@ -48,7 +48,7 @@
#include "nvim/ui.h" #include "nvim/ui.h"
#include "nvim/undo.h" #include "nvim/undo.h"
#include "nvim/window.h" #include "nvim/window.h"
#include "nvim/api/private/helpers.h" #include "nvim/os/input.h"
/* /*
* Registers: * Registers:
@ -1112,7 +1112,7 @@ insert_reg (
* register a and then, in insert mode, doing CTRL-R a. * register a and then, in insert mode, doing CTRL-R a.
* If you hit CTRL-C, the loop will be broken here. * If you hit CTRL-C, the loop will be broken here.
*/ */
ui_breakcheck(); os_breakcheck();
if (got_int) if (got_int)
return FAIL; return FAIL;
@ -1296,7 +1296,7 @@ cmdline_paste_reg (
/* Check for CTRL-C, in case someone tries to paste a few thousand /* Check for CTRL-C, in case someone tries to paste a few thousand
* lines and gets bored. */ * lines and gets bored. */
ui_breakcheck(); os_breakcheck();
if (got_int) if (got_int)
return FAIL; return FAIL;
} }
@ -3254,7 +3254,7 @@ void ex_display(exarg_T *eap)
MSG_PUTS_ATTR("^J", attr); MSG_PUTS_ATTR("^J", attr);
out_flush(); /* show one line at a time */ out_flush(); /* show one line at a time */
} }
ui_breakcheck(); os_breakcheck();
} }
/* /*
@ -3339,7 +3339,7 @@ dis_msg (
} else } else
msg_outtrans_len(p++, 1); msg_outtrans_len(p++, 1);
} }
ui_breakcheck(); os_breakcheck();
} }
/* /*
@ -5079,7 +5079,7 @@ void cursor_pos_info(void)
for (lnum = 1; lnum <= curbuf->b_ml.ml_line_count; ++lnum) { for (lnum = 1; lnum <= curbuf->b_ml.ml_line_count; ++lnum) {
/* Check for a CTRL-C every 100000 characters. */ /* Check for a CTRL-C every 100000 characters. */
if (byte_count > last_check) { if (byte_count > last_check) {
ui_breakcheck(); os_breakcheck();
if (got_int) if (got_int)
return; return;
last_check = byte_count + 100000L; last_check = byte_count + 100000L;

View File

@ -79,6 +79,7 @@
#include "nvim/undo.h" #include "nvim/undo.h"
#include "nvim/window.h" #include "nvim/window.h"
#include "nvim/os/os.h" #include "nvim/os/os.h"
#include "nvim/os/input.h"
/* /*
* The options that are local to a window or buffer have "indir" set to one of * The options that are local to a window or buffer have "indir" set to one of
@ -6123,7 +6124,7 @@ showoptions (
col += INC; col += INC;
} }
out_flush(); out_flush();
ui_breakcheck(); os_breakcheck();
} }
} }
free(items); free(items);

View File

@ -31,7 +31,7 @@
#include "nvim/strings.h" #include "nvim/strings.h"
#include "nvim/tag.h" #include "nvim/tag.h"
#include "nvim/types.h" #include "nvim/types.h"
#include "nvim/ui.h" #include "nvim/os/input.h"
#include "nvim/window.h" #include "nvim/window.h"
#define URL_SLASH 1 /* path_is_url() has found "://" */ #define URL_SLASH 1 /* path_is_url() has found "://" */
@ -449,7 +449,7 @@ unix_expandpath (
/* Expanding "**" may take a long time, check for CTRL-C. */ /* Expanding "**" may take a long time, check for CTRL-C. */
if (stardepth > 0) { if (stardepth > 0) {
ui_breakcheck(); os_breakcheck();
if (got_int) if (got_int)
return 0; return 0;
} }
@ -850,7 +850,7 @@ static void uniquefy_paths(garray_T *gap, char_u *pattern)
STRMOVE(path + STRLEN(path), short_name); STRMOVE(path + STRLEN(path), short_name);
} }
} }
ui_breakcheck(); os_breakcheck();
} }
/* Shorten filenames in /in/current/directory/{filename} */ /* Shorten filenames in /in/current/directory/{filename} */
@ -879,7 +879,7 @@ static void uniquefy_paths(garray_T *gap, char_u *pattern)
free(fnames[i]); free(fnames[i]);
fnames[i] = rel_path; fnames[i] = rel_path;
sort_again = TRUE; sort_again = TRUE;
ui_breakcheck(); os_breakcheck();
} }
free(curdir); free(curdir);

View File

@ -52,6 +52,7 @@
#include "nvim/ui.h" #include "nvim/ui.h"
#include "nvim/window.h" #include "nvim/window.h"
#include "nvim/os/os.h" #include "nvim/os/os.h"
#include "nvim/os/input.h"
struct dir_stack_T { struct dir_stack_T {
@ -1791,7 +1792,7 @@ void qf_list(exarg_T *eap)
qfp = qfp->qf_next; qfp = qfp->qf_next;
++i; ++i;
ui_breakcheck(); os_breakcheck();
} }
} }

View File

@ -133,6 +133,7 @@
#include "nvim/undo.h" #include "nvim/undo.h"
#include "nvim/version.h" #include "nvim/version.h"
#include "nvim/window.h" #include "nvim/window.h"
#include "nvim/os/time.h"
#define MB_FILLER_CHAR '<' /* character used when a double-width character #define MB_FILLER_CHAR '<' /* character used when a double-width character
* doesn't fit. */ * doesn't fit. */
@ -6255,7 +6256,7 @@ void check_for_delay(int check_msg_scroll)
&& !did_wait_return && !did_wait_return
&& emsg_silent == 0) { && emsg_silent == 0) {
out_flush(); out_flush();
ui_delay(1000L, true); os_delay(1000L, true);
emsg_on_display = FALSE; emsg_on_display = FALSE;
if (check_msg_scroll) if (check_msg_scroll)
msg_scroll = FALSE; msg_scroll = FALSE;

View File

@ -48,6 +48,7 @@
#include "nvim/term.h" #include "nvim/term.h"
#include "nvim/ui.h" #include "nvim/ui.h"
#include "nvim/window.h" #include "nvim/window.h"
#include "nvim/os/time.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS #ifdef INCLUDE_GENERATED_DECLARATIONS
@ -2053,9 +2054,9 @@ showmatch (
* available. * available.
*/ */
if (vim_strchr(p_cpo, CPO_SHOWMATCH) != NULL) if (vim_strchr(p_cpo, CPO_SHOWMATCH) != NULL)
ui_delay(p_mat * 100L, true); os_delay(p_mat * 100L, true);
else if (!char_avail()) else if (!char_avail())
ui_delay(p_mat * 100L, false); os_delay(p_mat * 100L, false);
curwin->w_cursor = save_cursor; /* restore cursor position */ curwin->w_cursor = save_cursor; /* restore cursor position */
p_so = save_so; p_so = save_so;
p_siso = save_siso; p_siso = save_siso;

View File

@ -328,6 +328,7 @@
#include "nvim/ui.h" #include "nvim/ui.h"
#include "nvim/undo.h" #include "nvim/undo.h"
#include "nvim/os/os.h" #include "nvim/os/os.h"
#include "nvim/os/input.h"
#ifndef UNIX // it's in os_unix_defs.h for Unix #ifndef UNIX // it's in os_unix_defs.h for Unix
# include <time.h> // for time_t # include <time.h> // for time_t
@ -9018,7 +9019,7 @@ static void spell_suggest_intern(suginfo_T *su, bool interactive)
// When CTRL-C was hit while searching do show the results. Only clear // When CTRL-C was hit while searching do show the results. Only clear
// got_int when using a command, not for spellsuggest(). // got_int when using a command, not for spellsuggest().
ui_breakcheck(); os_breakcheck();
if (interactive && got_int) { if (interactive && got_int) {
(void)vgetc(); (void)vgetc();
got_int = FALSE; got_int = FALSE;
@ -10616,7 +10617,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
// Don't check for CTRL-C too often, it takes time. // Don't check for CTRL-C too often, it takes time.
if (--breakcheckcount == 0) { if (--breakcheckcount == 0) {
ui_breakcheck(); os_breakcheck();
breakcheckcount = 1000; breakcheckcount = 1000;
} }
} }

View File

@ -46,6 +46,7 @@
#include "nvim/term.h" #include "nvim/term.h"
#include "nvim/ui.h" #include "nvim/ui.h"
#include "nvim/os/os.h" #include "nvim/os/os.h"
#include "nvim/os/time.h"
/* /*
* Structure that stores information about a highlight group. * Structure that stores information about a highlight group.
@ -7606,7 +7607,7 @@ static void highlight_list_two(int cnt, int attr)
msg_puts_attr((char_u *)&("N \bI \b! \b"[cnt / 11]), attr); msg_puts_attr((char_u *)&("N \bI \b! \b"[cnt / 11]), attr);
msg_clr_eos(); msg_clr_eos();
out_flush(); out_flush();
ui_delay(cnt == 99 ? 40L : (long)cnt * 50L, false); os_delay(cnt == 99 ? 40L : (long)cnt * 50L, false);
} }

View File

@ -52,6 +52,8 @@
#include "nvim/ui.h" #include "nvim/ui.h"
#include "nvim/window.h" #include "nvim/window.h"
#include "nvim/os/os.h" #include "nvim/os/os.h"
#include "nvim/os/time.h"
#include "nvim/os/input.h"
/* /*
* Structure to hold pointers to various items in a tag line. * Structure to hold pointers to various items in a tag line.
@ -672,7 +674,7 @@ do_tag (
} }
if (msg_col) if (msg_col)
msg_putchar('\n'); msg_putchar('\n');
ui_breakcheck(); os_breakcheck();
} }
if (got_int) if (got_int)
got_int = FALSE; /* only stop the listing */ got_int = FALSE; /* only stop the listing */
@ -881,7 +883,7 @@ do_tag (
give_warning(IObuff, ic); give_warning(IObuff, ic);
if (ic && !msg_scrolled && msg_silent == 0) { if (ic && !msg_scrolled && msg_silent == 0) {
out_flush(); out_flush();
ui_delay(1000L, true); os_delay(1000L, true);
} }
} }
@ -2493,7 +2495,7 @@ jumpto_tag (
MSG(_("E435: Couldn't find tag, just guessing!")); MSG(_("E435: Couldn't find tag, just guessing!"));
if (!msg_scrolled && msg_silent == 0) { if (!msg_scrolled && msg_silent == 0) {
out_flush(); out_flush();
ui_delay(1000L, true); os_delay(1000L, true);
} }
} }
retval = OK; retval = OK;

View File

@ -54,6 +54,7 @@
#include "nvim/window.h" #include "nvim/window.h"
#include "nvim/os/os.h" #include "nvim/os/os.h"
#include "nvim/os/time.h" #include "nvim/os/time.h"
#include "nvim/os/input.h"
#ifdef HAVE_TGETENT #ifdef HAVE_TGETENT
# ifdef HAVE_TERMIOS_H # ifdef HAVE_TERMIOS_H
@ -1330,7 +1331,7 @@ int set_termname(char_u *term)
if (emsg_silent == 0) { if (emsg_silent == 0) {
screen_start(); /* don't know where cursor is now */ screen_start(); /* don't know where cursor is now */
out_flush(); out_flush();
ui_delay(2000L, true); os_delay(2000L, true);
} }
set_string_option_direct((char_u *)"term", -1, term, set_string_option_direct((char_u *)"term", -1, term,
OPT_FREE, 0); OPT_FREE, 0);
@ -2302,7 +2303,7 @@ void set_shellsize(int width, int height, int mustset)
Rows = height; Rows = height;
Columns = width; Columns = width;
check_shellsize(); check_shellsize();
ui_set_shellsize(mustset); mch_set_shellsize();
} else } else
check_shellsize(); check_shellsize();
@ -4111,7 +4112,7 @@ void show_termcodes(void)
col += INC3; col += INC3;
} }
out_flush(); out_flush();
ui_breakcheck(); os_breakcheck();
} }
} }
free(items); free(items);

View File

@ -62,15 +62,6 @@ void ui_write(char_u *s, int len)
} }
} }
/*
* Delay for the given number of milliseconds. If ignoreinput is FALSE then we
* cancel the delay if a key is hit.
*/
void ui_delay(long msec, bool ignoreinput)
{
os_delay(msec, ignoreinput);
}
/* /*
* If the machine has job control, use it to suspend the program, * If the machine has job control, use it to suspend the program,
* otherwise fake it by starting a new shell. * otherwise fake it by starting a new shell.
@ -102,34 +93,6 @@ int ui_get_shellsize(void)
return retval; return retval;
} }
/*
* Set the size of the Vim shell according to Rows and Columns, if possible.
* The gui_set_shellsize() or mch_set_shellsize() function will try to set the
* new size. If this is not possible, it will adjust Rows and Columns.
*/
void
ui_set_shellsize(int mustset)
{
mch_set_shellsize();
}
void ui_breakcheck(void)
{
os_breakcheck();
}
/*****************************************************************************
* Functions for copying and pasting text between applications.
* This is always included in a GUI version, but may also be included when the
* clipboard and mouse is available to a terminal version such as xterm.
* Note: there are some more functions in ops.c that handle selection stuff.
*
* Also note that the majority of functions here deal with the X 'primary'
* (visible - for Visual mode use) selection, and only that. There are no
* versions of these for the 'clipboard' selection, as Visual mode has no use
* for them.
*/
/* /*
* Exit because of an input read error. * Exit because of an input read error.
*/ */
@ -147,8 +110,6 @@ void read_error_exit(void)
void ui_cursor_shape(void) void ui_cursor_shape(void)
{ {
term_cursor_shape(); term_cursor_shape();
conceal_check_cursur_line(); conceal_check_cursur_line();
} }