diff --git a/developer/src/tike/child/UfrmDebug.pas b/developer/src/tike/child/UfrmDebug.pas index 30c91eba0c3..a6aa3ad752f 100644 --- a/developer/src/tike/child/UfrmDebug.pas +++ b/developer/src/tike/child/UfrmDebug.pas @@ -759,10 +759,16 @@ TMemoSelectionState = record begin Assert(m >= 1); Assert(memo.Text[m] <> #$FFFC); + // Delete surrogate pairs if (m > 1) and Uni_IsSurrogate2(memo.Text[m]) and Uni_IsSurrogate1(memo.Text[m-1]) then Dec(m, 2) + // Delete \r\n line breaks + else if (m > 1) and + (memo.Text[m] = #$0A) and + (memo.Text[m-1] = #$0D) then + Dec(m, 2) else Dec(m); end; @@ -894,7 +900,8 @@ TMemoSelectionState = record state: TMemoSelectionState; begin state := SaveMemoSelectionState; - memo.SelText := Text; + // Line breaks: replace \n with \r\n so line breaks work + memo.SelText := ReplaceStr(Text, #$0D, #$0D#$0A); memo.SelStart := memo.SelStart + memo.SelLength; // I1603 memo.SelLength := 0; RealignMemoSelectionState(state);