diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2024-09-01 13:01:24 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-01 13:01:24 -0700 |
commit | 61e9137394fc5229e582a64316c2ffef55d8d7af (patch) | |
tree | c0f380b5efa26bed8c13d2d7b192c0c89568222a /src | |
parent | 6913c5e1d975a11262d08b3339d50b579e6b6bb8 (diff) | |
download | rneovim-61e9137394fc5229e582a64316c2ffef55d8d7af.tar.gz rneovim-61e9137394fc5229e582a64316c2ffef55d8d7af.tar.bz2 rneovim-61e9137394fc5229e582a64316c2ffef55d8d7af.zip |
docs: misc #28970
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/eval.lua | 1 | ||||
-rw-r--r-- | src/nvim/main.c | 4 | ||||
-rw-r--r-- | src/nvim/os/env.c | 30 | ||||
-rw-r--r-- | src/nvim/os/input.c | 2 |
4 files changed, 19 insertions, 18 deletions
diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua index 5087c2d36d..cbab735489 100644 --- a/src/nvim/eval.lua +++ b/src/nvim/eval.lua @@ -6442,6 +6442,7 @@ M.funcs = { "lhsrawalt" The {lhs} of the mapping as raw bytes, alternate form, only present when it differs from "lhsraw" "rhs" The {rhs} of the mapping as typed. + "callback" Lua function, if RHS was defined as such. "silent" 1 for a |:map-silent| mapping, else 0. "noremap" 1 if the {rhs} of the mapping is not remappable. "script" 1 if mapping was defined with <script>. diff --git a/src/nvim/main.c b/src/nvim/main.c index c507a201b0..6b90a13e1e 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -1434,9 +1434,9 @@ scripterror: // On Windows expand "~\" or "~/" prefix in file names to profile directory. #ifdef MSWIN if (*p == '~' && (p[1] == '\\' || p[1] == '/')) { - size_t size = strlen(os_get_homedir()) + strlen(p); + size_t size = strlen(os_homedir()) + strlen(p); char *tilde_expanded = xmalloc(size); - snprintf(tilde_expanded, size, "%s%s", os_get_homedir(), p + 1); + snprintf(tilde_expanded, size, "%s%s", os_homedir(), p + 1); xfree(p); p = tilde_expanded; } diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c index a4d5c02b5b..8dfedd073e 100644 --- a/src/nvim/os/env.c +++ b/src/nvim/os/env.c @@ -395,7 +395,21 @@ void os_get_hostname(char *hostname, size_t size) #endif } -/// To get the "real" home directory: +/// The "real" home directory as determined by `init_homedir`. +static char *homedir = NULL; +static char *os_uv_homedir(void); + +/// Gets the "real", resolved user home directory as determined by `init_homedir`. +const char *os_homedir(void) +{ + if (!homedir) { + emsg("os_homedir failed: homedir not initialized"); + return NULL; + } + return homedir; +} + +/// Sets `homedir` to the "real", resolved user home directory, as follows: /// 1. get value of $HOME /// 2. if $HOME is not set, try the following /// For Windows: @@ -409,20 +423,6 @@ void os_get_hostname(char *hostname, size_t size) /// This also works with mounts and links. /// Don't do this for Windows, it will change the "current dir" for a drive. /// 3. fall back to current working directory as a last resort -static char *homedir = NULL; -static char *os_uv_homedir(void); - -/// Public accessor for the cached "real", resolved user home directory. See -/// comment on `homedir`. -const char *os_get_homedir(void) -{ - if (!homedir) { - emsg("os_get_homedir failed: homedir not initialized"); - return NULL; - } - return homedir; -} - void init_homedir(void) { // In case we are called a second time. diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c index c4eb2803f6..8affc58591 100644 --- a/src/nvim/os/input.c +++ b/src/nvim/os/input.c @@ -514,7 +514,7 @@ static void process_ctrl_c(void) size_t available = input_available(); ssize_t i; - for (i = (ssize_t)available - 1; i >= 0; i--) { + for (i = (ssize_t)available - 1; i >= 0; i--) { // Reverse-search input for Ctrl_C. uint8_t c = (uint8_t)input_read_pos[i]; if (c == Ctrl_C || (c == 'C' && i >= 3 |