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
ec98647b
Commit
ec98647b
authored
15 years ago
by
Bram Moolenaar
Browse files
Options
Downloads
Patches
Plain Diff
updated for version 7.2-274
parent
2f59b5c1
Loading
Loading
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/fold.c
+34
-0
34 additions, 0 deletions
src/fold.c
src/testdir/test45.in
+6
-1
6 additions, 1 deletion
src/testdir/test45.in
src/testdir/test45.ok
+2
-1
2 additions, 1 deletion
src/testdir/test45.ok
src/version.c
+2
-0
2 additions, 0 deletions
src/version.c
with
44 additions
and
2 deletions
src/fold.c
+
34
−
0
View file @
ec98647b
...
...
@@ -2256,6 +2256,40 @@ foldUpdateIEMS(wp, top, bot)
}
}
/*
* If folding is defined by the syntax, it is possible that a change in
* one line will cause all sub-folds of the current fold to change (e.g.,
* closing a C-style comment can cause folds in the subsequent lines to
* appear). To take that into account we should adjust the value of "bot"
* to point to the end of the current fold:
*/
if
(
foldlevelSyntax
==
getlevel
)
{
garray_T
*
gap
=
&
wp
->
w_folds
;
fold_T
*
fp
=
NULL
;
int
current_fdl
=
0
;
linenr_T
fold_start_lnum
=
0
;
linenr_T
lnum_rel
=
fline
.
lnum
;
while
(
current_fdl
<
fline
.
lvl
)
{
if
(
!
foldFind
(
gap
,
lnum_rel
,
&
fp
))
break
;
++
current_fdl
;
fold_start_lnum
+=
fp
->
fd_top
;
gap
=
&
fp
->
fd_nested
;
lnum_rel
-=
fp
->
fd_top
;
}
if
(
fp
!=
NULL
&&
current_fdl
==
fline
.
lvl
)
{
linenr_T
fold_end_lnum
=
fold_start_lnum
+
fp
->
fd_len
;
if
(
fold_end_lnum
>
bot
)
bot
=
fold_end_lnum
;
}
}
start
=
fline
.
lnum
;
end
=
bot
;
/* Do at least one line. */
...
...
This diff is collapsed.
Click to expand it.
src/testdir/test45.in
+
6
−
1
View file @
ec98647b
...
...
@@ -28,9 +28,14 @@ i jI :call append("$", "indent " . foldlevel("."))
k
:
call
append
(
"$"
,
foldlevel
(
"."
))
:
" test
syntax
folding
:
set
fdm
=
syntax
fdl
=
0
:
syn
region Hup start
=
"dd"
end
=
"hh"
fold
:
syn
region Hup start
=
"dd"
end
=
"ii"
fold
contains
=
Fd1
,
Fd2
,
Fd3
:
syn
region Fd1 start
=
"ee"
end
=
"ff"
fold
contained
:
syn
region Fd2 start
=
"gg"
end
=
"hh"
fold
contained
:
syn
region Fd3 start
=
"commentstart"
end
=
"commentend"
fold
contained
Gzk
:
call
append
(
"$"
,
"folding "
.
getline
(
"."
))
k
:
call
append
(
"$"
,
getline
(
"."
))
jAcommentstart Acommentend
:
set
fdl
=
1
3
j
:
call
append
(
"$"
,
getline
(
"."
))
:
" test expression folding
:
fun
Flvl
()
let
l
=
getline
(
v
:
lnum
)
...
...
This diff is collapsed.
Click to expand it.
src/testdir/test45.ok
+
2
−
1
View file @
ec98647b
...
...
@@ -8,8 +8,9 @@ marker 2
0
indent 2
1
folding
8 hh
folding
9 ii
3 cc
7 gg
expr 2
1
2
...
...
This diff is collapsed.
Click to expand it.
src/version.c
+
2
−
0
View file @
ec98647b
...
...
@@ -676,6 +676,8 @@ static char *(features[]) =
static
int
included_patches
[]
=
{
/* Add new patch number below this line */
/**/
274
,
/**/
273
,
/**/
...
...
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