diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-07-07 11:54:15 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-07-07 11:54:15 +0200 |
commit | e4f25e4a8db2c8a8a71a4ba2a68540b3ab341e42 (patch) | |
tree | 5e48e171c0581f9a8240c95d4cde445e8b354ff2 /src | |
parent | da5116da4586fc714434411d2cccb066caa3723e (diff) |
patch 8.0.0693: no terminal emulator supportv8.0.0693
Problem: No terminal emulator support. Cannot properly run commands in the
GUI. Cannot run a job interactively with an ssh connection.
Solution: Very early implementation of the :terminal command. Includes
libvterm converted to ANSI C. Many parts still missing.
Diffstat (limited to 'src')
84 files changed, 11489 insertions, 13 deletions
diff --git a/src/Makefile b/src/Makefile index 2df82ecedc..907fdb127e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -482,6 +482,11 @@ CClink = $(CC) # Uncomment this when you do not want inter process communication. #CONF_OPT_CHANNEL = --disable-channel +# TERMINAL - Terminal emulator support, :terminal command. Requires the +# channel feature. +# Uncomment this when you want terminal emulator support. +#CONF_OPT_TERMINAL = --enable-terminal + # MULTIBYTE - To edit multi-byte characters. # Uncomment this when you want to edit a multibyte language. # It's automatically enabled with normal features, GTK or IME support. @@ -598,6 +603,9 @@ CClink = $(CC) # Use this with GCC to check for mistakes, unused arguments, etc. #CFLAGS = -g -Wall -Wextra -Wshadow -Wmissing-prototypes -Wunreachable-code -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 +# Add -Wpedantic to find // comments and other C99 constructs. +# Better disable Perl and Python to avoid a lot of warnings. +#CFLAGS = -g -Wall -Wextra -Wshadow -Wmissing-prototypes -Wpedantic -Wunreachable-code -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 #CFLAGS = -g -O2 -Wall -Wextra -Wmissing-prototypes -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DU_DEBUG #PYTHON_CFLAGS_EXTRA = -Wno-missing-field-initializers #MZSCHEME_CFLAGS_EXTRA = -Wno-unreachable-code -Wno-unused-parameter @@ -1371,6 +1379,13 @@ ALL_GUI_PRO = gui.pro gui_gtk.pro gui_motif.pro gui_xmdlg.pro gui_athena.pro gu # }}} +TERM_DEPS = \ + libvterm/include/vterm.h \ + libvterm/include/vterm_keycodes.h \ + libvterm/src/rect.h \ + libvterm/src/utf8.h \ + libvterm/src/vterm_internal.h + ### Command to create dependencies based on #include "..." ### prototype headers are ignored due to -DPROTO, system ### headers #include <...> are ignored if we use the -MM option, as @@ -1560,6 +1575,7 @@ BASIC_SRC = \ syntax.c \ tag.c \ term.c \ + terminal.c \ ui.c \ undo.c \ userfunc.c \ @@ -1569,6 +1585,7 @@ BASIC_SRC = \ SRC = $(BASIC_SRC) \ $(GUI_SRC) \ + $(TERM_SRC) \ $(HANGULIN_SRC) \ $(LUA_SRC) \ $(MZSCHEME_SRC) \ @@ -1610,7 +1627,7 @@ ALL_SRC = $(BASIC_SRC) $(ALL_GUI_SRC) $(UNITTEST_SRC) $(EXTRA_SRC) LINT_SRC = $(BASIC_SRC) $(GUI_SRC) $(HANGULIN_SRC) \ $(PYTHON_SRC) $(PYTHON3_SRC) $(TCL_SRC) \ $(WORKSHOP_SRC) $(WSDEBUG_SRC) \ - $(NETBEANS_SRC) $(CHANNEL_SRC) + $(NETBEANS_SRC) $(CHANNEL_SRC) $(TERM_SRC) #LINT_SRC = $(SRC) #LINT_SRC = $(ALL_SRC) #LINT_SRC = $(BASIC_SRC) @@ -1665,12 +1682,14 @@ OBJ_COMMON = \ objects/syntax.o \ objects/tag.o \ objects/term.o \ + objects/terminal.o \ objects/ui.o \ objects/undo.o \ objects/userfunc.o \ objects/version.o \ objects/window.o \ $(GUI_OBJ) \ + $(TERM_OBJ) \ $(LUA_OBJ) \ $(MZSCHEME_OBJ) \ $(PERL_OBJ) \ @@ -1795,6 +1814,7 @@ PRO_AUTO = \ syntax.pro \ tag.pro \ term.pro \ + terminal.pro \ termlib.pro \ ui.pro \ undo.pro \ @@ -1848,7 +1868,7 @@ config auto/config.mk: auto/configure config.mk.in config.h.in $(CONF_OPT_OUTPUT) $(CONF_OPT_GPM) $(CONF_OPT_WORKSHOP) \ $(CONF_OPT_FEAT) $(CONF_TERM_LIB) \ $(CONF_OPT_COMPBY) $(CONF_OPT_ACL) $(CONF_OPT_NETBEANS) \ - $(CONF_OPT_CHANNEL) \ + $(CONF_OPT_CHANNEL) $(CONF_OPT_TERMINAL) \ $(CONF_ARGS) $(CONF_OPT_MZSCHEME) $(CONF_OPT_PLTHOME) \ $(CONF_OPT_LUA) $(CONF_OPT_LUA_PREFIX) \ $(CONF_OPT_SYSMOUSE); \ @@ -3228,6 +3248,9 @@ objects/tag.o: tag.c objects/term.o: term.c $(CCC) -o $@ term.c +objects/terminal.o: terminal.c $(TERM_DEPS) + $(CCC) -o $@ terminal.c + objects/ui.o: ui.c $(CCC) -o $@ ui.c @@ -3255,6 +3278,34 @@ objects/channel.o: channel.c Makefile: @echo The name of the makefile MUST be "Makefile" (with capital M)!!!! +CCCTERM = $(CCC) -Ilibvterm/include -DINLINE="" +objects/term_encoding.o: libvterm/src/encoding.c $(TERM_DEPS) + $(CCCTERM) -o $@ libvterm/src/encoding.c + +objects/term_keyboard.o: libvterm/src/keyboard.c $(TERM_DEPS) + $(CCCTERM) -o $@ libvterm/src/keyboard.c + +objects/term_mouse.o: libvterm/src/mouse.c $(TERM_DEPS) + $(CCCTERM) -o $@ libvterm/src/mouse.c + +objects/term_parser.o: libvterm/src/parser.c $(TERM_DEPS) + $(CCCTERM) -o $@ libvterm/src/parser.c + +objects/term_pen.o: libvterm/src/pen.c $(TERM_DEPS) + $(CCCTERM) -o $@ libvterm/src/pen.c + +objects/term_screen.o: libvterm/src/screen.c $(TERM_DEPS) + $(CCCTERM) -o $@ libvterm/src/screen.c + +objects/term_state.o: libvterm/src/state.c $(TERM_DEPS) + $(CCCTERM) -o $@ libvterm/src/state.c + +objects/term_unicode.o: libvterm/src/unicode.c $(TERM_DEPS) + $(CCCTERM) -o $@ libvterm/src/unicode.c + +objects/term_vterm.o: libvterm/src/vterm.c $(TERM_DEPS) + $(CCCTERM) -o $@ libvterm/src/vterm.c + ############################################################################### ### MacOS X installation ### @@ -3399,7 +3450,7 @@ objects/ex_cmds2.o: ex_cmds2.c vim.h auto/config.h feature.h os_unix.h \ objects/ex_docmd.o: ex_docmd.c vim.h auto/config.h feature.h os_unix.h \ auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ regexp.h gui.h gui_beval.h proto/gui_beval.pro alloc.h ex_cmds.h spell.h \ - proto.h globals.h farsi.h arabic.h + proto.h globals.h farsi.h arabic.h ex_cmdidxs.h objects/ex_eval.o: ex_eval.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ gui_beval.h proto/gui_beval.pro alloc.h ex_cmds.h spell.h proto.h \ diff --git a/src/auto/configure b/src/auto/configure index 1980a95b20..c575a44130 100755 --- a/src/auto/configure +++ b/src/auto/configure @@ -655,6 +655,8 @@ X_PRE_LIBS X_CFLAGS XMKMF xmkmfpath +TERM_OBJ +TERM_SRC CHANNEL_OBJ CHANNEL_SRC NETBEANS_OBJ @@ -814,6 +816,7 @@ enable_cscope enable_workshop enable_netbeans enable_channel +enable_terminal enable_multibyte enable_hangulinput enable_xim @@ -1491,6 +1494,7 @@ Optional Features: --enable-workshop Include Sun Visual Workshop support. --disable-netbeans Disable NetBeans integration support. --disable-channel Disable process communication support. + --enable-terminal Disable terminal emulation support. --enable-multibyte Include multibyte editing support. --enable-hangulinput Include Hangul input support. --enable-xim Include XIM input support. @@ -7464,6 +7468,35 @@ 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; enable_terminal="yes" +fi + +if test "$enable_terminal" = "yes"; 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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +if test "$enable_terminal" = "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/screen.c libvterm/src/state.c libvterm/src/unicode.c libvterm/src/vterm.c" + + TERM_OBJ="objects/term_encoding.o objects/term_keyboard.o objects/term_mouse.o objects/term_parser.o objects/term_pen.o objects/term_screen.o objects/term_state.o objects/term_unicode.o objects/term_vterm.o" + +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-multibyte argument" >&5 $as_echo_n "checking --enable-multibyte argument... " >&6; } # Check whether --enable-multibyte was given. diff --git a/src/config.h.in b/src/config.h.in index a93450710f..fe68d49b14 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -431,6 +431,9 @@ /* 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/config.mk.in b/src/config.mk.in index 90a3337789..1e7fbd5106 100644 --- a/src/config.mk.in +++ b/src/config.mk.in @@ -91,6 +91,8 @@ NETBEANS_SRC = @NETBEANS_SRC@ NETBEANS_OBJ = @NETBEANS_OBJ@ CHANNEL_SRC = @CHANNEL_SRC@ CHANNEL_OBJ = @CHANNEL_OBJ@ +TERM_SRC = @TERM_SRC@ +TERM_OBJ = @TERM_OBJ@ RUBY = @vi_cv_path_ruby@ RUBY_SRC = @RUBY_SRC@ diff --git a/src/configure.ac b/src/configure.ac index 1c1b1c7e42..6ffdab2910 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -2028,6 +2028,28 @@ if test "$enable_channel" = "yes"; then AC_SUBST(CHANNEL_OBJ) fi +AC_MSG_CHECKING(--enable-terminal argument) +AC_ARG_ENABLE(terminal, + [ --enable-terminal Disable terminal emulation support.], + [enable_terminal="yes"], ) +if test "$enable_terminal" = "yes"; 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 + AC_MSG_RESULT(yes) + fi +else + AC_MSG_RESULT(no) +fi +if test "$enable_terminal" = "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/screen.c libvterm/src/state.c libvterm/src/unicode.c libvterm/src/vterm.c" + AC_SUBST(TERM_SRC) + TERM_OBJ="objects/term_encoding.o objects/term_keyboard.o objects/term_mouse.o objects/term_parser.o objects/term_pen.o objects/term_screen.o objects/term_state.o objects/term_unicode.o objects/term_vterm.o" + AC_SUBST(TERM_OBJ) +fi + AC_MSG_CHECKING(--enable-multibyte argument) AC_ARG_ENABLE(multibyte, [ --enable-multibyte Include multibyte editing support.], , diff --git a/src/evalfunc.c b/src/evalfunc.c index 2d796f7e13..3af5cd74be 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -5870,6 +5870,9 @@ f_has(typval_T *argvars, typval_T *rettv) #ifdef FEAT_TERMGUICOLORS "termguicolors", #endif +#ifdef FEAT_TERMINAL + "terminal", +#endif #ifdef TERMINFO "terminfo", #endif diff --git a/src/ex_cmdidxs.h b/src/ex_cmdidxs.h index 3b6120e864..4d3bcbebb5 100644 --- a/src/ex_cmdidxs.h +++ b/src/ex_cmdidxs.h @@ -25,12 +25,12 @@ static const unsigned short cmdidxs1[26] = /* r */ 351, /* s */ 370, /* t */ 437, - /* u */ 472, - /* v */ 483, - /* w */ 501, - /* x */ 516, - /* y */ 525, - /* z */ 526 + /* u */ 473, + /* v */ 484, + /* w */ 502, + /* x */ 517, + /* y */ 526, + /* z */ 527 }; /* @@ -60,7 +60,7 @@ static const unsigned char cmdidxs2[26][26] = /* q */ { 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* r */ { 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 18, 0, 0, 0, 0 }, /* s */ { 2, 6, 15, 0, 18, 22, 0, 24, 25, 0, 0, 28, 30, 34, 38, 40, 0, 48, 0, 49, 0, 61, 62, 0, 63, 0 }, - /* t */ { 2, 0, 19, 0, 22, 23, 0, 24, 0, 25, 0, 26, 27, 28, 29, 30, 0, 31, 33, 0, 34, 0, 0, 0, 0, 0 }, + /* t */ { 2, 0, 19, 0, 22, 24, 0, 25, 0, 26, 0, 27, 28, 29, 30, 31, 0, 32, 34, 0, 35, 0, 0, 0, 0, 0 }, /* u */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* v */ { 0, 0, 0, 0, 1, 0, 0, 0, 4, 0, 0, 0, 9, 12, 0, 0, 0, 0, 15, 0, 16, 0, 0, 0, 0, 0 }, /* w */ { 2, 0, 0, 0, 0, 0, 0, 3, 4, 0, 0, 0, 0, 8, 0, 9, 10, 0, 12, 0, 13, 14, 0, 0, 0, 0 }, @@ -69,4 +69,4 @@ static const unsigned char cmdidxs2[26][26] = /* z */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; -static const int command_count = 539; +static const int command_count = 540; diff --git a/src/ex_docmd.c b/src/ex_docmd.c index bdd152dfd7..6ff578e655 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -488,6 +488,9 @@ static void ex_folddo(exarg_T *eap); #ifndef FEAT_PROFILE # define ex_profile ex_ni #endif +#ifndef FEAT_TERMINAL +# define ex_terminal ex_ni +#endif /* * Declare cmdnames[]. diff --git a/src/feature.h b/src/feature.h index 138279e462..f77ffd6fe0 100644 --- a/src/feature.h +++ b/src/feature.h @@ -1268,6 +1268,13 @@ #endif /* + * +terminal ":terminal" command. Runs a terminal in a window. + */ +#if !defined(FEAT_JOB_CHANNEL) && defined(FEAT_TERMINAL) +# undef FEAT_TERMINAL +#endif + +/* * +signs Allow signs to be displayed to the left of text lines. * Adds the ":sign" command. */ diff --git a/src/libvterm/.bzrignore b/src/libvterm/.bzrignore new file mode 100644 index 0000000000..e58c036693 --- /dev/null +++ b/src/libvterm/.bzrignore @@ -0,0 +1,13 @@ +.libs +*.lo +*.la + +bin/* +!bin/*.c + +pangoterm +t/test +t/suites.h +t/externs.h +t/harness +src/encoding/*.inc diff --git a/src/libvterm/.gitignore b/src/libvterm/.gitignore new file mode 100644 index 0000000000..725c6f16f4 --- /dev/null +++ b/src/libvterm/.gitignore @ |