| Commit message (Collapse) | Author | Age |
... | |
|
|
|
|
| |
fix #10127
fix #5972
|
| |
|
|
|
|
|
|
|
|
| |
Forcing insert-mode after the first paste-chunk seems to work, as an
alternative to a9e2bae0eb69 (insert-before-cursor).
NB: Dot-repeat needs to match the original action. Since a9e2bae0eb69
changed paste to insert-before-cursor, dot-repeat must also. But that
makes dot-repeat unpleasant/unusual.
|
|
|
|
|
|
|
|
|
| |
Inserting "after" the cursor in Normal-mode, for big paste-streams, is
not reliable: sometimes the text "after" the cursor ends up in the
middle of the pasted text. Maybe the cursor position is not updated?
To avoid weird behavior, always paste "before". Maybe nvim_put() or
vim.paste() can be fixed more properly later.
|
| |
|
|
|
|
|
|
| |
Problem: If multiple paste "chunks" are streamed, chunks after the
first line are pasted into the buffer.
Solution: Check for cmdline-mode for all chunks in a paste-stream.
|
|
|
|
|
|
| |
- Workaround #10966: 'paste' option is not always reset.
- In any case there's not much reason to wait until phase=3, because
pasting in cmdline-mode skips lines after the first line (thus the
`:set paste .. :set nopaste` dance happens only ~once).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Attempt to fix test failure since 976c6667e140 removed per-chunk redraw:
ERROR test/functional/terminal/tui_spec.lua: TUI paste: cmdline-mode inserts 1 line
test/functional/terminal/tui_spec.lua:367: in function <test/functional/terminal/tui_spec.lua:360
Expected:
|*foo |
|* |
|{4:~ }|
|{4:~ }|
|{5:[No Name] [+] }|
|:"line 1{1:"} |
|{3:-- TERMINAL --} |
Actual:
|* |
|*{4:~ }|
|{4:~ }|
|{4:~ }|
|{5:[No Name] [+] }|
|:"line 1{1:"} |
|{3:-- TERMINAL --} |
|
|
|
|
|
|
| |
- All "chunks" in a paste-stream should form a single undo-block. Side
effect of 7a8579288424 was to create an undo-block for each chunk.
- Also: remove old :redraw force logic, irrelevant after 7a8579288424.
|
| |
|
|
|
|
|
|
| |
- Normal-mode redo idiom(?): prepend "i" and append ESC.
- Insert-mode only needs AppendToRedobuffLit().
- Cmdline-mode: only paste the first line.
|
| |
|
| |
|
|
|
|
|
|
| |
- Send `phase` parameter to the paste handler.
- Redraw at intervals and when paste terminates.
- Show "..." throbber during paste to indicate activity.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
Flush input before entering, not only when leaving, paste mode. Else
there could be pending input which will erroneously be sent to the paste
handler.
|
|
|
|
|
|
|
| |
- Define in Lua so that it is compiled-in (available with `-u NONE`).
TODO: Eventually we will want a 'pastefunc' option or some other way to
override the default paste handler.
|
| |
|
|
|
|
|
| |
Disable the use of deferred API functions in a fast lua callback
Correctly display error messages from a fast lua callback
|
| |
|
|\
| |
| |
| | |
ref #8288
|
| |
| |
| |
| |
| | |
Leave trim() in vim.lua, because gen_vimdoc.py needs at least one
function in there, else it gets confused...
|
| |
| |
| |
| | |
deepcopy() was duplicated in test/helpers.lua
|
| | |
|
| | |
|
|/
|
|
|
|
|
|
|
|
| |
This is where "pure functions" can live, which can be shared by Nvim and
test logic which may not have a running Nvim instance available.
If in the future we use Nvim itself as the Lua engine for tests, then
these functions could be moved directly onto the `vim` Lua module.
closes #6580
|
|
|
|
|
|
| |
Implement lazy loading for vim.submodule, this would be over-engineering
for inspect only, but we expect to use this solution also for more and
larger modules.
|
|
|
|
|
|
|
|
|
|
| |
Instead of eager-loading during plugin/* sourcing, define runtime
modules such as `vim.inspect` as lazy builtins. Otherwise non-builtin
Lua modules such as `vim.inspect` would not be available during startup
(init.vim, `-c`, `--cmd`, …).
ref #6580
ref #8677
|
|
|
|
|
| |
ref #6580
ref #8677
|
|
|
|
|
|
| |
On macOS the output from `ps -o comm` might contain the full path of the
executable. The `ucomm` would be the basename only but is less portable
(see previous commit).
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- The POSIX version of ps(1) only specifies "comm" for the "-o" option
but not "ucomm". See
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ps.html
- On Linux (with the procps-ng package) "ucomm" is an alias for "comm".
See https://gitlab.com/procps-ng/procps
- OpenBSD also has "ucomm" as an alias for "comm" (with the extra note
"Name to be used for accounting."). See https://man.openbsd.org/ps
- FreeBSD describes "ucomm" as "Name to be used for accounting." but
does not say that it should be an alias for "comm". See
https://www.freebsd.org/cgi/man.cgi?query=ps
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TODO: "exepath" field (win32: QueryFullProcessImageName())
On unix-likes `ps` is used because the platform-specific APIs are
a nightmare. For reference, below is a (incomplete) attempt:
diff --git a/src/nvim/os/process.c b/src/nvim/os/process.c
index 09769925aca5..99afbbf290c1 100644
--- a/src/nvim/os/process.c
+++ b/src/nvim/os/process.c
@@ -208,3 +210,60 @@ int os_proc_children(int ppid, int **proc_list, size_t *proc_count)
return 0;
}
+/// Gets various properties of the process identified by `pid`.
+///
+/// @param pid Process to inspect.
+/// @return Map of process properties, empty on error.
+Dictionary os_proc_info(int pid)
+{
+ Dictionary pinfo = ARRAY_DICT_INIT;
+#ifdef WIN32
+
+#elif defined(__APPLE__)
+ char buf[PROC_PIDPATHINFO_MAXSIZE];
+ if (proc_pidpath(pid, buf, sizeof(buf))) {
+ name = getName(buf);
+ PUT(pinfo, "exepath", STRING_OBJ(cstr_to_string(buf)));
+ return name;
+ } else {
+ ILOG("proc_pidpath() failed for pid: %d", pid);
+ }
+#elif defined(BSD)
+# if defined(__FreeBSD__)
+# define KP_COMM(o) o.ki_comm
+# else
+# define KP_COMM(o) o.p_comm
+# endif
+ struct kinfo_proc *proc = kinfo_getproc(pid);
+ if (proc) {
+ PUT(pinfo, "name", cstr_to_string(KP_COMM(proc)));
+ xfree(proc);
+ } else {
+ ILOG("kinfo_getproc() failed for pid: %d", pid);
+ }
+
+#elif defined(__linux__)
+ char fname[256] = { 0 };
+ char buf[MAXPATHL];
+ snprintf(fname, sizeof(fname), "/proc/%d/comm", pid);
+ FILE *fp = fopen(fname, "r");
+ // FileDescriptor *f = file_open_new(&error, fname, kFileReadOnly, 0);
+ // ptrdiff_t file_read(FileDescriptor *const fp, char *const ret_buf,
+ // const size_t size)
+ if (fp == NULL) {
+ ILOG("fopen() of /proc/%d/comm failed", pid);
+ } else {
+ size_t n = fread(buf, sizeof(char), sizeof(buf) - 1, fp);
+ if (n == 0) {
+ WLOG("fread() of /proc/%d/comm failed", pid);
+ } else {
+ size_t end = MIN(sizeof(buf) - 1, n);
+ end = (end > 0 && buf[end - 1] == '\n') ? end - 1 : end;
+ buf[end] = '\0';
+ PUT(pinfo, "name", STRING_OBJ(cstr_to_string(buf)));
+ }
+ }
+ fclose(fp);
+#endif
+ return pinfo;
+}
|
|
|
|
|
| |
/proc/…/children may be unavailable because of an unset kernel option.
Fallback to `pgrep` invoked in a shell.
|
| |
|
| |
|
|
|