Permalink
Browse files

patch 8.0.0718: output of job in terminal is not displayed

Problem:    Output of job in terminal is not displayed.
Solution:   Connect the job output to the terminal.
  • Loading branch information...
brammool committed Jul 16, 2017
1 parent 26e8558 commit cb8bbe9bf3214d07580d6b43d6539416884153bd
Showing with 175 additions and 38 deletions.
  1. +17 −7 src/channel.c
  2. +1 −1 src/evalfunc.c
  3. +2 −1 src/proto/channel.pro
  4. +2 −0 src/proto/screen.pro
  5. +2 −0 src/proto/terminal.pro
  6. +31 −19 src/screen.c
  7. +118 −10 src/terminal.c
  8. +2 −0 src/version.c
View
@@ -171,7 +171,7 @@ ch_log(channel_T *ch, char *msg)
}
}
static void
void
ch_logn(channel_T *ch, char *msg, int nr)
{
if (log_fd != NULL)
@@ -2656,7 +2656,12 @@ may_invoke_callback(channel_T *channel, ch_part_T part)
/* JSON or JS mode: re-encode the message. */
msg = json_encode(listtv, ch_mode);
if (msg != NULL)
append_to_buffer(buffer, msg, channel, part);
{
if (buffer->b_term != NULL)
write_to_term(buffer, msg, channel);
else
append_to_buffer(buffer, msg, channel, part);
}
}
if (callback != NULL)
@@ -4889,7 +4894,7 @@ job_check_ended(void)
* "job_start()" function
*/
job_T *
job_start(typval_T *argvars)
job_start(typval_T *argvars, jobopt_T *opt_arg)
{
job_T *job;
char_u *cmd = NULL;
@@ -4912,13 +4917,18 @@ job_start(typval_T *argvars)
ga_init2(&ga, (int)sizeof(char*), 20);
#endif
/* Default mode is NL. */
clear_job_options(&opt);
opt.jo_mode = MODE_NL;
if (get_job_options(&argvars[1], &opt,
if (opt_arg != NULL)
opt = *opt_arg;
else
{
/* Default mode is NL. */
clear_job_options(&opt);
opt.jo_mode = MODE_NL;
if (get_job_options(&argvars[1], &opt,
JO_MODE_ALL + JO_CB_ALL + JO_TIMEOUT_ALL + JO_STOPONEXIT
+ JO_EXIT_CB + JO_OUT_IO + JO_BLOCK_WRITE) == FAIL)
goto theend;
}
/* Check that when io is "file" that there is a file name. */
for (part = PART_OUT; part < PART_COUNT; ++part)
View
@@ -6745,7 +6745,7 @@ f_job_start(typval_T *argvars, typval_T *rettv)
rettv->v_type = VAR_JOB;
if (check_restricted() || check_secure())
return;
rettv->vval.v_job = job_start(argvars);
rettv->vval.v_job = job_start(argvars, NULL);
}
/*
View
@@ -2,6 +2,7 @@
void ch_logfile(char_u *fname, char_u *opt);
int ch_log_active(void);
void ch_log(channel_T *ch, char *msg);
void ch_logn(channel_T *ch, char *msg, int nr);
void ch_logs(channel_T *ch, char *msg, char *name);
channel_T *add_channel(void);
int has_any_channel(void);
@@ -63,7 +64,7 @@ void job_set_options(job_T *job, jobopt_T *opt);
void job_stop_on_exit(void);
int has_pending_job(void);
void job_check_ended(void);
job_T *job_start(typval_T *argvars);
job_T *job_start(typval_T *argvars, jobopt_T *opt_arg);
char *job_status(job_T *job);
void job_info(job_T *job, dict_T *dict);
int job_stop(job_T *job, typval_T *argvars);
View
@@ -16,6 +16,8 @@ void conceal_check_cursur_line(void);
void update_single_line(win_T *wp, linenr_T lnum);
void update_debug_sign(buf_T *buf, linenr_T lnum);
void updateWindow(win_T *wp);
int screen_get_current_line_off(void);
void screen_line(int row, int coloff, int endcol, int clear_width, int rlflag);
void rl_mirror(char_u *str);
void status_redraw_all(void);
void status_redraw_curbuf(void);
View
@@ -1,3 +1,5 @@
/* terminal.c */
void ex_terminal(exarg_T *eap);
void write_to_term(buf_T *buffer, char_u *msg, channel_T *channel);
void term_update_window(win_T *wp);
/* vim: set ft=c : */
View
@@ -126,13 +126,6 @@ static void copy_text_attr(int off, char_u *buf, int len, int attr);
#endif
static int win_line(win_T *, linenr_T, int, int, int nochange, proftime_T *syntax_tm);
static int char_needs_redraw(int off_from, int off_to, int cols);
#ifdef FEAT_RIGHTLEFT
static void screen_line(int row, int coloff, int endcol, int clear_width, int rlflag);
# define SCREEN_LINE(r, o, e, c, rl) screen_line((r), (o), (e), (c), (rl))
#else
static void screen_line(int row, int coloff, int endcol, int clear_width);
# define SCREEN_LINE(r, o, e, c, rl) screen_line((r), (o), (e), (c))
#endif
#ifdef FEAT_WINDOWS
static void draw_vsep_win(win_T *wp, int row);
#endif
@@ -411,7 +404,7 @@ redraw_asap(int type)
screenline2 + r * cols,
(size_t)cols * sizeof(schar_T));
#endif
SCREEN_LINE(cmdline_row + r, 0, cols, cols, FALSE);
screen_line(cmdline_row + r, 0, cols, cols, FALSE);
}
ret = 4;
}
@@ -1192,6 +1185,17 @@ win_update(win_T *wp)
}
#endif
#ifdef FEAT_TERMINAL
if (wp->w_buffer->b_term != NULL)
{
/* This window contains a terminal, redraw works completely
* differently. */
term_update_window(wp);
wp->w_redr_type = 0;
return;
}
#endif
#ifdef FEAT_SEARCH_EXTRA
init_search_hl(wp);
#endif
@@ -2886,7 +2890,7 @@ fold_line(
}
#endif
SCREEN_LINE(row + W_WINROW(wp), W_WINCOL(wp), (int)W_WIDTH(wp),
screen_line(row + W_WINROW(wp), W_WINCOL(wp), (int)W_WIDTH(wp),
(int)W_WIDTH(wp), FALSE);
/*
@@ -3996,7 +4000,7 @@ win_line(
#endif
)
{
SCREEN_LINE(screen_row, W_WINCOL(wp), col, -(int)W_WIDTH(wp),
screen_line(screen_row, W_WINCOL(wp), col, -(int)W_WIDTH(wp),
wp->w_p_rl);
/* Pretend we have finished updating the window. Except when
* 'cursorcolumn' is set. */
@@ -5443,7 +5447,7 @@ win_line(
}
#endif
SCREEN_LINE(screen_row, W_WINCOL(wp), col,
screen_line(screen_row, W_WINCOL(wp), col,
(int)W_WIDTH(wp), wp->w_p_rl);
row++;
@@ -5749,11 +5753,11 @@ win_line(
)
{
#ifdef FEAT_CONCEAL
SCREEN_LINE(screen_row, W_WINCOL(wp), col - boguscols,
screen_line(screen_row, W_WINCOL(wp), col - boguscols,
(int)W_WIDTH(wp), wp->w_p_rl);
boguscols = 0;
#else
SCREEN_LINE(screen_row, W_WINCOL(wp), col,
screen_line(screen_row, W_WINCOL(wp), col,
(int)W_WIDTH(wp), wp->w_p_rl);
#endif
++row;
@@ -5959,6 +5963,17 @@ char_needs_redraw(int off_from, int off_to, int cols)
return FALSE;
}
#if defined(FEAT_TERMINAL) || defined(PROTO)
/*
* Return the index in ScreenLines[] for the current screen line.
*/
int
screen_get_current_line_off()
{
return (int)(current_ScreenLine - ScreenLines);
}
#endif
/*
* Move one "cooked" screen line to the screen, but only the characters that
* have actually changed. Handle insert/delete character.
@@ -5970,16 +5985,13 @@ char_needs_redraw(int off_from, int off_to, int cols)
* When TRUE and "clear_width" > 0, clear columns 0 to "endcol"
* When FALSE and "clear_width" > 0, clear columns "endcol" to "clear_width"
*/
static void
void
screen_line(
int row,
int coloff,
int endcol,
int clear_width
#ifdef FEAT_RIGHTLEFT
, int rlflag
#endif
)
int clear_width,
int rlflag UNUSED)
{
unsigned off_from;
unsigned off_to;
Oops, something went wrong.

0 comments on commit cb8bbe9

Please sign in to comment.