aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/buffer.c6
-rw-r--r--src/nvim/fileio.c11
-rw-r--r--src/nvim/log.c2
-rw-r--r--src/nvim/os/env.c21
-rw-r--r--src/nvim/os/signal.c12
-rw-r--r--src/nvim/path.c3
6 files changed, 38 insertions, 17 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 7978dc8969..fae8e9ecd0 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -3745,8 +3745,10 @@ int build_stl_str_hl(
// Put a `<` to mark where we truncated at
*trunc_p = '<';
- // Advance the pointer to the end of the string
- trunc_p = trunc_p + STRLEN(trunc_p);
+ if (width + 1 < maxwidth) {
+ // Advance the pointer to the end of the string
+ trunc_p = trunc_p + STRLEN(trunc_p);
+ }
// Fill up for half a double-wide character.
while (++width < maxwidth) {
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 5ac133a0c3..11673785fd 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -4331,8 +4331,6 @@ void shorten_fnames(int force)
/// @return [allocated] - A new filename, made up from:
/// * fname + ext, if fname not NULL.
/// * current dir + ext, if fname is NULL.
-/// On Windows, and if ext starts with ".", a "_" is
-/// preprended to ext (for filename to be valid).
/// Result is guaranteed to:
/// * be ended by <ext>.
/// * have a basename with at most BASENAMELEN chars:
@@ -4386,15 +4384,6 @@ char *modname(const char *fname, const char *ext, bool prepend_dot)
char *s;
s = ptr + strlen(ptr);
-#if defined(WIN3264)
- // If there is no file name, and the extension starts with '.', put a
- // '_' before the dot, because just ".ext" may be invalid if it's on a
- // FAT partition, and on HPFS it doesn't matter.
- else if ((fname == NULL || *fname == NUL) && *ext == '.') {
- *s++ = '_';
- }
-#endif
-
// Append the extension.
// ext can start with '.' and cannot exceed 3 more characters.
strcpy(s, ext);
diff --git a/src/nvim/log.c b/src/nvim/log.c
index 08b6d0483e..5767da03af 100644
--- a/src/nvim/log.c
+++ b/src/nvim/log.c
@@ -14,7 +14,7 @@
# include <unistd.h>
#endif
-#define USR_LOG_FILE "$HOME/.nvimlog"
+#define USR_LOG_FILE "$HOME" _PATHSEPSTR ".nvimlog"
static uv_mutex_t mutex;
diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c
index bf6db97fcf..0e052ced55 100644
--- a/src/nvim/os/env.c
+++ b/src/nvim/os/env.c
@@ -141,6 +141,27 @@ void init_homedir(void)
char_u *var = (char_u *)os_getenv("HOME");
+#ifdef WIN32
+ // Typically, $HOME is not defined on Windows, unless the user has
+ // specifically defined it for Vim's sake. However, on Windows NT
+ // platforms, $HOMEDRIVE and $HOMEPATH are automatically defined for
+ // each user. Try constructing $HOME from these.
+ if (var == NULL) {
+ const char *homedrive = os_getenv("HOMEDRIVE");
+ const char *homepath = os_getenv("HOMEPATH");
+ if (homepath == NULL) {
+ homepath = "\\";
+ }
+ if (homedrive != NULL && strlen(homedrive) + strlen(homepath) < MAXPATHL) {
+ snprintf((char *)NameBuff, MAXPATHL, "%s%s", homedrive, homepath);
+ if (NameBuff[0] != NUL) {
+ var = NameBuff;
+ vim_setenv("HOME", (char *)NameBuff);
+ }
+ }
+ }
+#endif
+
if (var != NULL) {
#ifdef UNIX
/*
diff --git a/src/nvim/os/signal.c b/src/nvim/os/signal.c
index 7158721433..0ff6016e32 100644
--- a/src/nvim/os/signal.c
+++ b/src/nvim/os/signal.c
@@ -32,9 +32,13 @@ void signal_init(void)
signal_watcher_init(&loop, &shup, NULL);
signal_watcher_init(&loop, &squit, NULL);
signal_watcher_init(&loop, &sterm, NULL);
+#ifdef SIGPIPE
signal_watcher_start(&spipe, on_signal, SIGPIPE);
+#endif
signal_watcher_start(&shup, on_signal, SIGHUP);
+#ifdef SIGQUIT
signal_watcher_start(&squit, on_signal, SIGQUIT);
+#endif
signal_watcher_start(&sterm, on_signal, SIGTERM);
#ifdef SIGPWR
signal_watcher_init(&loop, &spwr, NULL);
@@ -82,12 +86,16 @@ static char * signal_name(int signum)
case SIGPWR:
return "SIGPWR";
#endif
+#ifdef SIGPIPE
case SIGPIPE:
return "SIGPIPE";
+#endif
case SIGTERM:
return "SIGTERM";
+#ifdef SIGQUIT
case SIGQUIT:
return "SIGQUIT";
+#endif
case SIGHUP:
return "SIGHUP";
default:
@@ -123,11 +131,15 @@ static void on_signal(SignalWatcher *handle, int signum, void *data)
ml_sync_all(false, false);
break;
#endif
+#ifdef SIGPIPE
case SIGPIPE:
// Ignore
break;
+#endif
case SIGTERM:
+#ifdef SIGQUIT
case SIGQUIT:
+#endif
case SIGHUP:
if (!rejecting_deadly) {
deadly_signal(signum);
diff --git a/src/nvim/path.c b/src/nvim/path.c
index 877ef1565a..253035ed99 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -467,16 +467,13 @@ bool path_has_wildcard(const char_u *p)
return false;
}
-#if defined(UNIX)
/*
* Unix style wildcard expansion code.
- * It's here because it's used both for Unix and Mac.
*/
static int pstrcmp(const void *a, const void *b)
{
return pathcmp(*(char **)a, *(char **)b, -1);
}
-#endif
/// Checks if a path has a character path_expand can expand.
/// @param p The path to expand.