Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
Vim
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Someone-Else
Vim
Commits
80fc0434
Commit
80fc0434
authored
19 years ago
by
Bram Moolenaar
Browse files
Options
Downloads
Patches
Plain Diff
updated for version 7.0111
parent
87b774da
No related branches found
Branches containing commit
Tags
v7.0111
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
runtime/syntax/html.vim
+4
-2
4 additions, 2 deletions
runtime/syntax/html.vim
src/eval.c
+102
-48
102 additions, 48 deletions
src/eval.c
with
106 additions
and
50 deletions
runtime/syntax/html.vim
+
4
−
2
View file @
80fc0434
...
...
@@ -2,7 +2,7 @@
" Language: HTML
" Maintainer: Claudio Fleiner <claudio@fleiner.com>
" URL: http://www.fleiner.com/vim/syntax/html.vim
" Last Change: 2005 Jul
18
" Last Change: 2005 Jul
20
" Please check :help html.vim for some comments and a description of the options
...
...
@@ -27,7 +27,9 @@ endif
syn
case ignore
syn
spell
toplevel
if
main_syntax
==
"html"
syn
spell
toplevel
endif
" mark illegal characters
syn
match
htmlError
"[<>&]"
...
...
This diff is collapsed.
Click to expand it.
src/eval.c
+
102
−
48
View file @
80fc0434
...
...
@@ -493,6 +493,7 @@ static void f_foreground __ARGS((typval_T *argvars, typval_T *rettv));
static void f_function __ARGS((typval_T *argvars, typval_T *rettv));
static void f_garbagecollect __ARGS((typval_T *argvars, typval_T *rettv));
static void f_get __ARGS((typval_T *argvars, typval_T *rettv));
static void f_getbufline __ARGS((typval_T *argvars, typval_T *rettv));
static void f_getbufvar __ARGS((typval_T *argvars, typval_T *rettv));
static void f_getchar __ARGS((typval_T *argvars, typval_T *rettv));
static void f_getcharmod __ARGS((typval_T *argvars, typval_T *rettv));
...
...
@@ -6676,6 +6677,7 @@ static struct fst
{"function", 1, 1, f_function},
{"garbagecollect", 0, 0, f_garbagecollect},
{"get", 2, 3, f_get},
{"getbufline", 2, 3, f_getbufline},
{"getbufvar", 2, 2, f_getbufvar},
{"getchar", 0, 1, f_getchar},
{"getcharmod", 0, 0, f_getcharmod},
...
...
@@ -9076,6 +9078,101 @@ f_get(argvars, rettv)
copy_tv(tv, rettv);
}
static void get_buffer_lines __ARGS((buf_T *buf, linenr_T start, linenr_T end, typval_T *rettv));
/*
* Get line or list of lines from buffer "buf" into "rettv".
*/
static void
get_buffer_lines(buf, start, end, rettv)
buf_T *buf;
linenr_T start;
linenr_T end;
typval_T *rettv;
{
char_u *p;
list_T *l;
listitem_T *li;
if (start < 0)
rettv->vval.v_number = 0; /* failure; error message already given */
else if (end == 0)
{
/* getline(lnum): return one line as a string */
if (start >= 1 && start <= buf->b_ml.ml_line_count)
p = ml_get_buf(buf, start, FALSE);
else
p = (char_u *)"";
rettv->v_type = VAR_STRING;
rettv->vval.v_string = vim_strsave(p);
}
else
{
if (end < start)
{
if (end >= 0) /* else: error message already given */
EMSG(_(e_invrange));
rettv->vval.v_number = 0;
}
else
{
l = list_alloc();
if (l != NULL)
{
if (start < 1)
start = 1;
if (end > buf->b_ml.ml_line_count)
end = buf->b_ml.ml_line_count;
while (start <= end)
{
li = listitem_alloc();
if (li == NULL)
break;
list_append(l, li);
li->li_tv.v_type = VAR_STRING;
li->li_tv.v_lock = 0;
li->li_tv.vval.v_string =
vim_strsave(ml_get_buf(buf, start++, FALSE));
}
rettv->vval.v_list = l;
rettv->v_type = VAR_LIST;
++l->lv_refcount;
}
}
}
}
/*
* "getbufline()" function
*/
static void
f_getbufline(argvars, rettv)
typval_T *argvars;
typval_T *rettv;
{
linenr_T lnum;
linenr_T end;
buf_T *buf;
(void)get_tv_number(&argvars[0]); /* issue errmsg if type error */
++emsg_off;
buf = get_buf_tv(&argvars[0]);
--emsg_off;
if (buf == NULL || buf->b_ml.ml_mfp == NULL)
rettv->vval.v_number = 0;
else
{
lnum = get_tv_lnum(&argvars[1]);
if (argvars[2].v_type == VAR_UNKNOWN)
end = lnum;
else
end = get_tv_lnum(&argvars[2]);
get_buffer_lines(buf, lnum, end, rettv);
}
}
/*
* "getbufvar()" function
*/
...
...
@@ -9444,7 +9541,7 @@ f_getftype(argvars, rettv)
}
/*
* "getline(lnum)" function
* "getline(lnum
, [end]
)" function
*/
static void
f_getline(argvars, rettv)
...
...
@@ -9453,57 +9550,14 @@ f_getline(argvars, rettv)
{
linenr_T lnum;
linenr_T end;
char_u *p;
list_T *l;
listitem_T *li;
lnum = get_tv_lnum(argvars);
if (lnum < 0)
rettv->vval.v_number = 0; /* failure; error message already given */
else if (argvars[1].v_type == VAR_UNKNOWN)
{
if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count)
p = ml_get(lnum);
else
p = (char_u *)"";
rettv->v_type = VAR_STRING;
rettv->vval.v_string = vim_strsave(p);
}
if (argvars[1].v_type == VAR_UNKNOWN)
end = 0;
else
{
end = get_tv_lnum(&argvars[1]);
if (end < lnum)
{
if (end >= 0) /* else: error message already given */
EMSG(_(e_invrange));
rettv->vval.v_number = 0;
}
else
{
l = list_alloc();
if (l != NULL)
{
if (lnum < 1)
lnum = 1;
if (end > curbuf->b_ml.ml_line_count)
end = curbuf->b_ml.ml_line_count;
while (lnum <= end)
{
li = listitem_alloc();
if (li == NULL)
break;
list_append(l, li);
li->li_tv.v_type = VAR_STRING;
li->li_tv.v_lock = 0;
li->li_tv.vval.v_string = vim_strsave(ml_get(lnum++));
}
rettv->vval.v_list = l;
rettv->v_type = VAR_LIST;
++l->lv_refcount;
}
}
}
get_buffer_lines(curbuf, lnum, end, rettv);
}
/*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment