mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
Merge remote-tracking branch 'vim/master'
This commit is contained in:
Vendored
+42
-12
@@ -72,22 +72,35 @@ export def FTbas()
|
||||
|
||||
# most frequent FreeBASIC-specific keywords in distro files
|
||||
var fb_keywords = '\c^\s*\%(extern\|var\|enum\|private\|scope\|union\|byref\|operator\|constructor\|delete\|namespace\|public\|property\|with\|destructor\|using\)\>\%(\s*[:=(]\)\@!'
|
||||
var fb_preproc = '\c^\s*\%(#\a\+\|option\s\+\%(byval\|dynamic\|escape\|\%(no\)\=gosub\|nokeyword\|private\|static\)\>\)'
|
||||
var fb_preproc = '\c^\s*\%(' ..
|
||||
# preprocessor
|
||||
'#\s*\a\+\|' ..
|
||||
# compiler option
|
||||
'option\s\+\%(byval\|dynamic\|escape\|\%(no\)\=gosub\|nokeyword\|private\|static\)\>\|' ..
|
||||
# metacommand
|
||||
'\%(''\|rem\)\s*\$lang\>\|' ..
|
||||
# default datatype
|
||||
'def\%(byte\|longint\|short\|ubyte\|uint\|ulongint\|ushort\)\>' ..
|
||||
'\)'
|
||||
var fb_comment = "^\\s*/'"
|
||||
|
||||
# OPTION EXPLICIT, without the leading underscore, is common to many dialects
|
||||
var qb64_preproc = '\c^\s*\%($\a\+\|option\s\+\%(_explicit\|_\=explicitarray\)\>\)'
|
||||
|
||||
var lines = getline(1, min([line("$"), 100]))
|
||||
|
||||
if match(lines, fb_preproc) > -1 || match(lines, fb_comment) > -1 || match(lines, fb_keywords) > -1
|
||||
setf freebasic
|
||||
elseif match(lines, qb64_preproc) > -1
|
||||
setf qb64
|
||||
elseif match(lines, ft_visual_basic_content) > -1
|
||||
setf vb
|
||||
else
|
||||
setf basic
|
||||
endif
|
||||
for lnum in range(1, min([line("$"), 100]))
|
||||
var line = getline(lnum)
|
||||
if line =~ ft_visual_basic_content
|
||||
setf vb
|
||||
return
|
||||
elseif line =~ fb_preproc || line =~ fb_comment || line =~ fb_keywords
|
||||
setf freebasic
|
||||
return
|
||||
elseif line =~ qb64_preproc
|
||||
setf qb64
|
||||
return
|
||||
endif
|
||||
endfor
|
||||
setf basic
|
||||
enddef
|
||||
|
||||
export def FTbtm()
|
||||
@@ -126,6 +139,23 @@ export def FTcfg()
|
||||
endif
|
||||
enddef
|
||||
|
||||
export def FTcls()
|
||||
if exists("g:filetype_cls")
|
||||
exe "setf " .. g:filetype_cls
|
||||
return
|
||||
endif
|
||||
|
||||
if getline(1) =~ '^%'
|
||||
setf tex
|
||||
elseif getline(1)[0] == '#' && getline(1) =~ 'rexx'
|
||||
setf rexx
|
||||
elseif getline(1) == 'VERSION 1.0 CLASS'
|
||||
setf vb
|
||||
else
|
||||
setf st
|
||||
endif
|
||||
enddef
|
||||
|
||||
export def FTlpc()
|
||||
if exists("g:lpc_syntax_for_c")
|
||||
var lnum = 1
|
||||
|
||||
@@ -143,6 +143,7 @@ variables can be used to overrule the filetype used for certain extensions:
|
||||
*.asp g:filetype_asp |ft-aspvbs-syntax| |ft-aspperl-syntax|
|
||||
*.bas g:filetype_bas |ft-basic-syntax|
|
||||
*.cfg g:filetype_cfg
|
||||
*.cls g:filetype_cls
|
||||
*.csh g:filetype_csh |ft-csh-syntax|
|
||||
*.dat g:filetype_dat
|
||||
*.frm g:filetype_frm |ft-form-syntax|
|
||||
|
||||
@@ -4306,7 +4306,10 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
b bold (termcap entry "md" and "me")
|
||||
s standout (termcap entry "so" and "se")
|
||||
u underline (termcap entry "us" and "ue")
|
||||
c undercurl (termcap entry "Cs" and "Ce")
|
||||
c undercurl (termcap entry "Us" and "Ce")
|
||||
2 double underline (termcap entry "Ds" and "Ce")
|
||||
d dotted underline (termcap entry "ds" and "Ce")
|
||||
= dashed underline (termcap entry "Ds" and "Ce")
|
||||
t strikethrough (termcap entry "Ts" and "Te")
|
||||
n no highlighting
|
||||
- no highlighting
|
||||
|
||||
+18
-2
@@ -5002,14 +5002,18 @@ the same syntax file on all terminals, and use the optimal highlighting.
|
||||
1. highlight arguments for normal terminals
|
||||
|
||||
*bold* *underline* *undercurl*
|
||||
*inverse* *italic* *standout*
|
||||
*nocombine* *strikethrough*
|
||||
*underdouble* *underdotted*
|
||||
*underdashed* *inverse* *italic*
|
||||
*standout* *nocombine* *strikethrough*
|
||||
term={attr-list} *attr-list* *highlight-term* *E418*
|
||||
attr-list is a comma-separated list (without spaces) of the
|
||||
following items (in any order):
|
||||
bold
|
||||
underline
|
||||
undercurl not always available
|
||||
underdouble not always available
|
||||
underdotted not always available
|
||||
underdashed not always available
|
||||
strikethrough not always available
|
||||
reverse
|
||||
inverse same as reverse
|
||||
@@ -5020,6 +5024,7 @@ term={attr-list} *attr-list* *highlight-term* *E418*
|
||||
|
||||
Note that "bold" can be used here and by using a bold font. They
|
||||
have the same effect.
|
||||
*underline-codes*
|
||||
"undercurl" is a curly underline. When "undercurl" is not possible
|
||||
then "underline" is used. In general "undercurl" and "strikethrough"
|
||||
are only available in the GUI and some terminals. The color is set
|
||||
@@ -5028,6 +5033,17 @@ term={attr-list} *attr-list* *highlight-term* *E418*
|
||||
let &t_Cs = "\e[4:3m"
|
||||
let &t_Ce = "\e[4:0m"
|
||||
|
||||
< "underdouble" is a double underline, "underdotted" is a dotted
|
||||
underline and "underdashed" is a dashed underline. These are only
|
||||
supported by some terminals. If your terminal supports them you may
|
||||
have to specify the codes like this: >
|
||||
let &t_Us = "\e[4:2m"
|
||||
let &t_ds = "\e[4:4m"
|
||||
let &t_Ds = "\e[4:5m"
|
||||
< They are reset with |t_Ce|, the same as curly underline (undercurl).
|
||||
When t_Us, t_ds or t_Ds is not set then underline will be used as a
|
||||
fallback.
|
||||
|
||||
|
||||
start={term-list} *highlight-start* *E422*
|
||||
stop={term-list} *term-list* *highlight-stop*
|
||||
|
||||
@@ -372,8 +372,11 @@ OUTPUT CODES *terminal-output-codes*
|
||||
|
||||
Added by Vim (there are no standard codes for these):
|
||||
t_AU set underline color (ANSI) *t_AU* *'t_AU'*
|
||||
t_Ce undercurl end *t_Ce* *'t_Ce'*
|
||||
t_Cs undercurl mode *t_Cs* *'t_Cs'*
|
||||
t_Ce undercurl and underline end *t_Ce* *'t_Ce'*
|
||||
t_Cs undercurl (curly underline) mode *t_Cs* *'t_Cs'*
|
||||
t_Us double underline mode *t_Us* *'t_Us'*
|
||||
t_ds dotted underline mode *t_ds* *'t_ds'*
|
||||
t_Ds dashed underline mode *t_Ds* *'t_Ds'*
|
||||
t_Te strikethrough end *t_Te* *'t_Te'*
|
||||
t_Ts strikethrough mode *t_Ts* *'t_Ts'*
|
||||
t_IS set icon text start *t_IS* *'t_IS'*
|
||||
|
||||
@@ -113,6 +113,10 @@ Stop after writing
|
||||
.RI < len >
|
||||
octets.
|
||||
.TP
|
||||
.I "\-n name " | " \-name name"
|
||||
Override the variable name output when \-i is used. The array is named
|
||||
\fIname\fP and the length is named \fIname\fP_len.
|
||||
.TP
|
||||
.I \-o offset
|
||||
Add
|
||||
.RI < offset >
|
||||
|
||||
@@ -789,6 +789,9 @@ au BufNewFile,BufRead *.hsm setf hamster
|
||||
" Handlebars
|
||||
au BufNewFile,BufRead *.hbs setf handlebars
|
||||
|
||||
" Hare
|
||||
au BufNewFile,BufRead *.ha setf hare
|
||||
|
||||
" Haskell
|
||||
au BufNewFile,BufRead *.hs,*.hsc,*.hs-boot,*.hsig setf haskell
|
||||
au BufNewFile,BufRead *.lhs setf lhaskell
|
||||
@@ -1795,16 +1798,11 @@ au BufNewFile,BufRead *.il,*.ils,*.cdf setf skill
|
||||
au BufNewFile,BufRead .slrnrc setf slrnrc
|
||||
au BufNewFile,BufRead *.score setf slrnsc
|
||||
|
||||
" Smalltalk (and TeX)
|
||||
" Smalltalk
|
||||
au BufNewFile,BufRead *.st setf st
|
||||
au BufNewFile,BufRead *.cls
|
||||
\ if getline(1) =~ '^%' |
|
||||
\ setf tex |
|
||||
\ elseif getline(1)[0] == '#' && getline(1) =~ 'rexx' |
|
||||
\ setf rexx |
|
||||
\ else |
|
||||
\ setf st |
|
||||
\ endif
|
||||
|
||||
" Smalltalk (and Rexx, TeX, and Visual Basic)
|
||||
au BufNewFile,BufRead *.cls call dist#ft#FTcls()
|
||||
|
||||
" Smarty templates
|
||||
au BufNewFile,BufRead *.tpl setf smarty
|
||||
|
||||
+2
-2
@@ -1008,8 +1008,8 @@ free_buffer_stuff(
|
||||
#ifdef FEAT_NETBEANS_INTG
|
||||
netbeans_file_killed(buf);
|
||||
#endif
|
||||
map_clear_int(buf, MAP_ALL_MODES, TRUE, FALSE); // clear local mappings
|
||||
map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE); // clear local abbrevs
|
||||
map_clear_mode(buf, MAP_ALL_MODES, TRUE, FALSE); // clear local mappings
|
||||
map_clear_mode(buf, MAP_ALL_MODES, TRUE, TRUE); // clear local abbrevs
|
||||
VIM_CLEAR(buf->b_start_fenc);
|
||||
}
|
||||
|
||||
|
||||
+7
-3
@@ -73,6 +73,10 @@ typedef struct {
|
||||
char_u *p2, int last);
|
||||
} cryptmethod_T;
|
||||
|
||||
static int crypt_sodium_init(cryptstate_T *state, char_u *key, char_u *salt, int salt_len, char_u *seed, int seed_len);
|
||||
static long crypt_sodium_buffer_decode(cryptstate_T *state, char_u *from, size_t len, char_u **buf_out, int last);
|
||||
static long crypt_sodium_buffer_encode(cryptstate_T *state, char_u *from, size_t len, char_u **buf_out, int last);
|
||||
|
||||
// index is method_nr of cryptstate_T, CRYPT_M_*
|
||||
static cryptmethod_T cryptmethods[CRYPT_M_COUNT] = {
|
||||
// PK_Zip; very weak
|
||||
@@ -850,7 +854,7 @@ crypt_append_msg(
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
crypt_sodium_init(
|
||||
cryptstate_T *state UNUSED,
|
||||
char_u *key UNUSED,
|
||||
@@ -1030,7 +1034,7 @@ fail:
|
||||
* Encrypt "from[len]" into "to[len]".
|
||||
* "from" and "to" can be equal to encrypt in place.
|
||||
*/
|
||||
long
|
||||
static long
|
||||
crypt_sodium_buffer_encode(
|
||||
cryptstate_T *state UNUSED,
|
||||
char_u *from UNUSED,
|
||||
@@ -1080,7 +1084,7 @@ crypt_sodium_buffer_encode(
|
||||
* Decrypt "from[len]" into "to[len]".
|
||||
* "from" and "to" can be equal to encrypt in place.
|
||||
*/
|
||||
long
|
||||
static long
|
||||
crypt_sodium_buffer_decode(
|
||||
cryptstate_T *state UNUSED,
|
||||
char_u *from UNUSED,
|
||||
|
||||
+19
-41
@@ -75,7 +75,6 @@ static void f_getregtype(typval_T *argvars, typval_T *rettv);
|
||||
static void f_gettagstack(typval_T *argvars, typval_T *rettv);
|
||||
static void f_gettext(typval_T *argvars, typval_T *rettv);
|
||||
static void f_haslocaldir(typval_T *argvars, typval_T *rettv);
|
||||
static void f_hasmapto(typval_T *argvars, typval_T *rettv);
|
||||
static void f_hlID(typval_T *argvars, typval_T *rettv);
|
||||
static void f_hlexists(typval_T *argvars, typval_T *rettv);
|
||||
static void f_hostname(typval_T *argvars, typval_T *rettv);
|
||||
@@ -6688,40 +6687,6 @@ f_haslocaldir(typval_T *argvars, typval_T *rettv)
|
||||
rettv->vval.v_number = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* "hasmapto()" function
|
||||
*/
|
||||
static void
|
||||
f_hasmapto(typval_T *argvars, typval_T *rettv)
|
||||
{
|
||||
char_u *name;
|
||||
char_u *mode;
|
||||
char_u buf[NUMBUFLEN];
|
||||
int abbr = FALSE;
|
||||
|
||||
if (in_vim9script()
|
||||
&& (check_for_string_arg(argvars, 0) == FAIL
|
||||
|| check_for_opt_string_arg(argvars, 1) == FAIL
|
||||
|| (argvars[1].v_type != VAR_UNKNOWN
|
||||
&& check_for_opt_bool_arg(argvars, 2) == FAIL)))
|
||||
return;
|
||||
|
||||
name = tv_get_string(&argvars[0]);
|
||||
if (argvars[1].v_type == VAR_UNKNOWN)
|
||||
mode = (char_u *)"nvo";
|
||||
else
|
||||
{
|
||||
mode = tv_get_string_buf(&argvars[1], buf);
|
||||
if (argvars[2].v_type != VAR_UNKNOWN)
|
||||
abbr = (int)tv_get_bool(&argvars[2]);
|
||||
}
|
||||
|
||||
if (map_to_exists(name, mode, abbr))
|
||||
rettv->vval.v_number = TRUE;
|
||||
else
|
||||
rettv->vval.v_number = FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* "highlightID(name)" function
|
||||
*/
|
||||
@@ -10174,14 +10139,27 @@ f_synIDattr(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
if (TOLOWER_ASC(what[1]) == 'l') // ul
|
||||
p = highlight_color(id, what, modec);
|
||||
else if (STRLEN(what) <= 5 || TOLOWER_ASC(what[5]) != 'c')
|
||||
if (STRLEN(what) >= 9)
|
||||
{
|
||||
if (TOLOWER_ASC(what[5]) == 'l')
|
||||
// underline
|
||||
p = highlight_has_attr(id, HL_UNDERLINE, modec);
|
||||
else
|
||||
p = highlight_has_attr(id, HL_UNDERLINE, modec);
|
||||
else if (TOLOWER_ASC(what[5]) != 'd')
|
||||
// undercurl
|
||||
p = highlight_has_attr(id, HL_UNDERCURL, modec);
|
||||
p = highlight_has_attr(id, HL_UNDERCURL, modec);
|
||||
else if (TOLOWER_ASC(what[6]) != 'o')
|
||||
// underdashed
|
||||
p = highlight_has_attr(id, HL_UNDERDASHED, modec);
|
||||
else if (TOLOWER_ASC(what[7]) == 'u')
|
||||
// underdouble
|
||||
p = highlight_has_attr(id, HL_UNDERDOUBLE, modec);
|
||||
else
|
||||
// underdotted
|
||||
p = highlight_has_attr(id, HL_UNDERDOTTED, modec);
|
||||
}
|
||||
else
|
||||
// ul
|
||||
p = highlight_color(id, what, modec);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -650,7 +650,7 @@ eval_one_expr_in_str(char_u *p, garray_T *gap, int evaluate)
|
||||
* Used for a heredoc assignment.
|
||||
* Returns NULL for an error.
|
||||
*/
|
||||
char_u *
|
||||
static char_u *
|
||||
eval_all_expr_in_str(char_u *str)
|
||||
{
|
||||
garray_T ga;
|
||||
|
||||
@@ -32,6 +32,7 @@ static void gui_do_scrollbar(win_T *wp, int which, int enable);
|
||||
static void gui_update_horiz_scrollbar(int);
|
||||
static void gui_set_fg_color(char_u *name);
|
||||
static void gui_set_bg_color(char_u *name);
|
||||
static void init_gui_options(void);
|
||||
static win_T *xy2win(int x, int y, mouse_find_T popup);
|
||||
|
||||
#ifdef GUI_MAY_FORK
|
||||
@@ -1414,7 +1415,7 @@ gui_update_cursor(
|
||||
}
|
||||
|
||||
#if defined(FEAT_MENU) || defined(PROTO)
|
||||
void
|
||||
static void
|
||||
gui_position_menu(void)
|
||||
{
|
||||
# if !(defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MOTIF) \
|
||||
@@ -2531,6 +2532,8 @@ gui_outstr_nowrap(
|
||||
if (hl_mask_todo & HL_UNDERCURL)
|
||||
draw_flags |= DRAW_UNDERC;
|
||||
|
||||
// TODO: HL_UNDERDOUBLE, HL_UNDERDOTTED, HL_UNDERDASHED
|
||||
|
||||
// Do we strikethrough the text?
|
||||
if (hl_mask_todo & HL_STRIKETHROUGH)
|
||||
draw_flags |= DRAW_STRIKE;
|
||||
@@ -4855,7 +4858,7 @@ gui_bg_default(void)
|
||||
/*
|
||||
* Option initializations that can only be done after opening the GUI window.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
init_gui_options(void)
|
||||
{
|
||||
// Set the 'background' option according to the lightness of the
|
||||
|
||||
@@ -293,6 +293,7 @@ prt_get_attr(
|
||||
pattr->italic = (highlight_has_attr(hl_id, HL_ITALIC, modec) != NULL);
|
||||
pattr->underline = (highlight_has_attr(hl_id, HL_UNDERLINE, modec) != NULL);
|
||||
pattr->undercurl = (highlight_has_attr(hl_id, HL_UNDERCURL, modec) != NULL);
|
||||
// TODO: HL_UNDERDOUBLE, HL_UNDERDOTTED, HL_UNDERDASHED
|
||||
|
||||
# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS)
|
||||
if (USE_24BIT)
|
||||
|
||||
+24
-11
@@ -25,10 +25,16 @@
|
||||
* following names, separated by commas (but no spaces!).
|
||||
*/
|
||||
static char *(hl_name_table[]) =
|
||||
{"bold", "standout", "underline", "undercurl",
|
||||
"italic", "reverse", "inverse", "nocombine", "strikethrough", "NONE"};
|
||||
{"bold", "standout", "underline",
|
||||
"undercurl", "underdouble", "underdotted", "underdashed",
|
||||
"italic", "reverse", "inverse", "nocombine", "strikethrough", "NONE"};
|
||||
static int hl_attr_table[] =
|
||||
{HL_BOLD, HL_STANDOUT, HL_UNDERLINE, HL_UNDERCURL, HL_ITALIC, HL_INVERSE, HL_INVERSE, HL_NOCOMBINE, HL_STRIKETHROUGH, 0};
|
||||
{HL_BOLD, HL_STANDOUT, HL_UNDERLINE,
|
||||
HL_UNDERCURL, HL_UNDERDOUBLE, HL_UNDERDOTTED, HL_UNDERDASHED,
|
||||
HL_ITALIC, HL_INVERSE, HL_INVERSE, HL_NOCOMBINE, HL_STRIKETHROUGH, 0};
|
||||
// length of all attribute names, plus commas, together (and a bit more)
|
||||
#define MAX_ATTR_LEN 120
|
||||
|
||||
#define ATTR_COMBINE(attr_a, attr_b) ((((attr_b) & HL_NOCOMBINE) ? (attr_b) : (attr_a)) | (attr_b))
|
||||
|
||||
/*
|
||||
@@ -566,7 +572,7 @@ static int color_numbers_8[28] = {0, 4, 2, 6,
|
||||
* "boldp" will be set to TRUE or FALSE for a foreground color when using 8
|
||||
* colors, otherwise it will be unchanged.
|
||||
*/
|
||||
int
|
||||
static int
|
||||
lookup_color(int idx, int foreground, int *boldp)
|
||||
{
|
||||
int color = color_numbers_16[idx];
|
||||
@@ -2963,7 +2969,7 @@ highlight_list_arg(
|
||||
char_u *sarg,
|
||||
char *name)
|
||||
{
|
||||
char_u buf[100];
|
||||
char_u buf[MAX_ATTR_LEN];
|
||||
char_u *ts;
|
||||
int i;
|
||||
|
||||
@@ -2984,8 +2990,8 @@ highlight_list_arg(
|
||||
if (iarg & hl_attr_table[i])
|
||||
{
|
||||
if (buf[0] != NUL)
|
||||
vim_strcat(buf, (char_u *)",", 100);
|
||||
vim_strcat(buf, (char_u *)hl_name_table[i], 100);
|
||||
vim_strcat(buf, (char_u *)",", MAX_ATTR_LEN);
|
||||
vim_strcat(buf, (char_u *)hl_name_table[i], MAX_ATTR_LEN);
|
||||
iarg &= ~hl_attr_table[i]; // don't want "inverse"
|
||||
}
|
||||
}
|
||||
@@ -3287,7 +3293,8 @@ set_hl_attr(
|
||||
at_en.ae_u.cterm.bg_rgb = GUI_MCH_GET_RGB2(sgp->sg_gui_bg);
|
||||
// Only use the underline/undercurl color when used, it may clear the
|
||||
// background color if not supported.
|
||||
if (sgp->sg_cterm & (HL_UNDERLINE | HL_UNDERCURL))
|
||||
if (sgp->sg_cterm & (HL_UNDERLINE | HL_UNDERCURL
|
||||
| HL_UNDERDOUBLE | HL_UNDERDOTTED | HL_UNDERDASHED))
|
||||
at_en.ae_u.cterm.ul_rgb = GUI_MCH_GET_RGB2(sgp->sg_gui_sp);
|
||||
else
|
||||
at_en.ae_u.cterm.ul_rgb = INVALCOLOR;
|
||||
@@ -3801,6 +3808,12 @@ highlight_changed(void)
|
||||
break;
|
||||
case 'c': attr |= HL_UNDERCURL;
|
||||
break;
|
||||
case '2': attr |= HL_UNDERDOUBLE;
|
||||
break;
|
||||
case 'd': attr |= HL_UNDERDOTTED;
|
||||
break;
|
||||
case '=': attr |= HL_UNDERDASHED;
|
||||
break;
|
||||
case 't': attr |= HL_STRIKETHROUGH;
|
||||
break;
|
||||
case ':': ++p; // highlight group name
|
||||
@@ -4362,9 +4375,9 @@ hlg_add_or_update(dict_T *dict)
|
||||
{
|
||||
char_u *name;
|
||||
int error;
|
||||
char_u term_attr[80];
|
||||
char_u cterm_attr[80];
|
||||
char_u gui_attr[80];
|
||||
char_u term_attr[MAX_ATTR_LEN];
|
||||
char_u cterm_attr[MAX_ATTR_LEN];
|
||||
char_u gui_attr[MAX_ATTR_LEN];
|
||||
char_u *start;
|
||||
char_u *stop;
|
||||
char_u *ctermfg;
|
||||
|
||||
@@ -908,13 +908,13 @@ get_map_mode(char_u **cmdp, int forceit)
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear all mappings or abbreviations.
|
||||
* 'abbr' should be FALSE for mappings, TRUE for abbreviations.
|
||||
* Clear all mappings (":mapclear") or abbreviations (":abclear").
|
||||
* "abbr" should be FALSE for mappings, TRUE for abbreviations.
|
||||
*/
|
||||
static void
|
||||
map_clear(
|
||||
char_u *cmdp,
|
||||
char_u *arg UNUSED,
|
||||
char_u *arg,
|
||||
int forceit,
|
||||
int abbr)
|
||||
{
|
||||
@@ -929,14 +929,14 @@ map_clear(
|
||||
}
|
||||
|
||||
mode = get_map_mode(&cmdp, forceit);
|
||||
map_clear_int(curbuf, mode, local, abbr);
|
||||
map_clear_mode(curbuf, mode, local, abbr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear all mappings in "mode".
|
||||
*/
|
||||
void
|
||||
map_clear_int(
|
||||
map_clear_mode(
|
||||
buf_T *buf, // buffer for local mappings
|
||||
int mode, // mode in which to delete
|
||||
int local, // TRUE for buffer-local mappings
|
||||
@@ -2272,6 +2272,40 @@ check_map(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* "hasmapto()" function
|
||||
*/
|
||||
void
|
||||
f_hasmapto(typval_T *argvars, typval_T *rettv)
|
||||
{
|
||||
char_u *name;
|
||||
char_u *mode;
|
||||
char_u buf[NUMBUFLEN];
|
||||
int abbr = FALSE;
|
||||
|
||||
if (in_vim9script()
|
||||
&& (check_for_string_arg(argvars, 0) == FAIL
|
||||
|| check_for_opt_string_arg(argvars, 1) == FAIL
|
||||
|| (argvars[1].v_type != VAR_UNKNOWN
|
||||
&& check_for_opt_bool_arg(argvars, 2) == FAIL)))
|
||||
return;
|
||||
|
||||
name = tv_get_string(&argvars[0]);
|
||||
if (argvars[1].v_type == VAR_UNKNOWN)
|
||||
mode = (char_u *)"nvo";
|
||||
else
|
||||
{
|
||||
mode = tv_get_string_buf(&argvars[1], buf);
|
||||
if (argvars[2].v_type != VAR_UNKNOWN)
|
||||
abbr = (int)tv_get_bool(&argvars[2]);
|
||||
}
|
||||
|
||||
if (map_to_exists(name, mode, abbr))
|
||||
rettv->vval.v_number = TRUE;
|
||||
else
|
||||
rettv->vval.v_number = FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Fill in the empty dictionary with items as defined by maparg builtin.
|
||||
*/
|
||||
|
||||
+2
-2
@@ -1825,8 +1825,8 @@ str2special(
|
||||
*sp = str + 1;
|
||||
}
|
||||
else
|
||||
// single-byte character or illegal byte
|
||||
*sp = str + 1;
|
||||
// single-byte character, NUL or illegal byte
|
||||
*sp = str + (*str == NUL ? 0 : 1);
|
||||
|
||||
// Make special keys and C0 control characters in <> form, also <M-Space>.
|
||||
// Use <Space> only for lhs of a mapping.
|
||||
|
||||
+4
-1
@@ -3012,9 +3012,9 @@ static struct vimoption options[] =
|
||||
p_term("t_BD", T_BD)
|
||||
p_term("t_cd", T_CD)
|
||||
p_term("t_ce", T_CE)
|
||||
p_term("t_Ce", T_UCE)
|
||||
p_term("t_cl", T_CL)
|
||||
p_term("t_cm", T_CM)
|
||||
p_term("t_Ce", T_UCE)
|
||||
p_term("t_Co", T_CCO)
|
||||
p_term("t_CS", T_CCS)
|
||||
p_term("t_Cs", T_UCS)
|
||||
@@ -3024,6 +3024,8 @@ static struct vimoption options[] =
|
||||
p_term("t_db", T_DB)
|
||||
p_term("t_DL", T_CDL)
|
||||
p_term("t_dl", T_DL)
|
||||
p_term("t_ds", T_DS)
|
||||
p_term("t_Ds", T_CDS)
|
||||
p_term("t_EC", T_CEC)
|
||||
p_term("t_EI", T_CEI)
|
||||
p_term("t_fs", T_FS)
|
||||
@@ -3071,6 +3073,7 @@ static struct vimoption options[] =
|
||||
p_term("t_u7", T_U7)
|
||||
p_term("t_ue", T_UE)
|
||||
p_term("t_us", T_US)
|
||||
p_term("t_Us", T_USS)
|
||||
p_term("t_ut", T_UT)
|
||||
p_term("t_vb", T_VB)
|
||||
p_term("t_ve", T_VE)
|
||||
|
||||
@@ -24,9 +24,6 @@ void crypt_check_method(int method);
|
||||
void crypt_check_current_method(void);
|
||||
char_u *crypt_get_key(int store, int twice);
|
||||
void crypt_append_msg(buf_T *buf);
|
||||
int crypt_sodium_init(cryptstate_T *state, char_u *key, char_u *salt, int salt_len, char_u *seed, int seed_len);
|
||||
long crypt_sodium_buffer_encode(cryptstate_T *state, char_u *from, size_t len, char_u **buf_out, int last);
|
||||
long crypt_sodium_buffer_decode(cryptstate_T *state, char_u *from, size_t len, char_u **buf_out, int last);
|
||||
int crypt_sodium_munlock(void *const addr, const size_t len);
|
||||
void crypt_sodium_randombytes_buf(void *const buf, const size_t size);
|
||||
/* vim: set ft=c : */
|
||||
|
||||
@@ -14,7 +14,6 @@ int get_spellword(list_T *list, char_u **pp);
|
||||
void prepare_vimvar(int idx, typval_T *save_tv);
|
||||
void restore_vimvar(int idx, typval_T *save_tv);
|
||||
char_u *eval_one_expr_in_str(char_u *p, garray_T *gap, int evaluate);
|
||||
char_u *eval_all_expr_in_str(char_u *str);
|
||||
list_T *heredoc_get(exarg_T *eap, char_u *cmd, int script_get, int vim9compile);
|
||||
void ex_var(exarg_T *eap);
|
||||
void ex_let(exarg_T *eap);
|
||||
|
||||
@@ -9,7 +9,6 @@ int gui_init_font(char_u *font_list, int fontset);
|
||||
int gui_get_wide_font(void);
|
||||
void gui_set_ligatures(void);
|
||||
void gui_update_cursor(int force, int clear_selection);
|
||||
void gui_position_menu(void);
|
||||
int gui_get_base_width(void);
|
||||
int gui_get_base_height(void);
|
||||
void gui_resize_shell(int pixel_width, int pixel_height);
|
||||
@@ -51,7 +50,6 @@ void gui_check_colors(void);
|
||||
guicolor_T gui_get_color(char_u *name);
|
||||
int gui_get_lightness(guicolor_T pixel);
|
||||
char_u *gui_bg_default(void);
|
||||
void init_gui_options(void);
|
||||
void gui_new_scrollbar_colors(void);
|
||||
void gui_focus_change(int in_focus);
|
||||
void gui_mouse_moved(int x, int y);
|
||||
|
||||
@@ -4,7 +4,6 @@ char_u *highlight_group_name(int id);
|
||||
int highlight_link_id(int id);
|
||||
void init_highlight(int both, int reset);
|
||||
int load_colors(char_u *name);
|
||||
int lookup_color(int idx, int foreground, int *boldp);
|
||||
void do_highlight(char_u *line, int forceit, int init);
|
||||
void free_highlight(void);
|
||||
void restore_cterm_colors(void);
|
||||
|
||||
+2
-1
@@ -3,7 +3,7 @@ mapblock_T *get_maphash_list(int state, int c);
|
||||
mapblock_T *get_buf_maphash_list(int state, int c);
|
||||
int is_maphash_valid(void);
|
||||
int do_map(int maptype, char_u *arg, int mode, int abbrev);
|
||||
void map_clear_int(buf_T *buf, int mode, int local, int abbr);
|
||||
void map_clear_mode(buf_T *buf, int mode, int local, int abbr);
|
||||
int mode_str2flags(char_u *modechars);
|
||||
int map_to_exists(char_u *str, char_u *modechars, int abbr);
|
||||
int map_to_exists_mode(char_u *rhs, int mode, int abbr);
|
||||
@@ -17,6 +17,7 @@ int makemap(FILE *fd, buf_T *buf);
|
||||
int put_escstr(FILE *fd, char_u *strstart, int what);
|
||||
void check_map_keycodes(void);
|
||||
char_u *check_map(char_u *keys, int mode, int exact, int ign_mod, int abbr, mapblock_T **mp_ptr, int *local_ptr);
|
||||
void f_hasmapto(typval_T *argvars, typval_T *rettv);
|
||||
void f_maplist(typval_T *argvars, typval_T *rettv);
|
||||
void f_maparg(typval_T *argvars, typval_T *rettv);
|
||||
void f_mapcheck(typval_T *argvars, typval_T *rettv);
|
||||
|
||||
@@ -40,7 +40,6 @@ void ex_scriptversion(exarg_T *eap);
|
||||
void ex_finish(exarg_T *eap);
|
||||
void do_finish(exarg_T *eap, int reanimate);
|
||||
int source_finished(char_u *(*fgetline)(int, void *, int, getline_opt_T), void *cookie);
|
||||
char_u *script_name_after_autoload(scriptitem_T *si);
|
||||
char_u *get_autoload_prefix(scriptitem_T *si);
|
||||
char_u *may_prefix_autoload(char_u *name);
|
||||
char_u *autoload_name(char_u *name);
|
||||
|
||||
@@ -38,7 +38,6 @@ void user_func_error(int error, char_u *name, funcexe_T *funcexe);
|
||||
int call_func(char_u *funcname, int len, typval_T *rettv, int argcount_in, typval_T *argvars_in, funcexe_T *funcexe);
|
||||
char_u *printable_func_name(ufunc_T *fp);
|
||||
char_u *trans_function_name(char_u **pp, int *is_global, int skip, int flags, funcdict_T *fdp, partial_T **partial, type_T **type);
|
||||
char_u *untrans_function_name(char_u *name);
|
||||
char_u *get_scriptlocal_funcname(char_u *funcname);
|
||||
char_u *alloc_printable_func_name(char_u *fname);
|
||||
char_u *save_function_name(char_u **name, int *is_global, int skip, int flags, funcdict_T *fudi);
|
||||
|
||||
+17
-5
@@ -1871,8 +1871,17 @@ screen_start_highlight(int attr)
|
||||
out_str(T_SO);
|
||||
if ((attr & HL_UNDERCURL) && *T_UCS != NUL) // undercurl
|
||||
out_str(T_UCS);
|
||||
if (((attr & HL_UNDERLINE) // underline or undercurl
|
||||
|| ((attr & HL_UNDERCURL) && *T_UCS == NUL))
|
||||
if ((attr & HL_UNDERDOUBLE) && *T_USS != NUL) // double underline
|
||||
out_str(T_USS);
|
||||
if ((attr & HL_UNDERDOTTED) && *T_DS != NUL) // dotted underline
|
||||
out_str(T_DS);
|
||||
if ((attr & HL_UNDERDASHED) && *T_CDS != NUL) // dashed underline
|
||||
out_str(T_CDS);
|
||||
if (((attr & HL_UNDERLINE) // underline or undercurl, etc.
|
||||
|| ((attr & HL_UNDERCURL) && *T_UCS == NUL)
|
||||
|| ((attr & HL_UNDERDOUBLE) && *T_USS == NUL)
|
||||
|| ((attr & HL_UNDERDOTTED) && *T_DS == NUL)
|
||||
|| ((attr & HL_UNDERDASHED) && *T_CDS == NUL))
|
||||
&& *T_US != NUL)
|
||||
out_str(T_US);
|
||||
if ((attr & HL_ITALIC) && *T_CZH != NUL) // italic
|
||||
@@ -1967,6 +1976,8 @@ screen_stop_highlight(void)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
int is_under;
|
||||
|
||||
if (screen_attr > HL_ALL) // special HL attr.
|
||||
{
|
||||
attrentry_T *aep;
|
||||
@@ -2046,15 +2057,16 @@ screen_stop_highlight(void)
|
||||
else
|
||||
out_str(T_SE);
|
||||
}
|
||||
if ((screen_attr & HL_UNDERCURL) && *T_UCE != NUL)
|
||||
is_under = (screen_attr & (HL_UNDERCURL
|
||||
| HL_UNDERDOUBLE | HL_UNDERDOTTED | HL_UNDERDASHED));
|
||||
if (is_under && *T_UCE != NUL)
|
||||
{
|
||||
if (STRCMP(T_UCE, T_ME) == 0)
|
||||
do_ME = TRUE;
|
||||
else
|
||||
out_str(T_UCE);
|
||||
}
|
||||
if ((screen_attr & HL_UNDERLINE)
|
||||
|| ((screen_attr & HL_UNDERCURL) && *T_UCE == NUL))
|
||||
if ((screen_attr & HL_UNDERLINE) || (is_under && *T_UCE == NUL))
|
||||
{
|
||||
if (STRCMP(T_UE, T_ME) == 0)
|
||||
do_ME = TRUE;
|
||||
|
||||
+1
-1
@@ -2346,7 +2346,7 @@ source_finished(
|
||||
* Find the path of a script below the "autoload" directory.
|
||||
* Returns NULL if there is no "/autoload/" in the script name.
|
||||
*/
|
||||
char_u *
|
||||
static char_u *
|
||||
script_name_after_autoload(scriptitem_T *si)
|
||||
{
|
||||
char_u *p = si->sn_name;
|
||||
|
||||
@@ -1187,6 +1187,9 @@ static struct builtin_term builtin_termcaps[] =
|
||||
{(int)KS_US, "[US]"},
|
||||
{(int)KS_UCE, "[UCE]"},
|
||||
{(int)KS_UCS, "[UCS]"},
|
||||
{(int)KS_USS, "[USS]"},
|
||||
{(int)KS_DS, "[DS]"},
|
||||
{(int)KS_CDS, "[CDS]"},
|
||||
{(int)KS_STE, "[STE]"},
|
||||
{(int)KS_STS, "[STS]"},
|
||||
{(int)KS_MS, "[MS]"},
|
||||
@@ -1675,6 +1678,7 @@ get_term_entries(int *height, int *width)
|
||||
{KS_MD, "md"}, {KS_SE, "se"}, {KS_SO, "so"},
|
||||
{KS_CZH,"ZH"}, {KS_CZR,"ZR"}, {KS_UE, "ue"},
|
||||
{KS_US, "us"}, {KS_UCE, "Ce"}, {KS_UCS, "Cs"},
|
||||
{KS_USS, "Us"}, {KS_DS, "ds"}, {KS_CDS, "Ds"},
|
||||
{KS_STE,"Te"}, {KS_STS,"Ts"},
|
||||
{KS_CM, "cm"}, {KS_SR, "sr"},
|
||||
{KS_CRI,"RI"}, {KS_VB, "vb"}, {KS_KS, "ks"},
|
||||
|
||||
@@ -55,6 +55,9 @@ enum SpecialKey
|
||||
KS_US, // underscore (underline) mode
|
||||
KS_UCE, // exit undercurl mode
|
||||
KS_UCS, // undercurl mode
|
||||
KS_USS, // double underline mode
|
||||
KS_DS, // dotted underline mode
|
||||
KS_CDS, // dashed underline mode
|
||||
KS_STE, // exit strikethrough mode
|
||||
KS_STS, // strikethrough mode
|
||||
KS_MS, // save to move cur in reverse mode
|
||||
@@ -160,6 +163,9 @@ extern char_u *(term_strings[]); // current terminal strings
|
||||
#define T_US (TERM_STR(KS_US)) // underscore (underline) mode
|
||||
#define T_UCE (TERM_STR(KS_UCE)) // exit undercurl mode
|
||||
#define T_UCS (TERM_STR(KS_UCS)) // undercurl mode
|
||||
#define T_USS (TERM_STR(KS_USS)) // double underline mode
|
||||
#define T_DS (TERM_STR(KS_DS)) // dotted underline mode
|
||||
#define T_CDS (TERM_STR(KS_CDS)) // dashed underline mode
|
||||
#define T_STE (TERM_STR(KS_STE)) // exit strikethrough mode
|
||||
#define T_STS (TERM_STR(KS_STS)) // strikethrough mode
|
||||
#define T_MS (TERM_STR(KS_MS)) // save to move cur in reverse mode
|
||||
|
||||
@@ -234,6 +234,7 @@ let s:filename_checks = {
|
||||
\ 'haml': ['file.haml'],
|
||||
\ 'hamster': ['file.hsm'],
|
||||
\ 'handlebars': ['file.hbs'],
|
||||
\ 'hare': ['file.ha'],
|
||||
\ 'haskell': ['file.hs', 'file.hsc', 'file.hs-boot', 'file.hsig'],
|
||||
\ 'haste': ['file.ht'],
|
||||
\ 'hastepreproc': ['file.htpp'],
|
||||
@@ -836,7 +837,7 @@ func Test_bas_file()
|
||||
|
||||
" Visual Basic
|
||||
|
||||
call writefile(['Attribute VB_NAME = "Testing"'], 'Xfile.bas')
|
||||
call writefile(['Attribute VB_NAME = "Testing"', 'Enum Foo', 'End Enum'], 'Xfile.bas')
|
||||
split Xfile.bas
|
||||
call assert_equal('vb', &filetype)
|
||||
bwipe!
|
||||
@@ -1718,5 +1719,45 @@ func Test_xpm_file()
|
||||
filetype off
|
||||
endfunc
|
||||
|
||||
func Test_cls_file()
|
||||
filetype on
|
||||
|
||||
call writefile(['looks like Smalltalk'], 'Xfile.cls')
|
||||
split Xfile.cls
|
||||
call assert_equal('st', &filetype)
|
||||
bwipe!
|
||||
|
||||
" Test dist#ft#FTcls()
|
||||
|
||||
let g:filetype_cls = 'vb'
|
||||
split Xfile.cls
|
||||
call assert_equal('vb', &filetype)
|
||||
bwipe!
|
||||
unlet g:filetype_cls
|
||||
|
||||
" TeX
|
||||
|
||||
call writefile(['%'], 'Xfile.cls')
|
||||
split Xfile.cls
|
||||
call assert_equal('tex', &filetype)
|
||||
bwipe!
|
||||
|
||||
" Rexx
|
||||
|
||||
call writefile(['# rexx'], 'Xfile.cls')
|
||||
split Xfile.cls
|
||||
call assert_equal('rexx', &filetype)
|
||||
bwipe!
|
||||
|
||||
" Visual Basic
|
||||
|
||||
call writefile(['VERSION 1.0 CLASS'], 'Xfile.cls')
|
||||
split Xfile.cls
|
||||
call assert_equal('vb', &filetype)
|
||||
bwipe!
|
||||
|
||||
call delete('Xfile.cls')
|
||||
filetype off
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
@@ -1476,6 +1476,8 @@ func Test_fold_split()
|
||||
call assert_equal([0, 1, 1, 2, 2], range(1, 5)->map('foldlevel(v:val)'))
|
||||
call append(2, 'line 2.5')
|
||||
call assert_equal([0, 1, 0, 1, 2, 2], range(1, 6)->map('foldlevel(v:val)'))
|
||||
3d
|
||||
call assert_equal([0, 1, 1, 2, 2], range(1, 5)->map('foldlevel(v:val)'))
|
||||
bw!
|
||||
endfunc
|
||||
|
||||
|
||||
@@ -888,8 +888,8 @@ endfunc
|
||||
|
||||
" Test for setting various 'term' attributes
|
||||
func Test_highlight_term_attr()
|
||||
hi HlGrp3 term=bold,underline,undercurl,strikethrough,reverse,italic,standout
|
||||
call assert_equal('hi HlGrp3 term=bold,standout,underline,undercurl,italic,reverse,strikethrough', HighlightArgs('HlGrp3'))
|
||||
hi HlGrp3 term=bold,underline,undercurl,underdouble,underdotted,underdashed,strikethrough,reverse,italic,standout
|
||||
call assert_equal('hi HlGrp3 term=bold,standout,underline,undercurl,underdouble,underdotted,underdashed,italic,reverse,strikethrough', HighlightArgs('HlGrp3'))
|
||||
hi HlGrp3 term=NONE
|
||||
call assert_equal('hi HlGrp3 cleared', HighlightArgs('HlGrp3'))
|
||||
hi clear
|
||||
@@ -1174,12 +1174,14 @@ func Test_hlset()
|
||||
" Test for setting all the 'term', 'cterm' and 'gui' attributes of a
|
||||
" highlight group
|
||||
let lines =<< trim END
|
||||
VAR attr = {'bold': v:true, 'underline': v:true, 'undercurl': v:true,
|
||||
VAR attr = {'bold': v:true, 'underline': v:true,
|
||||
\ 'undercurl': v:true, 'underdouble': v:true,
|
||||
\ 'underdotted': v:true, 'underdashed': v:true,
|
||||
\ 'strikethrough': v:true, 'reverse': v:true, 'italic': v:true,
|
||||
\ 'standout': v:true, 'nocombine': v:true}
|
||||
call hlset([{'name': 'myhlg2', 'term': attr, 'cterm': attr, 'gui': attr}])
|
||||
VAR id2 = hlID('myhlg2')
|
||||
VAR expected = "myhlg2 xxx term=bold,standout,underline,undercurl,italic,reverse,nocombine,strikethrough cterm=bold,standout,underline,undercurl,italic,reverse,nocombine,strikethrough gui=bold,standout,underline,undercurl,italic,reverse,nocombine,strikethrough"
|
||||
VAR expected = "myhlg2 xxx term=bold,standout,underline,undercurl,underdouble,underdotted,underdashed,italic,reverse,nocombine,strikethrough cterm=bold,standout,underline,undercurl,underdouble,underdotted,underdashed,italic,reverse,nocombine,strikethrough gui=bold,standout,underline,undercurl,underdouble,underdotted,underdashed,italic,reverse,nocombine,strikethrough"
|
||||
VAR output = execute('highlight myhlg2')
|
||||
LET output = output->split("\n")->join()->substitute('\s\+', ' ', 'g')
|
||||
call assert_equal(expected, output)
|
||||
|
||||
@@ -536,4 +536,17 @@ func Test_tmenu()
|
||||
tunmenu Test
|
||||
endfunc
|
||||
|
||||
func Test_only_modifier()
|
||||
exe "tmenu a.b \x80\xfc0"
|
||||
let exp =<< trim [TEXT]
|
||||
--- Menus ---
|
||||
500 a
|
||||
500 b
|
||||
t - <T-2-^@>
|
||||
[TEXT]
|
||||
call assert_equal(exp, split(execute('tmenu'), "\n"))
|
||||
|
||||
tunmenu a.b
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
@@ -960,6 +960,18 @@ func Test_opt_set_keycode()
|
||||
set <F9>=xyz
|
||||
call assert_equal('xyz', &t_k9)
|
||||
set <t_k9>&
|
||||
|
||||
" should we test all of them?
|
||||
set t_Ce=testCe
|
||||
set t_Cs=testCs
|
||||
set t_Us=testUs
|
||||
set t_ds=testds
|
||||
set t_Ds=testDs
|
||||
call assert_equal('testCe', &t_Ce)
|
||||
call assert_equal('testCs', &t_Cs)
|
||||
call assert_equal('testUs', &t_Us)
|
||||
call assert_equal('testds', &t_ds)
|
||||
call assert_equal('testDs', &t_Ds)
|
||||
endfunc
|
||||
|
||||
" Test for changing options in a sandbox
|
||||
|
||||
@@ -3363,8 +3363,11 @@ func Test_bufoverflow()
|
||||
cgetexpr ['Compiler: ' . repeat('a', 1015), 'File1:10:Hello World']
|
||||
|
||||
set efm=%DEntering\ directory\ %f,%f:%l:%m
|
||||
cgetexpr ['Entering directory ' . repeat('a', 1006),
|
||||
\ 'File1:10:Hello World']
|
||||
let lines =<< trim eval END
|
||||
Entering directory $"{repeat('a', 1006)}"
|
||||
File1:10:Hello World
|
||||
END
|
||||
cgetexpr lines
|
||||
set efm&vim
|
||||
endfunc
|
||||
|
||||
|
||||
@@ -11,10 +11,17 @@ func Test_missing_attr()
|
||||
hi Mine term=reverse cterm=inverse
|
||||
call assert_equal('1', synIDattr(hlID("Mine"), "reverse", 'term'))
|
||||
call assert_equal('1', synIDattr(hlID("Mine"), "inverse", 'cterm'))
|
||||
|
||||
hi Mine term=underline cterm=standout gui=undercurl
|
||||
call assert_equal('1', synIDattr(hlID("Mine"), "underline", 'term'))
|
||||
call assert_equal('1', synIDattr(hlID("Mine"), "standout", 'cterm'))
|
||||
call assert_equal('1', synIDattr("Mine"->hlID(), "undercurl", 'gui'))
|
||||
|
||||
hi Mine term=underdouble cterm=underdotted gui=underdashed
|
||||
call assert_equal('1', synIDattr(hlID("Mine"), "underdouble", 'term'))
|
||||
call assert_equal('1', synIDattr(hlID("Mine"), "underdotted", 'cterm'))
|
||||
call assert_equal('1', synIDattr("Mine"->hlID(), "underdashed", 'gui'))
|
||||
|
||||
hi Mine gui=strikethrough
|
||||
call assert_equal('1', synIDattr(hlID("Mine"), "strikethrough", 'gui'))
|
||||
hi Mine term=NONE cterm=NONE gui=NONE
|
||||
|
||||
@@ -3364,6 +3364,22 @@ def Test_searchdecl()
|
||||
v9.CheckDefAndScriptFailure(['searchdecl(1)'], ['E1013: Argument 1: type mismatch, expected string but got number', 'E1174: String required for argument 1'])
|
||||
v9.CheckDefAndScriptFailure(['searchdecl("a", 2)'], ['E1013: Argument 2: type mismatch, expected bool but got number', 'E1212: Bool required for argument 2'])
|
||||
v9.CheckDefAndScriptFailure(['searchdecl("a", true, 2)'], ['E1013: Argument 3: type mismatch, expected bool but got number', 'E1212: Bool required for argument 3'])
|
||||
|
||||
# search for an empty string declaration
|
||||
var lines: list<string> =<< trim END
|
||||
int var1;
|
||||
|
||||
{
|
||||
int var2;
|
||||
var1 = 10;
|
||||
}
|
||||
END
|
||||
new
|
||||
setline(1, lines)
|
||||
cursor(5, 4)
|
||||
searchdecl('')
|
||||
assert_equal([3, 1], [line('.'), col('.')])
|
||||
bw!
|
||||
enddef
|
||||
|
||||
def Test_searchpair()
|
||||
|
||||
@@ -219,6 +219,53 @@ func Test_xxd()
|
||||
call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
|
||||
endfor
|
||||
|
||||
" Test 17: Print C include with custom variable name
|
||||
let s:test += 1
|
||||
call writefile(['TESTabcd09'], 'XXDfile')
|
||||
for arg in ['-nvarName', '-n varName', '-name varName']
|
||||
%d
|
||||
exe '0r! ' . s:xxd_cmd . ' -i ' . arg . ' XXDfile'
|
||||
$d
|
||||
let expected =<< trim [CODE]
|
||||
unsigned char varName[] = {
|
||||
0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a
|
||||
};
|
||||
unsigned int varName_len = 11;
|
||||
[CODE]
|
||||
|
||||
call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
|
||||
endfor
|
||||
|
||||
" using "-n name" reading from stdin
|
||||
%d
|
||||
exe '0r! ' . s:xxd_cmd . ' -i < XXDfile -n StdIn'
|
||||
$d
|
||||
let expected =<< trim [CODE]
|
||||
unsigned char StdIn[] = {
|
||||
0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a
|
||||
};
|
||||
unsigned int StdIn_len = 11;
|
||||
[CODE]
|
||||
call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
|
||||
|
||||
|
||||
" Test 18: Print C include: custom variable names can be capitalized
|
||||
let s:test += 1
|
||||
for arg in ['-C', '-capitalize']
|
||||
call writefile(['TESTabcd09'], 'XXDfile')
|
||||
%d
|
||||
exe '0r! ' . s:xxd_cmd . ' -i ' . arg . ' -n varName XXDfile'
|
||||
$d
|
||||
let expected =<< trim [CODE]
|
||||
unsigned char VARNAME[] = {
|
||||
0x54, 0x45, 0x53, 0x54, 0x61, 0x62, 0x63, 0x64, 0x30, 0x39, 0x0a
|
||||
};
|
||||
unsigned int VARNAME_LEN = 11;
|
||||
[CODE]
|
||||
call assert_equal(expected, getline(1,'$'), s:Mess(s:test))
|
||||
endfor
|
||||
|
||||
|
||||
%d
|
||||
bwipe!
|
||||
call delete('XXDfile')
|
||||
|
||||
+2
-1
@@ -32,6 +32,7 @@ static funccall_T *previous_funccal = NULL;
|
||||
static void funccal_unref(funccall_T *fc, ufunc_T *fp, int force);
|
||||
static void func_clear(ufunc_T *fp, int force);
|
||||
static int func_free(ufunc_T *fp, int force);
|
||||
static char_u *untrans_function_name(char_u *name);
|
||||
|
||||
void
|
||||
func_init()
|
||||
@@ -4073,7 +4074,7 @@ theend:
|
||||
* This can be used to first search for a script-local function and fall back
|
||||
* to the global function if not found.
|
||||
*/
|
||||
char_u *
|
||||
static char_u *
|
||||
untrans_function_name(char_u *name)
|
||||
{
|
||||
char_u *p;
|
||||
|
||||
@@ -750,6 +750,22 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
9,
|
||||
/**/
|
||||
8,
|
||||
/**/
|
||||
7,
|
||||
/**/
|
||||
6,
|
||||
/**/
|
||||
5,
|
||||
/**/
|
||||
4,
|
||||
/**/
|
||||
3,
|
||||
/**/
|
||||
2,
|
||||
/**/
|
||||
1,
|
||||
/**/
|
||||
|
||||
@@ -666,10 +666,13 @@ extern int (*dyn_libintl_wputenv)(const wchar_t *envstring);
|
||||
#define HL_ITALIC 0x04
|
||||
#define HL_UNDERLINE 0x08
|
||||
#define HL_UNDERCURL 0x10
|
||||
#define HL_STANDOUT 0x20
|
||||
#define HL_NOCOMBINE 0x40
|
||||
#define HL_STRIKETHROUGH 0x80
|
||||
#define HL_ALL 0xff
|
||||
#define HL_UNDERDOUBLE 0x20
|
||||
#define HL_UNDERDOTTED 0x40
|
||||
#define HL_UNDERDASHED 0x80
|
||||
#define HL_STANDOUT 0x100
|
||||
#define HL_NOCOMBINE 0x200
|
||||
#define HL_STRIKETHROUGH 0x400
|
||||
#define HL_ALL 0x7ff
|
||||
|
||||
// special attribute addition: Put message in history
|
||||
#define MSG_HIST 0x1000
|
||||
|
||||
+8
-16
@@ -478,20 +478,16 @@ call_dfunc(
|
||||
arg_to_add = ufunc->uf_args.ga_len - argcount;
|
||||
if (arg_to_add < 0)
|
||||
{
|
||||
if (arg_to_add == -1)
|
||||
emsg(_(e_one_argument_too_many));
|
||||
else
|
||||
semsg(_(e_nr_arguments_too_many), -arg_to_add);
|
||||
semsg(NGETTEXT(e_one_argument_too_many, e_nr_arguments_too_many,
|
||||
-arg_to_add), -arg_to_add);
|
||||
return FAIL;
|
||||
}
|
||||
else if (arg_to_add > ufunc->uf_def_args.ga_len)
|
||||
{
|
||||
int missing = arg_to_add - ufunc->uf_def_args.ga_len;
|
||||
|
||||
if (missing == 1)
|
||||
emsg(_(e_one_argument_too_few));
|
||||
else
|
||||
semsg(_(e_nr_arguments_too_few), missing);
|
||||
semsg(NGETTEXT(e_one_argument_too_few, e_nr_arguments_too_few,
|
||||
missing), missing);
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@@ -5170,19 +5166,15 @@ call_def_function(
|
||||
idx = argc - ufunc->uf_args.ga_len;
|
||||
if (idx > 0 && ufunc->uf_va_name == NULL)
|
||||
{
|
||||
if (idx == 1)
|
||||
emsg(_(e_one_argument_too_many));
|
||||
else
|
||||
semsg(_(e_nr_arguments_too_many), idx);
|
||||
semsg(NGETTEXT(e_one_argument_too_many, e_nr_arguments_too_many,
|
||||
idx), idx);
|
||||
goto failed_early;
|
||||
}
|
||||
idx = argc - ufunc->uf_args.ga_len + ufunc->uf_def_args.ga_len;
|
||||
if (idx < 0)
|
||||
{
|
||||
if (idx == -1)
|
||||
emsg(_(e_one_argument_too_few));
|
||||
else
|
||||
semsg(_(e_nr_arguments_too_few), -idx);
|
||||
semsg(NGETTEXT(e_one_argument_too_few, e_nr_arguments_too_few,
|
||||
-idx), -idx);
|
||||
goto failed_early;
|
||||
}
|
||||
|
||||
|
||||
+26
-6
@@ -55,6 +55,7 @@
|
||||
* 11.01.2019 Add full 64/32 bit range to -o and output by Christer Jensen.
|
||||
* 04.02.2020 Add -d for decimal offsets by Aapo Rantalainen
|
||||
* 14.01.2022 Disable extra newlines with -c0 -p by Erik Auerswald.
|
||||
* 20.06.2022 Permit setting the variable names used by -i by David Gow
|
||||
*
|
||||
* (c) 1990-1998 by Juergen Weigert (jnweiger@gmail.com)
|
||||
*
|
||||
@@ -226,6 +227,7 @@ exit_with_usage(void)
|
||||
fprintf(stderr, " -h print this summary.\n");
|
||||
fprintf(stderr, " -i output in C include file style.\n");
|
||||
fprintf(stderr, " -l len stop after <len> octets.\n");
|
||||
fprintf(stderr, " -n name set the variable name used in C include output (-i).\n");
|
||||
fprintf(stderr, " -o off add <off> to the displayed file position.\n");
|
||||
fprintf(stderr, " -ps output in postscript plain hexdump style.\n");
|
||||
fprintf(stderr, " -r reverse operation: convert (or patch) hexdump into binary.\n");
|
||||
@@ -497,6 +499,7 @@ main(int argc, char *argv[])
|
||||
unsigned long displayoff = 0;
|
||||
static char l[LLEN+1]; /* static because it may be too big for stack */
|
||||
char *pp;
|
||||
char *varname = NULL;
|
||||
int addrlen = 9;
|
||||
|
||||
#ifdef AMIGA
|
||||
@@ -635,6 +638,19 @@ main(int argc, char *argv[])
|
||||
argc--;
|
||||
}
|
||||
}
|
||||
else if (!STRNCMP(pp, "-n", 2))
|
||||
{
|
||||
if (pp[2] && STRNCMP("ame", pp + 2, 3))
|
||||
varname = pp + 2;
|
||||
else
|
||||
{
|
||||
if (!argv[2])
|
||||
exit_with_usage();
|
||||
varname = argv[2];
|
||||
argv++;
|
||||
argc--;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(pp, "--")) /* end of options */
|
||||
{
|
||||
argv++;
|
||||
@@ -753,10 +769,14 @@ main(int argc, char *argv[])
|
||||
|
||||
if (hextype == HEX_CINCLUDE)
|
||||
{
|
||||
if (fp != stdin)
|
||||
/* A user-set variable name overrides fp == stdin */
|
||||
if (varname == NULL && fp != stdin)
|
||||
varname = argv[1];
|
||||
|
||||
if (varname != NULL)
|
||||
{
|
||||
FPRINTF_OR_DIE((fpo, "unsigned char %s", isdigit((int)argv[1][0]) ? "__" : ""));
|
||||
for (e = 0; (c = argv[1][e]) != 0; e++)
|
||||
FPRINTF_OR_DIE((fpo, "unsigned char %s", isdigit((int)varname[0]) ? "__" : ""));
|
||||
for (e = 0; (c = varname[e]) != 0; e++)
|
||||
putc_or_die(isalnum(c) ? CONDITIONAL_CAPITALIZE(c) : '_', fpo);
|
||||
fputs_or_die("[] = {\n", fpo);
|
||||
}
|
||||
@@ -773,11 +793,11 @@ main(int argc, char *argv[])
|
||||
if (p)
|
||||
fputs_or_die("\n", fpo);
|
||||
|
||||
if (fp != stdin)
|
||||
if (varname != NULL)
|
||||
{
|
||||
fputs_or_die("};\n", fpo);
|
||||
FPRINTF_OR_DIE((fpo, "unsigned int %s", isdigit((int)argv[1][0]) ? "__" : ""));
|
||||
for (e = 0; (c = argv[1][e]) != 0; e++)
|
||||
FPRINTF_OR_DIE((fpo, "unsigned int %s", isdigit((int)varname[0]) ? "__" : ""));
|
||||
for (e = 0; (c = varname[e]) != 0; e++)
|
||||
putc_or_die(isalnum(c) ? CONDITIONAL_CAPITALIZE(c) : '_', fpo);
|
||||
FPRINTF_OR_DIE((fpo, "_%s = %d;\n", capitalize ? "LEN" : "len", p));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user