aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/buffer.c3
-rw-r--r--src/nvim/edit.c19
-rw-r--r--src/nvim/eval.c7
-rw-r--r--src/nvim/ex_cmds.c16
-rw-r--r--src/nvim/ex_cmds2.c2
-rw-r--r--src/nvim/ex_docmd.c21
-rw-r--r--src/nvim/ex_getln.c9
-rw-r--r--src/nvim/globals.h17
-rw-r--r--src/nvim/hardcopy.c4
-rw-r--r--src/nvim/memline.c1
-rw-r--r--src/nvim/message.c3
-rw-r--r--src/nvim/misc1.c28
-rw-r--r--src/nvim/msgpack_rpc/remote_ui.c8
-rw-r--r--src/nvim/normal.c6
-rw-r--r--src/nvim/ops.c9
-rw-r--r--src/nvim/option.c38
-rw-r--r--src/nvim/os_unix.c7
-rw-r--r--src/nvim/path.c2
-rw-r--r--src/nvim/screen.c40
-rw-r--r--src/nvim/syntax.c7
-rw-r--r--src/nvim/tag.c4
-rw-r--r--src/nvim/testdir/test77.in30
-rw-r--r--src/nvim/testdir/test77.ok1
-rw-r--r--src/nvim/tui/tui.c2
-rw-r--r--src/nvim/types.h16
-rw-r--r--src/nvim/undo.c4
-rw-r--r--src/nvim/version.c22
-rw-r--r--src/nvim/version.h17
-rw-r--r--src/nvim/version_defs.h56
-rw-r--r--src/nvim/window.c3
30 files changed, 92 insertions, 310 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index fa25b68641..c4abcd77b1 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -70,6 +70,7 @@
#include "nvim/syntax.h"
#include "nvim/ui.h"
#include "nvim/undo.h"
+#include "nvim/version.h"
#include "nvim/window.h"
#include "nvim/os/os.h"
#include "nvim/os/time.h"
@@ -4033,8 +4034,6 @@ void do_modelines(int flags)
--entered;
}
-#include "nvim/version_defs.h" /* for version number */
-
/*
* chk_modeline() - check a single line for a mode string
* Return FAIL if an error encountered.
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index c0bd8cc8fd..c6716dc870 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -268,13 +268,11 @@ edit (
// set Insstart_orig to Insstart
update_Insstart_orig = true;
-#ifdef HAVE_SANDBOX
- /* Don't allow inserting in the sandbox. */
+ // Don't allow inserting in the sandbox.
if (sandbox != 0) {
EMSG(_(e_sandbox));
return FALSE;
}
-#endif
/* Don't allow changes in the buffer while editing the cmdline. The
* caller of getcmdline() may get confused. */
if (textlock != 0) {
@@ -584,9 +582,6 @@ edit (
old_topline = curwin->w_topline;
old_topfill = curwin->w_topfill;
-#ifdef USE_ON_FLY_SCROLL
- dont_scroll = FALSE; /* allow scrolling here */
-#endif
/*
* Get a character for Insert mode. Ignore K_IGNORE.
@@ -4703,9 +4698,6 @@ int get_literal(void)
if (got_int)
return Ctrl_C;
-#ifdef USE_ON_FLY_SCROLL
- dont_scroll = TRUE; /* disallow scrolling here */
-#endif
++no_mapping; /* don't map the next key hits */
cc = 0;
i = 0;
@@ -4964,9 +4956,6 @@ insertchar (
* Don't do this when there an InsertCharPre autocommand is defined,
* because we need to fire the event for every character.
*/
-#ifdef USE_ON_FLY_SCROLL
- dont_scroll = FALSE; /* allow scrolling here */
-#endif
if ( !ISSPECIAL(c)
&& (!has_mbyte || (*mb_char2len)(c) == 1)
@@ -6731,9 +6720,6 @@ static void ins_reg(void)
add_to_showcmd_c(Ctrl_R);
}
-#ifdef USE_ON_FLY_SCROLL
- dont_scroll = TRUE; /* disallow scrolling here */
-#endif
/*
* Don't map the register name. This also prevents the mode message to be
@@ -8058,9 +8044,6 @@ static int ins_digraph(void)
add_to_showcmd_c(Ctrl_K);
}
-#ifdef USE_ON_FLY_SCROLL
- dont_scroll = TRUE; /* disallow scrolling here */
-#endif
/* don't map the digraph chars. This also prevents the
* mode message to be deleted when ESC is hit */
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 45355bd7ac..ae8e0d329f 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -351,7 +351,6 @@ typedef enum {
* The reason to use this table anyway is for very quick access to the
* variables with the VV_ defines.
*/
-#include "nvim/version_defs.h"
/* values for vv_flags: */
#define VV_COMPAT 1 /* compatible, also used without "v:" */
@@ -9479,7 +9478,9 @@ static void getpos_both(typval_T *argvars, typval_T *rettv, bool getcurpos)
list_append_number(l,
(fp != NULL) ? (varnumber_T)fp->coladd : (varnumber_T)0);
if (getcurpos) {
- list_append_number(l, (varnumber_T) curwin->w_curswant + 1);
+ list_append_number(l, curwin->w_curswant == MAXCOL
+ ? (varnumber_T)MAXCOL
+ : (varnumber_T)curwin->w_curswant + 1);
}
}
@@ -10656,7 +10657,7 @@ static void f_jobsend(typval_T *argvars, typval_T *rettv)
}
ssize_t input_len;
- char *input = (char *) save_tv_as_string(&argvars[1], &input_len, true);
+ char *input = (char *) save_tv_as_string(&argvars[1], &input_len, false);
if (!input) {
// Either the error has been handled by save_tv_as_string(), or there is no
// input to send.
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 3dde055c2a..e98032da5c 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -19,7 +19,6 @@
#include "nvim/vim.h"
#include "nvim/ascii.h"
-#include "nvim/version_defs.h"
#include "nvim/ex_cmds.h"
#include "nvim/buffer.h"
#include "nvim/charset.h"
@@ -64,6 +63,7 @@
#include "nvim/tempfile.h"
#include "nvim/ui.h"
#include "nvim/undo.h"
+#include "nvim/version.h"
#include "nvim/window.h"
#include "nvim/os/os.h"
#include "nvim/os/shell.h"
@@ -1708,7 +1708,7 @@ static void do_viminfo(FILE *fp_in, FILE *fp_out, int flags)
if (fp_out != NULL) {
/* Write the info: */
fprintf(fp_out, _("# This viminfo file was generated by Nvim %s.\n"),
- NVIM_VERSION_MEDIUM);
+ mediumVersion);
fputs(_("# You may edit it if you're careful!\n\n"), fp_out);
fputs(_("# Value of 'encoding' when this file was written\n"), fp_out);
fprintf(fp_out, "*encoding=%s\n\n", p_enc);
@@ -3396,16 +3396,13 @@ int check_secure(void)
EMSG(_(e_curdir));
return TRUE;
}
-#ifdef HAVE_SANDBOX
- /*
- * In the sandbox more things are not allowed, including the things
- * disallowed in secure mode.
- */
+
+ // In the sandbox more things are not allowed, including the things
+ // disallowed in secure mode.
if (sandbox != 0) {
EMSG(_(e_sandbox));
return TRUE;
}
-#endif
return FALSE;
}
@@ -3952,9 +3949,6 @@ void do_sub(exarg_T *eap)
ui_cursor_goto(msg_row, msg_col);
RedrawingDisabled = temp;
-#ifdef USE_ON_FLY_SCROLL
- dont_scroll = FALSE; /* allow scrolling here */
-#endif
++no_mapping; /* don't map this key */
++allow_keys; /* allow special keys */
typed = plain_vgetc();
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index ffafe3cffb..44cb2d48a2 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -21,7 +21,7 @@
#ifdef HAVE_LOCALE_H
# include <locale.h>
#endif
-#include "nvim/version_defs.h"
+#include "nvim/version.h"
#include "nvim/ex_cmds2.h"
#include "nvim/buffer.h"
#include "nvim/charset.h"
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 22ffd67fdd..4e835cc43a 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -1093,9 +1093,7 @@ static char_u * do_one_cmd(char_u **cmdlinep,
int save_msg_scroll = msg_scroll;
int save_msg_silent = -1;
int did_esilent = 0;
-#ifdef HAVE_SANDBOX
int did_sandbox = FALSE;
-#endif
cmdmod_T save_cmdmod;
int ni; /* set when Not Implemented */
@@ -1240,11 +1238,9 @@ static char_u * do_one_cmd(char_u **cmdlinep,
continue;
case 's': if (checkforcmd(&ea.cmd, "sandbox", 3)) {
-#ifdef HAVE_SANDBOX
if (!did_sandbox)
++sandbox;
did_sandbox = TRUE;
-#endif
continue;
}
if (!checkforcmd(&ea.cmd, "silent", 3))
@@ -1509,13 +1505,11 @@ static char_u * do_one_cmd(char_u **cmdlinep,
}
if (!ea.skip) {
-#ifdef HAVE_SANDBOX
if (sandbox != 0 && !(ea.argt & SBOXOK)) {
/* Command not allowed in sandbox. */
errormsg = (char_u *)_(e_sandbox);
goto doend;
}
-#endif
if (!curbuf->b_p_ma && (ea.argt & MODIFY)) {
/* Command not allowed in non-'modifiable' buffer */
errormsg = (char_u *)_(e_modifiable);
@@ -1983,10 +1977,8 @@ doend:
msg_col = 0;
}
-#ifdef HAVE_SANDBOX
if (did_sandbox)
--sandbox;
-#endif
if (ea.nextcmd && *ea.nextcmd == NUL) /* not really a next command */
ea.nextcmd = NULL;
@@ -2582,12 +2574,10 @@ set_one_cmd_context (
}
/* An argument can contain just about everything, except
* characters that end the command and white space. */
- else if (c == '|' || c == '\n' || c == '"' || (vim_iswhite(c)
-#ifdef SPACE_IN_FILENAME
- && (!(ea.argt & NOSPC) ||
- usefilter)
-#endif
- )) {
+ else if (c == '|'
+ || c == '\n'
+ || c == '"'
+ || vim_iswhite(c)) {
len = 0; /* avoid getting stuck when space is in 'isfname' */
while (*p != NUL) {
if (has_mbyte)
@@ -6617,9 +6607,6 @@ static void ex_at(exarg_T *eap)
curwin->w_cursor.lnum = eap->line2;
-#ifdef USE_ON_FLY_SCROLL
- dont_scroll = TRUE; /* disallow scrolling here */
-#endif
/* get the register name. No name means to use the previous one */
c = *eap->arg;
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 3dffb1f1d3..a7bb4afa70 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -291,9 +291,6 @@ getcmdline (
redir_off = TRUE; /* Don't redirect the typed command.
Repeated, because a ":redir" inside
completion may switch it on. */
-#ifdef USE_ON_FLY_SCROLL
- dont_scroll = FALSE; /* allow scrolling here */
-#endif
quit_more = FALSE; /* reset after CTRL-D which had a more-prompt */
cursorcmd(); /* set the cursor on the right spot */
@@ -904,9 +901,6 @@ getcmdline (
goto returncmd; /* back to cmd mode */
case Ctrl_R: /* insert register */
-#ifdef USE_ON_FLY_SCROLL
- dont_scroll = TRUE; /* disallow scrolling here */
-#endif
putcmdline('"', TRUE);
++no_mapping;
i = c = plain_vgetc(); /* CTRL-R <char> */
@@ -1270,9 +1264,6 @@ getcmdline (
case Ctrl_K:
ignore_drag_release = TRUE;
putcmdline('?', TRUE);
-#ifdef USE_ON_FLY_SCROLL
- dont_scroll = TRUE; /* disallow scrolling here */
-#endif
c = get_digraph(TRUE);
if (c != NUL)
break;
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index c0d5217fc2..b15db61f99 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -457,11 +457,8 @@ typedef enum {
'*', '#', '_', '!', '.', 'o'}
EXTERN int highlight_attr[HLF_COUNT]; /* Highl. attr for each context. */
-# define USER_HIGHLIGHT
-#ifdef USER_HIGHLIGHT
EXTERN int highlight_user[9]; /* User[1-9] attributes */
EXTERN int highlight_stlnc[9]; /* On top of user */
-#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);
@@ -622,7 +619,6 @@ EXTERN int allbuf_lock INIT(= 0);
* changed, no buffer can be deleted and
* current directory can't be changed.
* Used for SwapExists et al. */
-# define HAVE_SANDBOX
EXTERN int sandbox INIT(= 0);
/* Non-zero when evaluating an expression in a
* "sandbox". Several things are not allowed
@@ -838,13 +834,6 @@ EXTERN int ctrl_x_mode INIT(= 0); /* Which Ctrl-X mode are we in? */
EXTERN int no_abbr INIT(= TRUE); /* TRUE when no abbreviations loaded */
-#ifdef USE_EXE_NAME
-EXTERN char_u *exe_name; /* the name of the executable */
-#endif
-
-#ifdef USE_ON_FLY_SCROLL
-EXTERN int dont_scroll INIT(= FALSE); /* don't use scrollbars when TRUE */
-#endif
EXTERN int mapped_ctrl_c INIT(= FALSE); /* CTRL-C is mapped */
EXTERN cmdmod_T cmdmod; /* Ex command modifiers */
@@ -978,10 +967,6 @@ EXTERN int wild_menu_showing INIT(= 0);
EXTERN char breakat_flags[256]; /* which characters are in 'breakat' */
-/* these are in version.c */
-extern char *Version;
-extern char *longVersion;
-
/*
* Some file names are stored in pathdef.c, which is generated from the
* Makefile to make their value depend on the Makefile.
@@ -1180,9 +1165,7 @@ EXTERN char_u e_readonlyvar[] INIT(= N_(
EXTERN char_u e_readonlysbx[] INIT(= N_(
"E794: Cannot set variable in the sandbox: \"%s\""));
EXTERN char_u e_readerrf[] INIT(= N_("E47: Error while reading errorfile"));
-#ifdef HAVE_SANDBOX
EXTERN char_u e_sandbox[] INIT(= N_("E48: Not allowed in sandbox"));
-#endif
EXTERN char_u e_secure[] INIT(= N_("E523: Not allowed here"));
EXTERN char_u e_screenmode[] INIT(= N_(
"E359: Screen mode setting not supported"));
diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c
index 0da5caf7cd..db81746d73 100644
--- a/src/nvim/hardcopy.c
+++ b/src/nvim/hardcopy.c
@@ -21,7 +21,6 @@
#ifdef HAVE_LOCALE_H
# include <locale.h>
#endif
-#include "nvim/version_defs.h"
#include "nvim/hardcopy.h"
#include "nvim/buffer.h"
#include "nvim/charset.h"
@@ -42,6 +41,7 @@
#include "nvim/strings.h"
#include "nvim/syntax.h"
#include "nvim/ui.h"
+#include "nvim/version.h"
#include "nvim/tempfile.h"
#include "nvim/os/os.h"
#include "nvim/os/input.h"
@@ -2440,7 +2440,7 @@ int mch_print_begin(prt_settings_T *psettings)
STRCPY(buffer, "Unknown");
}
prt_dsc_textline("For", buffer);
- prt_dsc_textline("Creator", NVIM_VERSION_LONG);
+ prt_dsc_textline("Creator", longVersion);
/* Note: to ensure Clean8bit I don't think we can use LC_TIME */
now = time(NULL);
p_time = ctime(&now);
diff --git a/src/nvim/memline.c b/src/nvim/memline.c
index 817fd08a9c..1339671c92 100644
--- a/src/nvim/memline.c
+++ b/src/nvim/memline.c
@@ -70,6 +70,7 @@
#include "nvim/spell.h"
#include "nvim/strings.h"
#include "nvim/ui.h"
+#include "nvim/version.h"
#include "nvim/tempfile.h"
#include "nvim/undo.h"
#include "nvim/window.h"
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 27619fcc5d..3a68de8881 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -794,9 +794,6 @@ void wait_return(int redraw)
State = HITRETURN;
setmouse();
-#ifdef USE_ON_FLY_SCROLL
- dont_scroll = TRUE; /* disallow scrolling here */
-#endif
/* Avoid the sequence that the user types ":" at the hit-return prompt
* to start an Ex command, but the file-changed dialog gets in the
* way. */
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c
index bf6443e21e..04551355ae 100644
--- a/src/nvim/misc1.c
+++ b/src/nvim/misc1.c
@@ -19,7 +19,7 @@
#include "nvim/vim.h"
#include "nvim/ascii.h"
-#include "nvim/version_defs.h"
+#include "nvim/version.h"
#include "nvim/misc1.h"
#include "nvim/charset.h"
#include "nvim/cursor.h"
@@ -2290,9 +2290,6 @@ int ask_yesno(char_u *str, int direct)
int save_State = State;
++no_wait_return;
-#ifdef USE_ON_FLY_SCROLL
- dont_scroll = TRUE; /* disallow scrolling here */
-#endif
State = CONFIRM; /* mouse behaves like with :confirm */
setmouse(); /* disables mouse for xterm */
++no_mapping;
@@ -2465,9 +2462,6 @@ get_number (
if (msg_silent != 0)
return 0;
-#ifdef USE_ON_FLY_SCROLL
- dont_scroll = TRUE; /* disallow scrolling here */
-#endif
++no_mapping;
++allow_keys; /* no mapping here, but recognize keys */
for (;; ) {
@@ -2955,13 +2949,6 @@ char_u *vim_getenv(char_u *name, int *mustfree)
if (p == NULL) {
if (p_hf != NULL && vim_strchr(p_hf, '$') == NULL)
p = p_hf;
-#ifdef USE_EXE_NAME
- /*
- * Use the name of the executable, obtained from argv[0].
- */
- else
- p = exe_name;
-#endif
if (p != NULL) {
/* remove the file name */
pend = path_tail(p);
@@ -2970,12 +2957,6 @@ char_u *vim_getenv(char_u *name, int *mustfree)
if (p == p_hf)
pend = remove_tail(p, pend, (char_u *)"doc");
-#ifdef USE_EXE_NAME
- /* remove "src/" from exe_name, if present */
- if (p == exe_name)
- pend = remove_tail(p, pend, (char_u *)"src");
-#endif
-
/* for $VIM, remove "runtime/" or "vim54/", if present */
if (!vimruntime) {
pend = remove_tail(p, pend, (char_u *)RUNTIME_DIRNAME);
@@ -2995,13 +2976,6 @@ char_u *vim_getenv(char_u *name, int *mustfree)
free(p);
p = NULL;
} else {
-#ifdef USE_EXE_NAME
- /* may add "/vim54" or "/runtime" if it exists */
- if (vimruntime && (pend = vim_version_dir(p)) != NULL) {
- free(p);
- p = pend;
- }
-#endif
*mustfree = TRUE;
}
}
diff --git a/src/nvim/msgpack_rpc/remote_ui.c b/src/nvim/msgpack_rpc/remote_ui.c
index 361e93a6da..45b3dee0fd 100644
--- a/src/nvim/msgpack_rpc/remote_ui.c
+++ b/src/nvim/msgpack_rpc/remote_ui.c
@@ -66,8 +66,8 @@ static Object remote_ui_attach(uint64_t channel_id, uint64_t request_id,
|| args.items[2].type != kObjectTypeBoolean
|| args.items[0].data.integer <= 0 || args.items[1].data.integer <= 0) {
api_set_error(error, Validation,
- _("Arguments must be a pair of positive integers "
- "representing the remote screen width/height"));
+ _("Invalid arguments. Expected: "
+ "(uint width > 0, uint height > 0, bool enable_rgb)"));
return NIL;
}
UIData *data = xmalloc(sizeof(UIData));
@@ -127,8 +127,8 @@ static Object remote_ui_try_resize(uint64_t channel_id, uint64_t request_id,
|| args.items[1].type != kObjectTypeInteger
|| args.items[0].data.integer <= 0 || args.items[1].data.integer <= 0) {
api_set_error(error, Validation,
- _("Arguments must be a pair of positive integers "
- "representing the remote screen width/height"));
+ _("Invalid arguments. Expected: "
+ "(uint width > 0, uint height > 0)"));
return NIL;
}
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 3906226b2e..c6250297c1 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -473,9 +473,6 @@ normal_cmd (
mapped_len = typebuf_maplen();
State = NORMAL_BUSY;
-#ifdef USE_ON_FLY_SCROLL
- dont_scroll = false; /* allow scrolling here */
-#endif
/* Set v:count here, when called from main() and not a stuffed
* command, so that v:count can be used in an expression mapping
@@ -3607,9 +3604,6 @@ static void nv_zet(cmdarg_T *cap)
return;
n = nchar - '0';
for (;; ) {
-#ifdef USE_ON_FLY_SCROLL
- dont_scroll = true; /* disallow scrolling here */
-#endif
++no_mapping;
++allow_keys; /* no mapping for nchar, but allow key codes */
nchar = plain_vgetc();
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 395ddf95a7..062fc1bbfa 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -3200,13 +3200,10 @@ void ex_display(exarg_T *eap)
MSG_PUTS_TITLE(_("\n--- Registers ---"));
for (i = -1; i < NUM_REGISTERS && !got_int; ++i) {
name = get_register_name(i);
- if (arg != NULL && vim_strchr(arg, name) == NULL
-#ifdef ONE_CLIPBOARD
- /* Star register and plus register contain the same thing. */
- && (name != '*' || vim_strchr(arg, '+') == NULL)
-#endif
- )
+
+ if (arg != NULL && vim_strchr(arg, name) == NULL) {
continue; /* did not ask for this register */
+ }
get_clipboard(name);
diff --git a/src/nvim/option.c b/src/nvim/option.c
index d52b9ebf7a..3d596f81cc 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -1989,7 +1989,7 @@ void set_init_1(void)
char_u *save_enc;
/* Try setting 'encoding' and check if the value is valid.
- * If not, go back to the default "latin1". */
+ * If not, go back to the default "utf-8". */
save_enc = p_enc;
p_enc = p;
if (STRCMP(p_enc, "gb18030") == 0) {
@@ -2029,8 +2029,13 @@ void set_init_1(void)
} else {
free(p_enc);
+ // mb_init() failed; fallback to utf8 and try again.
p_enc = save_enc;
+ mb_init();
}
+ } else {
+ // enc_locale() failed; initialize the default (utf8).
+ mb_init();
}
/* Set the default for 'helplang'. */
@@ -2525,13 +2530,11 @@ do_set (
goto skip;
}
-#ifdef HAVE_SANDBOX
/* Disallow changing some options in the sandbox */
if (sandbox != 0 && (flags & P_SECURE)) {
errmsg = (char_u *)_(e_sandbox);
goto skip;
}
-#endif
if (vim_strchr((char_u *)"?=:!&<", nextchar) != NULL) {
arg += len;
@@ -3066,9 +3069,7 @@ did_set_option (
* flag. */
uint32_t *p = insecure_flag(opt_idx, opt_flags);
if (secure
-#ifdef HAVE_SANDBOX
|| sandbox != 0
-#endif
|| (opt_flags & OPT_MODELINE))
*p = *p | P_INSECURE;
else if (new_value)
@@ -3577,11 +3578,8 @@ did_set_string_option (
gvarp = (char_u **)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL);
/* Disallow changing some options from secure mode */
- if ((secure
-#ifdef HAVE_SANDBOX
- || sandbox != 0
-#endif
- ) && (options[opt_idx].flags & P_SECURE)) {
+ if ((secure || sandbox != 0)
+ && (options[opt_idx].flags & P_SECURE)) {
errmsg = e_secure;
}
/* Check for a "normal" file name in some options. Disallow a path
@@ -4697,12 +4695,10 @@ set_bool_option (
int old_value = *(int *)varp;
/* Disallow changing some options from secure mode */
- if ((secure
-#ifdef HAVE_SANDBOX
- || sandbox != 0
-#endif
- ) && (options[opt_idx].flags & P_SECURE))
+ if ((secure || sandbox != 0)
+ && (options[opt_idx].flags & P_SECURE)) {
return e_secure;
+ }
*(int *)varp = value; /* set the new value */
/* Remember where the option was set. */
@@ -5064,12 +5060,10 @@ set_num_option (
long *pp = (long *)varp;
/* Disallow changing some options from secure mode. */
- if ((secure
-#ifdef HAVE_SANDBOX
- || sandbox != 0
-#endif
- ) && (options[opt_idx].flags & P_SECURE))
+ if ((secure || sandbox != 0)
+ && (options[opt_idx].flags & P_SECURE)) {
return e_secure;
+ }
*pp = value;
/* Remember where the option was set. */
@@ -5755,13 +5749,11 @@ set_option_value (
EMSG2(_("E355: Unknown option: %s"), name);
else {
uint32_t flags = options[opt_idx].flags;
-#ifdef HAVE_SANDBOX
- /* Disallow changing some options in the sandbox */
+ // Disallow changing some options in the sandbox
if (sandbox > 0 && (flags & P_SECURE)) {
EMSG(_(e_sandbox));
return NULL;
}
-#endif
if (flags & P_STRING)
return set_string_option(opt_idx, string, opt_flags);
else {
diff --git a/src/nvim/os_unix.c b/src/nvim/os_unix.c
index 87ef1220e7..5d8b4ad26a 100644
--- a/src/nvim/os_unix.c
+++ b/src/nvim/os_unix.c
@@ -317,11 +317,10 @@ int mch_expand_wildcards(int num_pat, char_u **pat, int *num_file,
return OK;
}
-# ifdef HAVE_SANDBOX
- /* Don't allow any shell command in the sandbox. */
- if (sandbox != 0 && check_secure())
+ // Don't allow any shell command in the sandbox.
+ if (sandbox != 0 && check_secure()) {
return FAIL;
-# endif
+ }
/*
* Don't allow the use of backticks in secure and restricted mode.
diff --git a/src/nvim/path.c b/src/nvim/path.c
index 93aa5eed3d..361a4a57f0 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -403,7 +403,7 @@ char_u *save_absolute_path(const char_u *name)
#if !defined(NO_EXPANDPATH)
-#if defined(UNIX) || defined(USE_UNIXFILENAME)
+#if defined(UNIX)
/*
* Unix style wildcard expansion code.
* It's here because it's used both for Unix and Mac.
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 69025e15bb..f26c74998e 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -1858,11 +1858,6 @@ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T
} else
prev_c = u8c;
/* Non-BMP character: display as ? or fullwidth ?. */
-#ifdef UNICODE16
- if (u8c >= 0x10000)
- ScreenLinesUC[idx] = (cells == 2) ? 0xff1f : (int)'?';
- else
-#endif
ScreenLinesUC[idx] = u8c;
for (i = 0; i < Screen_mco; ++i) {
ScreenLinesC[i][idx] = u8cc[i];
@@ -3051,30 +3046,13 @@ win_line (
if ((mb_l == 1 && c >= 0x80)
|| (mb_l >= 1 && mb_c == 0)
- || (mb_l > 1 && (!vim_isprintc(mb_c)
-# ifdef UNICODE16
- || mb_c >= 0x10000
-# endif
- ))) {
- /*
- * Illegal UTF-8 byte: display as <xx>.
- * Non-BMP character : display as ? or fullwidth ?.
- */
-# ifdef UNICODE16
- if (mb_c < 0x10000)
-# endif
- {
- transchar_hex(extra, mb_c);
- if (wp->w_p_rl) /* reverse */
+ || (mb_l > 1 && (!vim_isprintc(mb_c)))) {
+ // Illegal UTF-8 byte: display as <xx>.
+ // Non-BMP character : display as ? or fullwidth ?.
+ transchar_hex(extra, mb_c);
+ if (wp->w_p_rl) { // reverse
rl_mirror(extra);
}
-# ifdef UNICODE16
- else if (utf_char2cells(mb_c) != 2)
- STRCPY(extra, "?");
- else
- /* 0xff1f in UTF-8: full-width '?' */
- STRCPY(extra, "\357\274\237");
-# endif
p_extra = extra;
c = *p_extra;
@@ -5226,14 +5204,6 @@ void screen_puts_len(char_u *text, int textlen, int row, int col, int attr)
else
u8c = utfc_ptr2char(ptr, u8cc);
mbyte_cells = utf_char2cells(u8c);
-# ifdef UNICODE16
- /* Non-BMP character: display as ? or fullwidth ?. */
- if (u8c >= 0x10000) {
- u8c = (mbyte_cells == 2) ? 0xff1f : (int)'?';
- if (attr == 0)
- attr = hl_attr(HLF_8);
- }
-# endif
if (p_arshape && !p_tbidi && arabic_char(u8c)) {
/* Do Arabic shaping. */
if (len >= 0 && (int)(ptr - text) + mbyte_blen >= len) {
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index 3fc004036e..4f67507ea2 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -7174,12 +7174,10 @@ int highlight_changed(void)
int attr;
char_u *end;
int id;
-#ifdef USER_HIGHLIGHT
char_u userhl[10];
int id_SNC = -1;
int id_S = -1;
int hlcnt;
-#endif
static int hl_flags[HLF_COUNT] = HL_FLAGS;
need_highlight_changed = FALSE;
@@ -7251,12 +7249,10 @@ int highlight_changed(void)
return FAIL;
attr = syn_id2attr(id);
p = end - 1;
-#ifdef USER_HIGHLIGHT
if (hlf == (int)HLF_SNC)
id_SNC = syn_get_final_id(id);
else if (hlf == (int)HLF_S)
id_S = syn_get_final_id(id);
-#endif
break;
default: return FAIL;
}
@@ -7267,7 +7263,6 @@ int highlight_changed(void)
}
}
-#ifdef USER_HIGHLIGHT
/* Setup the user highlights
*
* Temporarily utilize 10 more hl entries. Have to be in there
@@ -7327,8 +7322,6 @@ int highlight_changed(void)
}
highlight_ga.ga_len = hlcnt;
-#endif /* USER_HIGHLIGHT */
-
return OK;
}
diff --git a/src/nvim/tag.c b/src/nvim/tag.c
index 44c653c852..9e6a65cef3 100644
--- a/src/nvim/tag.c
+++ b/src/nvim/tag.c
@@ -2416,9 +2416,7 @@ jumpto_tag (
save_secure = secure;
secure = 1;
-#ifdef HAVE_SANDBOX
++sandbox;
-#endif
save_magic = p_magic;
p_magic = FALSE; /* always execute with 'nomagic' */
/* Save value of no_hlsearch, jumping to a tag is not a real search */
@@ -2525,9 +2523,7 @@ jumpto_tag (
wait_return(TRUE);
secure = save_secure;
p_magic = save_magic;
-#ifdef HAVE_SANDBOX
--sandbox;
-#endif
/* restore no_hlsearch when keeping the old search pattern */
if (search_options) {
SET_NO_HLSEARCH(save_no_hlsearch);
diff --git a/src/nvim/testdir/test77.in b/src/nvim/testdir/test77.in
deleted file mode 100644
index 0dbc4fcbaf..0000000000
--- a/src/nvim/testdir/test77.in
+++ /dev/null
@@ -1,30 +0,0 @@
-Inserts 2 million lines with consecutive integers starting from 1
-(essentially, the output of GNU's seq 1 2000000), writes them to Xtest
-and writes its cksum to test.out.
-
-We need 2 million lines to trigger a call to mf_hash_grow(). If it would mess
-up the lines the checksum would differ.
-
-cksum is part of POSIX and so should be available on most Unixes.
-If it isn't available then the test will be skipped.
-
-STARTTEST
-:so small.vim
-:if !executable("cksum")
-: e! test.ok
-: w! test.out
-: qa!
-:endif
-:set fileformat=unix undolevels=-1
-ggdG
-:let i = 1
-:while i <= 2000000 | call append(i, range(i, i + 99)) | let i += 100 | endwhile
-ggdd
-:w! Xtest
-:r !cksum Xtest
-:s/\s/ /g
-:set fileformat&
-:.w! test.out
-:qa!
-ENDTEST
-
diff --git a/src/nvim/testdir/test77.ok b/src/nvim/testdir/test77.ok
deleted file mode 100644
index 11f148c73f..0000000000
--- a/src/nvim/testdir/test77.ok
+++ /dev/null
@@ -1 +0,0 @@
-3678979763 14888896 Xtest
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c
index cdea8673c7..dec2840fdb 100644
--- a/src/nvim/tui/tui.c
+++ b/src/nvim/tui/tui.c
@@ -239,7 +239,7 @@ static void update_attrs(UI *ui, HlAttrs attrs)
if (attrs.italic) {
unibi_out(ui, unibi_enter_italics_mode);
}
- if (attrs.underline) {
+ if (attrs.underline || attrs.undercurl) {
unibi_out(ui, unibi_enter_underline_mode);
}
if (attrs.reverse) {
diff --git a/src/nvim/types.h b/src/nvim/types.h
index a87122d24b..afd684925a 100644
--- a/src/nvim/types.h
+++ b/src/nvim/types.h
@@ -13,19 +13,11 @@
// dummy to pass an ACL to a function
typedef void *vim_acl_T;
-/*
- * Shorthand for unsigned variables. Many systems, but not all, have u_char
- * already defined, so we use char_u to avoid trouble.
- */
+// Shorthand for unsigned variables. Many systems, but not all, have u_char
+// already defined, so we use char_u to avoid trouble.
typedef unsigned char char_u;
-// The u8char_T can hold one decoded UTF-8 character. We normally use 32
-// bits now, since some Asian characters don't fit in 16 bits. u8char_T is
-// only used for displaying, it could be 16 bits to save memory.
-#ifdef UNICODE16
-typedef uint16_t u8char_T;
-#else
+// Can hold one decoded UTF-8 character.
typedef uint32_t u8char_T;
-#endif
-#endif /* NVIM_TYPES_H */
+#endif // NVIM_TYPES_H
diff --git a/src/nvim/undo.c b/src/nvim/undo.c
index 4d84c69158..2c287e0fdf 100644
--- a/src/nvim/undo.c
+++ b/src/nvim/undo.c
@@ -295,13 +295,11 @@ int undo_allowed(void)
return FALSE;
}
-#ifdef HAVE_SANDBOX
- /* In the sandbox it's not allowed to change the text. */
+ // In the sandbox it's not allowed to change the text.
if (sandbox != 0) {
EMSG(_(e_sandbox));
return FALSE;
}
-#endif
/* Don't allow changes in the buffer while editing the cmdline. The
* caller of getcmdline() may get confused. */
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 8abbdb8a8b..474dbf73f8 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -18,10 +18,24 @@
#include "nvim/misc2.h"
#include "nvim/screen.h"
#include "nvim/strings.h"
-#include "nvim/version_defs.h"
+
+// version info generated by the build system
+#include "auto/versiondef.h"
+
+#define STR_(x) #x
+#define STR(x) STR_(x)
+
+// for the startup-screen ( ":intro" command )
+#define NVIM_VERSION_MEDIUM STR(NVIM_VERSION_MAJOR) "." STR(NVIM_VERSION_MINOR)
+
+// for the ":version" command and "nvim --version"
+#define NVIM_VERSION_LONG "NVIM " NVIM_VERSION_MEDIUM "." STR(NVIM_VERSION_PATCH) NVIM_VERSION_PRERELEASE NVIM_VERSION_BUILD
+
char *Version = VIM_VERSION_SHORT;
-char *longVersion = NVIM_VERSION_LONG " (compiled " __DATE__ " " __TIME__ ")";
+char *longVersion = NVIM_VERSION_LONG;
+char *longVersionWithDate = NVIM_VERSION_LONG " (compiled " __DATE__ " " __TIME__ ")";
+char *mediumVersion = NVIM_VERSION_MEDIUM;
char *version_commit = "Commit: " NVIM_VERSION_COMMIT;
char *version_buildtype = "Build type: " NVIM_VERSION_BUILD_TYPE;
char *version_cflags = "Compilation: " NVIM_VERSION_CFLAGS;
@@ -206,7 +220,7 @@ static int included_patches[] = {
//581,
//580,
//579,
- //578,
+ 578,
//577,
//576,
//575,
@@ -885,7 +899,7 @@ void list_version(void)
{
// When adding features here, don't forget to update the list of
// internal variables in eval.c!
- MSG(longVersion);
+ MSG(longVersionWithDate);
MSG(version_commit);
MSG(version_buildtype);
MSG(version_cflags);
diff --git a/src/nvim/version.h b/src/nvim/version.h
index d1b19a062f..c1881250f1 100644
--- a/src/nvim/version.h
+++ b/src/nvim/version.h
@@ -1,6 +1,23 @@
#ifndef NVIM_VERSION_H
#define NVIM_VERSION_H
+// defined in version.c
+extern char* Version;
+extern char* mediumVersion;
+extern char* longVersion;
+
+//
+// Vim version number, name, etc. Patchlevel is defined in version.c.
+//
+#define VIM_VERSION_MAJOR 7
+#define VIM_VERSION_MINOR 4
+#define VIM_VERSION_100 (VIM_VERSION_MAJOR * 100 + VIM_VERSION_MINOR)
+
+// used for the runtime directory name
+#define VIM_VERSION_NODOT "vim74"
+// swap file compatibility (max. length is 6 chars)
+#define VIM_VERSION_SHORT "7.4"
+
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "version.h.generated.h"
#endif
diff --git a/src/nvim/version_defs.h b/src/nvim/version_defs.h
deleted file mode 100644
index 0ba6143632..0000000000
--- a/src/nvim/version_defs.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef NVIM_VERSION_DEFS_H
-#define NVIM_VERSION_DEFS_H
-
-// VIM - Vi IMproved by Bram Moolenaar
-//
-// Do ":help uganda" in Vim to read copying and usage conditions.
-// Do ":help credits" in Vim to see a list of people who contributed.
-
-#define STR_(x) #x
-#define STR(x) STR_(x)
-
-//
-// Nvim version identifiers
-//
-#ifndef NVIM_VERSION_MAJOR
-#define NVIM_VERSION_MAJOR 0
-#endif
-#ifndef NVIM_VERSION_MINOR
-#define NVIM_VERSION_MINOR 0
-#endif
-#ifndef NVIM_VERSION_PATCH
-#define NVIM_VERSION_PATCH 0
-#endif
-#ifndef NVIM_VERSION_PRERELEASE
-#define NVIM_VERSION_PRERELEASE "?"
-#endif
-#ifndef NVIM_VERSION_BUILD
-#define NVIM_VERSION_BUILD "?"
-#endif
-#ifndef NVIM_VERSION_COMMIT
-#define NVIM_VERSION_COMMIT "?"
-#endif
-#ifndef NVIM_VERSION_CFLAGS
-#define NVIM_VERSION_CFLAGS "?"
-#endif
-#ifndef NVIM_VERSION_BUILD_TYPE
-#define NVIM_VERSION_BUILD_TYPE "?"
-#endif
-// for the startup-screen
-#define NVIM_VERSION_MEDIUM STR(NVIM_VERSION_MAJOR) "." STR(NVIM_VERSION_MINOR)
-// for the ":version" command and "nvim -h"
-#define NVIM_VERSION_LONG "NVIM " NVIM_VERSION_MEDIUM "." STR(NVIM_VERSION_PATCH) NVIM_VERSION_PRERELEASE NVIM_VERSION_BUILD
-
-//
-// Vim version number, name, etc. Patchlevel is defined in version.c.
-//
-#define VIM_VERSION_MAJOR 7
-#define VIM_VERSION_MINOR 4
-#define VIM_VERSION_100 (VIM_VERSION_MAJOR * 100 + VIM_VERSION_MINOR)
-
-// used for the runtime directory name
-#define VIM_VERSION_NODOT "vim74"
-// swap file compatibility (max. length is 6 chars)
-#define VIM_VERSION_SHORT "7.4"
-
-#endif // NVIM_VERSION_DEFS_H
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 1e8de3ce4f..8b6f925928 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -441,9 +441,6 @@ wingotofile:
case 'g':
case Ctrl_G:
CHECK_CMDWIN
-#ifdef USE_ON_FLY_SCROLL
- dont_scroll = TRUE; /* disallow scrolling here */
-#endif
++ no_mapping;
++allow_keys; /* no mapping for xchar, but allow key codes */
if (xchar == NUL)