comparison src/buffer.c @ 29871:a4eab0d846dc v9.0.0274

patch 9.0.0274: netrw plugin does not show remote files Commit: https://github.com/vim/vim/commit/c312619f7c0cf590d96e0b2ed891d1f6c43d769b Author: Bram Moolenaar <Bram@vim.org> Date: Fri Aug 26 12:58:17 2022 +0100 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 https://github.com/vim/vim/issues/10983)
author Bram Moolenaar <Bram@vim.org>
date Fri, 26 Aug 2022 14:00:04 +0200
parents 6eaef7375f17
children 8e73ecbee60d
comparison
equal deleted inserted replaced
29870:76f4cea7033c 29871:a4eab0d846dc
46 #endif 46 #endif
47 static int value_changed(char_u *str, char_u **last); 47 static int value_changed(char_u *str, char_u **last);
48 static int append_arg_number(win_T *wp, char_u *buf, int buflen, int add_file); 48 static int append_arg_number(win_T *wp, char_u *buf, int buflen, int add_file);
49 static void free_buffer(buf_T *); 49 static void free_buffer(buf_T *);
50 static void free_buffer_stuff(buf_T *buf, int free_options); 50 static void free_buffer_stuff(buf_T *buf, int free_options);
51 static void clear_wininfo(buf_T *buf); 51 static int bt_nofileread(buf_T *buf);
52 52
53 #ifdef UNIX 53 #ifdef UNIX
54 # define dev_T dev_t 54 # define dev_T dev_t
55 #else 55 #else
56 # define dev_T unsigned 56 # define dev_T unsigned
221 // mark cursor position as being invalid 221 // mark cursor position as being invalid
222 curwin->w_valid = 0; 222 curwin->w_valid = 0;
223 223
224 // A buffer without an actual file should not use the buffer name to read a 224 // A buffer without an actual file should not use the buffer name to read a
225 // file. 225 // file.
226 if (bt_quickfix(curbuf) || bt_nofilename(curbuf)) 226 if (bt_nofileread(curbuf))
227 flags |= READ_NOFILE; 227 flags |= READ_NOFILE;
228 228
229 // Read the file if there is one. 229 // Read the file if there is one.
230 if (curbuf->b_ffname != NULL 230 if (curbuf->b_ffname != NULL
231 #ifdef FEAT_NETBEANS_INTG 231 #ifdef FEAT_NETBEANS_INTG
976 (void)dict_add(buf->b_vars, di); 976 (void)dict_add(buf->b_vars, di);
977 #endif 977 #endif
978 } 978 }
979 979
980 /* 980 /*
981 * Free the b_wininfo list for buffer "buf".
982 */
983 static void
984 clear_wininfo(buf_T *buf)
985 {
986 wininfo_T *wip;
987
988 while (buf->b_wininfo != NULL)
989 {
990 wip = buf->b_wininfo;
991 buf->b_wininfo = wip->wi_next;
992 free_wininfo(wip);
993 }
994 }
995
996 /*
981 * Free stuff in the buffer for ":bdel" and when wiping out the buffer. 997 * Free stuff in the buffer for ":bdel" and when wiping out the buffer.
982 */ 998 */
983 static void 999 static void
984 free_buffer_stuff( 1000 free_buffer_stuff(
985 buf_T *buf, 1001 buf_T *buf,
1031 #ifdef FEAT_FOLDING 1047 #ifdef FEAT_FOLDING
1032 deleteFoldRecurse(&wip->wi_folds); 1048 deleteFoldRecurse(&wip->wi_folds);
1033 #endif 1049 #endif
1034 } 1050 }
1035 vim_free(wip); 1051 vim_free(wip);
1036 }
1037
1038 /*
1039 * Free the b_wininfo list for buffer "buf".
1040 */
1041 static void
1042 clear_wininfo(buf_T *buf)
1043 {
1044 wininfo_T *wip;
1045
1046 while (buf->b_wininfo != NULL)
1047 {
1048 wip = buf->b_wininfo;
1049 buf->b_wininfo = wip->wi_next;
1050 free_wininfo(wip);
1051 }
1052 } 1052 }
1053 1053
1054 /* 1054 /*
1055 * Go to another buffer. Handles the result of the ATTENTION dialog. 1055 * Go to another buffer. Handles the result of the ATTENTION dialog.
1056 */ 1056 */
5707 } 5707 }
5708 #endif 5708 #endif
5709 5709
5710 /* 5710 /*
5711 * Return TRUE if "buf" is a "nofile", "acwrite", "terminal" or "prompt" 5711 * Return TRUE if "buf" is a "nofile", "acwrite", "terminal" or "prompt"
5712 * buffer. This means the buffer name is not a file name. 5712 * buffer. This means the buffer name may not be a file name, at least not for
5713 * writing the buffer.
5713 */ 5714 */
5714 int 5715 int
5715 bt_nofilename(buf_T *buf) 5716 bt_nofilename(buf_T *buf)
5716 { 5717 {
5717 return buf != NULL && ((buf->b_p_bt[0] == 'n' && buf->b_p_bt[2] == 'f') 5718 return buf != NULL && ((buf->b_p_bt[0] == 'n' && buf->b_p_bt[2] == 'f')
5718 || buf->b_p_bt[0] == 'a' 5719 || buf->b_p_bt[0] == 'a'
5719 || buf->b_p_bt[0] == 't' 5720 || buf->b_p_bt[0] == 't'
5721 || buf->b_p_bt[0] == 'p');
5722 }
5723
5724 /*
5725 * Return TRUE if "buf" is a "nofile", "quickfix", "terminal" or "prompt"
5726 * buffer. This means the buffer is not to be read from a file.
5727 */
5728 static int
5729 bt_nofileread(buf_T *buf)
5730 {
5731 return buf != NULL && ((buf->b_p_bt[0] == 'n' && buf->b_p_bt[2] == 'f')
5732 || buf->b_p_bt[0] == 't'
5733 || buf->b_p_bt[0] == 'q'
5720 || buf->b_p_bt[0] == 'p'); 5734 || buf->b_p_bt[0] == 'p');
5721 } 5735 }
5722 5736
5723 #if defined(FEAT_QUICKFIX) || defined(PROTO) 5737 #if defined(FEAT_QUICKFIX) || defined(PROTO)
5724 /* 5738 /*