Skip to content

Commit

Permalink
gh-573: viewer long regex search fix
Browse files Browse the repository at this point in the history
  • Loading branch information
w17 committed Dec 16, 2022
1 parent 2c4902b commit 6803e4f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions far/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
--------------------------------------------------------------------------------
w17 16.12.2022 03:00:34 +0300 - build 6071

1. gh-573: viewer long regex serch fix

--------------------------------------------------------------------------------
drkns 15.12.2022 19:04:20 +0000 - build 6070

Expand Down
2 changes: 1 addition & 1 deletion far/vbuild.m4
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6070
6071
5 changes: 3 additions & 2 deletions far/viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3324,8 +3324,9 @@ void Viewer::Search(int Next,const Manager::Key* FirstChar)
}
LastSearchDirection = search_direction;

if (!sd.search_len || static_cast<long long>(sd.search_len) > FileSize)
if (!sd.search_len || !FileSize)
return;
const auto can_found = (SearchRegexp && !SearchHex) || static_cast<long long>(sd.search_len) <= FileSize;

sd.CurPos = LastSelectPos;
{
Expand All @@ -3337,7 +3338,7 @@ void Viewer::Search(int Next,const Manager::Key* FirstChar)

for (;;)
{
const auto found = std::invoke(searcher, this, &sd);
const auto found = can_found ? std::invoke(searcher, this, &sd) : Search_NotFound;
if (found == Search_Found)
break;

Expand Down

0 comments on commit 6803e4f

Please sign in to comment.