Skip to content

Commit

Permalink
Allow long searches to be interrupted.
Browse files Browse the repository at this point in the history
  • Loading branch information
slewsys committed Dec 21, 2024
1 parent fb8f4d1 commit bf5075a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 0 additions & 3 deletions src/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,12 @@ line_address (off_t *addr, ed_buffer_t *ed)
if ((status = check_address_bounds (*addr, ed)) < 0)
return status;
ed->state->dot = *addr;
spl1 ();
if ((status =
get_matching_node_address (get_compiled_regex (c, RE_SEARCH, ed),
c == '/', addr, ed)) < 0)
{
spl0 ();
return status;
}
spl0 ();
if (*ed->input == c)
++ed->input;
break;
Expand Down
12 changes: 10 additions & 2 deletions src/re.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,16 @@ get_matching_node_address (const regex_t *re, int dir, off_t *addr,
return ERR;
do
{
spl1 ();
if ((*addr = (dir ? INC_MOD (*addr, ed->state->lines)
: DEC_MOD (*addr, ed->state->lines))))
{
lp = get_line_node (*addr, ed);
if (!(s = get_buffer_line (lp, ed)))
return ERR;
{
spl0 ();
return ERR;
}
#ifdef REG_STARTEND
rm->rm_so = 0;
rm->rm_eo = lp->len;
Expand All @@ -266,8 +270,12 @@ get_matching_node_address (const regex_t *re, int dir, off_t *addr,
NUL_TO_NEWLINE (s, lp->len);
if (!regexec (re, s, 0, NULL, 0))
#endif /* !defined (REG_STARTEND) */
return 0;
{
spl0 ();
return 0;
}
}
spl0 ();
}
while (*addr != ed->state->dot);
ed->exec->err = _("No match");
Expand Down

0 comments on commit bf5075a

Please sign in to comment.