diff options
author | Scott Prager <splinterofchaos@gmail.com> | 2014-09-16 19:14:20 -0400 |
---|---|---|
committer | Scott Prager <splinterofchaos@gmail.com> | 2014-11-28 14:24:27 -0500 |
commit | a3ef5723a95edf153095f512417c402202ac3270 (patch) | |
tree | 9f5c2307a2818da722cb92e808dc184a1711fb1a /src/nvim/os_unix.c | |
parent | 98b11f5db3a99ef633ad77ddc6b22dc428873e95 (diff) | |
download | rneovim-a3ef5723a95edf153095f512417c402202ac3270.tar.gz rneovim-a3ef5723a95edf153095f512417c402202ac3270.tar.bz2 rneovim-a3ef5723a95edf153095f512417c402202ac3270.zip |
mch_write -> term_write
Switch from POSIX's write() to fwrite(stdout,...) and disable buffering
since vim buffers output explicitly and flushes when needed, like when a
key is typed.
Diffstat (limited to 'src/nvim/os_unix.c')
-rw-r--r-- | src/nvim/os_unix.c | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/src/nvim/os_unix.c b/src/nvim/os_unix.c index 3bf1198b46..bcb35e297b 100644 --- a/src/nvim/os_unix.c +++ b/src/nvim/os_unix.c @@ -82,30 +82,6 @@ static int did_set_title = FALSE; static char_u *oldicon = NULL; static int did_set_icon = FALSE; - - -/* - * Write s[len] to the screen. - */ -void mch_write(char_u *s, int len) -{ - if (embedded_mode) { - // TODO(tarruda): This is a temporary hack to stop Neovim from writing - // messages to stdout in embedded mode. In the future, embedded mode will - // be the only possibility(GUIs will always start neovim with a msgpack-rpc - // over stdio) and this function won't exist. - // - // The reason for this is because before Neovim fully migrates to a - // msgpack-rpc-driven architecture, we must have a fully functional - // UI working - return; - } - - ignored = (int)write(1, (char *)s, len); - if (p_wd) /* Unix is too fast, slow down a bit more */ - os_microdelay(p_wd, false); -} - /* * If the machine has job control, use it to suspend the program, * otherwise fake it by starting a new shell. @@ -159,6 +135,12 @@ void mch_init(void) Columns = 80; Rows = 24; + // Prevent buffering output. + // Output gets explicitly buffered and flushed by out_flush() at times like, + // for example, when the user presses a key. Without this line, vim will not + // render the screen correctly. + setbuf(stdout, NULL); + out_flush(); #ifdef MACOS_CONVERT |