Merge #2011 'Macro cleanup'

This commit is contained in:
Justin M. Keyes 2015-03-05 19:03:37 -05:00
commit a06186de41
19 changed files with 34 additions and 199 deletions

View File

@ -119,7 +119,6 @@ src/nvim/tag.h
src/nvim/term.c src/nvim/term.c
src/nvim/term.h src/nvim/term.h
src/nvim/term_defs.h src/nvim/term_defs.h
src/nvim/types.h
src/nvim/ui.c src/nvim/ui.c
src/nvim/ui.h src/nvim/ui.h
src/nvim/undo.c src/nvim/undo.c

View File

@ -268,13 +268,11 @@ edit (
// set Insstart_orig to Insstart // set Insstart_orig to Insstart
update_Insstart_orig = true; update_Insstart_orig = true;
#ifdef HAVE_SANDBOX // Don't allow inserting in the sandbox.
/* Don't allow inserting in the sandbox. */
if (sandbox != 0) { if (sandbox != 0) {
EMSG(_(e_sandbox)); EMSG(_(e_sandbox));
return FALSE; return FALSE;
} }
#endif
/* Don't allow changes in the buffer while editing the cmdline. The /* Don't allow changes in the buffer while editing the cmdline. The
* caller of getcmdline() may get confused. */ * caller of getcmdline() may get confused. */
if (textlock != 0) { if (textlock != 0) {
@ -584,9 +582,6 @@ edit (
old_topline = curwin->w_topline; old_topline = curwin->w_topline;
old_topfill = curwin->w_topfill; 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. * Get a character for Insert mode. Ignore K_IGNORE.
@ -4703,9 +4698,6 @@ int get_literal(void)
if (got_int) if (got_int)
return Ctrl_C; return Ctrl_C;
#ifdef USE_ON_FLY_SCROLL
dont_scroll = TRUE; /* disallow scrolling here */
#endif
++no_mapping; /* don't map the next key hits */ ++no_mapping; /* don't map the next key hits */
cc = 0; cc = 0;
i = 0; i = 0;
@ -4964,9 +4956,6 @@ insertchar (
* Don't do this when there an InsertCharPre autocommand is defined, * Don't do this when there an InsertCharPre autocommand is defined,
* because we need to fire the event for every character. * 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) if ( !ISSPECIAL(c)
&& (!has_mbyte || (*mb_char2len)(c) == 1) && (!has_mbyte || (*mb_char2len)(c) == 1)
@ -6731,9 +6720,6 @@ static void ins_reg(void)
add_to_showcmd_c(Ctrl_R); 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 * 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); 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 /* don't map the digraph chars. This also prevents the
* mode message to be deleted when ESC is hit */ * mode message to be deleted when ESC is hit */

View File

@ -3396,16 +3396,13 @@ int check_secure(void)
EMSG(_(e_curdir)); EMSG(_(e_curdir));
return TRUE; return TRUE;
} }
#ifdef HAVE_SANDBOX
/* // In the sandbox more things are not allowed, including the things
* In the sandbox more things are not allowed, including the things // disallowed in secure mode.
* disallowed in secure mode.
*/
if (sandbox != 0) { if (sandbox != 0) {
EMSG(_(e_sandbox)); EMSG(_(e_sandbox));
return TRUE; return TRUE;
} }
#endif
return FALSE; return FALSE;
} }
@ -3952,9 +3949,6 @@ void do_sub(exarg_T *eap)
ui_cursor_goto(msg_row, msg_col); ui_cursor_goto(msg_row, msg_col);
RedrawingDisabled = temp; RedrawingDisabled = temp;
#ifdef USE_ON_FLY_SCROLL
dont_scroll = FALSE; /* allow scrolling here */
#endif
++no_mapping; /* don't map this key */ ++no_mapping; /* don't map this key */
++allow_keys; /* allow special keys */ ++allow_keys; /* allow special keys */
typed = plain_vgetc(); typed = plain_vgetc();

View File

@ -1093,9 +1093,7 @@ static char_u * do_one_cmd(char_u **cmdlinep,
int save_msg_scroll = msg_scroll; int save_msg_scroll = msg_scroll;
int save_msg_silent = -1; int save_msg_silent = -1;
int did_esilent = 0; int did_esilent = 0;
#ifdef HAVE_SANDBOX
int did_sandbox = FALSE; int did_sandbox = FALSE;
#endif
cmdmod_T save_cmdmod; cmdmod_T save_cmdmod;
int ni; /* set when Not Implemented */ int ni; /* set when Not Implemented */
@ -1240,11 +1238,9 @@ static char_u * do_one_cmd(char_u **cmdlinep,
continue; continue;
case 's': if (checkforcmd(&ea.cmd, "sandbox", 3)) { case 's': if (checkforcmd(&ea.cmd, "sandbox", 3)) {
#ifdef HAVE_SANDBOX
if (!did_sandbox) if (!did_sandbox)
++sandbox; ++sandbox;
did_sandbox = TRUE; did_sandbox = TRUE;
#endif
continue; continue;
} }
if (!checkforcmd(&ea.cmd, "silent", 3)) if (!checkforcmd(&ea.cmd, "silent", 3))
@ -1509,13 +1505,11 @@ static char_u * do_one_cmd(char_u **cmdlinep,
} }
if (!ea.skip) { if (!ea.skip) {
#ifdef HAVE_SANDBOX
if (sandbox != 0 && !(ea.argt & SBOXOK)) { if (sandbox != 0 && !(ea.argt & SBOXOK)) {
/* Command not allowed in sandbox. */ /* Command not allowed in sandbox. */
errormsg = (char_u *)_(e_sandbox); errormsg = (char_u *)_(e_sandbox);
goto doend; goto doend;
} }
#endif
if (!curbuf->b_p_ma && (ea.argt & MODIFY)) { if (!curbuf->b_p_ma && (ea.argt & MODIFY)) {
/* Command not allowed in non-'modifiable' buffer */ /* Command not allowed in non-'modifiable' buffer */
errormsg = (char_u *)_(e_modifiable); errormsg = (char_u *)_(e_modifiable);
@ -1983,10 +1977,8 @@ doend:
msg_col = 0; msg_col = 0;
} }
#ifdef HAVE_SANDBOX
if (did_sandbox) if (did_sandbox)
--sandbox; --sandbox;
#endif
if (ea.nextcmd && *ea.nextcmd == NUL) /* not really a next command */ if (ea.nextcmd && *ea.nextcmd == NUL) /* not really a next command */
ea.nextcmd = NULL; ea.nextcmd = NULL;
@ -2582,12 +2574,10 @@ set_one_cmd_context (
} }
/* An argument can contain just about everything, except /* An argument can contain just about everything, except
* characters that end the command and white space. */ * characters that end the command and white space. */
else if (c == '|' || c == '\n' || c == '"' || (vim_iswhite(c) else if (c == '|'
#ifdef SPACE_IN_FILENAME || c == '\n'
&& (!(ea.argt & NOSPC) || || c == '"'
usefilter) || vim_iswhite(c)) {
#endif
)) {
len = 0; /* avoid getting stuck when space is in 'isfname' */ len = 0; /* avoid getting stuck when space is in 'isfname' */
while (*p != NUL) { while (*p != NUL) {
if (has_mbyte) if (has_mbyte)
@ -6617,9 +6607,6 @@ static void ex_at(exarg_T *eap)
curwin->w_cursor.lnum = eap->line2; 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 */ /* get the register name. No name means to use the previous one */
c = *eap->arg; c = *eap->arg;

View File

@ -291,9 +291,6 @@ getcmdline (
redir_off = TRUE; /* Don't redirect the typed command. redir_off = TRUE; /* Don't redirect the typed command.
Repeated, because a ":redir" inside Repeated, because a ":redir" inside
completion may switch it on. */ 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 */ quit_more = FALSE; /* reset after CTRL-D which had a more-prompt */
cursorcmd(); /* set the cursor on the right spot */ cursorcmd(); /* set the cursor on the right spot */
@ -904,9 +901,6 @@ getcmdline (
goto returncmd; /* back to cmd mode */ goto returncmd; /* back to cmd mode */
case Ctrl_R: /* insert register */ case Ctrl_R: /* insert register */
#ifdef USE_ON_FLY_SCROLL
dont_scroll = TRUE; /* disallow scrolling here */
#endif
putcmdline('"', TRUE); putcmdline('"', TRUE);
++no_mapping; ++no_mapping;
i = c = plain_vgetc(); /* CTRL-R <char> */ i = c = plain_vgetc(); /* CTRL-R <char> */
@ -1270,9 +1264,6 @@ getcmdline (
case Ctrl_K: case Ctrl_K:
ignore_drag_release = TRUE; ignore_drag_release = TRUE;
putcmdline('?', TRUE); putcmdline('?', TRUE);
#ifdef USE_ON_FLY_SCROLL
dont_scroll = TRUE; /* disallow scrolling here */
#endif
c = get_digraph(TRUE); c = get_digraph(TRUE);
if (c != NUL) if (c != NUL)
break; break;

View File

@ -457,11 +457,8 @@ typedef enum {
'*', '#', '_', '!', '.', 'o'} '*', '#', '_', '!', '.', 'o'}
EXTERN int highlight_attr[HLF_COUNT]; /* Highl. attr for each context. */ 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_user[9]; /* User[1-9] attributes */
EXTERN int highlight_stlnc[9]; /* On top of user */ EXTERN int highlight_stlnc[9]; /* On top of user */
#endif
EXTERN int cterm_normal_fg_color INIT(= 0); EXTERN int cterm_normal_fg_color INIT(= 0);
EXTERN int cterm_normal_fg_bold INIT(= 0); EXTERN int cterm_normal_fg_bold INIT(= 0);
EXTERN int cterm_normal_bg_color 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 * changed, no buffer can be deleted and
* current directory can't be changed. * current directory can't be changed.
* Used for SwapExists et al. */ * Used for SwapExists et al. */
# define HAVE_SANDBOX
EXTERN int sandbox INIT(= 0); EXTERN int sandbox INIT(= 0);
/* Non-zero when evaluating an expression in a /* Non-zero when evaluating an expression in a
* "sandbox". Several things are not allowed * "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 */ 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 int mapped_ctrl_c INIT(= FALSE); /* CTRL-C is mapped */
EXTERN cmdmod_T cmdmod; /* Ex command modifiers */ EXTERN cmdmod_T cmdmod; /* Ex command modifiers */
@ -1180,9 +1169,7 @@ EXTERN char_u e_readonlyvar[] INIT(= N_(
EXTERN char_u e_readonlysbx[] INIT(= N_( EXTERN char_u e_readonlysbx[] INIT(= N_(
"E794: Cannot set variable in the sandbox: \"%s\"")); "E794: Cannot set variable in the sandbox: \"%s\""));
EXTERN char_u e_readerrf[] INIT(= N_("E47: Error while reading errorfile")); 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")); 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_secure[] INIT(= N_("E523: Not allowed here"));
EXTERN char_u e_screenmode[] INIT(= N_( EXTERN char_u e_screenmode[] INIT(= N_(
"E359: Screen mode setting not supported")); "E359: Screen mode setting not supported"));

View File

@ -794,9 +794,6 @@ void wait_return(int redraw)
State = HITRETURN; State = HITRETURN;
setmouse(); 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 /* 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 * to start an Ex command, but the file-changed dialog gets in the
* way. */ * way. */

View File

@ -2290,9 +2290,6 @@ int ask_yesno(char_u *str, int direct)
int save_State = State; int save_State = State;
++no_wait_return; ++no_wait_return;
#ifdef USE_ON_FLY_SCROLL
dont_scroll = TRUE; /* disallow scrolling here */
#endif
State = CONFIRM; /* mouse behaves like with :confirm */ State = CONFIRM; /* mouse behaves like with :confirm */
setmouse(); /* disables mouse for xterm */ setmouse(); /* disables mouse for xterm */
++no_mapping; ++no_mapping;
@ -2465,9 +2462,6 @@ get_number (
if (msg_silent != 0) if (msg_silent != 0)
return 0; return 0;
#ifdef USE_ON_FLY_SCROLL
dont_scroll = TRUE; /* disallow scrolling here */
#endif
++no_mapping; ++no_mapping;
++allow_keys; /* no mapping here, but recognize keys */ ++allow_keys; /* no mapping here, but recognize keys */
for (;; ) { for (;; ) {
@ -2955,13 +2949,6 @@ char_u *vim_getenv(char_u *name, int *mustfree)
if (p == NULL) { if (p == NULL) {
if (p_hf != NULL && vim_strchr(p_hf, '$') == NULL) if (p_hf != NULL && vim_strchr(p_hf, '$') == NULL)
p = p_hf; 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) { if (p != NULL) {
/* remove the file name */ /* remove the file name */
pend = path_tail(p); pend = path_tail(p);
@ -2970,12 +2957,6 @@ char_u *vim_getenv(char_u *name, int *mustfree)
if (p == p_hf) if (p == p_hf)
pend = remove_tail(p, pend, (char_u *)"doc"); 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 */ /* for $VIM, remove "runtime/" or "vim54/", if present */
if (!vimruntime) { if (!vimruntime) {
pend = remove_tail(p, pend, (char_u *)RUNTIME_DIRNAME); pend = remove_tail(p, pend, (char_u *)RUNTIME_DIRNAME);
@ -2995,13 +2976,6 @@ char_u *vim_getenv(char_u *name, int *mustfree)
free(p); free(p);
p = NULL; p = NULL;
} else { } 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; *mustfree = TRUE;
} }
} }

View File

@ -473,9 +473,6 @@ normal_cmd (
mapped_len = typebuf_maplen(); mapped_len = typebuf_maplen();
State = NORMAL_BUSY; 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 /* Set v:count here, when called from main() and not a stuffed
* command, so that v:count can be used in an expression mapping * command, so that v:count can be used in an expression mapping
@ -3607,9 +3604,6 @@ static void nv_zet(cmdarg_T *cap)
return; return;
n = nchar - '0'; n = nchar - '0';
for (;; ) { for (;; ) {
#ifdef USE_ON_FLY_SCROLL
dont_scroll = true; /* disallow scrolling here */
#endif
++no_mapping; ++no_mapping;
++allow_keys; /* no mapping for nchar, but allow key codes */ ++allow_keys; /* no mapping for nchar, but allow key codes */
nchar = plain_vgetc(); nchar = plain_vgetc();

View File

@ -3200,13 +3200,10 @@ void ex_display(exarg_T *eap)
MSG_PUTS_TITLE(_("\n--- Registers ---")); MSG_PUTS_TITLE(_("\n--- Registers ---"));
for (i = -1; i < NUM_REGISTERS && !got_int; ++i) { for (i = -1; i < NUM_REGISTERS && !got_int; ++i) {
name = get_register_name(i); name = get_register_name(i);
if (arg != NULL && vim_strchr(arg, name) == NULL
#ifdef ONE_CLIPBOARD if (arg != NULL && vim_strchr(arg, name) == NULL) {
/* Star register and plus register contain the same thing. */
&& (name != '*' || vim_strchr(arg, '+') == NULL)
#endif
)
continue; /* did not ask for this register */ continue; /* did not ask for this register */
}
get_clipboard(name); get_clipboard(name);

View File

@ -2525,13 +2525,11 @@ do_set (
goto skip; goto skip;
} }
#ifdef HAVE_SANDBOX
/* Disallow changing some options in the sandbox */ /* Disallow changing some options in the sandbox */
if (sandbox != 0 && (flags & P_SECURE)) { if (sandbox != 0 && (flags & P_SECURE)) {
errmsg = (char_u *)_(e_sandbox); errmsg = (char_u *)_(e_sandbox);
goto skip; goto skip;
} }
#endif
if (vim_strchr((char_u *)"?=:!&<", nextchar) != NULL) { if (vim_strchr((char_u *)"?=:!&<", nextchar) != NULL) {
arg += len; arg += len;
@ -3066,9 +3064,7 @@ did_set_option (
* flag. */ * flag. */
uint32_t *p = insecure_flag(opt_idx, opt_flags); uint32_t *p = insecure_flag(opt_idx, opt_flags);
if (secure if (secure
#ifdef HAVE_SANDBOX
|| sandbox != 0 || sandbox != 0
#endif
|| (opt_flags & OPT_MODELINE)) || (opt_flags & OPT_MODELINE))
*p = *p | P_INSECURE; *p = *p | P_INSECURE;
else if (new_value) else if (new_value)
@ -3577,11 +3573,8 @@ did_set_string_option (
gvarp = (char_u **)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL); gvarp = (char_u **)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL);
/* Disallow changing some options from secure mode */ /* Disallow changing some options from secure mode */
if ((secure if ((secure || sandbox != 0)
#ifdef HAVE_SANDBOX && (options[opt_idx].flags & P_SECURE)) {
|| sandbox != 0
#endif
) && (options[opt_idx].flags & P_SECURE)) {
errmsg = e_secure; errmsg = e_secure;
} }
/* Check for a "normal" file name in some options. Disallow a path /* Check for a "normal" file name in some options. Disallow a path
@ -4697,12 +4690,10 @@ set_bool_option (
int old_value = *(int *)varp; int old_value = *(int *)varp;
/* Disallow changing some options from secure mode */ /* Disallow changing some options from secure mode */
if ((secure if ((secure || sandbox != 0)
#ifdef HAVE_SANDBOX && (options[opt_idx].flags & P_SECURE)) {
|| sandbox != 0
#endif
) && (options[opt_idx].flags & P_SECURE))
return e_secure; return e_secure;
}
*(int *)varp = value; /* set the new value */ *(int *)varp = value; /* set the new value */
/* Remember where the option was set. */ /* Remember where the option was set. */
@ -5064,12 +5055,10 @@ set_num_option (
long *pp = (long *)varp; long *pp = (long *)varp;
/* Disallow changing some options from secure mode. */ /* Disallow changing some options from secure mode. */
if ((secure if ((secure || sandbox != 0)
#ifdef HAVE_SANDBOX && (options[opt_idx].flags & P_SECURE)) {
|| sandbox != 0
#endif
) && (options[opt_idx].flags & P_SECURE))
return e_secure; return e_secure;
}
*pp = value; *pp = value;
/* Remember where the option was set. */ /* Remember where the option was set. */
@ -5755,13 +5744,11 @@ set_option_value (
EMSG2(_("E355: Unknown option: %s"), name); EMSG2(_("E355: Unknown option: %s"), name);
else { else {
uint32_t flags = options[opt_idx].flags; 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)) { if (sandbox > 0 && (flags & P_SECURE)) {
EMSG(_(e_sandbox)); EMSG(_(e_sandbox));
return NULL; return NULL;
} }
#endif
if (flags & P_STRING) if (flags & P_STRING)
return set_string_option(opt_idx, string, opt_flags); return set_string_option(opt_idx, string, opt_flags);
else { else {

View File

@ -317,11 +317,10 @@ int mch_expand_wildcards(int num_pat, char_u **pat, int *num_file,
return OK; return OK;
} }
# ifdef HAVE_SANDBOX // Don't allow any shell command in the sandbox.
/* Don't allow any shell command in the sandbox. */ if (sandbox != 0 && check_secure()) {
if (sandbox != 0 && check_secure())
return FAIL; return FAIL;
# endif }
/* /*
* Don't allow the use of backticks in secure and restricted mode. * Don't allow the use of backticks in secure and restricted mode.

View File

@ -403,7 +403,7 @@ char_u *save_absolute_path(const char_u *name)
#if !defined(NO_EXPANDPATH) #if !defined(NO_EXPANDPATH)
#if defined(UNIX) || defined(USE_UNIXFILENAME) #if defined(UNIX)
/* /*
* Unix style wildcard expansion code. * Unix style wildcard expansion code.
* It's here because it's used both for Unix and Mac. * It's here because it's used both for Unix and Mac.

View File

@ -1858,11 +1858,6 @@ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T
} else } else
prev_c = u8c; prev_c = u8c;
/* Non-BMP character: display as ? or fullwidth ?. */ /* Non-BMP character: display as ? or fullwidth ?. */
#ifdef UNICODE16
if (u8c >= 0x10000)
ScreenLinesUC[idx] = (cells == 2) ? 0xff1f : (int)'?';
else
#endif
ScreenLinesUC[idx] = u8c; ScreenLinesUC[idx] = u8c;
for (i = 0; i < Screen_mco; ++i) { for (i = 0; i < Screen_mco; ++i) {
ScreenLinesC[i][idx] = u8cc[i]; ScreenLinesC[i][idx] = u8cc[i];
@ -3051,30 +3046,13 @@ win_line (
if ((mb_l == 1 && c >= 0x80) if ((mb_l == 1 && c >= 0x80)
|| (mb_l >= 1 && mb_c == 0) || (mb_l >= 1 && mb_c == 0)
|| (mb_l > 1 && (!vim_isprintc(mb_c) || (mb_l > 1 && (!vim_isprintc(mb_c)))) {
# ifdef UNICODE16 // Illegal UTF-8 byte: display as <xx>.
|| mb_c >= 0x10000 // Non-BMP character : display as ? or fullwidth ?.
# endif transchar_hex(extra, mb_c);
))) { if (wp->w_p_rl) { // reverse
/*
* 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 */
rl_mirror(extra); 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; p_extra = extra;
c = *p_extra; c = *p_extra;
@ -5226,14 +5204,6 @@ void screen_puts_len(char_u *text, int textlen, int row, int col, int attr)
else else
u8c = utfc_ptr2char(ptr, u8cc); u8c = utfc_ptr2char(ptr, u8cc);
mbyte_cells = utf_char2cells(u8c); 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)) { if (p_arshape && !p_tbidi && arabic_char(u8c)) {
/* Do Arabic shaping. */ /* Do Arabic shaping. */
if (len >= 0 && (int)(ptr - text) + mbyte_blen >= len) { if (len >= 0 && (int)(ptr - text) + mbyte_blen >= len) {

View File

@ -7174,12 +7174,10 @@ int highlight_changed(void)
int attr; int attr;
char_u *end; char_u *end;
int id; int id;
#ifdef USER_HIGHLIGHT
char_u userhl[10]; char_u userhl[10];
int id_SNC = -1; int id_SNC = -1;
int id_S = -1; int id_S = -1;
int hlcnt; int hlcnt;
#endif
static int hl_flags[HLF_COUNT] = HL_FLAGS; static int hl_flags[HLF_COUNT] = HL_FLAGS;
need_highlight_changed = FALSE; need_highlight_changed = FALSE;
@ -7251,12 +7249,10 @@ int highlight_changed(void)
return FAIL; return FAIL;
attr = syn_id2attr(id); attr = syn_id2attr(id);
p = end - 1; p = end - 1;
#ifdef USER_HIGHLIGHT
if (hlf == (int)HLF_SNC) if (hlf == (int)HLF_SNC)
id_SNC = syn_get_final_id(id); id_SNC = syn_get_final_id(id);
else if (hlf == (int)HLF_S) else if (hlf == (int)HLF_S)
id_S = syn_get_final_id(id); id_S = syn_get_final_id(id);
#endif
break; break;
default: return FAIL; default: return FAIL;
} }
@ -7267,7 +7263,6 @@ int highlight_changed(void)
} }
} }
#ifdef USER_HIGHLIGHT
/* Setup the user highlights /* Setup the user highlights
* *
* Temporarily utilize 10 more hl entries. Have to be in there * Temporarily utilize 10 more hl entries. Have to be in there
@ -7327,8 +7322,6 @@ int highlight_changed(void)
} }
highlight_ga.ga_len = hlcnt; highlight_ga.ga_len = hlcnt;
#endif /* USER_HIGHLIGHT */
return OK; return OK;
} }

View File

@ -2416,9 +2416,7 @@ jumpto_tag (
save_secure = secure; save_secure = secure;
secure = 1; secure = 1;
#ifdef HAVE_SANDBOX
++sandbox; ++sandbox;
#endif
save_magic = p_magic; save_magic = p_magic;
p_magic = FALSE; /* always execute with 'nomagic' */ p_magic = FALSE; /* always execute with 'nomagic' */
/* Save value of no_hlsearch, jumping to a tag is not a real search */ /* Save value of no_hlsearch, jumping to a tag is not a real search */
@ -2525,9 +2523,7 @@ jumpto_tag (
wait_return(TRUE); wait_return(TRUE);
secure = save_secure; secure = save_secure;
p_magic = save_magic; p_magic = save_magic;
#ifdef HAVE_SANDBOX
--sandbox; --sandbox;
#endif
/* restore no_hlsearch when keeping the old search pattern */ /* restore no_hlsearch when keeping the old search pattern */
if (search_options) { if (search_options) {
SET_NO_HLSEARCH(save_no_hlsearch); SET_NO_HLSEARCH(save_no_hlsearch);

View File

@ -13,19 +13,11 @@
// dummy to pass an ACL to a function // dummy to pass an ACL to a function
typedef void *vim_acl_T; typedef void *vim_acl_T;
/* // Shorthand for unsigned variables. Many systems, but not all, have u_char
* Shorthand for unsigned variables. Many systems, but not all, have u_char // already defined, so we use char_u to avoid trouble.
* already defined, so we use char_u to avoid trouble.
*/
typedef unsigned char char_u; typedef unsigned char char_u;
// The u8char_T can hold one decoded UTF-8 character. We normally use 32 // Can hold one decoded UTF-8 character.
// 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
typedef uint32_t u8char_T; typedef uint32_t u8char_T;
#endif
#endif /* NVIM_TYPES_H */ #endif // NVIM_TYPES_H

View File

@ -295,13 +295,11 @@ int undo_allowed(void)
return FALSE; 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) { if (sandbox != 0) {
EMSG(_(e_sandbox)); EMSG(_(e_sandbox));
return FALSE; return FALSE;
} }
#endif
/* Don't allow changes in the buffer while editing the cmdline. The /* Don't allow changes in the buffer while editing the cmdline. The
* caller of getcmdline() may get confused. */ * caller of getcmdline() may get confused. */

View File

@ -441,9 +441,6 @@ wingotofile:
case 'g': case 'g':
case Ctrl_G: case Ctrl_G:
CHECK_CMDWIN CHECK_CMDWIN
#ifdef USE_ON_FLY_SCROLL
dont_scroll = TRUE; /* disallow scrolling here */
#endif
++ no_mapping; ++ no_mapping;
++allow_keys; /* no mapping for xchar, but allow key codes */ ++allow_keys; /* no mapping for xchar, but allow key codes */
if (xchar == NUL) if (xchar == NUL)