mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 16:09:41 +02:00
Fix SynEdit IME handler / crash on short section of only one char, loop for FRightPosForTarget not entered. Issue #0029126
git-svn-id: trunk@50592 -
This commit is contained in:
parent
2136904400
commit
19e4bf8d04
@ -789,18 +789,13 @@ begin
|
|||||||
if (FLeftPosForTarget < 0) or (FLeftPosForTarget > xy.x) then
|
if (FLeftPosForTarget < 0) or (FLeftPosForTarget > xy.x) then
|
||||||
FLeftPosForTarget := xy.x;
|
FLeftPosForTarget := xy.x;
|
||||||
inc(i);
|
inc(i);
|
||||||
while longword(i) < ImeCount do begin
|
|
||||||
if (ord(p[i]) <> ATTR_TARGET_CONVERTED) or (i = ImeCount-1) then begin
|
while (longword(i) < ImeCount) and (ord(p[i]) = ATTR_TARGET_CONVERTED) do
|
||||||
if (ord(p[i]) = ATTR_TARGET_CONVERTED) then
|
|
||||||
inc(i);
|
|
||||||
xy.x := x + CharToByte(x, i);
|
|
||||||
FImeBlockSelection2.EndLineBytePos := xy;
|
|
||||||
if (FRightPosForTarget < 0) or (FRightPosForTarget > xy.x) then
|
|
||||||
FRightPosForTarget := xy.x;
|
|
||||||
break;
|
|
||||||
end;
|
|
||||||
inc(i);
|
inc(i);
|
||||||
end;
|
xy.x := x + CharToByte(x, i);
|
||||||
|
FImeBlockSelection2.EndLineBytePos := xy;
|
||||||
|
if (FRightPosForTarget < 0) or (FRightPosForTarget < xy.x) then
|
||||||
|
FRightPosForTarget := xy.x;
|
||||||
//break;
|
//break;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -811,18 +806,13 @@ begin
|
|||||||
FLeftPosForTarget := xy.x;
|
FLeftPosForTarget := xy.x;
|
||||||
FImeBlockSelection3.StartLineBytePos := xy;
|
FImeBlockSelection3.StartLineBytePos := xy;
|
||||||
inc(i);
|
inc(i);
|
||||||
while longword(i) < ImeCount do begin
|
|
||||||
if (ord(p[i]) <> ATTR_TARGET_NOTCONVERTED) or (i = ImeCount-1) then begin
|
while (longword(i) < ImeCount) and (ord(p[i]) = ATTR_TARGET_NOTCONVERTED) do
|
||||||
if (ord(p[i]) = ATTR_TARGET_NOTCONVERTED) then
|
|
||||||
inc(i);
|
|
||||||
xy.x := x + CharToByte(x, i);
|
|
||||||
FImeBlockSelection3.EndLineBytePos := xy;
|
|
||||||
if (FRightPosForTarget < 0) or (FRightPosForTarget > xy.x) then
|
|
||||||
FRightPosForTarget := xy.x;
|
|
||||||
break;
|
|
||||||
end;
|
|
||||||
inc(i);
|
inc(i);
|
||||||
end;
|
xy.x := x + CharToByte(x, i);
|
||||||
|
FImeBlockSelection3.EndLineBytePos := xy;
|
||||||
|
if (FRightPosForTarget < 0) or (FRightPosForTarget < xy.x) then
|
||||||
|
FRightPosForTarget := xy.x;
|
||||||
//break;
|
//break;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -837,8 +827,9 @@ begin
|
|||||||
if (FLeftPosForTarget > 0) and FAdjustLeftCharForTargets then begin
|
if (FLeftPosForTarget > 0) and FAdjustLeftCharForTargets then begin
|
||||||
FLeftPosForTarget := ViewedTextBuffer.LogicalToPhysicalPos
|
FLeftPosForTarget := ViewedTextBuffer.LogicalToPhysicalPos
|
||||||
(Point(FLeftPosForTarget, FImeBlockSelection.FirstLineBytePos.Y)).x;
|
(Point(FLeftPosForTarget, FImeBlockSelection.FirstLineBytePos.Y)).x;
|
||||||
FRightPosForTarget := ViewedTextBuffer.LogicalToPhysicalPos
|
if FRightPosForTarget > 0 then
|
||||||
(Point(FRightPosForTarget, FImeBlockSelection.FirstLineBytePos.Y)).x;
|
FRightPosForTarget := ViewedTextBuffer.LogicalToPhysicalPos
|
||||||
|
(Point(FRightPosForTarget, FImeBlockSelection.FirstLineBytePos.Y)).x;
|
||||||
EnsureLeftChar;
|
EnsureLeftChar;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user