Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs24-19fa
git_rec_nano
Commits
66945350
Commit
66945350
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
painting: when skipping a zero-length match, skip a character, not a byte
parent
9de376de
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/winio.c
+14
-12
src/winio.c
with
14 additions
and
12 deletions
+14
-12
src/winio.c
View file @
66945350
...
...
@@ -2384,9 +2384,10 @@ void edit_draw(filestruct *fileptr, const char *converted,
REG_NOMATCH
)
break
;
/*
Skip over a zero-length regex match
. */
/*
If the match is of length zero, skip it
. */
if
(
startmatch
.
rm_so
==
startmatch
.
rm_eo
)
{
index
+=
startmatch
.
rm_eo
+
1
;
index
=
move_mbright
(
fileptr
->
data
,
index
+
startmatch
.
rm_eo
);
continue
;
}
...
...
@@ -2484,10 +2485,11 @@ void edit_draw(filestruct *fileptr, const char *converted,
/* Begin searching for an end after the start match. */
index
+=
startmatch
.
rm_eo
;
/* If the start match is zero-length, don't get stuck. */
if
(
startmatch
.
rm_so
==
startmatch
.
rm_eo
)
if
(
++
index
>
linelen
)
if
(
startmatch
.
rm_so
==
startmatch
.
rm_eo
)
{
index
=
move_mbright
(
start_line
->
data
,
index
);
if
(
index
>
linelen
)
break
;
}
/* If there is no end after this last start, good. */
if
(
regexec
(
varnish
->
end
,
start_line
->
data
+
index
,
0
,
NULL
,
REG_NOTBOL
)
==
REG_NOMATCH
)
...
...
@@ -2578,13 +2580,13 @@ void edit_draw(filestruct *fileptr, const char *converted,
#endif
}
index
=
endmatch
.
rm_eo
;
/*
Skip over a zero-length match
. */
if
(
endmatch
.
rm_so
==
endmatch
.
rm_eo
)
index
+
=
1
;
if
(
index
>
linelen
)
break
;
else
continue
;
/*
If the end match is of length zero, step ahead
. */
if
(
endmatch
.
rm_so
==
endmatch
.
rm_eo
)
{
index
=
move_mbright
(
fileptr
->
data
,
index
)
;
if
(
index
>
linelen
)
break
;
}
continue
;
}
/* There is no end on this line. But maybe on later lines? */
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment