mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 9.0.0274: netrw plugin does not show remote files
Problem: Netrw plugin does not show remote files. Solution: Do read a file when 'buftype' is "acwrite". (closes #10983)
This commit is contained in:
52
src/buffer.c
52
src/buffer.c
@@ -48,7 +48,7 @@ static int value_changed(char_u *str, char_u **last);
|
|||||||
static int append_arg_number(win_T *wp, char_u *buf, int buflen, int add_file);
|
static int append_arg_number(win_T *wp, char_u *buf, int buflen, int add_file);
|
||||||
static void free_buffer(buf_T *);
|
static void free_buffer(buf_T *);
|
||||||
static void free_buffer_stuff(buf_T *buf, int free_options);
|
static void free_buffer_stuff(buf_T *buf, int free_options);
|
||||||
static void clear_wininfo(buf_T *buf);
|
static int bt_nofileread(buf_T *buf);
|
||||||
|
|
||||||
#ifdef UNIX
|
#ifdef UNIX
|
||||||
# define dev_T dev_t
|
# define dev_T dev_t
|
||||||
@@ -223,7 +223,7 @@ open_buffer(
|
|||||||
|
|
||||||
// A buffer without an actual file should not use the buffer name to read a
|
// A buffer without an actual file should not use the buffer name to read a
|
||||||
// file.
|
// file.
|
||||||
if (bt_quickfix(curbuf) || bt_nofilename(curbuf))
|
if (bt_nofileread(curbuf))
|
||||||
flags |= READ_NOFILE;
|
flags |= READ_NOFILE;
|
||||||
|
|
||||||
// Read the file if there is one.
|
// Read the file if there is one.
|
||||||
@@ -977,6 +977,22 @@ init_changedtick(buf_T *buf)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Free the b_wininfo list for buffer "buf".
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
clear_wininfo(buf_T *buf)
|
||||||
|
{
|
||||||
|
wininfo_T *wip;
|
||||||
|
|
||||||
|
while (buf->b_wininfo != NULL)
|
||||||
|
{
|
||||||
|
wip = buf->b_wininfo;
|
||||||
|
buf->b_wininfo = wip->wi_next;
|
||||||
|
free_wininfo(wip);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Free stuff in the buffer for ":bdel" and when wiping out the buffer.
|
* Free stuff in the buffer for ":bdel" and when wiping out the buffer.
|
||||||
*/
|
*/
|
||||||
@@ -1035,22 +1051,6 @@ free_wininfo(wininfo_T *wip)
|
|||||||
vim_free(wip);
|
vim_free(wip);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Free the b_wininfo list for buffer "buf".
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
clear_wininfo(buf_T *buf)
|
|
||||||
{
|
|
||||||
wininfo_T *wip;
|
|
||||||
|
|
||||||
while (buf->b_wininfo != NULL)
|
|
||||||
{
|
|
||||||
wip = buf->b_wininfo;
|
|
||||||
buf->b_wininfo = wip->wi_next;
|
|
||||||
free_wininfo(wip);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Go to another buffer. Handles the result of the ATTENTION dialog.
|
* Go to another buffer. Handles the result of the ATTENTION dialog.
|
||||||
*/
|
*/
|
||||||
@@ -5709,7 +5709,8 @@ bt_popup(buf_T *buf)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Return TRUE if "buf" is a "nofile", "acwrite", "terminal" or "prompt"
|
* Return TRUE if "buf" is a "nofile", "acwrite", "terminal" or "prompt"
|
||||||
* buffer. This means the buffer name is not a file name.
|
* buffer. This means the buffer name may not be a file name, at least not for
|
||||||
|
* writing the buffer.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
bt_nofilename(buf_T *buf)
|
bt_nofilename(buf_T *buf)
|
||||||
@@ -5720,6 +5721,19 @@ bt_nofilename(buf_T *buf)
|
|||||||
|| buf->b_p_bt[0] == 'p');
|
|| buf->b_p_bt[0] == 'p');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return TRUE if "buf" is a "nofile", "quickfix", "terminal" or "prompt"
|
||||||
|
* buffer. This means the buffer is not to be read from a file.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
bt_nofileread(buf_T *buf)
|
||||||
|
{
|
||||||
|
return buf != NULL && ((buf->b_p_bt[0] == 'n' && buf->b_p_bt[2] == 'f')
|
||||||
|
|| buf->b_p_bt[0] == 't'
|
||||||
|
|| buf->b_p_bt[0] == 'q'
|
||||||
|
|| buf->b_p_bt[0] == 'p');
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(FEAT_QUICKFIX) || defined(PROTO)
|
#if defined(FEAT_QUICKFIX) || defined(PROTO)
|
||||||
/*
|
/*
|
||||||
* Return TRUE if "buf" has 'buftype' set to "nofile".
|
* Return TRUE if "buf" has 'buftype' set to "nofile".
|
||||||
|
@@ -2375,6 +2375,13 @@ func Test_bufadd_bufload()
|
|||||||
call bufload(buf)
|
call bufload(buf)
|
||||||
call assert_equal([''], getbufline(buf, 1, '$'))
|
call assert_equal([''], getbufline(buf, 1, '$'))
|
||||||
|
|
||||||
|
" when 'buftype' is "acwrite" then bufload() DOES read the file
|
||||||
|
bwipe! XotherName
|
||||||
|
let buf = bufadd('XotherName')
|
||||||
|
call setbufvar(buf, '&bt', 'acwrite')
|
||||||
|
call bufload(buf)
|
||||||
|
call assert_equal(['some', 'text'], getbufline(buf, 1, '$'))
|
||||||
|
|
||||||
bwipe someName
|
bwipe someName
|
||||||
bwipe XotherName
|
bwipe XotherName
|
||||||
call assert_equal(0, bufexists('someName'))
|
call assert_equal(0, bufexists('someName'))
|
||||||
|
@@ -723,6 +723,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
274,
|
||||||
/**/
|
/**/
|
||||||
273,
|
273,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user