diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-04-05 11:54:00 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-04-06 11:43:23 -0300 |
commit | dfb7d826ac5d9a4332a0f673ec3a6e7d69a27f1b (patch) | |
tree | 5965efffa5d576793717b8f905e38b0a6c431dc1 | |
parent | f8970e1c7c445c1cc18065902f77ea33b67cf050 (diff) | |
download | rneovim-dfb7d826ac5d9a4332a0f673ec3a6e7d69a27f1b.tar.gz rneovim-dfb7d826ac5d9a4332a0f673ec3a6e7d69a27f1b.tar.bz2 rneovim-dfb7d826ac5d9a4332a0f673ec3a6e7d69a27f1b.zip |
Remove `RealWaitForChar` and `mch_new_shellsize`
The last occurrence of `RealWaitForChar` was replaced by the `os_microdelay`
function. `mch_new_shellsize` had an empty body, so there seems to be no reason
for keeping it around
-rw-r--r-- | src/os_unix.c | 134 | ||||
-rw-r--r-- | src/os_unix.h | 1 | ||||
-rw-r--r-- | src/term.c | 2 | ||||
-rw-r--r-- | src/ui.c | 15 | ||||
-rw-r--r-- | src/ui.h | 1 |
5 files changed, 2 insertions, 151 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index e90d52afa5..98521fe682 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -64,16 +64,6 @@ static int selinux_enabled = -1; #endif -/* - * Use this prototype for select, some include files have a wrong prototype - */ -# undef select - - -#if defined(HAVE_SELECT) -extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); -#endif - static int get_x11_title(int); static int get_x11_icon(int); @@ -82,14 +72,6 @@ static int did_set_title = FALSE; static char_u *oldicon = NULL; static int did_set_icon = FALSE; -#ifdef HAVE_UNION_WAIT -typedef union wait waitstatus; -#else -typedef int waitstatus; -#endif - -static int RealWaitForChar(int, long, int *); - static int have_wildcard(int, char_u **); static int have_dollars(int, char_u **); @@ -103,7 +85,7 @@ 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 */ - RealWaitForChar(read_cmd_fd, p_wd, NULL); + os_microdelay(p_wd, 0); } /* @@ -1026,120 +1008,6 @@ void mch_set_shellsize() } /* - * Rows and/or Columns has changed. - */ -void mch_new_shellsize() -{ - /* Nothing to do. */ -} - -/* - * Wait "msec" msec until a character is available from file descriptor "fd". - * "msec" == 0 will check for characters once. - * "msec" == -1 will block until a character is available. - * When a GUI is being used, this will not be used for input -- webb - * Or when a Linux GPM mouse event is waiting. - */ -static int RealWaitForChar(fd, msec, check_for_gpm) -int fd; -long msec; -int *check_for_gpm; -{ - int ret; - -#ifdef MAY_LOOP - for (;; ) -#endif - { -#ifdef MAY_LOOP - int finished = TRUE; /* default is to 'loop' just once */ -#endif -#ifndef HAVE_SELECT - struct pollfd fds[6]; - int nfd; - int towait = (int)msec; - - fds[0].fd = fd; - fds[0].events = POLLIN; - nfd = 1; - - - ret = poll(fds, nfd, towait); - - - -#else /* HAVE_SELECT */ - - struct timeval tv; - struct timeval *tvp; - fd_set rfds, efds; - int maxfd; - long towait = msec; - - - if (towait >= 0) { - tv.tv_sec = towait / 1000; - tv.tv_usec = (towait % 1000) * (1000000/1000); - tvp = &tv; - } else - tvp = NULL; - - /* - * Select on ready for reading and exceptional condition (end of file). - */ -select_eintr: - FD_ZERO(&rfds); - FD_ZERO(&efds); - FD_SET(fd, &rfds); - /* For QNX select() always returns 1 if this is set. Why? */ - FD_SET(fd, &efds); - maxfd = fd; - - - ret = select(maxfd + 1, &rfds, NULL, &efds, tvp); -# ifdef EINTR - if (ret == -1 && errno == EINTR) { - /* Check whether window has been resized, EINTR may be caused by - * SIGWINCH. FIXME this is broken for now */ - - /* Interrupted by a signal, need to try again. We ignore msec - * here, because we do want to check even after a timeout if - * characters are available. Needed for reading output of an - * external command after the process has finished. */ - goto select_eintr; - } -# endif - - -#endif /* HAVE_SELECT */ - -#ifdef MAY_LOOP - if (finished || msec == 0) - break; - - /* We're going to loop around again, find out for how long */ - if (msec > 0) { -# ifdef USE_START_TV - struct timeval mtv; - - /* Compute remaining wait time. */ - gettimeofday(&mtv, NULL); - msec -= (mtv.tv_sec - start_tv.tv_sec) * 1000L - + (mtv.tv_usec - start_tv.tv_usec) / 1000L; -# else - /* Guess we got interrupted halfway. */ - msec = msec / 2; -# endif - if (msec <= 0) - break; /* waited long enough */ - } -#endif - } - - return ret > 0; -} - -/* * mch_expand_wildcards() - this code does wild-card pattern matching using * the shell * diff --git a/src/os_unix.h b/src/os_unix.h index 2f592c50af..8bd1105721 100644 --- a/src/os_unix.h +++ b/src/os_unix.h @@ -37,7 +37,6 @@ void check_mouse_termcode(void); int mch_screenmode(char_u *arg); int mch_get_shellsize(void); void mch_set_shellsize(void); -void mch_new_shellsize(void); int mch_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file, int flags); diff --git a/src/term.c b/src/term.c index 2e596f84a2..dbba313f02 100644 --- a/src/term.c +++ b/src/term.c @@ -2465,8 +2465,6 @@ void win_new_shellsize(void) static int old_Rows = 0; static int old_Columns = 0; - if (old_Rows != Rows || old_Columns != Columns) - ui_new_shellsize(); if (old_Rows != Rows) { /* if 'window' uses the whole screen, keep it using that */ if (p_window == old_Rows - 1 || old_Rows == 0) @@ -237,24 +237,11 @@ int ui_get_shellsize(void) * new size. If this is not possible, it will adjust Rows and Columns. */ void -ui_set_shellsize ( - int mustset /* set by the user */ -) +ui_set_shellsize(int mustset) { mch_set_shellsize(); } -/* - * Called when Rows and/or Columns changed. Adjust scroll region and mouse - * region. - */ -void ui_new_shellsize(void) -{ - if (full_screen && !exiting) { - mch_new_shellsize(); - } -} - void ui_breakcheck(void) { os_breakcheck(); @@ -10,7 +10,6 @@ void ui_suspend(void); void suspend_shell(void); int ui_get_shellsize(void); void ui_set_shellsize(int mustset); -void ui_new_shellsize(void); void ui_breakcheck(void); void clip_init(int can_use); void clip_update_selection(VimClipboard *clip); |