aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/time.c
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-12-01 21:31:40 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-12-02 07:15:07 -0300
commit8a5a8dbf0f8dfec0b0494a0215891469753961a1 (patch)
tree1f22a425eb77401b524a93292bfc5eb2f7e61d06 /src/nvim/os/time.c
parent05f8d261fe305741ea99c6da2096d890b1005bf7 (diff)
downloadrneovim-8a5a8dbf0f8dfec0b0494a0215891469753961a1.tar.gz
rneovim-8a5a8dbf0f8dfec0b0494a0215891469753961a1.tar.bz2
rneovim-8a5a8dbf0f8dfec0b0494a0215891469753961a1.zip
term: Remove most calls to settmode
Nvim now relies much less on setting terminal mode to cooked mode, remove most calls to settmode, except for those that happen on startup or when suspending. Eventually even those will be handled by the UI layer.
Diffstat (limited to 'src/nvim/os/time.c')
-rw-r--r--src/nvim/os/time.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/src/nvim/os/time.c b/src/nvim/os/time.c
index a4871ef499..3794e813d2 100644
--- a/src/nvim/os/time.c
+++ b/src/nvim/os/time.c
@@ -6,6 +6,7 @@
#include <uv.h>
#include "nvim/os/time.h"
+#include "nvim/os/event.h"
#include "nvim/vim.h"
#include "nvim/term.h"
@@ -38,31 +39,22 @@ uint64_t os_hrtime(void)
/// @param ignoreinput If true, allow a SIGINT to interrupt us
void os_delay(uint64_t milliseconds, bool ignoreinput)
{
- os_microdelay(milliseconds * 1000, ignoreinput);
+ if (ignoreinput) {
+ if (milliseconds > INT_MAX) {
+ milliseconds = INT_MAX;
+ }
+ event_poll_until((int)milliseconds, got_int);
+ } else {
+ os_microdelay(milliseconds * 1000);
+ }
}
/// Sleeps for a certain amount of microseconds
///
/// @param microseconds Number of microseconds to sleep
-/// @param ignoreinput If true, allow a SIGINT to interrupt us
-void os_microdelay(uint64_t microseconds, bool ignoreinput)
+void os_microdelay(uint64_t microseconds)
{
- int old_tmode;
-
- if (ignoreinput) {
- // Go to cooked mode without echo, to allow SIGINT interrupting us
- // here
- old_tmode = curr_tmode;
-
- if (curr_tmode == TMODE_RAW)
- settmode(TMODE_SLEEP);
-
- microdelay(microseconds);
-
- settmode(old_tmode);
- } else {
- microdelay(microseconds);
- }
+ microdelay(microseconds);
}
/// Portable version of POSIX localtime_r()