File tree Expand file tree Collapse file tree 4 files changed +48
-4
lines changed
Filter options
Expand file tree Collapse file tree 4 files changed +48
-4
lines changed
Original file line number Diff line number Diff line change 29
29
#include "nvim/api/vim.h"
30
30
#include "nvim/ascii.h"
31
31
#include "nvim/assert.h"
32
+ #include "nvim/channel.h"
32
33
#include "nvim/vim.h"
33
34
#include "nvim/buffer.h"
34
35
#include "nvim/charset.h"
@@ -2608,9 +2609,10 @@ void buflist_list(exarg_T *eap)
2608
2609
const int changed_char = (buf -> b_flags & BF_READERR )
2609
2610
? 'x'
2610
2611
: (bufIsChanged (buf ) ? '+' : ' ' );
2611
- const int ro_char = !MODIFIABLE (buf )
2612
- ? '-'
2613
- : (buf -> b_p_ro ? '=' : ' ' );
2612
+ int ro_char = !MODIFIABLE (buf ) ? '-' : (buf -> b_p_ro ? '=' : ' ' );
2613
+ if (buf -> terminal ) {
2614
+ ro_char = channel_job_running ((uint64_t )buf -> b_p_channel ) ? 'R' : 'F' ;
2615
+ }
2614
2616
2615
2617
msg_putchar ('\n' );
2616
2618
len = vim_snprintf (
Original file line number Diff line number Diff line change @@ -762,6 +762,14 @@ static void set_info_event(void **argv)
762
762
channel_decref (chan );
763
763
}
764
764
765
+ bool channel_job_running (uint64_t id )
766
+ {
767
+ Channel * chan = find_channel (id );
768
+ return (chan
769
+ && chan -> streamtype == kChannelStreamProc
770
+ && !process_is_stopped (& chan -> stream .proc ));
771
+ }
772
+
765
773
Dictionary channel_info (uint64_t id )
766
774
{
767
775
Channel * chan = find_channel (id );
Original file line number Diff line number Diff line change @@ -56,7 +56,8 @@ static inline Process process_init(Loop *loop, ProcessType type, void *data)
56
56
57
57
static inline bool process_is_stopped (Process * proc )
58
58
{
59
- return proc -> stopped_time != 0 ;
59
+ bool exited = (proc -> status >= 0 );
60
+ return exited || (proc -> stopped_time != 0 );
60
61
}
61
62
62
63
#ifdef INCLUDE_GENERATED_DECLARATIONS
Original file line number Diff line number Diff line change
1
+ local helpers = require (' test.functional.helpers' )(after_each )
2
+ local clear = helpers .clear
3
+ local command = helpers .command
4
+ local eq = helpers .eq
5
+ local eval = helpers .eval
6
+ local feed = helpers .feed
7
+ local retry = helpers .retry
8
+
9
+ describe (' :ls' , function ()
10
+ before_each (function ()
11
+ clear ()
12
+ end )
13
+
14
+ it (' R, F for :terminal buffers' , function ()
15
+ command (' edit foo' )
16
+ command (' set hidden' )
17
+ command (' terminal' )
18
+ command (' vsplit' )
19
+ command (' terminal' )
20
+ feed (' iexit<cr>' )
21
+ retry (nil , 5000 , function ()
22
+ local ls_output = eval (' execute("ls")' )
23
+ -- Normal buffer.
24
+ eq (' \n 1 h ' , string.match (ls_output , ' \n *1....' ))
25
+ -- Terminal buffer [R]unning.
26
+ eq (' \n 2 #aR' , string.match (ls_output , ' \n *2....' ))
27
+ -- Terminal buffer [F]inished.
28
+ eq (' \n 3 %aF' , string.match (ls_output , ' \n *3....' ))
29
+ end )
30
+ end )
31
+
32
+ end )
33
+
You can’t perform that action at this time.
0 commit comments