Skip to content

Commit

Permalink
patch 8.0.0797: finished job in terminal window is not handled
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
brammool committed Jul 28, 2017
1 parent d973bcb commit d85f271
Show file tree
Hide file tree
Showing 7 changed files with 281 additions and 80 deletions.
2 changes: 1 addition & 1 deletion src/buffer.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ free_buffer(buf_T *buf)
channel_buffer_free(buf); channel_buffer_free(buf);
#endif #endif
#ifdef FEAT_TERMINAL #ifdef FEAT_TERMINAL
free_terminal(buf->b_term); free_terminal(buf);
#endif #endif


buf_hashtab_remove(buf); buf_hashtab_remove(buf);
Expand Down
8 changes: 4 additions & 4 deletions src/channel.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2921,6 +2921,10 @@ channel_close(channel_T *channel, int invoke_close_cb)
} }


channel->ch_nb_close_cb = NULL; channel->ch_nb_close_cb = NULL;

#ifdef FEAT_TERMINAL
term_channel_closed(channel);
#endif
} }


/* /*
Expand Down Expand Up @@ -4696,10 +4700,6 @@ job_cleanup(job_T *job)
* not use "job" after this! */ * not use "job" after this! */
job_free(job); job_free(job);
} }

#ifdef FEAT_TERMINAL
term_job_ended(job);
#endif
} }


/* /*
Expand Down
3 changes: 3 additions & 0 deletions src/os_unix.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -412,6 +412,9 @@ mch_inchar(


#ifdef MESSAGE_QUEUE #ifdef MESSAGE_QUEUE
parse_queued_messages(); parse_queued_messages();
/* If input was put directly in typeahead buffer bail out here. */
if (typebuf_changed(tb_change_cnt))
return 0;
#endif #endif
if (wtime < 0 && did_start_blocking) if (wtime < 0 && did_start_blocking)
/* blocking and already waited for p_ut */ /* blocking and already waited for p_ut */
Expand Down
8 changes: 4 additions & 4 deletions src/proto/terminal.pro
Original file line number Original file line Diff line number Diff line change
@@ -1,10 +1,10 @@
/* terminal.c */ /* terminal.c */
void ex_terminal(exarg_T *eap); void ex_terminal(exarg_T *eap);
void free_terminal(term_T *term); void free_terminal(buf_T *buf);
void write_to_term(buf_T *buffer, char_u *msg, channel_T *channel); void write_to_term(buf_T *buffer, char_u *msg, channel_T *channel);
void terminal_loop(void); int terminal_loop(void);
void term_job_ended(job_T *job); void term_channel_closed(channel_T *ch);
void term_update_window(win_T *wp); int term_update_window(win_T *wp);
char_u *term_get_status_text(term_T *term); char_u *term_get_status_text(term_T *term);
int set_ref_in_term(int copyID); int set_ref_in_term(int copyID);
/* vim: set ft=c : */ /* vim: set ft=c : */
11 changes: 5 additions & 6 deletions src/screen.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1200,11 +1200,10 @@ win_update(win_T *wp)
#endif #endif


#ifdef FEAT_TERMINAL #ifdef FEAT_TERMINAL
if (wp->w_buffer->b_term != NULL) /* If this window contains a terminal, redraw works completely differently.
*/
if (term_update_window(wp) == OK)
{ {
/* This window contains a terminal, redraw works completely
* differently. */
term_update_window(wp);
wp->w_redr_type = 0; wp->w_redr_type = 0;
return; return;
} }
Expand Down Expand Up @@ -6849,14 +6848,14 @@ win_redr_status(win_T *wp)
p = NameBuff; p = NameBuff;
len = (int)STRLEN(p); len = (int)STRLEN(p);


if (wp->w_buffer->b_help if (bt_help(wp->w_buffer)
#ifdef FEAT_QUICKFIX #ifdef FEAT_QUICKFIX
|| wp->w_p_pvw || wp->w_p_pvw
#endif #endif
|| bufIsChanged(wp->w_buffer) || bufIsChanged(wp->w_buffer)
|| wp->w_buffer->b_p_ro) || wp->w_buffer->b_p_ro)
*(p + len++) = ' '; *(p + len++) = ' ';
if (wp->w_buffer->b_help) if (bt_help(wp->w_buffer))
{ {
STRCPY(p + len, _("[Help]")); STRCPY(p + len, _("[Help]"));
len += (int)STRLEN(p + len); len += (int)STRLEN(p + len);
Expand Down
Loading

0 comments on commit d85f271

Please sign in to comment.