diff --git a/src/auto/configure b/src/auto/configure index e5f43d38d..acca22032 100755 --- a/src/auto/configure +++ b/src/auto/configure @@ -7423,49 +7423,6 @@ if test "$enable_channel" = "yes"; then fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-terminal argument" >&5 -$as_echo_n "checking --enable-terminal argument... " >&6; } -# Check whether --enable-terminal was given. -if test "${enable_terminal+set}" = set; then : - enableval=$enable_terminal; -else - enable_terminal="auto" -fi - -if test "$enable_terminal" = "yes" || test "$enable_terminal" = "auto" -a "x$features" = "xhuge" ; then - if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot use terminal emulator with tiny or small features" >&5 -$as_echo "cannot use terminal emulator with tiny or small features" >&6; } - enable_terminal="no" - else - if test "$enable_terminal" = "auto"; then - enable_terminal="yes" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: defaulting to yes" >&5 -$as_echo "defaulting to yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - fi - fi -else - if test "$enable_terminal" = "auto"; then - enable_terminal="no" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: defaulting to no" >&5 -$as_echo "defaulting to no" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi -fi -if test "$enable_terminal" = "yes" -a "$enable_channel" = "yes"; then - $as_echo "#define FEAT_TERMINAL 1" >>confdefs.h - - TERM_SRC="libvterm/src/encoding.c libvterm/src/keyboard.c libvterm/src/mouse.c libvterm/src/parser.c libvterm/src/pen.c libvterm/src/termscreen.c libvterm/src/state.c libvterm/src/unicode.c libvterm/src/vterm.c" - - TERM_OBJ="objects/encoding.o objects/keyboard.o objects/mouse.o objects/parser.o objects/pen.o objects/termscreen.o objects/state.o objects/unicode.o objects/vterm.o" - -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-autoservername argument" >&5 $as_echo_n "checking --enable-autoservername argument... " >&6; } # Check whether --enable-autoservername was given. diff --git a/src/buffer.c b/src/buffer.c index 1ac93fc02..c14d7b75d 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -450,36 +450,6 @@ void close_buffer( else if (buf->b_p_bh[0] == 'u') /* 'bufhidden' == "unload" */ unload_buf = TRUE; -#ifdef FEAT_TERMINAL - if (bt_terminal(buf) && (buf->b_nwindows == 1 || del_buf)) - { - if (term_job_running(buf->b_term)) - { - if (wipe_buf || unload_buf) - { - if (!can_unload_buffer(buf)) - return; - - /* Wiping out or unloading a terminal buffer kills the job. */ - free_terminal(buf); - } - else - { - /* The job keeps running, hide the buffer. */ - del_buf = FALSE; - unload_buf = FALSE; - } - } - else - { - /* A terminal buffer is wiped out if the job has finished. */ - del_buf = TRUE; - unload_buf = TRUE; - wipe_buf = TRUE; - } - } -#endif - /* Disallow deleting the buffer when it is locked (already being closed or * halfway a command that relies on it). Unloading is allowed. */ if ((del_buf || wipe_buf) && !can_unload_buffer(buf)) @@ -795,9 +765,6 @@ free_buffer(buf_T *buf) #ifdef FEAT_JOB_CHANNEL channel_buffer_free(buf); #endif -#ifdef FEAT_TERMINAL - free_terminal(buf); -#endif #ifdef FEAT_JOB_CHANNEL vim_free(buf->b_prompt_text); free_callback(&buf->b_prompt_callback); @@ -1538,7 +1505,8 @@ void set_curbuf(buf_T *buf, int action) if (prevbuf == curbuf) u_sync(FALSE); close_buffer(prevbuf == curwin->w_buffer ? curwin : NULL, prevbuf, - unload ? action : (action == DOBUF_GOTO && !buf_hide(prevbuf) && !bufIsChanged(prevbuf)) ? DOBUF_UNLOAD : 0, FALSE); + unload ? action : (action == DOBUF_GOTO && !buf_hide(prevbuf) && !bufIsChanged(prevbuf)) ? DOBUF_UNLOAD : 0, + FALSE); if (curwin != previouswin && win_valid(previouswin)) /* autocommands changed curwin, Grr! */ curwin = previouswin; @@ -1660,22 +1628,12 @@ void do_autochdir(void) void no_write_message(void) { -#ifdef FEAT_TERMINAL - if (term_job_running(curbuf->b_term)) - emsg(_("E948: Job still running (add ! to end the job)")); - else -#endif - emsg(_("E37: No write since last change (add ! to override)")); + emsg(_("E37: No write since last change (add ! to override)")); } void no_write_message_nobang(buf_T *buf UNUSED) { -#ifdef FEAT_TERMINAL - if (term_job_running(buf->b_term)) - emsg(_("E948: Job still running")); - else -#endif - emsg(_("E37: No write since last change")); + emsg(_("E37: No write since last change")); } /* @@ -2753,23 +2711,11 @@ void buflist_list(exarg_T *eap) int i; int ro_char; int changed_char; -#ifdef FEAT_TERMINAL - int job_running; - int job_none_open; -#endif for (buf = firstbuf; buf != NULL && !got_int; buf = buf->b_next) { -#ifdef FEAT_TERMINAL - job_running = term_job_running(buf->b_term); - job_none_open = job_running && term_none_open(buf->b_term); -#endif /* skip unlisted buffers, unless ! was used */ - if ((!buf->b_p_bl && !eap->forceit && !vim_strchr(eap->arg, 'u')) || (vim_strchr(eap->arg, 'u') && buf->b_p_bl) || (vim_strchr(eap->arg, '+') && ((buf->b_flags & BF_READERR) || !bufIsChanged(buf))) || (vim_strchr(eap->arg, 'a') && (buf->b_ml.ml_mfp == NULL || buf->b_nwindows == 0)) || (vim_strchr(eap->arg, 'h') && (buf->b_ml.ml_mfp == NULL || buf->b_nwindows != 0)) -#ifdef FEAT_TERMINAL - || (vim_strchr(eap->arg, 'R') && (!job_running || (job_running && job_none_open))) || (vim_strchr(eap->arg, '?') && (!job_running || (job_running && !job_none_open))) || (vim_strchr(eap->arg, 'F') && (job_running || buf->b_term == NULL)) -#endif - || (vim_strchr(eap->arg, '-') && buf->b_p_ma) || (vim_strchr(eap->arg, '=') && !buf->b_p_ro) || (vim_strchr(eap->arg, 'x') && !(buf->b_flags & BF_READERR)) || (vim_strchr(eap->arg, '%') && buf != curbuf) || (vim_strchr(eap->arg, '#') && (buf == curbuf || curwin->w_alt_fnum != buf->b_fnum))) + if ((!buf->b_p_bl && !eap->forceit && !vim_strchr(eap->arg, 'u')) || (vim_strchr(eap->arg, 'u') && buf->b_p_bl) || (vim_strchr(eap->arg, '+') && ((buf->b_flags & BF_READERR) || !bufIsChanged(buf))) || (vim_strchr(eap->arg, 'a') && (buf->b_ml.ml_mfp == NULL || buf->b_nwindows == 0)) || (vim_strchr(eap->arg, 'h') && (buf->b_ml.ml_mfp == NULL || buf->b_nwindows != 0)) || (vim_strchr(eap->arg, '-') && buf->b_p_ma) || (vim_strchr(eap->arg, '=') && !buf->b_p_ro) || (vim_strchr(eap->arg, 'x') && !(buf->b_flags & BF_READERR)) || (vim_strchr(eap->arg, '%') && buf != curbuf) || (vim_strchr(eap->arg, '#') && (buf == curbuf || curwin->w_alt_fnum != buf->b_fnum))) continue; if (buf_spname(buf) != NULL) vim_strncpy(NameBuff, buf_spname(buf), MAXPATHL - 1); @@ -2780,21 +2726,8 @@ void buflist_list(exarg_T *eap) changed_char = (buf->b_flags & BF_READERR) ? 'x' : (bufIsChanged(buf) ? '+' : ' '); -#ifdef FEAT_TERMINAL - if (term_job_running(buf->b_term)) - { - if (term_none_open(buf->b_term)) - ro_char = '?'; - else - ro_char = 'R'; - changed_char = ' '; /* bufIsChanged() returns TRUE to avoid - * closing, but it's not actually changed. */ - } - else if (buf->b_term != NULL) - ro_char = 'F'; - else -#endif - ro_char = !buf->b_p_ma ? '-' : (buf->b_p_ro ? '=' : ' '); + + ro_char = !buf->b_p_ma ? '-' : (buf->b_p_ro ? '=' : ' '); msg_T *msg = msg2_create(MSG_INFO); @@ -4089,9 +4022,6 @@ void write_viminfo_bufferlist(FILE *fp) if (buf->b_fname == NULL || !buf->b_p_bl #ifdef FEAT_QUICKFIX || bt_quickfix(buf) -#endif -#ifdef FEAT_TERMINAL - || bt_terminal(buf) #endif || removable(buf->b_ffname)) continue; @@ -4127,16 +4057,6 @@ int bt_quickfix(buf_T *buf) } #endif -#if defined(FEAT_TERMINAL) || defined(PROTO) -/* - * Return TRUE if "buf" is a terminal buffer. - */ -int bt_terminal(buf_T *buf) -{ - return buf != NULL && buf->b_p_bt[0] == 't'; -} -#endif - /* * Return TRUE if "buf" is a help buffer. */ @@ -4235,10 +4155,6 @@ buf_spname(buf_T *buf) * contains the name as specified by the user. */ if (bt_nofile(buf)) { -#ifdef FEAT_TERMINAL - if (buf->b_term != NULL) - return term_get_status_text(buf->b_term); -#endif if (buf->b_fname != NULL) return buf->b_fname; #ifdef FEAT_JOB_CHANNEL diff --git a/src/channel.c b/src/channel.c index fe1f64bad..5e1f66768 100644 --- a/src/channel.c +++ b/src/channel.c @@ -1270,12 +1270,6 @@ channel_write_in(channel_T *channel) in_part->ch_buf_top = lnum; if (lnum > buf->b_ml.ml_line_count || lnum > in_part->ch_buf_bot) { -#if defined(FEAT_TERMINAL) - /* Send CTRL-D or "eof_chars" to close stdin on MS-Windows. */ - if (channel->ch_job != NULL) - term_send_eof(channel); -#endif - /* Writing is done, no longer need the buffer. */ in_part->ch_bufref.br_buf = NULL; ch_log(channel, "Finished writing all lines to channel"); @@ -2468,12 +2462,7 @@ may_invoke_callback(channel_T *channel, ch_part_T part) msg = json_encode(listtv, ch_mode); if (msg != NULL) { -#ifdef FEAT_TERMINAL - if (buffer->b_term != NULL) - write_to_term(buffer, msg, channel); - else -#endif - append_to_buffer(buffer, msg, channel, part); + append_to_buffer(buffer, msg, channel, part); } } @@ -2731,10 +2720,6 @@ void channel_close(channel_T *channel, int invoke_close_cb) } channel->ch_nb_close_cb = NULL; - -#ifdef FEAT_TERMINAL - term_channel_closed(channel); -#endif } /* @@ -4470,138 +4455,6 @@ int get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) return FAIL; } } -#ifdef FEAT_TERMINAL - else if (STRCMP(hi->hi_key, "term_name") == 0) - { - if (!(supported2 & JO2_TERM_NAME)) - break; - opt->jo_set2 |= JO2_TERM_NAME; - opt->jo_term_name = tv_get_string_chk(item); - if (opt->jo_term_name == NULL) - { - semsg(_(e_invargval), "term_name"); - return FAIL; - } - } - else if (STRCMP(hi->hi_key, "term_finish") == 0) - { - if (!(supported2 & JO2_TERM_FINISH)) - break; - val = tv_get_string(item); - if (STRCMP(val, "open") != 0 && STRCMP(val, "close") != 0) - { - semsg(_(e_invargNval), "term_finish", val); - return FAIL; - } - opt->jo_set2 |= JO2_TERM_FINISH; - opt->jo_term_finish = *val; - } - else if (STRCMP(hi->hi_key, "term_opencmd") == 0) - { - char_u *p; - - if (!(supported2 & JO2_TERM_OPENCMD)) - break; - opt->jo_set2 |= JO2_TERM_OPENCMD; - p = opt->jo_term_opencmd = tv_get_string_chk(item); - if (p != NULL) - { - /* Must have %d and no other %. */ - p = vim_strchr(p, '%'); - if (p != NULL && (p[1] != 'd' || vim_strchr(p + 2, '%') != NULL)) - p = NULL; - } - if (p == NULL) - { - semsg(_(e_invargval), "term_opencmd"); - return FAIL; - } - } - else if (STRCMP(hi->hi_key, "eof_chars") == 0) - { - char_u *p; - - if (!(supported2 & JO2_EOF_CHARS)) - break; - opt->jo_set2 |= JO2_EOF_CHARS; - p = opt->jo_eof_chars = tv_get_string_chk(item); - if (p == NULL) - { - semsg(_(e_invargval), "eof_chars"); - return FAIL; - } - } - else if (STRCMP(hi->hi_key, "term_rows") == 0) - { - if (!(supported2 & JO2_TERM_ROWS)) - break; - opt->jo_set2 |= JO2_TERM_ROWS; - opt->jo_term_rows = tv_get_number(item); - } - else if (STRCMP(hi->hi_key, "term_cols") == 0) - { - if (!(supported2 & JO2_TERM_COLS)) - break; - opt->jo_set2 |= JO2_TERM_COLS; - opt->jo_term_cols = tv_get_number(item); - } - else if (STRCMP(hi->hi_key, "vertical") == 0) - { - if (!(supported2 & JO2_VERTICAL)) - break; - opt->jo_set2 |= JO2_VERTICAL; - opt->jo_vertical = tv_get_number(item); - } - else if (STRCMP(hi->hi_key, "curwin") == 0) - { - if (!(supported2 & JO2_CURWIN)) - break; - opt->jo_set2 |= JO2_CURWIN; - opt->jo_curwin = tv_get_number(item); - } - else if (STRCMP(hi->hi_key, "hidden") == 0) - { - if (!(supported2 & JO2_HIDDEN)) - break; - opt->jo_set2 |= JO2_HIDDEN; - opt->jo_hidden = tv_get_number(item); - } - else if (STRCMP(hi->hi_key, "norestore") == 0) - { - if (!(supported2 & JO2_NORESTORE)) - break; - opt->jo_set2 |= JO2_NORESTORE; - opt->jo_term_norestore = tv_get_number(item); - } - else if (STRCMP(hi->hi_key, "term_kill") == 0) - { - if (!(supported2 & JO2_TERM_KILL)) - break; - opt->jo_set2 |= JO2_TERM_KILL; - opt->jo_term_kill = tv_get_string_chk(item); - } - else if (STRCMP(hi->hi_key, "tty_type") == 0) - { - char_u *p; - - if (!(supported2 & JO2_TTY_TYPE)) - break; - opt->jo_set2 |= JO2_TTY_TYPE; - p = tv_get_string_chk(item); - if (p == NULL) - { - semsg(_(e_invargval), "tty_type"); - return FAIL; - } - // Allow empty string, "winpty", "conpty". - if (!(*p == NUL || STRCMP(p, "winpty") == 0 || STRCMP(p, "conpty") == 0)) - { - semsg(_(e_invargval), "tty_type"); - return FAIL; - } - opt->jo_tty_type = p[0]; - } -#endif else if (STRCMP(hi->hi_key, "env") == 0) { if (!(supported2 & JO2_ENV)) @@ -4857,10 +4710,6 @@ void job_free_all(void) while (first_job != NULL) job_free(first_job); free_jobs_to_free_later(); - -#ifdef FEAT_TERMINAL - free_unused_terminals(); -#endif } #endif diff --git a/src/config.h.in b/src/config.h.in index fe7dd7960..11131de1e 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -429,9 +429,6 @@ /* Define if you want to include process communication. */ #undef FEAT_JOB_CHANNEL -/* Define if you want to include terminal emulator support. */ -#undef FEAT_TERMINAL - // Define default global runtime path. #undef RUNTIME_GLOBAL diff --git a/src/configure.ac b/src/configure.ac index 8c741b8a5..987b53e70 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -1927,38 +1927,6 @@ if test "$enable_channel" = "yes"; then AC_SUBST(CHANNEL_OBJ) fi -AC_MSG_CHECKING(--enable-terminal argument) -AC_ARG_ENABLE(terminal, - [ --enable-terminal Enable terminal emulation support.], - , [enable_terminal="auto"]) -if test "$enable_terminal" = "yes" || test "$enable_terminal" = "auto" -a "x$features" = "xhuge" ; then - if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then - AC_MSG_RESULT([cannot use terminal emulator with tiny or small features]) - enable_terminal="no" - else - if test "$enable_terminal" = "auto"; then - enable_terminal="yes" - AC_MSG_RESULT(defaulting to yes) - else - AC_MSG_RESULT(yes) - fi - fi -else - if test "$enable_terminal" = "auto"; then - enable_terminal="no" - AC_MSG_RESULT(defaulting to no) - else - AC_MSG_RESULT(no) - fi -fi -if test "$enable_terminal" = "yes" -a "$enable_channel" = "yes"; then - AC_DEFINE(FEAT_TERMINAL) - TERM_SRC="libvterm/src/encoding.c libvterm/src/keyboard.c libvterm/src/mouse.c libvterm/src/parser.c libvterm/src/pen.c libvterm/src/termscreen.c libvterm/src/state.c libvterm/src/unicode.c libvterm/src/vterm.c" - AC_SUBST(TERM_SRC) - TERM_OBJ="objects/encoding.o objects/keyboard.o objects/mouse.o objects/parser.o objects/pen.o objects/termscreen.o objects/state.o objects/unicode.o objects/vterm.o" - AC_SUBST(TERM_OBJ) -fi - AC_MSG_CHECKING(--enable-autoservername argument) AC_ARG_ENABLE(autoservername, [ --enable-autoservername Automatically define servername at vim startup.], , diff --git a/src/edit.c b/src/edit.c index 13caa2b52..b8bfea7d2 100644 --- a/src/edit.c +++ b/src/edit.c @@ -4761,7 +4761,8 @@ static void ins_insert(int replaceState) set_vim_var_string(VV_INSERTMODE, (char_u *)((State & REPLACE_FLAG) ? "i" - : replaceState == VREPLACE ? "v" : "r"), + : replaceState == VREPLACE ? "v" + : "r"), 1); #endif ins_apply_autocmds(EVENT_INSERTCHANGE); diff --git a/src/eval.c b/src/eval.c index 858483056..4d037eaeb 100644 --- a/src/eval.c +++ b/src/eval.c @@ -5532,10 +5532,6 @@ int garbage_collect(int testing) abort = abort || set_ref_in_quickfix(copyID); #endif -#ifdef FEAT_TERMINAL - abort = abort || set_ref_in_term(copyID); -#endif - if (!abort) { /* diff --git a/src/evalfunc.c b/src/evalfunc.c index 7cafdc99f..4d32d85f6 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -895,29 +895,6 @@ static struct fst {"tanh", 1, 1, f_tanh}, #endif {"tempname", 0, 0, f_tempname}, -#ifdef FEAT_TERMINAL - {"term_dumpdiff", 2, 3, f_term_dumpdiff}, - {"term_dumpload", 1, 2, f_term_dumpload}, - {"term_dumpwrite", 2, 3, f_term_dumpwrite}, - {"term_getaltscreen", 1, 1, f_term_getaltscreen}, - {"term_getattr", 2, 2, f_term_getattr}, - {"term_getcursor", 1, 1, f_term_getcursor}, - {"term_getjob", 1, 1, f_term_getjob}, - {"term_getline", 2, 2, f_term_getline}, - {"term_getscrolled", 1, 1, f_term_getscrolled}, - {"term_getsize", 1, 1, f_term_getsize}, - {"term_getstatus", 1, 1, f_term_getstatus}, - {"term_gettitle", 1, 1, f_term_gettitle}, - {"term_gettty", 1, 2, f_term_gettty}, - {"term_list", 0, 0, f_term_list}, - {"term_scrape", 2, 2, f_term_scrape}, - {"term_sendkeys", 2, 2, f_term_sendkeys}, - {"term_setkill", 2, 2, f_term_setkill}, - {"term_setrestore", 2, 2, f_term_setrestore}, - {"term_setsize", 3, 3, f_term_setsize}, - {"term_start", 1, 2, f_term_start}, - {"term_wait", 1, 2, f_term_wait}, -#endif {"test_alloc_fail", 3, 3, f_test_alloc_fail}, {"test_autochdir", 0, 0, f_test_autochdir}, {"test_feedinput", 1, 1, f_test_feedinput}, @@ -5584,9 +5561,6 @@ get_win_info(win_T *wp, short tpnr, short winnr) dict_add_number(dict, "wincol", wp->w_wincol + 1); dict_add_number(dict, "bufnr", wp->w_buffer->b_fnum); -#ifdef FEAT_TERMINAL - dict_add_number(dict, "terminal", bt_terminal(wp->w_buffer)); -#endif #ifdef FEAT_QUICKFIX dict_add_number(dict, "quickfix", bt_quickfix(wp->w_buffer)); dict_add_number(dict, "loclist", @@ -6134,9 +6108,6 @@ f_has(typval_T *argvars, typval_T *rettv) #ifdef FEAT_TAG_BINS "tag_binary", #endif -#if defined(FEAT_TERMINAL) && !defined(MSWIN) - "terminal", -#endif #ifdef TERMINFO "terminfo", #endif @@ -6281,14 +6252,6 @@ f_has(typval_T *argvars, typval_T *rettv) #ifdef DYNAMIC_PERL else if (STRICMP(name, "perl") == 0) n = perl_enabled(FALSE); -#endif -#if defined(FEAT_TERMINAL) && defined(MSWIN) - else if (STRICMP(name, "terminal") == 0) - n = terminal_enabled(); -#endif -#if defined(FEAT_TERMINAL) && defined(MSWIN) - else if (STRICMP(name, "conpty") == 0) - n = use_conpty(); #endif } @@ -8123,10 +8086,6 @@ f_mode(typval_T *argvars, typval_T *rettv) buf[0] = 'x'; buf[1] = '!'; } -#ifdef FEAT_TERMINAL - else if (term_use_loop()) - buf[0] = 't'; -#endif else if (VIsual_active) { if (VIsual_select) @@ -8759,10 +8718,12 @@ f_readfile(typval_T *argvars, typval_T *rettv) /* Find the two bytes before the 0xbf. If p is at buf, or buf * + 1, these may be in the "prev" string. */ char_u back1 = p >= buf + 1 ? p[-1] - : prevlen >= 1 ? prev[prevlen - 1] : NUL; + : prevlen >= 1 ? prev[prevlen - 1] + : NUL; char_u back2 = p >= buf + 2 ? p[-2] : p == buf + 1 && prevlen >= 1 ? prev[prevlen - 1] - : prevlen >= 2 ? prev[prevlen - 2] : NUL; + : prevlen >= 2 ? prev[prevlen - 2] + : NUL; if (back2 == 0xef && back1 == 0xbb) { @@ -11720,7 +11681,8 @@ f_spellbadword(typval_T *argvars UNUSED, typval_T *rettv) return; list_append_string(rettv->vval.v_list, word, len); - list_append_string(rettv->vval.v_list, (char_u *)(attr == HLF_SPB ? "bad" : attr == HLF_SPR ? "rare" : attr == HLF_SPL ? "local" : attr == HLF_SPC ? "caps" : ""), -1); + list_append_string(rettv->vval.v_list, (char_u *)(attr == HLF_SPB ? "bad" : attr == HLF_SPR ? "rare" : attr == HLF_SPL ? "local" : attr == HLF_SPC ? "caps" : ""), + -1); } /* diff --git a/src/ex_cmds.c b/src/ex_cmds.c index d3acf48af..95742500f 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -334,12 +334,14 @@ sort_compare(const void *s1, const void *s2) result = l1.st_u.num.is_number - l2.st_u.num.is_number; else result = l1.st_u.num.value == l2.st_u.num.value ? 0 - : l1.st_u.num.value > l2.st_u.num.value ? 1 : -1; + : l1.st_u.num.value > l2.st_u.num.value ? 1 + : -1; } #ifdef FEAT_FLOAT else if (sort_flt) result = l1.st_u.value_flt == l2.st_u.value_flt ? 0 - : l1.st_u.value_flt > l2.st_u.value_flt ? 1 : -1; + : l1.st_u.value_flt > l2.st_u.value_flt ? 1 + : -1; #endif else { @@ -1516,7 +1518,6 @@ void do_shell( char_u *cmd, int flags) /* may be SHELL_DOOUT when output is redirected */ { - buf_T *buf; int save_nwr; #ifdef MSWIN int winstart = FALSE; @@ -1561,13 +1562,8 @@ void do_shell( msg_putchar('\n'); // may shift screen one line up // warning message before calling the shell - if (p_warn && !autocmd_busy && msg_silent == 0) - FOR_ALL_BUFFERS(buf) - if (bufIsChangedNotTerm(buf)) - { + if (p_warn && !autocmd_busy && msg_silent == 0 && anyBufIsChanged()) msg_puts(_("[No write since last change]\n")); - break; - } // This windgoto is required for when the '\n' resulted in a "delete line // 1" command to the terminal. @@ -3375,15 +3371,8 @@ void do_wqall(exarg_T *eap) FOR_ALL_BUFFERS(buf) { -#ifdef FEAT_TERMINAL - if (exiting && term_job_running(buf->b_term)) - { - no_write_message_nobang(buf); - ++error; - } - else -#endif - if (bufIsChanged(buf) && !bt_dontwrite(buf)) + + if (bufIsChanged(buf) && !bt_dontwrite(buf)) { /* * Check if there is a reason the buffer cannot be written: diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index 8cca869e3..0699064d4 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -423,11 +423,6 @@ long check_due_timer(void) if (did_one) redraw_after_callback(need_update_screen); -#ifdef FEAT_TERMINAL - /* Some terminal windows may need their buffer updated. */ - next_due = term_check_timers(next_due, &now); -#endif - return current_id != last_timer_id ? 1 : next_due; } @@ -694,9 +689,8 @@ void ex_profile(exarg_T *eap) } /* Command line expansion for :profile. */ -static enum { - PEXP_SUBCMD, /* expand :profile sub-commands */ - PEXP_FUNC /* expand :profile func {funcname} */ +static enum { PEXP_SUBCMD, /* expand :profile sub-commands */ + PEXP_FUNC /* expand :profile func {funcname} */ } pexpand_what; static char *pexpand_cmds[] = { @@ -1099,17 +1093,9 @@ int check_changed_any( bufref_T bufref; set_bufref(&bufref, buf); -#ifdef FEAT_TERMINAL - if (term_job_running(buf->b_term)) - { - if (term_try_stop_job(buf) == FAIL) - break; - } - else -#endif - /* Try auto-writing the buffer. If this fails but the buffer no + /* Try auto-writing the buffer. If this fails but the buffer no * longer exists it's not changed, that's OK. */ - if (check_changed(buf, (p_awa ? CCGD_AW : 0) | CCGD_MULTWIN | CCGD_ALLBUF) && bufref_valid(&bufref)) + if (check_changed(buf, (p_awa ? CCGD_AW : 0) | CCGD_MULTWIN | CCGD_ALLBUF) && bufref_valid(&bufref)) break; /* didn't save - still changes */ } } @@ -1132,14 +1118,8 @@ int check_changed_any( msg_didout = FALSE; } if ( -#ifdef FEAT_TERMINAL - term_job_running(buf->b_term) - ? semsg(_("E947: Job still running in buffer \"%s\""), - buf->b_fname) - : -#endif - semsg(_("E162: No write since last change for buffer \"%s\""), - buf_spname(buf) != NULL ? buf_spname(buf) : buf->b_fname)) + semsg(_("E162: No write since last change for buffer \"%s\""), + buf_spname(buf) != NULL ? buf_spname(buf) : buf->b_fname)) { save = no_wait_return; no_wait_return = FALSE; @@ -2657,7 +2637,8 @@ void ex_options( { vim_setenv((char_u *)"OPTWIN_CMD", (char_u *)(cmdmod.tab ? "tab" - : (cmdmod.split & WSP_VERT) ? "vert" : "")); + : (cmdmod.split & WSP_VERT) ? "vert" + : "")); cmd_source((char_u *)SYS_OPTWIN_FILE, NULL); } #endif diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 34c6de306..309c361f7 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -9601,13 +9601,7 @@ makeopens( // ":badd" will have no effect. FOR_ALL_BUFFERS(buf) { - if (!(only_save_windows && buf->b_nwindows == 0) && !(buf->b_help && !(ssop_flags & SSOP_HELP)) -#ifdef FEAT_TERMINAL - // Skip terminal buffers: finished ones are not useful, others - // will be resurrected and result in a new buffer. - && !bt_terminal(buf) -#endif - && buf->b_fname != NULL && buf->b_p_bl) + if (!(only_save_windows && buf->b_nwindows == 0) && !(buf->b_help && !(ssop_flags & SSOP_HELP)) && buf->b_fname != NULL && buf->b_p_bl) { if (fprintf(fd, "badd +%ld ", buf->b_wininfo == NULL ? 1L : buf->b_wininfo->wi_fpos.lnum) < 0 || ses_fname(fd, buf, &ssop_flags, TRUE) == FAIL) return FAIL; @@ -9773,10 +9767,6 @@ ses_do_frame(frame_T *fr) static int ses_do_win(win_T *wp) { -#ifdef FEAT_TERMINAL - if (bt_terminal(wp->w_buffer)) - return !term_is_finished(wp->w_buffer) && (ssop_flags & SSOP_TERMINAL) && term_should_restore(wp->w_buffer); -#endif if (wp->w_buffer->b_fname == NULL #ifdef FEAT_QUICKFIX /* When 'buftype' is "nofile" can't restore the window contents. */ @@ -9850,22 +9840,14 @@ put_view( /* Edit the file. Skip this when ":next" already did it. */ if (add_edit && (!did_next || wp->w_arg_idx_invalid)) { -#ifdef FEAT_TERMINAL - if (bt_terminal(wp->w_buffer)) - { - if (term_write_session(fd, wp) == FAIL) - return FAIL; - } - else -#endif - /* + /* * Load the file. */ - if (wp->w_buffer->b_ffname != NULL + if (wp->w_buffer->b_ffname != NULL #ifdef FEAT_QUICKFIX - && !bt_nofile(wp->w_buffer) + && !bt_nofile(wp->w_buffer) #endif - ) + ) { /* * Editing a file in this buffer: use ":edit file". diff --git a/src/ex_getln.c b/src/ex_getln.c index da6562c57..c024836c0 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -5318,8 +5318,7 @@ ExpandFromContext( int ic; int escaped; } tab[] = - { - {EXPAND_COMMANDS, get_command_name, FALSE, TRUE}, + { {EXPAND_COMMANDS, get_command_name, FALSE, TRUE}, {EXPAND_BEHAVE, get_behave_arg, TRUE, TRUE}, {EXPAND_MAPCLEAR, get_mapclear_arg, TRUE, TRUE}, {EXPAND_MESSAGES, get_messages_arg, TRUE, TRUE}, diff --git a/src/feature.h b/src/feature.h index d5a5ec6d8..64a3ed1a4 100644 --- a/src/feature.h +++ b/src/feature.h @@ -741,14 +741,6 @@ #undef FEAT_JOB_CHANNEL #endif -/* - * +terminal ":terminal" command. Runs a terminal in a window. - * requires +channel - */ -#if defined(FEAT_TERMINAL) && !defined(FEAT_JOB_CHANNEL) -#undef FEAT_TERMINAL -#endif - /* * +signs Allow signs to be displayed to the left of text lines. * Adds the ":sign" command. @@ -792,7 +784,6 @@ #undef FEAT_CMDWIN #undef FEAT_CONCEAL #undef FEAT_SMARTINDENT -#undef FEAT_TERMINAL #undef FEAT_WILDMENU @@ -816,7 +807,6 @@ #undef FEAT_SPELL #undef FEAT_STL_OPT #undef FEAT_SYN_HL -#undef FEAT_TERMINAL // Handled by consumer #undef FEAT_TERMGUICOLORS #undef FEAT_TERMRESPONSE #undef FEAT_TITLE diff --git a/src/fileio.c b/src/fileio.c index 3d03e16e4..267ccc0bc 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -6188,11 +6188,7 @@ int buf_check_timestamp( /* If there is no file name, the buffer is not loaded, 'buftype' is * set, we are in the middle of a save or being called recursively: ignore * this buffer. */ - if (buf->b_ffname == NULL || buf->b_ml.ml_mfp == NULL || !bt_normal(buf) || buf->b_saving || busy -#ifdef FEAT_TERMINAL - || buf->b_term != NULL -#endif - ) + if (buf->b_ffname == NULL || buf->b_ml.ml_mfp == NULL || !bt_normal(buf) || buf->b_saving || busy) return 0; if (!(buf->b_flags & BF_NOTEDITED) && buf->b_mtime != 0 && ((stat_res = mch_stat((char *)buf->b_ffname, &st)) < 0 || time_differs((long)st.st_mtime, buf->b_mtime) || st.st_size != buf->b_orig_size diff --git a/src/getchar.c b/src/getchar.c index 5d810ab3e..2d3896ab8 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -1746,24 +1746,6 @@ int vpeekc(void) return vgetorpeek(FALSE); } -#if defined(FEAT_TERMINAL) || defined(PROTO) -/* - * Like vpeekc(), but don't allow mapping. Do allow checking for terminal - * codes. - */ -int vpeekc_nomap(void) -{ - int c; - - ++no_mapping; - ++allow_keys; - c = vpeekc(); - --no_mapping; - --allow_keys; - return c; -} -#endif - #if defined(FEAT_EVAL) || defined(PROTO) /* * Check if any character is available, also half an escape sequence. @@ -2482,10 +2464,6 @@ vgetorpeek(int advance) * cmdline window. */ if (p_im && (State & INSERT)) c = Ctrl_L; -#ifdef FEAT_TERMINAL - else if (terminal_is_active()) - c = K_CANCEL; -#endif else if ((State & CMDLINE)) c = Ctrl_C; else diff --git a/src/globals.h b/src/globals.h index 5aa81d48a..d52574d3e 100644 --- a/src/globals.h +++ b/src/globals.h @@ -376,11 +376,7 @@ EXTERN int highlight_attr[HLF_COUNT]; /* Highl. attr for each context. */ #ifdef USER_HIGHLIGHT EXTERN int highlight_user[9]; /* User[1-9] attributes */ #endif -#ifdef FEAT_TERMINAL -// When TRUE skip calling terminal_loop() once. Used when -// typing ':' at the more prompt. -EXTERN int skip_term_loop INIT(= FALSE); -#endif + EXTERN int cterm_normal_fg_color INIT(= 0); EXTERN int cterm_normal_fg_bold INIT(= 0); EXTERN int cterm_normal_bg_color INIT(= 0); @@ -1088,7 +1084,7 @@ EXTERN char e_libcall[] INIT(= N_("E364: Library call failed for \"%s()\"")); #ifdef HAVE_FSYNC EXTERN char e_fsync[] INIT(= N_("E667: Fsync failed")); #endif -#if defined(DYNAMIC_PERL) || defined(DYNAMIC_PYTHON) || defined(DYNAMIC_PYTHON3) || defined(DYNAMIC_RUBY) || defined(DYNAMIC_TCL) || defined(DYNAMIC_ICONV) || defined(DYNAMIC_GETTEXT) || defined(DYNAMIC_MZSCHEME) || defined(DYNAMIC_LUA) || defined(FEAT_TERMINAL) +#if defined(DYNAMIC_PERL) || defined(DYNAMIC_PYTHON) || defined(DYNAMIC_PYTHON3) || defined(DYNAMIC_RUBY) || defined(DYNAMIC_TCL) || defined(DYNAMIC_ICONV) || defined(DYNAMIC_GETTEXT) || defined(DYNAMIC_MZSCHEME) || defined(DYNAMIC_LUA) EXTERN char e_loadlib[] INIT(= N_("E370: Could not load library %s")); EXTERN char e_loadfunc[] INIT(= N_("E448: Could not load library function %s")); #endif diff --git a/src/main.c b/src/main.c index 55e2cb182..5266ef3b1 100644 --- a/src/main.c +++ b/src/main.c @@ -1021,21 +1021,7 @@ void main_loop( // } // else // { - // #ifdef FEAT_TERMINAL - // if (term_use_loop() && oa.op_type == OP_NOP && oa.regname == NUL && !VIsual_active && !skip_term_loop) // { - // /* If terminal_loop() returns OK we got a key that is handled - // * in Normal model. With FAIL we first need to position the - // * cursor and the screen needs to be redrawn. */ - // if (terminal_loop(TRUE) == OK) - // normal_cmd(&oa, TRUE); - // } - // else - // #endif - // { - // #ifdef FEAT_TERMINAL - // skip_term_loop = FALSE; - // #endif // normal_cmd(&oa, TRUE); // } // } diff --git a/src/mark.c b/src/mark.c index dbc8eb533..d7f4b021f 100644 --- a/src/mark.c +++ b/src/mark.c @@ -1637,11 +1637,7 @@ void handle_viminfo_mark(garray_T *values, int force) static int skip_for_viminfo(buf_T *buf) { - return -#ifdef FEAT_TERMINAL - bt_terminal(buf) || -#endif - removable(buf->b_ffname); + return removable(buf->b_ffname); } void write_viminfo_filemarks(FILE *fp) diff --git a/src/mbyte.c b/src/mbyte.c index f4d27d7f5..227e18756 100644 --- a/src/mbyte.c +++ b/src/mbyte.c @@ -1846,18 +1846,6 @@ static struct interval ambiguous[] = {0xf0000, 0xffffd}, {0x100000, 0x10fffd}}; -#if defined(FEAT_TERMINAL) || defined(PROTO) -/* - * utf_char2cells() with different argument type for libvterm. - */ -int utf_uint2cells(UINT32_T c) -{ - if (c >= 0x100 && utf_iscomposing((int)c)) - return 0; - return utf_char2cells((int)c); -} -#endif - /* * For UTF-8 character "c" return 2 for a double-width character, 1 for others. * Returns 4 or 6 for an unprintable character. @@ -2698,16 +2686,6 @@ int utf_char2bytes(int c, char_u *buf) return 6; } -#if defined(FEAT_TERMINAL) || defined(PROTO) -/* - * utf_iscomposing() with different argument type for libvterm. - */ -int utf_iscomposing_uint(UINT32_T c) -{ - return utf_iscomposing((int)c); -} -#endif - /* * Return TRUE if "c" is a composing UTF-8 character. This means it will be * drawn on top of the preceding character. diff --git a/src/misc2.c b/src/misc2.c index 4ebaf1c0e..fd316273d 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -3812,9 +3812,6 @@ void parse_queued_messages(void) // changes, e.g. stdin may have been closed. if (job_check_ended()) continue; -#endif -#ifdef FEAT_TERMINAL - free_unused_terminals(); #endif break; } diff --git a/src/normal.c b/src/normal.c index 49097e715..220a42615 100644 --- a/src/normal.c +++ b/src/normal.c @@ -4172,7 +4172,8 @@ static void nv_brackets(cmdarg_T *cap) ((cap->nchar & 0xf) == ('d' & 0xf)) ? FIND_DEFINE : FIND_ANY, cap->count1, isupper(cap->nchar) ? ACTION_SHOW_ALL - : islower(cap->nchar) ? ACTION_SHOW : ACTION_GOTO, + : islower(cap->nchar) ? ACTION_SHOW + : ACTION_GOTO, cap->cmdchar == ']' ? curwin->w_cursor.lnum + 1 : (linenr_T)1, (linenr_T)MAXLNUM); curwin->w_set_curswant = TRUE; @@ -4959,11 +4960,6 @@ static void v_visop(cmdarg_T *cap) */ static void nv_subst(cmdarg_T *cap) { -#ifdef FEAT_TERMINAL - /* When showing output of term_dumpdiff() swap the top and botom. */ - if (term_swap_diff() == OK) - return; -#endif #ifdef FEAT_JOB_CHANNEL if (bt_prompt(curbuf) && !prompt_curpos_editable()) { @@ -6402,15 +6398,6 @@ static void nv_edit(cmdarg_T *cap) /* in Visual mode "A" and "I" are an operator */ if (VIsual_active && (cap->cmdchar == 'A' || cap->cmdchar == 'I')) { -#ifdef FEAT_TERMINAL - if (term_in_normal_mode()) - { - end_visual_mode(); - clearop(cap->oap); - term_enter_job_mode(); - return; - } -#endif // Block 'I'insert or 'A'ppend - special case to produce multiple cursors if (VIsual_mode == Ctrl_V) { @@ -6488,14 +6475,6 @@ static void nv_edit(cmdarg_T *cap) clearopbeep(cap->oap); #endif } -#ifdef FEAT_TERMINAL - else if (term_in_normal_mode()) - { - clearop(cap->oap); - term_enter_job_mode(); - return; - } -#endif else if (!curbuf->b_p_ma && !p_im) { /* Only give this error when 'insertmode' is off. */ diff --git a/src/option.c b/src/option.c index a030830d3..bc26979e7 100644 --- a/src/option.c +++ b/src/option.c @@ -202,11 +202,6 @@ #define PV_WFW OPT_WIN(WV_WFW) #define PV_WRAP OPT_WIN(WV_WRAP) #define PV_CRBIND OPT_WIN(WV_CRBIND) -#ifdef FEAT_TERMINAL -#define PV_TWK OPT_WIN(WV_TWK) -#define PV_TWS OPT_WIN(WV_TWS) -#define PV_TWSL OPT_BUF(BV_TWSL) -#endif #ifdef FEAT_SIGNS #define PV_SCL OPT_WIN(WV_SCL) #endif @@ -299,9 +294,6 @@ static char_u *p_vts; #ifdef FEAT_KEYMAP static char_u *p_keymap; #endif -#ifdef FEAT_TERMINAL -static long p_twsl; /* 'termwinscroll' */ -#endif /* Saved values for when 'bin' is set. */ static int p_et_nobin; @@ -1888,49 +1880,17 @@ static struct vimoption options[] = {"termfont", "tfn", P_STRING | P_VI_DEF | P_RCLR | P_ONECOMMA | P_NODUP, (char_u *)&p_termfont, PV_NONE, {(char_u *)"", (char_u *)0L} SCTX_INIT}, {"termguicolors", "tgc", P_BOOL | P_VI_DEF | P_VIM | P_RCLR, (char_u *)NULL, PV_NONE, {(char_u *)FALSE, (char_u *)FALSE} SCTX_INIT}, {"termwinkey", "twk", P_STRING | P_ALLOCED | P_RWIN | P_VI_DEF, -#ifdef FEAT_TERMINAL - (char_u *)VAR_WIN, - PV_TWK, - {(char_u *)"", (char_u *)NULL} -#else + (char_u *)NULL, PV_NONE, - {(char_u *)NULL, (char_u *)0L} -#endif - SCTX_INIT}, + {(char_u *)NULL, (char_u *)0L} SCTX_INIT}, {"termwinscroll", "twsl", P_NUM | P_VI_DEF | P_VIM | P_RBUF, -#ifdef FEAT_TERMINAL - (char_u *)&p_twsl, - PV_TWSL, - {(char_u *)10000L, (char_u *)10000L} -#else - (char_u *)NULL, - PV_NONE, - {(char_u *)NULL, (char_u *)0L} -#endif - SCTX_INIT}, - {"termwinsize", "tws", P_STRING | P_ALLOCED | P_RWIN | P_VI_DEF, -#ifdef FEAT_TERMINAL - (char_u *)VAR_WIN, - PV_TWS, - {(char_u *)"", (char_u *)NULL} -#else - (char_u *)NULL, - PV_NONE, - {(char_u *)NULL, (char_u *)0L} -#endif - SCTX_INIT}, - {"termwintype", "twt", P_STRING | P_ALLOCED | P_VI_DEF, -#if defined(MSWIN) && defined(FEAT_TERMINAL) - (char_u *)&p_twt, - PV_NONE, - {(char_u *)"", (char_u *)NULL} -#else + (char_u *)NULL, PV_NONE, - {(char_u *)NULL, (char_u *)0L} -#endif - SCTX_INIT}, + {(char_u *)NULL, (char_u *)0L} SCTX_INIT}, + {"termwinsize", "tws", P_STRING | P_ALLOCED | P_RWIN | P_VI_DEF, (char_u *)NULL, PV_NONE, {(char_u *)NULL, (char_u *)0L} SCTX_INIT}, + {"termwintype", "twt", P_STRING | P_ALLOCED | P_VI_DEF, (char_u *)NULL, PV_NONE, {(char_u *)NULL, (char_u *)0L} SCTX_INIT}, {"terse", NULL, P_BOOL | P_VI_DEF, (char_u *)&p_terse, PV_NONE, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, {"textauto", "ta", P_BOOL | P_VIM, (char_u *)&p_ta, PV_NONE, {(char_u *)DFLT_TEXTAUTO, (char_u *)TRUE} SCTX_INIT}, {"textmode", "tx", P_BOOL | P_VI_DEF | P_NO_MKRC, (char_u *)&p_tx, PV_TX, { @@ -2130,23 +2090,7 @@ static struct vimoption options[] = {"winfixwidth", "wfw", P_BOOL | P_VI_DEF | P_RSTAT, (char_u *)VAR_WIN, PV_WFW, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, {"winminheight", "wmh", P_NUM | P_VI_DEF, (char_u *)&p_wmh, PV_NONE, {(char_u *)1L, (char_u *)0L} SCTX_INIT}, {"winminwidth", "wmw", P_NUM | P_VI_DEF, (char_u *)&p_wmw, PV_NONE, {(char_u *)1L, (char_u *)0L} SCTX_INIT}, - {"winptydll", NULL, P_STRING | P_EXPAND | P_VI_DEF | P_SECURE, -#if defined(MSWIN) && defined(FEAT_TERMINAL) - (char_u *)&p_winptydll, - PV_NONE, - { -#ifdef _WIN64 - (char_u *)"winpty64.dll", -#else - (char_u *)"winpty32.dll", -#endif - (char_u *)0L} -#else - (char_u *)NULL, - PV_NONE, - {(char_u *)0L, (char_u *)0L} -#endif - SCTX_INIT}, + {"winptydll", NULL, P_STRING | P_EXPAND | P_VI_DEF | P_SECURE, (char_u *)NULL, PV_NONE, {(char_u *)0L, (char_u *)0L} SCTX_INIT}, {"winwidth", "wiw", P_NUM | P_VI_DEF, (char_u *)&p_wiw, PV_NONE, {(char_u *)20L, (char_u *)0L} SCTX_INIT}, {"wrap", NULL, P_BOOL | P_VI_DEF | P_RWIN, (char_u *)VAR_WIN, PV_WRAP, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, {"wrapmargin", "wm", P_NUM | P_VI_DEF, (char_u *)&p_wm, PV_WM, {(char_u *)0L, (char_u *)0L} SCTX_INIT}, @@ -2208,9 +2152,6 @@ static char *(p_fcl_values[]) = {"all", NULL}; #ifdef FEAT_SIGNS static char *(p_scl_values[]) = {"yes", "no", "auto", NULL}; #endif -#if defined(MSWIN) && defined(FEAT_TERMINAL) -static char *(p_twt_values[]) = {"winpty", "conpty", "", NULL}; -#endif static void set_options_default(int opt_flags); static void set_string_default_esc(char *name, char_u *val, int escape); @@ -5718,33 +5659,6 @@ did_set_string_option( } } -#ifdef FEAT_TERMINAL - // 'termwinkey' - else if (varp == &curwin->w_p_twk) - { - if (*curwin->w_p_twk != NUL && string_to_key(curwin->w_p_twk, TRUE) == 0) - errmsg = e_invarg; - } - // 'termwinsize' - else if (varp == &curwin->w_p_tws) - { - if (*curwin->w_p_tws != NUL) - { - p = skipdigits(curwin->w_p_tws); - if (p == curwin->w_p_tws || (*p != 'x' && *p != '*') || *skipdigits(p + 1) != NUL) - errmsg = e_invarg; - } - } -#if defined(MSWIN) - // 'termwintype' - else if (varp == &p_twt) - { - if (check_opt_strings(*varp, p_twt_values, FALSE) != OK) - errmsg = e_invarg; - } -#endif -#endif - #ifdef FEAT_VARTABS /* 'varsofttabstop' */ else if (varp == &(curbuf->b_p_vsts)) @@ -6211,14 +6125,6 @@ set_bool_option( /* when 'modifiable' is changed, redraw the window title */ else if ((int *)varp == &curbuf->b_p_ma) { -#ifdef FEAT_TERMINAL - /* Cannot set 'modifiable' when in Terminal mode. */ - if (curbuf->b_p_ma && (term_in_normal_mode() || (bt_terminal(curbuf) && curbuf->b_term != NULL && !term_is_finished(curbuf)))) - { - curbuf->b_p_ma = FALSE; - return N_("E946: Cannot make a terminal with running job modifiable"); - } -#endif } /* when 'bin' is set also set some other options */ @@ -8435,15 +8341,6 @@ get_varp(struct vimoption *p) return (char_u *)&(curwin->w_p_scb); case PV_CRBIND: return (char_u *)&(curwin->w_p_crb); -#ifdef FEAT_TERMINAL - case PV_TWK: - return (char_u *)&(curwin->w_p_twk); - case PV_TWS: - return (char_u *)&(curwin->w_p_tws); - case PV_TWSL: - return (char_u *)&(curbuf->b_p_twsl); -#endif - case PV_AI: return (char_u *)&(curbuf->b_p_ai); case PV_BIN: @@ -8638,10 +8535,6 @@ void copy_winopt(winopt_T *from, winopt_T *to) to->wo_diff = from->wo_diff; to->wo_diff_saved = from->wo_diff_saved; #endif -#ifdef FEAT_TERMINAL - to->wo_twk = vim_strsave(from->wo_twk); - to->wo_tws = vim_strsave(from->wo_tws); -#endif #ifdef FEAT_FOLDING to->wo_fdc = from->wo_fdc; to->wo_fdc_save = from->wo_fdc_save; @@ -8699,10 +8592,6 @@ check_winopt(winopt_T *wop UNUSED) #ifdef FEAT_RIGHTLEFT check_string_option(&wop->wo_rlc); #endif -#ifdef FEAT_TERMINAL - check_string_option(&wop->wo_twk); - check_string_option(&wop->wo_tws); -#endif #ifdef FEAT_LINEBREAK check_string_option(&wop->wo_briopt); #endif @@ -8734,10 +8623,6 @@ void clear_winopt(winopt_T *wop UNUSED) #ifdef FEAT_RIGHTLEFT clear_string_option(&wop->wo_rlc); #endif -#ifdef FEAT_TERMINAL - clear_string_option(&wop->wo_twk); - clear_string_option(&wop->wo_tws); -#endif } /* @@ -8885,9 +8770,6 @@ void buf_copy_options(buf_T *buf, int flags) #ifdef FEAT_KEYMAP buf->b_p_keymap = vim_strsave(p_keymap); buf->b_kmap_state |= KEYMAP_INIT; -#endif -#ifdef FEAT_TERMINAL - buf->b_p_twsl = p_twsl; #endif /* This isn't really an option, but copying the langmap and IME * state from the current buffer is better than resetting it. */ diff --git a/src/option.h b/src/option.h index c89369fac..a93f99409 100644 --- a/src/option.h +++ b/src/option.h @@ -695,14 +695,11 @@ EXTERN int p_tbidi; /* 'termbidi' */ #endif EXTERN char_u *p_tenc; /* 'termencoding' */ EXTERN char_u *p_termfont; /* 'termfont' (Onivim) */ -#if defined(MSWIN) && defined(FEAT_TERMINAL) -EXTERN char_u *p_twt; // 'termwintype' -#endif -EXTERN int p_terse; /* 'terse' */ -EXTERN int p_ta; /* 'textauto' */ -EXTERN int p_to; /* 'tildeop' */ -EXTERN int p_timeout; /* 'timeout' */ -EXTERN long p_tm; /* 'timeoutlen' */ +EXTERN int p_terse; /* 'terse' */ +EXTERN int p_ta; /* 'textauto' */ +EXTERN int p_to; /* 'tildeop' */ +EXTERN int p_timeout; /* 'timeout' */ +EXTERN long p_tm; /* 'timeoutlen' */ #ifdef FEAT_TITLE EXTERN int p_title; /* 'title' */ EXTERN long p_titlelen; /* 'titlelen' */ @@ -778,13 +775,10 @@ EXTERN char_u *p_wim; /* 'wildmode' */ #ifdef FEAT_WILDMENU EXTERN int p_wmnu; /* 'wildmenu' */ #endif -EXTERN long p_wh; /* 'winheight' */ -EXTERN long p_wmh; /* 'winminheight' */ -EXTERN long p_wmw; /* 'winminwidth' */ -EXTERN long p_wiw; /* 'winwidth' */ -#if defined(MSWIN) && defined(FEAT_TERMINAL) -EXTERN char_u *p_winptydll; /* 'winptydll' */ -#endif +EXTERN long p_wh; /* 'winheight' */ +EXTERN long p_wmh; /* 'winminheight' */ +EXTERN long p_wmw; /* 'winminwidth' */ +EXTERN long p_wiw; /* 'winwidth' */ EXTERN int p_ws; /* 'wrapscan' */ EXTERN int p_write; /* 'write' */ EXTERN int p_wa; /* 'writeany' */ @@ -911,10 +905,6 @@ enum BV_UDF, BV_UL, BV_WM -#ifdef FEAT_TERMINAL - , - BV_TWSL -#endif #ifdef FEAT_VARTABS , BV_VSTS, @@ -935,11 +925,6 @@ enum #ifdef FEAT_ARABIC , WV_ARAB -#endif -#ifdef FEAT_TERMINAL - , - WV_TWK, - WV_TWS #endif , WV_CRBIND diff --git a/src/os_unix.c b/src/os_unix.c index fdb0b4a3d..2757a59b7 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -302,16 +302,6 @@ int mch_char_avail(void) return WaitForChar(0L, NULL, FALSE); } -#if defined(FEAT_TERMINAL) || defined(PROTO) -/* - * Check for any pending input or messages. - */ -int mch_check_messages(void) -{ - return WaitForChar(0L, NULL, TRUE); -} -#endif - #if defined(HAVE_TOTAL_MEM) || defined(PROTO) #ifdef HAVE_SYS_RESOURCE_H #include @@ -2728,44 +2718,6 @@ int mch_get_shellsize(void) return OK; } -#if defined(FEAT_TERMINAL) || defined(PROTO) -/* - * Report the windows size "rows" and "cols" to tty "fd". - */ -int mch_report_winsize(int fd, int rows, int cols) -{ - int tty_fd; - int retval = -1; - - tty_fd = get_tty_fd(fd); - if (tty_fd >= 0) - { -#if defined(TIOCSWINSZ) - struct winsize ws; - - ws.ws_col = cols; - ws.ws_row = rows; - ws.ws_xpixel = cols * 5; - ws.ws_ypixel = rows * 10; - retval = ioctl(tty_fd, TIOCSWINSZ, &ws); - ch_log(NULL, "ioctl(TIOCSWINSZ) %s", - retval == 0 ? "success" : "failed"); -#elif defined(TIOCSSIZE) - struct ttysize ts; - - ts.ts_cols = cols; - ts.ts_lines = rows; - retval = ioctl(tty_fd, TIOCSSIZE, &ts); - ch_log(NULL, "ioctl(TIOCSSIZE) %s", - retval == 0 ? "success" : "failed"); -#endif - if (tty_fd != fd) - close(tty_fd); - } - return retval == 0 ? OK : FAIL; -} -#endif - /* * Try to set the window size to Rows and Columns. */ @@ -2851,9 +2803,6 @@ set_child_environment( static char envbuf_Lines[20]; static char envbuf_Columns[20]; static char envbuf_Colors[20]; -#ifdef FEAT_TERMINAL - static char envbuf_Version[20]; -#endif #endif long colors = t_colors; @@ -2868,13 +2817,6 @@ set_child_environment( setenv("COLUMNS", (char *)envbuf, 1); sprintf((char *)envbuf, "%ld", colors); setenv("COLORS", (char *)envbuf, 1); -#ifdef FEAT_TERMINAL - if (is_terminal) - { - sprintf((char *)envbuf, "%ld", (long)get_vim_var_nr(VV_VERSION)); - setenv("VIM_TERMINAL", (char *)envbuf, 1); - } -#endif #else /* * Putenv does not copy the string, it has to remain valid. @@ -2892,14 +2834,6 @@ set_child_environment( putenv(envbuf_Columns); vim_snprintf(envbuf_Colors, sizeof(envbuf_Colors), "COLORS=%ld", colors); putenv(envbuf_Colors); -#ifdef FEAT_TERMINAL - if (is_terminal) - { - vim_snprintf(envbuf_Version, sizeof(envbuf_Version), - "VIM_TERMINAL=%ld", (long)get_vim_var_nr(VV_VERSION)); - putenv(envbuf_Version); - } -#endif #endif } @@ -3965,24 +3899,7 @@ void mch_job_start(char **argv, job_T *job, jobopt_T *options, int is_terminal) (void)setsid(); #endif -#ifdef FEAT_TERMINAL - if (options->jo_term_rows > 0) - { - char *term = (char *)T_NAME; - - /* Use 'term' or $TERM if it starts with "xterm", otherwise fall - * back to "xterm". */ - if (term == NULL || *term == NUL || STRNCMP(term, "xterm", 5) != 0) - term = "xterm"; - set_child_environment( - (long)options->jo_term_rows, - (long)options->jo_term_cols, - term, - is_terminal); - } - else -#endif - set_default_child_environment(is_terminal); + set_default_child_environment(is_terminal); if (options->jo_env != NULL) { @@ -4334,36 +4251,6 @@ void mch_clear_job(job_T *job) } #endif -#if defined(FEAT_TERMINAL) || defined(PROTO) -int mch_create_pty_channel(job_T *job, jobopt_T *options) -{ - int pty_master_fd = -1; - int pty_slave_fd = -1; - channel_T *channel; - - open_pty(&pty_master_fd, &pty_slave_fd, &job->jv_tty_out, &job->jv_tty_in); - close(pty_slave_fd); - - channel = add_channel(); - if (channel == NULL) - { - close(pty_master_fd); - return FAIL; - } - if (job->jv_tty_out != NULL) - ch_log(channel, "using pty %s on fd %d", - job->jv_tty_out, pty_master_fd); - job->jv_channel = channel; /* ch_refcount was set by add_channel() */ - channel->ch_keep_open = TRUE; - - /* Only set the pty_master_fd for stdout, do not duplicate it for stderr, - * it only needs to be read once. */ - channel_set_pipes(channel, pty_master_fd, pty_master_fd, INVALID_FD); - channel_set_job(channel, job, options); - return OK; -} -#endif - /* * Check for CTRL-C typed by reading all available characters. * In cooked mode we should get SIGINT, no need to check. diff --git a/src/os_win32.c b/src/os_win32.c index 168aeb7b4..659c1d6a1 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -1465,16 +1465,6 @@ int mch_char_avail(void) return WaitForChar(0L, FALSE); } -#if defined(FEAT_TERMINAL) || defined(PROTO) -/* - * Check for any pending input or messages. - */ -int mch_check_messages(void) -{ - return WaitForChar(0L, TRUE); -} -#endif - /* * Create the console input. Used when reading stdin doesn't work. */ diff --git a/src/proto.h b/src/proto.h index 8435ab7d8..efd93d9f2 100644 --- a/src/proto.h +++ b/src/proto.h @@ -162,9 +162,6 @@ void qsort(void *base, size_t elm_count, size_t elm_size, int (*cmp)(const void #include "syntax.pro" #include "tag.pro" #include "term.pro" -#ifdef FEAT_TERMINAL -#include "terminal.pro" -#endif #if defined(HAVE_TGETENT) && (defined(VMS)) #include "termlib.pro" #endif diff --git a/src/proto/undo.pro b/src/proto/undo.pro index f2190bfea..97f023646 100644 --- a/src/proto/undo.pro +++ b/src/proto/undo.pro @@ -26,7 +26,6 @@ void u_undoline(void); void u_blockfree(buf_T *buf); int bufIsChanged(buf_T *buf); int anyBufIsChanged(void); -int bufIsChangedNotTerm(buf_T *buf); int curbufIsChanged(void); void u_eval_tree(u_header_T *first_uhp, list_T *list); /* vim: set ft=c : */ diff --git a/src/screen.c b/src/screen.c index eb4bc4956..5c90de361 100644 --- a/src/screen.c +++ b/src/screen.c @@ -313,10 +313,6 @@ void redrawWinline( void after_updating_screen(int may_resize_shell UNUSED) { updating_screen = FALSE; -#ifdef FEAT_TERMINAL - term_check_channel_closed_recently(); -#endif - #ifdef HAVE_DROP_FILE // If handle_drop() was called while updating_screen was TRUE need to // handle the drop now. @@ -369,16 +365,6 @@ void updateWindow(win_T *wp) } #endif -#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. @@ -786,11 +772,7 @@ win_redr_status(win_T *wp, int ignore_pum UNUSED) len += (int)STRLEN(p + len); } #endif - if (bufIsChanged(wp->w_buffer) -#ifdef FEAT_TERMINAL - && !bt_terminal(wp->w_buffer) -#endif - ) + if (bufIsChanged(wp->w_buffer)) { STRCPY(p + len, "[+]"); len += 3; @@ -3131,23 +3113,7 @@ fillchar_status(int *attr, win_T *wp) { int fill; -#ifdef FEAT_TERMINAL - if (bt_terminal(wp->w_buffer)) - { - if (wp == curwin) - { - *attr = HL_ATTR(HLF_ST); - fill = fill_stl; - } - else - { - *attr = HL_ATTR(HLF_STNC); - fill = fill_stlnc; - } - } - else -#endif - if (wp == curwin) + if (wp == curwin) { *attr = HL_ATTR(HLF_S); fill = fill_stl; diff --git a/src/structs.h b/src/structs.h index aa9466798..94e5d55ea 100644 --- a/src/structs.h +++ b/src/structs.h @@ -472,13 +472,6 @@ typedef struct char_u *wo_scl; #define w_p_scl w_onebuf_opt.wo_scl /* 'signcolumn' */ #endif -#ifdef FEAT_TERMINAL - char_u *wo_twk; -#define w_p_twk w_onebuf_opt.wo_twk /* 'termwinkey' */ - char_u *wo_tws; -#define w_p_tws w_onebuf_opt.wo_tws /* 'termwinsize' */ -#endif - #ifdef FEAT_EVAL sctx_T wo_script_ctx[WV_COUNT]; /* SCTXs for window-local options */ #define w_p_script_ctx w_onebuf_opt.wo_script_ctx @@ -2399,9 +2392,6 @@ struct file_buffer #ifdef FEAT_PERSISTENT_UNDO int b_p_udf; /* 'undofile' */ #endif -#ifdef FEAT_TERMINAL - long b_p_twsl; /* 'termwinscroll' */ -#endif /* end of buffer options */ @@ -2475,10 +2465,6 @@ struct file_buffer int b_mapped_ctrl_c; /* modes where CTRL-C is mapped */ -#ifdef FEAT_TERMINAL - term_T *b_term; /* When not NULL this buffer is for a terminal - * window. */ -#endif #ifdef FEAT_DIFF int b_diff_failed; // internal diff failed for this buffer #endif diff --git a/src/syntax.c b/src/syntax.c index d4e022479..b75d2a3cc 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -184,12 +184,6 @@ static char *(highlight_init_light[]) = { "TabLine term=underline cterm=underline ctermfg=black ctermbg=LightGrey gui=underline guibg=LightGrey"), CENT("MatchParen term=reverse ctermbg=Cyan", "MatchParen term=reverse ctermbg=Cyan guibg=Cyan"), -#ifdef FEAT_TERMINAL - CENT("StatusLineTerm term=reverse,bold cterm=bold ctermfg=White ctermbg=DarkGreen", - "StatusLineTerm term=reverse,bold cterm=bold ctermfg=White ctermbg=DarkGreen gui=bold guifg=bg guibg=DarkGreen"), - CENT("StatusLineTermNC term=reverse ctermfg=White ctermbg=DarkGreen", - "StatusLineTermNC term=reverse ctermfg=White ctermbg=DarkGreen guifg=bg guibg=DarkGreen"), -#endif NULL}; /* Default colors only used with a dark background. */ @@ -240,12 +234,6 @@ static char *(highlight_init_dark[]) = { "TabLine term=underline cterm=underline ctermfg=white ctermbg=DarkGrey gui=underline guibg=DarkGrey"), CENT("MatchParen term=reverse ctermbg=DarkCyan", "MatchParen term=reverse ctermbg=DarkCyan guibg=DarkCyan"), -#ifdef FEAT_TERMINAL - CENT("StatusLineTerm term=reverse,bold cterm=bold ctermfg=Black ctermbg=LightGreen", - "StatusLineTerm term=reverse,bold cterm=bold ctermfg=Black ctermbg=LightGreen gui=bold guifg=bg guibg=LightGreen"), - CENT("StatusLineTermNC term=reverse ctermfg=Black ctermbg=LightGreen", - "StatusLineTermNC term=reverse ctermfg=Black ctermbg=LightGreen guifg=bg guibg=LightGreen"), -#endif NULL}; void init_highlight( @@ -487,9 +475,6 @@ void do_highlight( int error = FALSE; int color; int is_normal_group = FALSE; /* "Normal" group */ -#ifdef FEAT_TERMINAL - int is_terminal_group = FALSE; /* "Terminal" group */ -#endif #define is_menu_group 0 #define is_tooltip_group 0 @@ -661,10 +646,6 @@ void do_highlight( if (STRCMP(HL_TABLE()[idx].sg_name_u, "NORMAL") == 0) is_normal_group = TRUE; -#ifdef FEAT_TERMINAL - else if (STRCMP(HL_TABLE()[idx].sg_name_u, "TERMINAL") == 0) - is_terminal_group = TRUE; -#endif /* Clear the highlighting for ":hi clear {group}" and ":hi clear". */ if (doclear || (forceit && init)) @@ -1154,11 +1135,6 @@ void do_highlight( HL_TABLE() [idx].sg_cterm_attr = 0; } -#ifdef FEAT_TERMINAL - else if (is_terminal_group) - set_terminal_default_colors( - HL_TABLE()[idx].sg_cterm_fg, HL_TABLE()[idx].sg_cterm_bg); -#endif else set_hl_attr(idx); #ifdef FEAT_EVAL @@ -1615,23 +1591,6 @@ get_attr_entry(garray_T *table, attrentry_T *aep) return (table->ga_len - 1 + ATTR_OFF); } -#if defined(FEAT_TERMINAL) || defined(PROTO) -/* - * Get an attribute index for a cterm entry. - * Uses an existing entry when possible or adds one when needed. - */ -int get_cterm_attr_idx(int attr, int fg, int bg) -{ - attrentry_T at_en; - - vim_memset(&at_en, 0, sizeof(attrentry_T)); - at_en.ae_attr = attr; - at_en.ae_u.cterm.fg_color = fg; - at_en.ae_u.cterm.bg_color = bg; - return get_attr_entry(&cterm_attr_table, &at_en); -} -#endif - #if defined(PROTO) /* * Get an attribute index for a cterm entry. diff --git a/src/term.c b/src/term.c index c01a8e738..639e21f8e 100644 --- a/src/term.c +++ b/src/term.c @@ -3893,7 +3893,7 @@ gui_get_rgb_color_cmn(int r, int g, int b) } #endif -#if defined(MSWIN) || defined(FEAT_TERMINAL) || defined(PROTO) +#if defined(MSWIN) || defined(PROTO) static int cube_value[] = { 0x00, 0x5F, 0x87, 0xAF, 0xD7, 0xFF}; @@ -3901,11 +3901,7 @@ static int grey_ramp[] = { 0x08, 0x12, 0x1C, 0x26, 0x30, 0x3A, 0x44, 0x4E, 0x58, 0x62, 0x6C, 0x76, 0x80, 0x8A, 0x94, 0x9E, 0xA8, 0xB2, 0xBC, 0xC6, 0xD0, 0xDA, 0xE4, 0xEE}; -#ifdef FEAT_TERMINAL -#include "libvterm/include/vterm.h" // for VTERM_ANSI_INDEX_NONE -#else #define VTERM_ANSI_INDEX_NONE 0 -#endif static char_u ansi_table[16][4] = { // R G B idx diff --git a/src/undo.c b/src/undo.c index 7f7528a16..a7c28e21e 100644 --- a/src/undo.c +++ b/src/undo.c @@ -389,11 +389,6 @@ int u_savecommon( if (!undo_allowed()) return FAIL; -#ifdef FEAT_TERMINAL - /* A change in a terminal buffer removes the highlighting. */ - term_change_in_curbuf(); -#endif - /* * Saving text for undo means we are going to make a change. Give a * warning for a read-only file before making the change, so that the @@ -3153,16 +3148,13 @@ void u_blockfree(buf_T *buf) * Check if the 'modified' flag is set, or 'ff' has changed (only need to * check the first character, because it can only be "dos", "unix" or "mac"). * "nofile" and "scratch" type buffers are considered to always be unchanged. - * Also considers a buffer changed when a terminal window contains a running - * job. */ int bufIsChanged(buf_T *buf) { -#ifdef FEAT_TERMINAL - if (term_job_running(buf->b_term)) - return TRUE; -#endif - return bufIsChangedNotTerm(buf); + + // In a "prompt" buffer we do respect 'modified', so that we can control + // closing the window by setting or resetting that option. + return (!bt_dontwrite(buf) || bt_prompt(buf)) && (buf->b_changed || file_ff_differs(buf, TRUE)); } /* @@ -3178,16 +3170,6 @@ int anyBufIsChanged(void) return FALSE; } -/* - * Like bufIsChanged() but ignoring a terminal window. - */ -int bufIsChangedNotTerm(buf_T *buf) -{ - // In a "prompt" buffer we do respect 'modified', so that we can control - // closing the window by setting or resetting that option. - return (!bt_dontwrite(buf) || bt_prompt(buf)) && (buf->b_changed || file_ff_differs(buf, TRUE)); -} - int curbufIsChanged(void) { return bufIsChanged(curbuf); diff --git a/src/version.c b/src/version.c index 0aa92eb9e..cc2c69aed 100644 --- a/src/version.c +++ b/src/version.c @@ -406,11 +406,7 @@ static char *(features[]) = "-tag_old_static", "-tag_any_white", "-termguicolors", -#ifdef FEAT_TERMINAL - "+terminal", -#else "-terminal", -#endif #if defined(UNIX) /* only Unix can have terminfo instead of termcap */ #ifdef TERMINFO