From f2e452806a1987493e795d31458645925b179a8e Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Tue, 24 Feb 2026 15:02:39 +0100 Subject: [PATCH] fix(developer): handle CRLF as LF internally in LDML debugger While the debugger memo internally uses CRLF, in all references, CRLF should be converted to LF for consistent text manipulation operations. This follows a similar fix in the kmn debugger in #13334. Fixes: #15601 Relates-to: #13334 --- ...veloper.UI.Debug.UfrmLdmlKeyboardDebug.pas | 25 +++++++------------ 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/developer/src/tike/child/Keyman.Developer.UI.Debug.UfrmLdmlKeyboardDebug.pas b/developer/src/tike/child/Keyman.Developer.UI.Debug.UfrmLdmlKeyboardDebug.pas index 4a7aaf60660..f6c2afa2c09 100644 --- a/developer/src/tike/child/Keyman.Developer.UI.Debug.UfrmLdmlKeyboardDebug.pas +++ b/developer/src/tike/child/Keyman.Developer.UI.Debug.UfrmLdmlKeyboardDebug.pas @@ -391,7 +391,7 @@ TMemoSelectionState = record dk: TDeadKeyInfo; begin Result.Selection := memo.Selection; - Result.Length := Length(memo.Text); + Result.Length := Length(memo.GetTextCR); for dk in FDeadkeys do begin if dk.Position >= Result.Selection.Start @@ -406,7 +406,7 @@ TMemoSelectionState = record L: Integer; s: string; begin - s := memo.Text; + s := memo.GetTextCR; L := Length(s); for dk in FDeadkeys do if dk.SavedPosition < 0 then @@ -428,15 +428,6 @@ TMemoSelectionState = record // control (Windows code?), as are all cursor movement / selection keys, // apart from Ctrl+A - if GetKeyState(VK_CONTROL) >= 0 then - begin - if (vk = VK_RETURN) and (GetKeyState(VK_MENU) >= 0) then - begin - memo.SelText := #13#10; - end; - Exit; - end; - case vk of Ord('A'): memo.SelectAll; Ord('C'): memo.CopyToClipboard; @@ -596,8 +587,8 @@ TSetTextEx = record else lhs := ''; - context := Copy(memo.Text, lhs.Length + 1, selection.Start - lhs.Length); - rhs := Copy(memo.Text, lhs.Length + context.Length + 1, MaxInt); + context := Copy(memo.GetTextCR, lhs.Length + 1, selection.Start - lhs.Length); + rhs := Copy(memo.GetTextCR, lhs.Length + context.Length + 1, MaxInt); // Reinsert the context @@ -844,19 +835,21 @@ procedure TfrmLdmlKeyboardDebug.memoSelMove(Sender: TObject); procedure TfrmLdmlKeyboardDebug.UpdateCharacterGrid; // I4808 var start, len: Integer; + t: string; begin if csDestroying in ComponentState then Exit; start := memo.SelStart; len := memo.SelLength; - if start + len > Length(memo.Text) then + t := memo.GetTextCR; + if start + len > t.Length then begin // RichEdit has a virtual final character, which is selected when // pressing Ctrl+A, etc. - len := Length(memo.Text) - start; + len := t.Length - start; end; - TCharacterGridRenderer.Fill(sgChars, memo.Text, FDeadkeys, start, len, + TCharacterGridRenderer.Fill(sgChars, t, FDeadkeys, start, len, memo.Selection.Anchor, True); TCharacterGridRenderer.Size(sgChars, memo.Font); end;