aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os
Commit message (Collapse)AuthorAge
...
* refactor: Remove strncpy/STRNCPY. (#6008)Justin M. Keyes2017-01-26
| | | | | | | | | | | | | | | Closes #731 References #851 Note: This does not remove some intentional legacy usages of strncpy. - memcpy isn't equivalent because it doesn't check the string length of `src`, and doesn't zero-out the remainder of `dst`. - xstrlcpy isn't equivalent because it doesn't zero-out the remainder of `dst`. Some Vim logic depends on that (e.g. ex_append which calls vim_strnsave). Helped-by: Douglas Schneider <ds3@ualberta.ca> Helped-by: oni-link <knil.ino@gmail.com> Helped-by: James McCoy <jamessan@jamessan.com>
* refactor: strlcat instead of str{n}cat.cztchoice2017-01-23
| | | | | | | | | | Add xstrlcat function. Closes #3042 References #988 References #1069 coverity: 71530, 71531, 71532
* test: expand_env_esc()Justin M. Keyes2017-01-21
| | | | | | Test expand_env_esc() using the same parameters reported in #3725. Closes #3725
* input_enqueue(): Fix length calculation. (#5981)Justin M. Keyes2017-01-20
| | | Ref: https://github.com/neovim/neovim/issues/5885#issuecomment-273614373
* win: fix warningsJustin M. Keyes2017-01-19
|
* Windows: vim_getenv(): Find runtime relative to nvim. #3303 (#5929)Justin M. Keyes2017-01-11
| | | | | | | | | | | | In Windows we cannot rely on absolute install paths to point to the location of the runtime. Vim uses the path of the current binary as a possible location for the runtime folder. In Neovim the install location places the runtime folder in ../share/nvim/runtime. In Vim this logic is guarded by USE_EXE_NAME, which is defined for win32 and macOS. TODO: We may need to incorporate similar logic for macOS: https://github.com/vim/vim/blob/0cdb72aa38c4a0140c94d56bf8bc17cb30260ebf/src/misc1.c#L4287-L4308
* XDG: Windows: resolve $LOCALAPPDATA, $TEMP (#5278)Rui Abreu Ferreira2017-01-08
| | | | | | | | | | After #4964 environment variables in the XDG "fallback" table are no longer expanded. Fallback to correctly expanded $LOCALAPPDATA, $TEMP. If that fails (unlikely), fallback to hard-coded paths (e.g. ~/AppData/Local). Closes #5255
* time.c: os_microdelay(): Let input cancel the delay. #5830Michael Schupikov2017-01-06
| | | | Closes #5397
* tui: check stty/termios for kbsJustin M. Keyes2016-12-23
| | | | | | | | | | | Requires libtermkey 0.19+ Closes #2048 Closes #5693 See https://github.com/neovim/libtermkey/compare/a9b61424aae9f7548162ff112393c5f706cf54f1%5E...c0eb4e4a05f49ad8fee0195c77f2c29d09cc36af See https://bugzilla.redhat.com/show_bug.cgi?id=142659 See https://github.com/tmux/tmux/blob/fe4e9470bb504357d073320f5d305b22663ee3fd/tty-keys.c#L625-L632
* out_data_decide_throttle(): timeout instead of hard limit.Justin M. Keyes2016-12-10
| | | | | | | Instead of managing max_visits, check the time every N visits. This avoids edge cases where max_visits is large but the chunk frequency slowed down, which would causing the "..." pulse to show for a very long time. It's more important to show output at reasonable intervals than to avoid calling os_hrtime().
* out_data_decide_throttle(): Avoid too-small final chunk.Justin M. Keyes2016-12-10
|
* os/shell: do_os_system(): Always show last chunk.Justin M. Keyes2016-12-10
| | | | | | | | | | | | | | | | | | | | | This ameliorates use-cases like: :!cat foo.txt :make where the user is interested in the last few lines of output. Try these shell-based ex-commands before/after this commit: :grep -r '' * :make :!yes :!grep -r '' * :!git grep '' :!cat foo :!echo foo :!while true; do date; done :!for i in `seq 1 20000`; do echo XXXXXXXXXX $i; done In all cases the last few lines of the command should always be shown, regardless of where throttling was triggered.
* os/shell: Throttle :! output, pulse "..." message.Justin M. Keyes2016-12-09
| | | | | | | | | | | | | | | | | | | | | | | | | | Periodically skip :! spam. This is a "cheat" that works for all UIs and greatly improves responsiveness when :! spams MB or GB of output: :!yes :!while true; do date; done :!git grep '' :grep -r '' * After ~10KB of data is seen from a single :! invocation, output will be skipped for ~1s and three dots "..." will pulse in the bottom-left. Thereafter the behavior alternates at every: * 10KB received * ~1s throttled This also avoids out-of-memory which could happen with large :! outputs. Note: This commit does not change the behavior of execute(':!foo'). execute(':!foo') returns the string ':!foo^M', it captures *only* Vim messages, *not* shell command output. Vim behaves the same way. Use system('foo') for capturing shell command output. Closes #1234 Helped-by: oni-link <knil.ino@gmail.com>
* shell_write_cb: Schedule error message. (#5670)Justin M. Keyes2016-11-26
| | | Closes #5558
* os_nodetype: open fd with O_NONBLOCK (#5515)Justin M. Keyes2016-10-21
| | | | | Closes #5267 Helped-by: oni-link <knil.ino@gmail.com>
* system('foo &', 'bar'): Show error, don't crash.Justin M. Keyes2016-10-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes #3529 Closes #5241 In Vim, :echo system('cat - &', 'foo') works because for both system() and :! Vim writes input to a temp file and uses shell syntax to redirect the file to the backgrounded `cat` (get_cmd_output() .. make_filter_cmd()). In Nvim, :echo system('cat - &', 'foo') fails because we write the input directly via pipes (shell.c:do_os_system()), but (per POSIX[1]) backgrounded process input stream is redirected from /dev/null (unless overridden by shell redirection; supported only by some shells [2]), so our writes are ignored, the process exits quickly, and if we are writing data larger than the buffer size we'll see EPIPE. This still works: :%w !tee > foo1358.txt & but this does not: :%w !tee foo1358.txt & though it *should* (why doesn't it?) because we still do the temp file dance in do_bang() .. do_filter(). [1] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_03_02 [2] http://unix.stackexchange.com/a/71218
* event/multiqueue.c: Rename "queue" to "multiqueue".Justin M. Keyes2016-10-02
| | | | | | | | | | | | | | `lib/queue.h` implements a basic queue. `event/queue.c` implements a specialized data structure on top of lib/queue.h; it is not a "normal" queue. Rename the specialized multi-level queue implemented in event/queue.c to "multiqueue", to avoid confusion when reading the code. Before this change one can eventually notice that "macros (uppercase symbols) are for the normal queue, lowercase operations are for the multi-level queue", but that is unnecessary friction for new developers (or existing developers just visiting this part of the codebase).
* doc: minor comment tweaksJustin M. Keyes2016-09-28
|
* refactor: eliminate misc2.cJustin M. Keyes2016-09-13
| | | | | | | | | | move `call_shell` to misc1.c Move some fns to state.c Move some fns to option.c Move some fns to memline.c Move `vim_chdir*` fns to file_search.c Move some fns to new module, bytes.c Move some fns to fileio.c
* shell_escape: rename; refactorJustin M. Keyes2016-09-11
| | | | | | | | - rename to shell_xescape_xquote - move to os/shell.c - disallow NULL argument - eliminate casts, nesting - test: empty shellxquote/shellxescape
* system(): Respect 'sxe' and 'sxq' #2789Zhaosheng Pan2016-09-10
| | | | Fixes #2773
* signal_init: unblock all signals on startup. #5283Nicolas Hillegeer2016-09-03
| | | | | | | As discussed on #5243 and #5283. Helped-by: John Szakmeister <john@szakmeister.net> Helped-by: Justin M. Keyes <justinkz@gmail.com>
* signal_init: Always unblock SIGCHLD. (#5243)Justin M. Keyes2016-08-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Inherited signal mask may block SIGCHLD, which causes libuv to hang at epoll_wait. Closes #5230 Helped-by: Nicolas Hillegeer <nicolas@hillegeer.com> Helped-by: John Szakmeister <john@szakmeister.net> Note: the #pragma gymnastics are a workaround for broken system headers on macOS. signal.h: int sigaddset(sigset_t *, int); #define sigaddset(set, signo) (*(set) |= __sigbits(signo), 0) sys/_types/_sigset.h: typedef __darwin_sigset_t sigset_t; sys/_types.h: typedef __uint32_t __darwin_sigset_t; /* [???] signal set */ sigset_t is defined as unsigned int, but the sigaddset() ORs it with an int, mixing the types. So GCC generates a sign-conversion warning: sig.c:9:13: warning: implicit conversion changes signedness: 'int' to 'unsigned int' [-Wsign-conversion] (*(&s) |= __sigbits((sigset_t) 20), 0); ~~ ^~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. System headers are normally ignored when the compiler generates warnings: https://gcc.gnu.org/onlinedocs/cpp/System-Headers.html > GCC gives code found in system headers special treatment. All warnings, > other than those generated by ‘#warning’ (see Diagnostics), are suppressed > while GCC is processing a system header. Macros defined in a system header > are immune to a few warnings wherever they are expanded. This immunity is > granted on an ad-hoc basis, when we find that a warning generates lots of > false positives because of code in macros defined in system headers. Instead of the #pragma workaround, we could cast the sigset_t pointer: # if defined(__APPLE__) sigaddset((int *)&mask, SIGCHLD); # else sigaddset(&mask, SIGCHLD); # endif but that could break if the headers are later fixed.
* stream: set data together with callbackBjörn Linse2016-08-20
|
* Merge #5025 'input.c: Restore double click'Justin M. Keyes2016-08-07
|\
| * lintsach1t2016-08-07
| |
| * input.c: restore double clicksach1t2016-08-07
| |
* | Merge #5130 from equalsraf/tb-appveyorJustin M. Keyes2016-08-07
|\ \ | |/ |/| Enable MSYS/MinGW builds in Appveyor
| * Create os_translate_sys_error()Rui Abreu Ferreira2016-08-07
| | | | | | | | | | | | Wrap up uv_translate_sys_error and fallbacks into a new function os_translate_sys_error(). In windows a copy of the original uv_translate_sys_error() was imported from libuv.
* | Merge #4964 from ZyX-I/no-xdg-expandJustin M. Keyes2016-08-04
|\ \ | |/ |/| option: Do not expand options, obtained from XDG vars
| * option: Also escape commas in options other then &runtimepathZyX2016-07-10
| |
* | os_resolve_shortcut: Report conversion error.Justin M. Keyes2016-07-30
| |
* | mbyte.c: Move utf8/utf16 functions to mbyte.cJustin M. Keyes2016-07-30
| |
* | utf16_to_utf8Justin M. Keyes2016-07-30
| |
* | os_resolve_shortcut: cleanupJustin M. Keyes2016-07-30
| |
* | os_resolve_shortcut: Remove legacy win16 codepath.Justin M. Keyes2016-07-30
| |
* | utf8_to_utf16: adapt libuv's fs__capture_pathJustin M. Keyes2016-07-30
| |
* | os_resolve_shortcut: initial port from Vim sourceJustin M. Keyes2016-07-30
| |
* | Remove redundant includes of unistd.h (#5126)Rui Abreu Ferreira2016-07-29
|/
* os/fs: Rename os_file_exists to os_path_exists (#4973)Daniel Xu2016-07-06
| | | | Because the old name did not indicate that the function would return true on directories as well.
* Merge #4646 from oni-link/fix.issue.4569.3Justin M. Keyes2016-06-26
|\ | | | | Fix for missing output (#4569, ...)
| * shell.c: Fix missing outputoni-link2016-05-15
| | | | | | | | | | | | | | | | | | | | | | | | The whole stream buffer is now put on screen at once instead of only data up to the last newline. This has some advantages: * RBuffer cannot wrap around, so we never forget to output second half of the buffer. * Stream data is not delayed anymore, because we don't have to wait for a newline. This works by remembering the last used screen column.
* | Merge #4965 from justinmk/fixup4453Justin M. Keyes2016-06-25
|\ \ | | | | | | ex_cmds2.c: lint
| * | ex_cmds2.c: cleanupJustin M. Keyes2016-06-25
| | |
* | | os/fileio: Use readv oftenZyX2016-06-24
| | |
* | | *: Satisfy linter (newest type casts rule)ZyX2016-06-24
| | |
* | | file: Move src/nvim/file.* to src/nvim/os/fileio.*ZyX2016-06-24
| | |
* | | file: Add buffered reading and writingZyX2016-06-23
| | | | | | | | | | | | Still no busted tests. Not tested without HAVE_PREADV.
* | | file,os/fs,shada: Separate opening, closing, writing and reading filesZyX2016-06-23
|/ / | | | | | | | | | | | | | | Moves low-level functions handling to os/fs.c. Adds file.c with a proxy interface. Target: while leaving syscalls handling is os.c (partially handled by libuv), add buffering for reading and writing to file.c.
* | Remove some unnecessary function attributes (#4909)oni-link2016-06-11
| | | | | | | | This removes attribute FUNC_ATTR_NONNULL_ALL for functions without a pointer parameter.