Skip to content

Commit d85f271

Browse files
committed
patch 8.0.0797: finished job in terminal window is not handled
Problem: Finished job in terminal window is not handled. Solution: Add the scrollback buffer. Use it to fill the buffer when the job has ended.
1 parent d973bcb commit d85f271

7 files changed

Lines changed: 281 additions & 80 deletions

File tree

src/buffer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ free_buffer(buf_T *buf)
858858
channel_buffer_free(buf);
859859
#endif
860860
#ifdef FEAT_TERMINAL
861-
free_terminal(buf->b_term);
861+
free_terminal(buf);
862862
#endif
863863

864864
buf_hashtab_remove(buf);

src/channel.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2921,6 +2921,10 @@ channel_close(channel_T *channel, int invoke_close_cb)
29212921
}
29222922

29232923
channel->ch_nb_close_cb = NULL;
2924+
2925+
#ifdef FEAT_TERMINAL
2926+
term_channel_closed(channel);
2927+
#endif
29242928
}
29252929

29262930
/*
@@ -4696,10 +4700,6 @@ job_cleanup(job_T *job)
46964700
* not use "job" after this! */
46974701
job_free(job);
46984702
}
4699-
4700-
#ifdef FEAT_TERMINAL
4701-
term_job_ended(job);
4702-
#endif
47034703
}
47044704

47054705
/*

src/os_unix.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,9 @@ mch_inchar(
412412

413413
#ifdef MESSAGE_QUEUE
414414
parse_queued_messages();
415+
/* If input was put directly in typeahead buffer bail out here. */
416+
if (typebuf_changed(tb_change_cnt))
417+
return 0;
415418
#endif
416419
if (wtime < 0 && did_start_blocking)
417420
/* blocking and already waited for p_ut */

src/proto/terminal.pro

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* terminal.c */
22
void ex_terminal(exarg_T *eap);
3-
void free_terminal(term_T *term);
3+
void free_terminal(buf_T *buf);
44
void write_to_term(buf_T *buffer, char_u *msg, channel_T *channel);
5-
void terminal_loop(void);
6-
void term_job_ended(job_T *job);
7-
void term_update_window(win_T *wp);
5+
int terminal_loop(void);
6+
void term_channel_closed(channel_T *ch);
7+
int term_update_window(win_T *wp);
88
char_u *term_get_status_text(term_T *term);
99
int set_ref_in_term(int copyID);
1010
/* vim: set ft=c : */

src/screen.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,11 +1200,10 @@ win_update(win_T *wp)
12001200
#endif
12011201

12021202
#ifdef FEAT_TERMINAL
1203-
if (wp->w_buffer->b_term != NULL)
1203+
/* If this window contains a terminal, redraw works completely differently.
1204+
*/
1205+
if (term_update_window(wp) == OK)
12041206
{
1205-
/* This window contains a terminal, redraw works completely
1206-
* differently. */
1207-
term_update_window(wp);
12081207
wp->w_redr_type = 0;
12091208
return;
12101209
}
@@ -6849,14 +6848,14 @@ win_redr_status(win_T *wp)
68496848
p = NameBuff;
68506849
len = (int)STRLEN(p);
68516850

6852-
if (wp->w_buffer->b_help
6851+
if (bt_help(wp->w_buffer)
68536852
#ifdef FEAT_QUICKFIX
68546853
|| wp->w_p_pvw
68556854
#endif
68566855
|| bufIsChanged(wp->w_buffer)
68576856
|| wp->w_buffer->b_p_ro)
68586857
*(p + len++) = ' ';
6859-
if (wp->w_buffer->b_help)
6858+
if (bt_help(wp->w_buffer))
68606859
{
68616860
STRCPY(p + len, _("[Help]"));
68626861
len += (int)STRLEN(p + len);

0 commit comments

Comments
 (0)