diff options
author | Rui Abreu Ferreira <raf-ep@gmx.com> | 2016-05-01 00:18:42 +0100 |
---|---|---|
committer | KillTheMule <KillTheMule@users.noreply.github.com> | 2016-05-08 20:24:02 +0200 |
commit | 24dac220d377d0dedbe192437b1da4b5b6f4bd6f (patch) | |
tree | 076a6a78342d774c0e42698dc60c7e66f014d806 | |
parent | b02ba11cb156e094d3f6f12fc7c79a983b6df68d (diff) | |
download | rneovim-24dac220d377d0dedbe192437b1da4b5b6f4bd6f.tar.gz rneovim-24dac220d377d0dedbe192437b1da4b5b6f4bd6f.tar.bz2 rneovim-24dac220d377d0dedbe192437b1da4b5b6f4bd6f.zip |
vim-patch:7.4.896
Problem: Editing a URL, which netrw should handle, doesn't work.
Solution: Avoid changing slashes to backslashes. (Yasuhiro Matsumoto)
https://github.com/vim/vim/commit/b4f6a46b01ed00b642a2271e9d1559e51ab0f2c4
Cherry-picked from https://github.com/neovim/neovim/pull/810, rebased.
-rw-r--r-- | src/nvim/fileio.c | 8 | ||||
-rw-r--r-- | src/nvim/os/win_defs.h | 2 | ||||
-rw-r--r-- | src/nvim/path.c | 23 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
4 files changed, 31 insertions, 4 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 6c0bc59d93..6030f388d5 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -5097,13 +5097,15 @@ void write_lnum_adjust(linenr_T offset) } #if defined(BACKSLASH_IN_FILENAME) -/* - * Convert all backslashes in fname to forward slashes in-place. - */ +/// Convert all backslashes in fname to forward slashes in-place, +/// unless when it looks like a URL. void forward_slash(char_u *fname) { char_u *p; + if (path_with_url(fname)) { + return; + } for (p = fname; *p != NUL; ++p) /* The Big5 encoding can have '\' in the trail byte. */ if (enc_dbcs != 0 && (*mb_ptr2len)(p) > 1) diff --git a/src/nvim/os/win_defs.h b/src/nvim/os/win_defs.h index 55894e4d12..6a29f86e79 100644 --- a/src/nvim/os/win_defs.h +++ b/src/nvim/os/win_defs.h @@ -46,6 +46,8 @@ # endif #endif +#define BACKSLASH_IN_FILENAME + #ifdef _MSC_VER typedef SSIZE_T ssize_t; #endif diff --git a/src/nvim/path.c b/src/nvim/path.c index aff0ee2d48..41fd69f238 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -1284,6 +1284,29 @@ static int expand_backtick( return cnt; } +#ifdef BACKSLASH_IN_FILENAME +/// Replace all slashes by backslashes. +/// This used to be the other way around, but MS-DOS sometimes has problems +/// with slashes (e.g. in a command name). We can't have mixed slashes and +/// backslashes, because comparing file names will not work correctly. The +/// commands that use a file name should try to avoid the need to type a +/// backslash twice. +/// When 'shellslash' set do it the other way around. +/// When the path looks like a URL leave it unmodified. +void slash_adjust(char_u *p) +{ + if (path_with_url(p)) { + return; + } + while (*p) { + if (*p == psepcN) { + *p = psepc; + } + mb_ptr_adv(p); + } +} +#endif + // Add a file to a file list. Accepted flags: // EW_DIR add directories // EW_FILE add files diff --git a/src/nvim/version.c b/src/nvim/version.c index 637b3778a7..723eceee2e 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -782,7 +782,7 @@ static int included_patches[] = { // 899 NA 898, // 897 NA - // 896, + 896, 895, // 894 NA 893, |