Skip to content

Commit f1c3134

Browse files
committed
patch 9.1.1139: [fifo] is not displayed when editing a fifo
Problem: [fifo] is not displayed when editing a fifo (after v7.4.2189) Solution: stat the filename and detect the type correctly fixes: #16702 closes: #16705 Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent a7b8120 commit f1c3134

4 files changed

Lines changed: 37 additions & 3 deletions

File tree

src/buffer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,8 @@ open_buffer(
275275
{
276276
curbuf->b_p_bin = save_bin;
277277
if (retval == OK)
278+
// don't add READ_FIFO here, otherwise we won't be able to
279+
// detect the encoding
278280
retval = read_buffer(FALSE, eap, flags);
279281
}
280282
#endif

src/fileio.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,15 +366,18 @@ readfile(
366366
goto theend;
367367
}
368368
}
369-
370-
if (!read_stdin && !read_buffer && !read_fifo)
371-
{
372369
#if defined(UNIX) || defined(VMS)
370+
if (!read_stdin && fname != NULL)
373371
/*
374372
* On Unix it is possible to read a directory, so we have to
375373
* check for it before the mch_open().
376374
*/
377375
perm = mch_getperm(fname);
376+
#endif
377+
378+
if (!read_stdin && !read_buffer && !read_fifo)
379+
{
380+
#if defined(UNIX) || defined(VMS)
378381
if (perm >= 0 && !S_ISREG(perm) // not a regular file ...
379382
&& !S_ISFIFO(perm) // ... or fifo
380383
&& !S_ISSOCK(perm) // ... or socket

src/testdir/test_startup_utf8.vim

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,33 @@ func Test_read_fifo_utf8()
6060
call delete('Xtestout')
6161
endfunc
6262

63+
func Test_detect_fifo()
64+
CheckUnix
65+
" Using bash/zsh's process substitution.
66+
if executable('bash')
67+
set shell=bash
68+
elseif executable('zsh')
69+
set shell=zsh
70+
else
71+
throw 'Skipped: bash or zsh is required'
72+
endif
73+
let linesin = ['one', 'two']
74+
call writefile(linesin, 'Xtestin_fifo', 'D')
75+
let after = [
76+
\ 'call writefile(split(execute(":mess"), "\\n"), "Xtestout")',
77+
\ 'quit!',
78+
\ ]
79+
if RunVim([], after, '<(cat Xtestin_fifo)')
80+
let lines = readfile('Xtestout')
81+
call assert_match('\[fifo\]', lines[0])
82+
call assert_match('\[fifo\]', lines[1])
83+
else
84+
call assert_equal('', 'RunVim failed.')
85+
endif
86+
87+
call delete('Xtestout')
88+
endfunc
89+
6390
func Test_detect_ambiwidth()
6491
CheckRunVimInTerminal
6592

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
1139,
707709
/**/
708710
1138,
709711
/**/

0 commit comments

Comments
 (0)