FIX: Viewer - Incorrect selection offset after search in Text mode (issue #1755)

This commit is contained in:
Alexander Koblov 2024-08-12 21:31:51 +03:00
commit 1ee7a6b2b8

View file

@ -2903,7 +2903,7 @@ var
Inc(len); // Assume there is one character after conversion
// (otherwise use Inc(len, UTF8Length(s))).
if len <= FHPosition then
if (Mode = vcmText) and (len <= FHPosition) then
begin
i := i + CharLenInBytes;
Continue;
@ -3490,11 +3490,14 @@ begin
Update;
if (FVisibleOffset < FHPosition) or
(FVisibleOffset > FHPosition + FTextWidth) then
if FViewerControlMode = vcmText then
begin
SetHPosition(FVisibleOffset);
HScroll(-1);
if (FVisibleOffset < FHPosition) or
(FVisibleOffset > FHPosition + FTextWidth) then
begin
SetHPosition(FVisibleOffset);
HScroll(-1);
end;
end;
end;
end;