aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/CMakeLists.txt4
-rw-r--r--src/nvim/eval.c41
-rw-r--r--src/nvim/ui.c21
-rw-r--r--src/nvim/version.c10
4 files changed, 73 insertions, 3 deletions
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index 172643091a..ab6f69f66c 100644
--- a/src/nvim/CMakeLists.txt
+++ b/src/nvim/CMakeLists.txt
@@ -55,6 +55,10 @@ foreach(subdir
event
eval
)
+ if(${subdir} MATCHES "tui" AND NOT FEAT_TUI)
+ continue()
+ endif()
+
file(MAKE_DIRECTORY ${GENERATED_DIR}/${subdir})
file(MAKE_DIRECTORY ${GENERATED_INCLUDES_DIR}/${subdir})
file(GLOB sources ${subdir}/*.c)
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 6ae5081550..18d6dc1444 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -6680,6 +6680,7 @@ static struct fst {
{ "asin", 1, 1, f_asin }, // WJMc
{ "assert_equal", 2, 3, f_assert_equal },
{ "assert_exception", 1, 2, f_assert_exception },
+ { "assert_fails", 1, 2, f_assert_fails },
{ "assert_false", 1, 2, f_assert_false },
{ "assert_true", 1, 2, f_assert_true },
{ "atan", 1, 1, f_atan },
@@ -7667,6 +7668,43 @@ static void f_assert_exception(typval_T *argvars, typval_T *rettv)
}
}
+/// "assert_fails(cmd [, error])" function
+static void f_assert_fails(typval_T *argvars, typval_T *rettv)
+{
+ char_u *cmd = get_tv_string_chk(&argvars[0]);
+ garray_T ga;
+
+ called_emsg = false;
+ suppress_errthrow = true;
+ emsg_silent = true;
+ do_cmdline_cmd((char *)cmd);
+ if (!called_emsg) {
+ prepare_assert_error(&ga);
+ ga_concat(&ga, (char_u *)"command did not fail: ");
+ ga_concat(&ga, cmd);
+ assert_error(&ga);
+ ga_clear(&ga);
+ } else if (argvars[1].v_type != VAR_UNKNOWN) {
+ char_u buf[NUMBUFLEN];
+ char *error = (char *)get_tv_string_buf_chk(&argvars[1], buf);
+
+ if (error == NULL
+ || strstr((char *)vimvars[VV_ERRMSG].vv_str, error) == NULL) {
+ prepare_assert_error(&ga);
+ fill_assert_error(&ga, &argvars[2], NULL, &argvars[1],
+ &vimvars[VV_ERRMSG].vv_tv);
+ assert_error(&ga);
+ ga_clear(&ga);
+ }
+ }
+
+ called_emsg = false;
+ suppress_errthrow = false;
+ emsg_silent = false;
+ emsg_on_display = false;
+ set_vim_var_string(VV_ERRMSG, NULL, 0);
+}
+
// Common for assert_true() and assert_false().
static void assert_bool(typval_T *argvars, bool is_true)
{
@@ -16529,6 +16567,9 @@ static void f_timer_stop(typval_T *argvars, typval_T *rettv)
static void timer_due_cb(TimeWatcher *tw, void *data)
{
timer_T *timer = (timer_T *)data;
+ if (timer->stopped) {
+ return;
+ }
// if repeat was negative repeat forever
if (timer->repeat_count >= 0 && --timer->repeat_count == 0) {
timer_stop(timer);
diff --git a/src/nvim/ui.c b/src/nvim/ui.c
index 244b0974e5..ae38754c1e 100644
--- a/src/nvim/ui.c
+++ b/src/nvim/ui.c
@@ -30,7 +30,11 @@
#include "nvim/screen.h"
#include "nvim/syntax.h"
#include "nvim/window.h"
-#include "nvim/tui/tui.h"
+#ifdef FEAT_TUI
+# include "nvim/tui/tui.h"
+#else
+# include "nvim/msgpack_rpc/server.h"
+#endif
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "ui.c.generated.h"
@@ -83,7 +87,22 @@ static int height, width;
void ui_builtin_start(void)
{
+#ifdef FEAT_TUI
tui_start();
+#else
+ fprintf(stderr, "Neovim was built without a Terminal UI," \
+ "press Ctrl+C to exit\n");
+
+ size_t len;
+ char **addrs = server_address_list(&len);
+ if (addrs != NULL) {
+ fprintf(stderr, "currently listening on the following address(es)\n");
+ for (size_t i = 0; i < len; i++) {
+ fprintf(stderr, "\t%s\n", addrs[i]);
+ }
+ xfree(addrs);
+ }
+#endif
}
void ui_builtin_stop(void)
diff --git a/src/nvim/version.c b/src/nvim/version.c
index d34df421f3..c491021328 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -64,6 +64,12 @@ static char *features[] = {
#else
"-jemalloc",
#endif
+
+#ifdef FEAT_TUI
+ "+tui",
+#else
+ "-tui",
+#endif
NULL
};
@@ -119,7 +125,7 @@ static int included_patches[] = {
1570,
1569,
1568,
- // 1567,
+ 1567,
// 1566 NA
// 1565,
// 1564,
@@ -590,7 +596,7 @@ static int included_patches[] = {
// 1099 NA
// 1098 NA
// 1097,
- // 1096,
+ 1096,
// 1095 NA
// 1094,
1093,