From 3d0133556872c9b70f7c1b407ac0a290263d9fbb Mon Sep 17 00:00:00 2001 From: Martin Date: Sun, 9 Feb 2025 22:13:39 +0100 Subject: [PATCH] SynEdit: Fix detecting combining after white-space (tab). Amend fix from commit ed45ec5224bcc6d595b74f8dcfca6f4e92b58ae0 See Issue #41228 --- components/synedit/lazsyntextarea.pp | 42 +++++++++++++++------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/components/synedit/lazsyntextarea.pp b/components/synedit/lazsyntextarea.pp index d2cd3fa276..79aa9d1dc1 100644 --- a/components/synedit/lazsyntextarea.pp +++ b/components/synedit/lazsyntextarea.pp @@ -1738,25 +1738,29 @@ var case pt^ of #9: begin - dec(e); - if (vscTabAtFirst in FVisibleSpecialChars) and (j < CWLen) then begin - pl^ := #194; inc(pl); - pl^ := #187; inc(pl); - dec(k); - if FetoBuf <> nil then FEtoBuf.EtoData[e] := c; - inc(e); - end; - while k > 0 do begin - pl^ := ' '; inc(pl); - dec(k); - if FetoBuf <> nil then FEtoBuf.EtoData[e] := c; - inc(e); - end; - if (vscTabAtLast in FVisibleSpecialChars) and ((pl-1)^=' ') and (j < CWLen) and - (not IsCombiningCodePoint(pt+1)) - then begin - (pl-1)^ := #194; - pl^ := #187; inc(pl); + if (not IsCombiningCodePoint(pt+1)) then begin + dec(e); + if (vscTabAtFirst in FVisibleSpecialChars) and (j < CWLen) then begin + pl^ := #194; inc(pl); + pl^ := #187; inc(pl); + dec(k); + if FetoBuf <> nil then FEtoBuf.EtoData[e] := c; + inc(e); + end; + while k > 0 do begin + pl^ := ' '; inc(pl); + dec(k); + if FetoBuf <> nil then FEtoBuf.EtoData[e] := c; + inc(e); + end; + if (vscTabAtLast in FVisibleSpecialChars) and ((pl-1)^=' ') and (j < CWLen) then begin + (pl-1)^ := #194; + pl^ := #187; inc(pl); + end; + end + else begin + pl^ := pt^; + inc(pl); end; end; ' ': begin