-
-
Notifications
You must be signed in to change notification settings - Fork 135
fix(developer): handle CRLF as LF internally in LDML debugger #15616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Devin.ai: Missing On line 585, Root Cause and ImpactRichEdit's This means Every other |
||||||
| 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; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah - these 90s variable names! Can we rename it to
Suggested change
|
||||||
| 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; | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Devin.ai:
Removed Ctrl guard in
DoHandleShortcutcauses shortcuts to fire on regular keypressesThe old code had a guard
if GetKeyState(VK_CONTROL) >= 0 then ... Exit;that ensured the Ctrl+key shortcut handling (SelectAll, Copy, Paste, Cut, Undo) only executed when Ctrl was actually held down. This guard was removed in the PR.Root Cause and Impact
DoHandleShortcutis called fromDoEmitKeystroke(line 467), which runs wheneveractions.emit_keystroke <> 0(line 643). This happens when the LDML keyboard does not match a keystroke. If a user types a regular 'a', 'c', 'v', 'x', or 'z' key on a keyboard that doesn't define rules for those keys,emit_keystrokeis set to 1, the keystroke is dispatched to the memo (inserting the character), and thenDoHandleShortcutis called.Without the Ctrl guard, the
case vk of Ord('A'): memo.SelectAll; ...block at lines 431–438 now matches on the virtual key code alone. For example, pressing 'A' without Ctrl would both insert 'a' into the memo AND callmemo.SelectAll, selecting all text. Similarly, pressing 'V' would insert 'v' AND paste from clipboard, 'Z' would insert 'z' AND undo, etc.The fix for removing the Enter key handling (which was the apparent goal) should have preserved the Ctrl guard while only removing the Enter-specific block inside it.