mirror of
https://github.com/tmux/tmux.git
synced 2025-01-05 15:28:50 +00:00
Do not loop forever when search finds an empty match, GitHub issue 2203.
This commit is contained in:
parent
592f141dee
commit
126bacb473
@ -2445,7 +2445,8 @@ window_copy_search_lr_regex(struct grid *gd, u_int *ppx, u_int *psx, u_int py,
|
||||
len += gd->sx;
|
||||
}
|
||||
|
||||
if (regexec(reg, buf, 1, ®match, eflags) == 0) {
|
||||
if (regexec(reg, buf, 1, ®match, eflags) == 0 &&
|
||||
regmatch.rm_so != regmatch.rm_eo) {
|
||||
foundx = first;
|
||||
foundy = py;
|
||||
window_copy_cstrtocellpos(gd, len, &foundx, &foundy,
|
||||
@ -2547,6 +2548,8 @@ window_copy_last_regex(struct grid *gd, u_int py, u_int first, u_int last,
|
||||
foundy = py;
|
||||
oldx = first;
|
||||
while (regexec(preg, buf + px, 1, ®match, eflags) == 0) {
|
||||
if (regmatch.rm_so == regmatch.rm_eo)
|
||||
break;
|
||||
window_copy_cstrtocellpos(gd, len, &foundx, &foundy,
|
||||
buf + px + regmatch.rm_so);
|
||||
if (foundy > py || foundx >= last)
|
||||
|
Loading…
Reference in New Issue
Block a user