Lines Matching refs:term
187 #define FOR_ALL_TERMS(term) \ argument
188 for ((term) = first_term; (term) != NULL; (term) = (term)->tl_next)
193 static int term_and_job_init(term_T *term, typval_T *argvar, char **argv, jobopt_T *opt, jobopt_T *…
194 static int create_pty_only(term_T *term, jobopt_T *opt);
195 static void term_report_winsize(term_T *term, int rows, int cols);
196 static void term_free_vterm(term_T *term);
198 static void update_system_term(term_T *term);
201 static void handle_postponed_scrollback(term_T *term);
279 set_term_and_win_size(term_T *term, jobopt_T *opt) in set_term_and_win_size() argument
285 if (term->tl_system) in set_term_and_win_size()
289 term->tl_rows = Rows; in set_term_and_win_size()
290 term->tl_cols = Columns; in set_term_and_win_size()
294 term->tl_rows = curwin->w_height; in set_term_and_win_size()
295 term->tl_cols = curwin->w_width; in set_term_and_win_size()
300 if (term->tl_rows < rows) in set_term_and_win_size()
301 term->tl_rows = rows; in set_term_and_win_size()
302 if (term->tl_cols < cols) in set_term_and_win_size()
303 term->tl_cols = cols; in set_term_and_win_size()
306 term->tl_rows = opt->jo_term_rows; in set_term_and_win_size()
308 term->tl_rows = rows; in set_term_and_win_size()
310 term->tl_cols = opt->jo_term_cols; in set_term_and_win_size()
312 term->tl_cols = cols; in set_term_and_win_size()
316 if (term->tl_rows != curwin->w_height) in set_term_and_win_size()
317 win_setheight_win(term->tl_rows, curwin); in set_term_and_win_size()
318 if (term->tl_cols != curwin->w_width) in set_term_and_win_size()
319 win_setwidth_win(term->tl_cols, curwin); in set_term_and_win_size()
327 term->tl_rows, term->tl_cols); in set_term_and_win_size()
435 term_T *term; in term_start() local
465 term = ALLOC_CLEAR_ONE(term_T); in term_start()
466 if (term == NULL) in term_start()
468 term->tl_dirty_row_end = MAX_ROW; in term_start()
469 term->tl_cursor_visible = TRUE; in term_start()
470 term->tl_cursor_shape = VTERM_PROP_CURSORSHAPE_BLOCK; in term_start()
471 term->tl_finish = opt->jo_term_finish; in term_start()
473 term->tl_system = (flags & TERM_START_SYSTEM); in term_start()
475 ga_init2(&term->tl_scrollback, sizeof(sb_line_T), 300); in term_start()
476 ga_init2(&term->tl_scrollback_postponed, sizeof(sb_line_T), 300); in term_start()
477 ga_init2(&term->tl_osc_buf, sizeof(char), 300); in term_start()
487 vim_free(term); in term_start()
495 vim_free(term); in term_start()
509 vim_free(term); in term_start()
541 vim_free(term); in term_start()
545 term->tl_buffer = curbuf; in term_start()
546 curbuf->b_term = term; in term_start()
559 term->tl_next = first_term; in term_start()
560 first_term = term; in term_start()
621 term->tl_opencmd = vim_strsave(opt->jo_term_opencmd); in term_start()
624 term->tl_eof_chars = vim_strsave(opt->jo_eof_chars); in term_start()
635 set_term_and_win_size(term, opt); in term_start()
639 setup_job_options(opt, term->tl_rows, term->tl_cols); in term_start()
647 term->tl_command = vim_strsave((char_u *)"NONE"); in term_start()
653 term->tl_command = vim_strsave(cmd); in term_start()
680 term->tl_command = ga.ga_data; in term_start()
691 term->tl_kill = vim_strnsave(opt->jo_term_kill, p - opt->jo_term_kill); in term_start()
698 term->tl_api = vim_strnsave(opt->jo_term_api, p - opt->jo_term_api); in term_start()
701 term->tl_api = vim_strsave((char_u *)"Tapi_"); in term_start()
704 term->tl_highlight_name = vim_strsave(opt->jo_term_highlight); in term_start()
711 res = create_pty_only(term, opt); in term_start()
713 res = term_and_job_init(term, argvar, argv, opt, &orig_opt); in term_start()
719 vterm_get_size(term->tl_vterm, &term->tl_rows, &term->tl_cols); in term_start()
720 term_report_winsize(term, term->tl_rows, term->tl_cols); in term_start()
722 if (term->tl_system) in term_start()
725 term->tl_toprow = msg_row + 1; in term_start()
726 term->tl_dirty_row_end = 0; in term_start()
732 channel_set_nonblock(term->tl_job->jv_channel, PART_IN); in term_start()
945 term_T *term = wp->w_buffer->b_term; in term_write_session() local
971 term->tl_cols, term->tl_rows) < 0) in term_write_session()
974 if (fprintf(fd, "++type=%s ", term->tl_job->jv_tty_type) < 0) in term_write_session()
977 if (term->tl_command != NULL && fputs((char *)term->tl_command, fd) < 0) in term_write_session()
1002 term_T *term = buf->b_term; in term_should_restore() local
1004 return term != NULL && (term->tl_command == NULL in term_should_restore()
1005 || STRCMP(term->tl_command, "NONE") != 0); in term_should_restore()
1013 free_scrollback(term_T *term) in free_scrollback() argument
1017 for (i = 0; i < term->tl_scrollback.ga_len; ++i) in free_scrollback()
1018 vim_free(((sb_line_T *)term->tl_scrollback.ga_data + i)->sb_cells); in free_scrollback()
1019 ga_clear(&term->tl_scrollback); in free_scrollback()
1020 for (i = 0; i < term->tl_scrollback_postponed.ga_len; ++i) in free_scrollback()
1021 vim_free(((sb_line_T *)term->tl_scrollback_postponed.ga_data + i)->sb_cells); in free_scrollback()
1022 ga_clear(&term->tl_scrollback_postponed); in free_scrollback()
1040 term_T *term = buf->b_term; in free_terminal() local
1043 if (term == NULL) in free_terminal()
1047 if (first_term == term) in free_terminal()
1048 first_term = term->tl_next; in free_terminal()
1051 if (tp->tl_next == term) in free_terminal()
1053 tp->tl_next = term->tl_next; in free_terminal()
1057 if (term->tl_job != NULL) in free_terminal()
1059 if (term->tl_job->jv_status != JOB_ENDED in free_terminal()
1060 && term->tl_job->jv_status != JOB_FINISHED in free_terminal()
1061 && term->tl_job->jv_status != JOB_FAILED) in free_terminal()
1062 job_stop(term->tl_job, NULL, "kill"); in free_terminal()
1063 job_unref(term->tl_job); in free_terminal()
1065 term->tl_next = terminals_to_free; in free_terminal()
1066 terminals_to_free = term; in free_terminal()
1069 if (in_terminal_loop == term) in free_terminal()
1078 term_T *term = terminals_to_free; in free_unused_terminals() local
1080 terminals_to_free = term->tl_next; in free_unused_terminals()
1082 free_scrollback(term); in free_unused_terminals()
1083 ga_clear(&term->tl_osc_buf); in free_unused_terminals()
1085 term_free_vterm(term); in free_unused_terminals()
1086 vim_free(term->tl_api); in free_unused_terminals()
1087 vim_free(term->tl_title); in free_unused_terminals()
1089 vim_free(term->tl_command); in free_unused_terminals()
1091 vim_free(term->tl_kill); in free_unused_terminals()
1092 vim_free(term->tl_status_text); in free_unused_terminals()
1093 vim_free(term->tl_opencmd); in free_unused_terminals()
1094 vim_free(term->tl_eof_chars); in free_unused_terminals()
1095 vim_free(term->tl_arg0_cmd); in free_unused_terminals()
1097 if (term->tl_out_fd != NULL) in free_unused_terminals()
1098 fclose(term->tl_out_fd); in free_unused_terminals()
1100 vim_free(term->tl_highlight_name); in free_unused_terminals()
1101 vim_free(term->tl_cursor_color); in free_unused_terminals()
1102 vim_free(term); in free_unused_terminals()
1112 get_tty_part(term_T *term UNUSED) in get_tty_part()
1120 int fd = term->tl_job->jv_channel->ch_part[parts[i]].ch_fd; in get_tty_part()
1133 term_write_job_output(term_T *term, char_u *msg_arg, size_t len_arg) in term_write_job_output() argument
1137 VTerm *vterm = term->tl_vterm; in term_write_job_output()
1139 size_t limit = term->tl_buffer->b_p_twsl * term->tl_cols * 3; in term_write_job_output()
1161 channel_send(term->tl_job->jv_channel, get_tty_part(term), in term_write_job_output()
1170 update_cursor(term_T *term, int redraw) in update_cursor() argument
1172 if (term->tl_normal_mode) in update_cursor()
1175 if (term->tl_system) in update_cursor()
1176 windgoto(term->tl_cursor_pos.row + term->tl_toprow, in update_cursor()
1177 term->tl_cursor_pos.col); in update_cursor()
1183 if (term->tl_buffer == curbuf && term->tl_cursor_visible) in update_cursor()
1204 term_T *term = buffer->b_term; in write_to_term() local
1209 if (term->tl_out_fd != NULL) in write_to_term()
1212 fwrite(msg, len, 1, term->tl_out_fd); in write_to_term()
1217 if (term->tl_vterm == NULL) in write_to_term()
1224 term_write_job_output(term, msg, len); in write_to_term()
1227 if (term->tl_system) in write_to_term()
1230 update_system_term(term); in write_to_term()
1231 update_cursor(term, TRUE); in write_to_term()
1237 if (!term->tl_normal_mode) in write_to_term()
1242 ch_log(term->tl_job->jv_channel, "updating screen"); in write_to_term()
1384 term_convert_key(term_T *term, int c, int modmask, char *buf) in term_convert_key() argument
1386 VTerm *vterm = term->tl_vterm; in term_convert_key()
1558 term_job_running_check(term_T *term, int check_job_status) in term_job_running_check() argument
1562 if (term != NULL in term_job_running_check()
1563 && term->tl_job != NULL in term_job_running_check()
1564 && channel_is_open(term->tl_job->jv_channel)) in term_job_running_check()
1566 job_T *job = term->tl_job; in term_job_running_check()
1583 term_job_running(term_T *term) in term_job_running() argument
1585 return term_job_running_check(term, FALSE); in term_job_running()
1592 term_none_open(term_T *term) in term_none_open() argument
1596 return term != NULL in term_none_open()
1597 && term->tl_job != NULL in term_none_open()
1598 && channel_is_open(term->tl_job->jv_channel) in term_none_open()
1599 && term->tl_job->jv_channel->ch_keep_open; in term_none_open()
1661 add_scrollback_line_to_buffer(term_T *term, char_u *text, int len) in add_scrollback_line_to_buffer() argument
1663 buf_T *buf = term->tl_buffer; in add_scrollback_line_to_buffer()
1680 ml_append_buf(term->tl_buffer, lnum, text, len, FALSE); in add_scrollback_line_to_buffer()
1686 ml_append_buf(term->tl_buffer, lnum, text, len + 1, FALSE); in add_scrollback_line_to_buffer()
1723 add_empty_scrollback(term_T *term, cellattr_T *fill_attr, int lnum) in add_empty_scrollback() argument
1725 if (ga_grow(&term->tl_scrollback, 1) == OK) in add_empty_scrollback()
1727 sb_line_T *line = (sb_line_T *)term->tl_scrollback.ga_data in add_empty_scrollback()
1728 + term->tl_scrollback.ga_len; in add_empty_scrollback()
1734 for (i = 0; i < term->tl_scrollback.ga_len - lnum; ++i) in add_empty_scrollback()
1743 ++term->tl_scrollback.ga_len; in add_empty_scrollback()
1755 cleanup_scrollback(term_T *term) in cleanup_scrollback() argument
1760 curbuf = term->tl_buffer; in cleanup_scrollback()
1761 gap = &term->tl_scrollback; in cleanup_scrollback()
1762 while (curbuf->b_ml.ml_line_count > term->tl_scrollback_scrolled in cleanup_scrollback()
1771 if (curbuf == term->tl_buffer) in cleanup_scrollback()
1779 update_snapshot(term_T *term) in update_snapshot() argument
1789 ch_log(term->tl_job == NULL ? NULL : term->tl_job->jv_channel, in update_snapshot()
1794 cleanup_scrollback(term); in update_snapshot()
1796 screen = vterm_obtain_screen(term->tl_vterm); in update_snapshot()
1797 fill_attr = new_fill_attr = term->tl_default_color; in update_snapshot()
1798 for (pos.row = 0; pos.row < term->tl_rows; ++pos.row) in update_snapshot()
1801 for (pos.col = 0; pos.col < term->tl_cols; ++pos.col) in update_snapshot()
1806 new_fill_attr = term->tl_default_color; in update_snapshot()
1820 if (add_empty_scrollback(term, &fill_attr, 0) == OK) in update_snapshot()
1821 add_scrollback_line_to_buffer(term, (char_u *)"", 0); in update_snapshot()
1829 && ga_grow(&term->tl_scrollback, 1) == OK) in update_snapshot()
1833 sb_line_T *line = (sb_line_T *)term->tl_scrollback.ga_data in update_snapshot()
1834 + term->tl_scrollback.ga_len; in update_snapshot()
1873 ++term->tl_scrollback.ga_len; in update_snapshot()
1876 add_scrollback_line_to_buffer(term, (char_u *)"", 0); in update_snapshot()
1880 add_scrollback_line_to_buffer(term, ga.ga_data, ga.ga_len); in update_snapshot()
1890 for (pos.row = term->tl_scrollback.ga_len; in update_snapshot()
1891 pos.row < term->tl_scrollback_scrolled + term->tl_cursor_pos.row; in update_snapshot()
1894 if (add_empty_scrollback(term, &fill_attr, 0) == OK) in update_snapshot()
1895 add_scrollback_line_to_buffer(term, (char_u *)"", 0); in update_snapshot()
1898 term->tl_dirty_snapshot = FALSE; in update_snapshot()
1900 term->tl_timer_set = FALSE; in update_snapshot()
1932 may_move_terminal_to_buffer(term_T *term, int redraw) in may_move_terminal_to_buffer() argument
1934 if (term->tl_vterm == NULL) in may_move_terminal_to_buffer()
1939 if (term->tl_dirty_snapshot || term->tl_buffer->b_ml.ml_line_count in may_move_terminal_to_buffer()
1940 <= term->tl_scrollback_scrolled) in may_move_terminal_to_buffer()
1941 update_snapshot(term); in may_move_terminal_to_buffer()
1944 vterm_state_get_default_colors(vterm_obtain_state(term->tl_vterm), in may_move_terminal_to_buffer()
1945 &term->tl_default_color.fg, &term->tl_default_color.bg); in may_move_terminal_to_buffer()
1954 if (wp->w_buffer == term->tl_buffer) in may_move_terminal_to_buffer()
1956 wp->w_cursor.lnum = term->tl_buffer->b_ml.ml_line_count; in may_move_terminal_to_buffer()
1981 term_T *term; in term_check_timers() local
1984 FOR_ALL_TERMS(term) in term_check_timers()
1986 if (term->tl_timer_set && !term->tl_normal_mode) in term_check_timers()
1988 long this_due = proftime_time_left(&term->tl_timer_due, now); in term_check_timers()
1992 term->tl_timer_set = FALSE; in term_check_timers()
1993 may_move_terminal_to_buffer(term, FALSE); in term_check_timers()
2009 set_terminal_mode(term_T *term, int normal_mode) in set_terminal_mode() argument
2011 term->tl_normal_mode = normal_mode; in set_terminal_mode()
2014 handle_postponed_scrollback(term); in set_terminal_mode()
2015 VIM_CLEAR(term->tl_status_text); in set_terminal_mode()
2016 if (term->tl_buffer == curbuf) in set_terminal_mode()
2025 cleanup_vterm(term_T *term) in cleanup_vterm() argument
2027 set_terminal_mode(term, FALSE); in cleanup_vterm()
2028 if (term->tl_finish != TL_FINISH_CLOSE) in cleanup_vterm()
2029 may_move_terminal_to_buffer(term, TRUE); in cleanup_vterm()
2030 term_free_vterm(term); in cleanup_vterm()
2040 term_T *term = curbuf->b_term; in term_enter_normal_mode() local
2042 set_terminal_mode(term, TRUE); in term_enter_normal_mode()
2045 may_move_terminal_to_buffer(term, TRUE); in term_enter_normal_mode()
2049 curwin->w_cursor.lnum = term->tl_scrollback_scrolled in term_enter_normal_mode()
2050 + term->tl_cursor_pos.row + 1; in term_enter_normal_mode()
2052 if (coladvance(term->tl_cursor_pos.col) == FAIL) in term_enter_normal_mode()
2057 curwin->w_topline = term->tl_scrollback_scrolled + 1; in term_enter_normal_mode()
2067 term_T *term = curbuf->b_term; in term_in_normal_mode() local
2069 return term != NULL && term->tl_normal_mode; in term_in_normal_mode()
2079 term_T *term = curbuf->b_term; in term_enter_job_mode() local
2081 set_terminal_mode(term, FALSE); in term_enter_job_mode()
2083 if (term->tl_channel_closed) in term_enter_job_mode()
2084 cleanup_vterm(term); in term_enter_job_mode()
2128 send_keys_to_term(term_T *term, int c, int modmask, int typed) in send_keys_to_term() argument
2212 len = term_convert_key(term, c, modmask, msg); in send_keys_to_term()
2215 channel_send(term->tl_job->jv_channel, get_tty_part(term), in send_keys_to_term()
2325 term_get_highlight_id(term_T *term, win_T *wp) in term_get_highlight_id() argument
2331 else if (term->tl_highlight_name != NULL) in term_get_highlight_id()
2332 name = term->tl_highlight_name; in term_get_highlight_id()
2343 term_T *term = in_terminal_loop; in term_get_cursor_shape() local
2351 term->tl_cursor_shape == VTERM_PROP_CURSORSHAPE_UNDERLINE ? SHAPE_HOR : in term_get_cursor_shape()
2352 term->tl_cursor_shape == VTERM_PROP_CURSORSHAPE_BAR_LEFT ? SHAPE_VER : in term_get_cursor_shape()
2355 if (term->tl_cursor_blink) in term_get_cursor_shape()
2363 id = term_get_highlight_id(term, curwin); in term_get_cursor_shape()
2371 if (term->tl_cursor_color == NULL) in term_get_cursor_shape()
2379 *bg = color_name2handle(term->tl_cursor_color); in term_get_cursor_shape()
2410 may_set_cursor_props(term_T *term) in may_set_cursor_props() argument
2418 if (in_terminal_loop == term) in may_set_cursor_props()
2420 cursor_color_copy(&desired_cursor_color, term->tl_cursor_color); in may_set_cursor_props()
2421 desired_cursor_shape = term->tl_cursor_shape; in may_set_cursor_props()
2422 desired_cursor_blink = term->tl_cursor_blink; in may_set_cursor_props()
2451 term_T *term = curbuf->b_term; in term_use_loop_check() local
2453 return term != NULL in term_use_loop_check()
2454 && !term->tl_normal_mode in term_use_loop_check()
2455 && term->tl_vterm != NULL in term_use_loop_check()
2456 && term_job_running_check(term, check_job_status); in term_use_loop_check()
2476 term_T *term = curbuf->b_term; in term_win_entered() local
2478 if (term != NULL) in term_win_entered()
2731 may_toggle_cursor(term_T *term) in may_toggle_cursor() argument
2733 if (in_terminal_loop == term) in may_toggle_cursor()
2735 if (term->tl_cursor_visible) in may_toggle_cursor()
2865 term_T *term, in cell2attr() argument
2889 fg = &term->tl_default_color.fg; in cell2attr()
2891 bg = &term->tl_default_color.bg; in cell2attr()
2932 set_dirty_snapshot(term_T *term) in set_dirty_snapshot() argument
2934 term->tl_dirty_snapshot = TRUE; in set_dirty_snapshot()
2936 if (!term->tl_normal_mode) in set_dirty_snapshot()
2939 profile_setlimit(100L, &term->tl_timer_due); in set_dirty_snapshot()
2940 term->tl_timer_set = TRUE; in set_dirty_snapshot()
2948 term_T *term = (term_T *)user; in handle_damage() local
2950 term->tl_dirty_row_start = MIN(term->tl_dirty_row_start, rect.start_row); in handle_damage()
2951 term->tl_dirty_row_end = MAX(term->tl_dirty_row_end, rect.end_row); in handle_damage()
2952 set_dirty_snapshot(term); in handle_damage()
2953 redraw_buf_later(term->tl_buffer, SOME_VALID); in handle_damage()
2958 term_scroll_up(term_T *term, int start_row, int count) in term_scroll_up() argument
2970 if (wp->w_buffer == term->tl_buffer) in term_scroll_up()
2973 vterm_state_get_default_colors(vterm_obtain_state(term->tl_vterm), in term_scroll_up()
2975 clear_attr = cell2attr(term, wp, &attr, &fg, &bg); in term_scroll_up()
2984 term_T *term = (term_T *)user; in handle_moverect() local
2995 term->tl_postponed_scroll += count; in handle_moverect()
2997 term_scroll_up(term, dest.start_row, count); in handle_moverect()
3000 term->tl_dirty_row_start = MIN(term->tl_dirty_row_start, dest.start_row); in handle_moverect()
3001 term->tl_dirty_row_end = MIN(term->tl_dirty_row_end, dest.end_row); in handle_moverect()
3002 set_dirty_snapshot(term); in handle_moverect()
3006 redraw_buf_later(term->tl_buffer, NOT_VALID); in handle_moverect()
3017 term_T *term = (term_T *)user; in handle_movecursor() local
3021 term->tl_cursor_pos = pos; in handle_movecursor()
3022 term->tl_cursor_visible = visible; in handle_movecursor()
3026 if (wp->w_buffer == term->tl_buffer) in handle_movecursor()
3029 if (term->tl_buffer == curbuf && !term->tl_normal_mode) in handle_movecursor()
3030 update_cursor(term, term->tl_cursor_visible); in handle_movecursor()
3041 term_T *term = (term_T *)user; in handle_settermprop() local
3051 vim_free(term->tl_title); in handle_settermprop()
3055 term->tl_title = NULL; in handle_settermprop()
3057 else if (term->tl_arg0_cmd != NULL in handle_settermprop()
3058 && STRNCMP(term->tl_arg0_cmd, strval, in handle_settermprop()
3059 (int)STRLEN(term->tl_arg0_cmd)) == 0) in handle_settermprop()
3060 term->tl_title = NULL; in handle_settermprop()
3063 term->tl_title = NULL; in handle_settermprop()
3076 ret, length, (char**)&term->tl_title, in handle_settermprop()
3084 term->tl_title = strval; in handle_settermprop()
3087 VIM_CLEAR(term->tl_status_text); in handle_settermprop()
3088 if (term == curbuf->b_term) in handle_settermprop()
3093 term->tl_cursor_visible = value->boolean; in handle_settermprop()
3094 may_toggle_cursor(term); in handle_settermprop()
3099 term->tl_cursor_blink = value->boolean; in handle_settermprop()
3100 may_set_cursor_props(term); in handle_settermprop()
3104 term->tl_cursor_shape = value->number; in handle_settermprop()
3105 may_set_cursor_props(term); in handle_settermprop()
3113 cursor_color_copy(&term->tl_cursor_color, strval); in handle_settermprop()
3114 may_set_cursor_props(term); in handle_settermprop()
3119 term->tl_using_altscreen = value->boolean; in handle_settermprop()
3137 term_T *term = (term_T *)user; in handle_resize() local
3140 term->tl_rows = rows; in handle_resize()
3141 term->tl_cols = cols; in handle_resize()
3142 if (term->tl_vterm_size_changed) in handle_resize()
3144 term->tl_vterm_size_changed = FALSE; in handle_resize()
3149 if (wp->w_buffer == term->tl_buffer) in handle_resize()
3155 redraw_buf_later(term->tl_buffer, NOT_VALID); in handle_resize()
3167 limit_scrollback(term_T *term, garray_T *gap, int update_buffer) in limit_scrollback() argument
3169 if (gap->ga_len >= term->tl_buffer->b_p_twsl) in limit_scrollback()
3171 int todo = term->tl_buffer->b_p_twsl / 10; in limit_scrollback()
3174 curbuf = term->tl_buffer; in limit_scrollback()
3188 term->tl_scrollback_scrolled -= todo; in limit_scrollback()
3198 term_T *term = (term_T *)user; in handle_pushline() local
3202 if (term->tl_normal_mode) in handle_pushline()
3206 gap = &term->tl_scrollback_postponed; in handle_pushline()
3213 cleanup_scrollback(term); in handle_pushline()
3214 gap = &term->tl_scrollback; in handle_pushline()
3218 limit_scrollback(term, gap, update_buffer); in handle_pushline()
3231 cellattr_T fill_attr = term->tl_default_color; in handle_pushline()
3273 add_scrollback_line_to_buffer(term, text, text_len); in handle_pushline()
3282 ++term->tl_scrollback_scrolled; in handle_pushline()
3300 handle_postponed_scrollback(term_T *term) in handle_postponed_scrollback() argument
3304 if (term->tl_scrollback_postponed.ga_len == 0) in handle_postponed_scrollback()
3310 cleanup_scrollback(term); in handle_postponed_scrollback()
3312 for (i = 0; i < term->tl_scrollback_postponed.ga_len; ++i) in handle_postponed_scrollback()
3318 if (ga_grow(&term->tl_scrollback, 1) == FAIL) in handle_postponed_scrollback()
3320 pp_line = (sb_line_T *)term->tl_scrollback_postponed.ga_data + i; in handle_postponed_scrollback()
3325 add_scrollback_line_to_buffer(term, text, (int)STRLEN(text)); in handle_postponed_scrollback()
3328 line = (sb_line_T *)term->tl_scrollback.ga_data in handle_postponed_scrollback()
3329 + term->tl_scrollback.ga_len; in handle_postponed_scrollback()
3334 ++term->tl_scrollback_scrolled; in handle_postponed_scrollback()
3335 ++term->tl_scrollback.ga_len; in handle_postponed_scrollback()
3338 ga_clear(&term->tl_scrollback_postponed); in handle_postponed_scrollback()
3339 limit_scrollback(term, &term->tl_scrollback, TRUE); in handle_postponed_scrollback()
3359 term_after_channel_closed(term_T *term) in term_after_channel_closed() argument
3362 if (!term->tl_normal_mode) in term_after_channel_closed()
3364 int fnum = term->tl_buffer->b_fnum; in term_after_channel_closed()
3366 cleanup_vterm(term); in term_after_channel_closed()
3368 if (term->tl_finish == TL_FINISH_CLOSE) in term_after_channel_closed()
3371 int do_set_w_closing = term->tl_buffer->b_nwindows == 0; in term_after_channel_closed()
3377 if (popup_is_popup(curwin) && curbuf == term->tl_buffer) in term_after_channel_closed()
3386 if (term->tl_buffer->b_nwindows > 0 && only_one_window()) in term_after_channel_closed()
3397 aucmd_prepbuf(&aco, term->tl_buffer); in term_after_channel_closed()
3413 if (term->tl_finish == TL_FINISH_OPEN in term_after_channel_closed()
3414 && term->tl_buffer->b_nwindows == 0) in term_after_channel_closed()
3416 char *cmd = term->tl_opencmd == NULL in term_after_channel_closed()
3418 : (char *)term->tl_opencmd; in term_after_channel_closed()
3434 redraw_buf_and_status_later(term->tl_buffer, NOT_VALID); in term_after_channel_closed()
3468 term_T *term; in term_channel_closed() local
3472 for (term = first_term; term != NULL; term = next_term) in term_channel_closed()
3474 next_term = term->tl_next; in term_channel_closed()
3475 if (term->tl_job == ch->ch_job && !term->tl_channel_closed) in term_channel_closed()
3477 term->tl_channel_closed = TRUE; in term_channel_closed()
3480 VIM_CLEAR(term->tl_title); in term_channel_closed()
3481 VIM_CLEAR(term->tl_status_text); in term_channel_closed()
3483 if (term->tl_out_fd != NULL) in term_channel_closed()
3485 fclose(term->tl_out_fd); in term_channel_closed()
3486 term->tl_out_fd = NULL; in term_channel_closed()
3494 term->tl_channel_recently_closed = TRUE; in term_channel_closed()
3498 if (term_after_channel_closed(term)) in term_channel_closed()
3511 term = curbuf->b_term; in term_channel_closed()
3512 if (term != NULL) in term_channel_closed()
3514 if (term->tl_job == ch->ch_job) in term_channel_closed()
3516 update_cursor(term, term->tl_cursor_visible); in term_channel_closed()
3528 term_T *term; in term_check_channel_closed_recently() local
3531 for (term = first_term; term != NULL; term = next_term) in term_check_channel_closed_recently()
3533 next_term = term->tl_next; in term_check_channel_closed_recently()
3534 if (term->tl_channel_recently_closed) in term_check_channel_closed_recently()
3536 term->tl_channel_recently_closed = FALSE; in term_check_channel_closed_recently()
3537 if (term_after_channel_closed(term)) in term_check_channel_closed_recently()
3550 term_T *term, in term_line2screenline() argument
3620 ScreenAttrs[off] = cell2attr(term, wp, &cell.attrs, &cell.fg, in term_line2screenline()
3650 update_system_term(term_T *term) in update_system_term() argument
3655 if (term->tl_vterm == NULL) in update_system_term()
3657 screen = vterm_obtain_screen(term->tl_vterm); in update_system_term()
3660 while (term->tl_toprow > 0 in update_system_term()
3661 && (Rows - term->tl_toprow) < term->tl_dirty_row_end) in update_system_term()
3669 --term->tl_toprow; in update_system_term()
3672 for (pos.row = term->tl_dirty_row_start; pos.row < term->tl_dirty_row_end in update_system_term()
3675 if (pos.row < term->tl_rows) in update_system_term()
3677 int max_col = MIN(Columns, term->tl_cols); in update_system_term()
3679 term_line2screenline(term, NULL, screen, &pos, max_col); in update_system_term()
3684 screen_line(term->tl_toprow + pos.row, 0, pos.col, Columns, 0); in update_system_term()
3687 term->tl_dirty_row_start = MAX_ROW; in update_system_term()
3688 term->tl_dirty_row_end = 0; in update_system_term()
3700 term_T *term = wp->w_buffer->b_term; in term_do_update_window() local
3702 return term != NULL && term->tl_vterm != NULL && !term->tl_normal_mode; in term_do_update_window()
3711 term_T *term = wp->w_buffer->b_term; in term_update_window() local
3721 vterm = term->tl_vterm; in term_update_window()
3729 term->tl_dirty_row_start = 0; in term_update_window()
3730 term->tl_dirty_row_end = MAX_ROW; in term_update_window()
3732 if (term->tl_postponed_scroll > 0 in term_update_window()
3733 && term->tl_postponed_scroll < term->tl_rows / 3) in term_update_window()
3736 term_scroll_up(term, 0, term->tl_postponed_scroll); in term_update_window()
3737 term->tl_postponed_scroll = 0; in term_update_window()
3755 if (wwp->w_buffer == term->tl_buffer) in term_update_window()
3773 if (term->tl_rows != newrows || term->tl_cols != newcols) in term_update_window()
3775 term->tl_vterm_size_changed = TRUE; in term_update_window()
3777 ch_log(term->tl_job->jv_channel, "Resizing terminal to %d lines", in term_update_window()
3779 term_report_winsize(term, newrows, newcols); in term_update_window()
3783 if (term != in_terminal_loop) in term_update_window()
3784 may_move_terminal_to_buffer(term, FALSE); in term_update_window()
3791 for (pos.row = term->tl_dirty_row_start; pos.row < term->tl_dirty_row_end in term_update_window()
3794 if (pos.row < term->tl_rows) in term_update_window()
3796 int max_col = MIN(wp->w_width, term->tl_cols); in term_update_window()
3798 term_line2screenline(term, wp, screen, &pos, max_col); in term_update_window()
3813 term->tl_dirty_row_start = MAX_ROW; in term_update_window()
3814 term->tl_dirty_row_end = 0; in term_update_window()
3833 term_T *term = buf->b_term; in term_show_buffer() local
3835 return term != NULL && (term->tl_vterm == NULL || term->tl_normal_mode); in term_show_buffer()
3845 term_T *term = curbuf->b_term; in term_change_in_curbuf() local
3847 if (term_is_finished(curbuf) && term->tl_scrollback.ga_len > 0) in term_change_in_curbuf()
3849 free_scrollback(term); in term_change_in_curbuf()
3850 redraw_buf_later(term->tl_buffer, NOT_VALID); in term_change_in_curbuf()
3867 term_T *term = buf->b_term; in term_get_attr() local
3871 if (lnum > term->tl_scrollback.ga_len) in term_get_attr()
3872 cellattr = &term->tl_default_color; in term_get_attr()
3875 line = (sb_line_T *)term->tl_scrollback.ga_data + lnum - 1; in term_get_attr()
3881 return cell2attr(term, wp, &cellattr->attrs, &cellattr->fg, &cellattr->bg); in term_get_attr()
4026 init_default_colors(term_T *term) in init_default_colors() argument
4032 CLEAR_FIELD(term->tl_default_color.attrs); in init_default_colors()
4033 term->tl_default_color.width = 1; in init_default_colors()
4034 fg = &term->tl_default_color.fg; in init_default_colors()
4035 bg = &term->tl_default_color.bg; in init_default_colors()
4055 id = term_get_highlight_id(term, NULL); in init_default_colors()
4272 handle_call_command(term_T *term, channel_T *channel, listitem_T *item) in handle_call_command() argument
4286 if (!is_permitted_term_api(func, term->tl_api)) in handle_call_command()
4293 argvars[0].vval.v_number = term->tl_buffer->b_fnum; in handle_call_command()
4382 term_T *term = (term_T *)user; in parse_osc() local
4385 channel_T *channel = term->tl_job == NULL ? NULL in parse_osc()
4386 : term->tl_job->jv_channel; in parse_osc()
4387 garray_T *gap = &term->tl_osc_buf; in parse_osc()
4428 ++term->tl_buffer->b_locked; in parse_osc()
4436 handle_call_command(term, channel, item); in parse_osc()
4439 --term->tl_buffer->b_locked; in parse_osc()
4463 term_T *term = (term_T *)user; in parse_csi() local
4483 if (wp->w_buffer == term->tl_buffer) in parse_csi()
4504 channel_send(term->tl_job->jv_channel, get_tty_part(term), in parse_csi()
4542 create_vterm(term_T *term, int rows, int cols) in create_vterm() argument
4550 term->tl_vterm = vterm; in create_vterm()
4563 vterm_screen_set_callbacks(screen, &screen_callbacks, term); in create_vterm()
4567 init_default_colors(term); in create_vterm()
4571 &term->tl_default_color.fg, in create_vterm()
4572 &term->tl_default_color.bg); in create_vterm()
4597 vterm_state_set_unrecognised_fallbacks(state, &state_fallbacks, term); in create_vterm()
4609 term_T *term; in term_update_colors_all() local
4611 FOR_ALL_TERMS(term) in term_update_colors_all()
4613 if (term->tl_vterm == NULL) in term_update_colors_all()
4615 init_default_colors(term); in term_update_colors_all()
4617 vterm_obtain_state(term->tl_vterm), in term_update_colors_all()
4618 &term->tl_default_color.fg, in term_update_colors_all()
4619 &term->tl_default_color.bg); in term_update_colors_all()
4627 term_get_status_text(term_T *term) in term_get_status_text() argument
4629 if (term->tl_status_text == NULL) in term_get_status_text()
4635 if (term->tl_normal_mode) in term_get_status_text()
4637 if (term_job_running(term)) in term_get_status_text()
4642 else if (term->tl_title != NULL) in term_get_status_text()
4643 txt = term->tl_title; in term_get_status_text()
4644 else if (term_none_open(term)) in term_get_status_text()
4646 else if (term_job_running(term)) in term_get_status_text()
4650 fname = buf_get_fname(term->tl_buffer); in term_get_status_text()
4652 term->tl_status_text = alloc(len); in term_get_status_text()
4653 if (term->tl_status_text != NULL) in term_get_status_text()
4654 vim_snprintf((char *)term->tl_status_text, len, "%s [%s]", in term_get_status_text()
4657 return term->tl_status_text; in term_get_status_text()
4664 term_clear_status_text(term_T *term) in term_clear_status_text() argument
4666 VIM_CLEAR(term->tl_status_text); in term_clear_status_text()
4676 term_T *term; in set_ref_in_term() local
4679 for (term = first_term; !abort && term != NULL; term = term->tl_next) in set_ref_in_term()
4680 if (term->tl_job != NULL) in set_ref_in_term()
4683 tv.vval.v_job = term->tl_job; in set_ref_in_term()
4763 term_T *term; in f_term_dumpwrite() local
4787 term = buf->b_term; in f_term_dumpwrite()
4788 if (term->tl_vterm == NULL) in f_term_dumpwrite()
4828 screen = vterm_obtain_screen(term->tl_vterm); in f_term_dumpwrite()
4829 state = vterm_obtain_state(term->tl_vterm); in f_term_dumpwrite()
4833 && pos.row < term->tl_rows; ++pos.row) in f_term_dumpwrite()
4838 && pos.col < term->tl_cols; ++pos.col) in f_term_dumpwrite()
4989 term_T *term = curbuf->b_term; in read_dump_file() local
4991 int start_row = term->tl_scrollback.ga_len; in read_dump_file()
5015 if (ga_grow(&term->tl_scrollback, 1) == OK) in read_dump_file()
5017 sb_line_T *line = (sb_line_T *)term->tl_scrollback.ga_data in read_dump_file()
5018 + term->tl_scrollback.ga_len; in read_dump_file()
5024 line->sb_fill_attr = term->tl_default_color; in read_dump_file()
5025 ++term->tl_scrollback.ga_len; in read_dump_file()
5046 cursor_pos->row = term->tl_scrollback.ga_len - start_row; in read_dump_file()
5361 term_T *term = buf->b_term; in term_load_dump() local
5367 init_default_colors(term); in term_load_dump()
5388 term->tl_top_diff_rows = curbuf->b_ml.ml_line_count; in term_load_dump()
5393 if (add_empty_scrollback(term, &term->tl_default_color, 0) == OK) in term_load_dump()
5400 if (add_empty_scrollback(term, &term->tl_default_color, 0) == OK) in term_load_dump()
5415 term->tl_bot_diff_rows = curbuf->b_ml.ml_line_count - bot_lnum; in term_load_dump()
5417 for (lnum = 1; lnum <= term->tl_top_diff_rows; ++lnum) in term_load_dump()
5432 sb_line_T *sb_line = (sb_line_T *)term->tl_scrollback.ga_data; in term_load_dump()
5505 if (add_empty_scrollback(term, &term->tl_default_color, in term_load_dump()
5506 term->tl_top_diff_rows) == OK) in term_load_dump()
5507 ml_append(term->tl_top_diff_rows + lnum, textline, 0, FALSE); in term_load_dump()
5516 if (add_empty_scrollback(term, &term->tl_default_color, in term_load_dump()
5517 term->tl_top_diff_rows) == OK) in term_load_dump()
5518 ml_append(term->tl_top_diff_rows + lnum, textline, 0, FALSE); in term_load_dump()
5523 term->tl_cols = width; in term_load_dump()
5545 term_T *term = curbuf->b_term; in term_swap_diff() local
5554 if (term == NULL in term_swap_diff()
5556 || term->tl_top_diff_rows == 0 in term_swap_diff()
5557 || term->tl_scrollback.ga_len == 0) in term_swap_diff()
5561 top_rows = term->tl_top_diff_rows; in term_swap_diff()
5562 bot_rows = term->tl_bot_diff_rows; in term_swap_diff()
5564 sb_line = (sb_line_T *)term->tl_scrollback.ga_data; in term_swap_diff()
5618 size_t size = sizeof(sb_line_T) * term->tl_scrollback.ga_len; in term_swap_diff()
5624 mch_memmove(temp, term->tl_scrollback.ga_data, size); in term_swap_diff()
5625 mch_memmove(term->tl_scrollback.ga_data, in term_swap_diff()
5628 mch_memmove((sb_line_T *)term->tl_scrollback.ga_data + bot_rows, in term_swap_diff()
5631 mch_memmove((sb_line_T *)term->tl_scrollback.ga_data in term_swap_diff()
5639 term->tl_top_diff_rows = bot_rows; in term_swap_diff()
5640 term->tl_bot_diff_rows = top_rows; in term_swap_diff()
5740 term_T *term; in f_term_getcursor() local
5753 term = buf->b_term; in f_term_getcursor()
5756 list_append_number(l, term->tl_cursor_pos.row + 1); in f_term_getcursor()
5757 list_append_number(l, term->tl_cursor_pos.col + 1); in f_term_getcursor()
5762 dict_add_number(d, "visible", term->tl_cursor_visible); in f_term_getcursor()
5764 ? !term->tl_cursor_blink : term->tl_cursor_blink); in f_term_getcursor()
5765 dict_add_number(d, "shape", term->tl_cursor_shape); in f_term_getcursor()
5766 dict_add_string(d, "color", cursor_color_get(term->tl_cursor_color)); in f_term_getcursor()
5797 get_row_number(typval_T *tv, term_T *term) in get_row_number() argument
5802 return term->tl_cursor_pos.row; in get_row_number()
5813 term_T *term; in f_term_getline() local
5826 term = buf->b_term; in f_term_getline()
5827 row = get_row_number(&argvars[1], term); in f_term_getline()
5829 if (term->tl_vterm == NULL) in f_term_getline()
5831 linenr_T lnum = row + term->tl_scrollback_scrolled + 1; in f_term_getline()
5839 VTermScreen *screen = vterm_obtain_screen(term->tl_vterm); in f_term_getline()
5844 if (row < 0 || row >= term->tl_rows) in f_term_getline()
5846 len = term->tl_cols * MB_MAXBYTES + 1; in f_term_getline()
5853 rect.end_col = term->tl_cols; in f_term_getline()
5908 term_T *term; in f_term_setsize() local
5925 term = buf->b_term; in f_term_setsize()
5927 rows = rows <= 0 ? term->tl_rows : rows; in f_term_setsize()
5929 cols = cols <= 0 ? term->tl_cols : cols; in f_term_setsize()
5930 vterm_set_size(term->tl_vterm, rows, cols); in f_term_setsize()
5934 vterm_get_size(term->tl_vterm, &term->tl_rows, &term->tl_cols); in f_term_setsize()
5935 term_report_winsize(term, term->tl_rows, term->tl_cols); in f_term_setsize()
5945 term_T *term; in f_term_getstatus() local
5956 term = buf->b_term; in f_term_getstatus()
5958 if (term_job_running(term)) in f_term_getstatus()
5962 if (term->tl_normal_mode) in f_term_getstatus()
6058 term_T *term; in f_term_scrape() local
6073 term = buf->b_term; in f_term_scrape()
6076 pos.row = get_row_number(&argvars[1], term); in f_term_scrape()
6078 if (term->tl_vterm != NULL) in f_term_scrape()
6080 screen = vterm_obtain_screen(term->tl_vterm); in f_term_scrape()
6088 linenr_T lnum = pos.row + term->tl_scrollback_scrolled; in f_term_scrape()
6090 if (lnum < 0 || lnum >= term->tl_scrollback.ga_len) in f_term_scrape()
6093 line = (sb_line_T *)term->tl_scrollback.ga_data + lnum; in f_term_scrape()
6096 for (pos.col = 0; pos.col < term->tl_cols; ) in f_term_scrape()
6158 cell2attr(term, NULL, &attrs, &fg, &bg)); in f_term_scrape()
6175 term_T *term; in f_term_sendkeys() local
6189 term = buf->b_term; in f_term_sendkeys()
6190 if (term->tl_vterm == NULL) in f_term_sendkeys()
6207 send_keys_to_term(term, c, 0, FALSE); in f_term_sendkeys()
6219 term_T *term; in f_term_getansicolors() local
6235 term = buf->b_term; in f_term_getansicolors()
6236 if (term->tl_vterm == NULL) in f_term_getansicolors()
6240 state = vterm_obtain_state(term->tl_vterm); in f_term_getansicolors()
6258 term_T *term; in f_term_setansicolors() local
6268 term = buf->b_term; in f_term_setansicolors()
6269 if (term->tl_vterm == NULL) in f_term_setansicolors()
6278 if (set_ansi_colors_list(term->tl_vterm, argvars[1].vval.v_list) == FAIL) in f_term_setansicolors()
6290 term_T *term; in f_term_setapi() local
6301 term = buf->b_term; in f_term_setapi()
6302 vim_free(term->tl_api); in f_term_setapi()
6305 term->tl_api = vim_strsave(api); in f_term_setapi()
6307 term->tl_api = NULL; in f_term_setapi()
6318 term_T *term; in f_term_setrestore() local
6329 term = buf->b_term; in f_term_setrestore()
6330 vim_free(term->tl_command); in f_term_setrestore()
6333 term->tl_command = vim_strsave(cmd); in f_term_setrestore()
6335 term->tl_command = NULL; in f_term_setrestore()
6346 term_T *term; in f_term_setkill() local
6357 term = buf->b_term; in f_term_setkill()
6358 vim_free(term->tl_kill); in f_term_setkill()
6361 term->tl_kill = vim_strsave(how); in f_term_setkill()
6363 term->tl_kill = NULL; in f_term_setkill()
6469 term_T *term; in term_send_eof() local
6471 FOR_ALL_TERMS(term) in term_send_eof()
6472 if (term->tl_job == ch->ch_job) in term_send_eof()
6474 if (term->tl_eof_chars != NULL) in term_send_eof()
6476 channel_send(ch, PART_IN, term->tl_eof_chars, in term_send_eof()
6477 (int)STRLEN(term->tl_eof_chars), NULL); in term_send_eof()
6490 term_getjob(term_T *term) in term_getjob() argument
6492 return term != NULL ? term->tl_job : NULL; in term_getjob()
6575 term_T *term, in conpty_term_and_job_init() argument
6618 term->tl_arg0_cmd = vim_strsave(cmd); in conpty_term_and_job_init()
6644 consize.X = term->tl_cols; in conpty_term_and_job_init()
6645 consize.Y = term->tl_rows; in conpty_term_and_job_init()
6647 &term->tl_conpty); in conpty_term_and_job_init()
6651 term->tl_siex.StartupInfo.cb = sizeof(term->tl_siex); in conpty_term_and_job_init()
6655 term->tl_siex.lpAttributeList = alloc(breq); in conpty_term_and_job_init()
6656 if (!term->tl_siex.lpAttributeList) in conpty_term_and_job_init()
6658 if (!pInitializeProcThreadAttributeList(term->tl_siex.lpAttributeList, 1, in conpty_term_and_job_init()
6662 term->tl_siex.lpAttributeList, 0, in conpty_term_and_job_init()
6663 PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE, term->tl_conpty, in conpty_term_and_job_init()
6694 &term->tl_siex.StartupInfo, &proc_info)) in conpty_term_and_job_init()
6730 if (create_vterm(term, term->tl_rows, term->tl_cols) == FAIL) in conpty_term_and_job_init()
6735 set_vterm_palette(term->tl_vterm, opt->jo_ansi_colors); in conpty_term_and_job_init()
6737 init_vterm_ansi_colors(term->tl_vterm); in conpty_term_and_job_init()
6749 term->tl_job = job; in conpty_term_and_job_init()
6759 term->tl_out_fd = mch_fopen((char *)fname, WRITEBIN); in conpty_term_and_job_init()
6760 if (term->tl_out_fd == NULL) in conpty_term_and_job_init()
6779 term->tl_job = NULL; in conpty_term_and_job_init()
6783 if (term->tl_siex.lpAttributeList != NULL) in conpty_term_and_job_init()
6785 pDeleteProcThreadAttributeList(term->tl_siex.lpAttributeList); in conpty_term_and_job_init()
6786 vim_free(term->tl_siex.lpAttributeList); in conpty_term_and_job_init()
6788 term->tl_siex.lpAttributeList = NULL; in conpty_term_and_job_init()
6797 if (term->tl_conpty != NULL) in conpty_term_and_job_init()
6798 pClosePseudoConsole(term->tl_conpty); in conpty_term_and_job_init()
6799 term->tl_conpty = NULL; in conpty_term_and_job_init()
6804 conpty_term_report_winsize(term_T *term, int rows, int cols) in conpty_term_report_winsize() argument
6810 pResizePseudoConsole(term->tl_conpty, consize); in conpty_term_report_winsize()
6814 term_free_conpty(term_T *term) in term_free_conpty() argument
6816 if (term->tl_siex.lpAttributeList != NULL) in term_free_conpty()
6818 pDeleteProcThreadAttributeList(term->tl_siex.lpAttributeList); in term_free_conpty()
6819 vim_free(term->tl_siex.lpAttributeList); in term_free_conpty()
6821 term->tl_siex.lpAttributeList = NULL; in term_free_conpty()
6822 if (term->tl_conpty != NULL) in term_free_conpty()
6823 pClosePseudoConsole(term->tl_conpty); in term_free_conpty()
6824 term->tl_conpty = NULL; in term_free_conpty()
6927 term_T *term, in winpty_term_and_job_init() argument
6966 term->tl_arg0_cmd = vim_strsave(cmd); in winpty_term_and_job_init()
6978 term->tl_winpty_config = winpty_config_new(0, &winpty_err); in winpty_term_and_job_init()
6979 if (term->tl_winpty_config == NULL) in winpty_term_and_job_init()
6982 winpty_config_set_mouse_mode(term->tl_winpty_config, in winpty_term_and_job_init()
6984 winpty_config_set_initial_size(term->tl_winpty_config, in winpty_term_and_job_init()
6985 term->tl_cols, term->tl_rows); in winpty_term_and_job_init()
6986 term->tl_winpty = winpty_open(term->tl_winpty_config, &winpty_err); in winpty_term_and_job_init()
6987 if (term->tl_winpty == NULL) in winpty_term_and_job_init()
7024 if (!winpty_spawn(term->tl_winpty, spawn_config, &child_process_handle, in winpty_term_and_job_init()
7030 winpty_conin_name(term->tl_winpty), in winpty_term_and_job_init()
7034 winpty_conout_name(term->tl_winpty), in winpty_term_and_job_init()
7038 winpty_conerr_name(term->tl_winpty), in winpty_term_and_job_init()
7061 if (create_vterm(term, term->tl_rows, term->tl_cols) == FAIL) in winpty_term_and_job_init()
7066 set_vterm_palette(term->tl_vterm, opt->jo_ansi_colors); in winpty_term_and_job_init()
7068 init_vterm_ansi_colors(term->tl_vterm); in winpty_term_and_job_init()
7080 (short_u *)winpty_conin_name(term->tl_winpty), NULL); in winpty_term_and_job_init()
7082 (short_u *)winpty_conout_name(term->tl_winpty), NULL); in winpty_term_and_job_init()
7085 term->tl_job = job; in winpty_term_and_job_init()
7095 term->tl_out_fd = mch_fopen((char *)fname, WRITEBIN); in winpty_term_and_job_init()
7096 if (term->tl_out_fd == NULL) in winpty_term_and_job_init()
7116 term->tl_job = NULL; in winpty_term_and_job_init()
7119 if (term->tl_winpty != NULL) in winpty_term_and_job_init()
7120 winpty_free(term->tl_winpty); in winpty_term_and_job_init()
7121 term->tl_winpty = NULL; in winpty_term_and_job_init()
7122 if (term->tl_winpty_config != NULL) in winpty_term_and_job_init()
7123 winpty_config_free(term->tl_winpty_config); in winpty_term_and_job_init()
7124 term->tl_winpty_config = NULL; in winpty_term_and_job_init()
7143 term_T *term, in term_and_job_init() argument
7186 return conpty_term_and_job_init(term, argvar, argv, opt, orig_opt); in term_and_job_init()
7189 return winpty_term_and_job_init(term, argvar, argv, opt, orig_opt); in term_and_job_init()
7196 create_pty_only(term_T *term, jobopt_T *options) in create_pty_only() argument
7203 if (create_vterm(term, term->tl_rows, term->tl_cols) == FAIL) in create_pty_only()
7229 term->tl_job = job_alloc(); in create_pty_only()
7230 if (term->tl_job == NULL) in create_pty_only()
7232 ++term->tl_job->jv_refcount; in create_pty_only()
7235 term->tl_job->jv_status = JOB_FINISHED; in create_pty_only()
7240 term->tl_job->jv_channel = channel; in create_pty_only()
7248 channel_set_job(channel, term->tl_job, options); in create_pty_only()
7249 term->tl_job->jv_tty_in = vim_strsave((char_u*)in_name); in create_pty_only()
7250 term->tl_job->jv_tty_out = vim_strsave((char_u*)out_name); in create_pty_only()
7266 term_free_vterm(term_T *term) in term_free_vterm() argument
7268 term_free_conpty(term); in term_free_vterm()
7269 if (term->tl_winpty != NULL) in term_free_vterm()
7270 winpty_free(term->tl_winpty); in term_free_vterm()
7271 term->tl_winpty = NULL; in term_free_vterm()
7272 if (term->tl_winpty_config != NULL) in term_free_vterm()
7273 winpty_config_free(term->tl_winpty_config); in term_free_vterm()
7274 term->tl_winpty_config = NULL; in term_free_vterm()
7275 if (term->tl_vterm != NULL) in term_free_vterm()
7276 vterm_free(term->tl_vterm); in term_free_vterm()
7277 term->tl_vterm = NULL; in term_free_vterm()
7284 term_report_winsize(term_T *term, int rows, int cols) in term_report_winsize() argument
7286 if (term->tl_conpty) in term_report_winsize()
7287 conpty_term_report_winsize(term, rows, cols); in term_report_winsize()
7288 if (term->tl_winpty) in term_report_winsize()
7289 winpty_set_size(term->tl_winpty, cols, rows, NULL); in term_report_winsize()
7312 term_T *term, in term_and_job_init() argument
7318 term->tl_arg0_cmd = NULL; in term_and_job_init()
7320 if (create_vterm(term, term->tl_rows, term->tl_cols) == FAIL) in term_and_job_init()
7325 set_vterm_palette(term->tl_vterm, opt->jo_ansi_colors); in term_and_job_init()
7327 init_vterm_ansi_colors(term->tl_vterm); in term_and_job_init()
7331 term->tl_job = job_start(argvar, argv, opt, &term->tl_job); in term_and_job_init()
7332 if (term->tl_job != NULL) in term_and_job_init()
7333 ++term->tl_job->jv_refcount; in term_and_job_init()
7335 return term->tl_job != NULL in term_and_job_init()
7336 && term->tl_job->jv_channel != NULL in term_and_job_init()
7337 && term->tl_job->jv_status != JOB_FAILED ? OK : FAIL; in term_and_job_init()
7341 create_pty_only(term_T *term, jobopt_T *opt) in create_pty_only() argument
7343 if (create_vterm(term, term->tl_rows, term->tl_cols) == FAIL) in create_pty_only()
7346 term->tl_job = job_alloc(); in create_pty_only()
7347 if (term->tl_job == NULL) in create_pty_only()
7349 ++term->tl_job->jv_refcount; in create_pty_only()
7352 term->tl_job->jv_status = JOB_FINISHED; in create_pty_only()
7354 return mch_create_pty_channel(term->tl_job, opt); in create_pty_only()
7361 term_free_vterm(term_T *term) in term_free_vterm() argument
7363 if (term->tl_vterm != NULL) in term_free_vterm()
7364 vterm_free(term->tl_vterm); in term_free_vterm()
7365 term->tl_vterm = NULL; in term_free_vterm()
7372 term_report_winsize(term_T *term, int rows, int cols) in term_report_winsize() argument
7375 if (term->tl_job != NULL && term->tl_job->jv_channel != NULL) in term_report_winsize()
7382 fd = term->tl_job->jv_channel->ch_part[part].ch_fd; in term_report_winsize()
7387 mch_signal_job(term->tl_job, (char_u *)"winch"); in term_report_winsize()