Just try this code
//get the string
SomeString := RichEdit.Lines.Strings[RichEdit.Lines.Count-1];
//replace the 'comma' with 'comma+space'
SomeString :=StringReplace(SomeString ,',',', ',[rfReplaceAll,rfIgnoreCase]);
//now delete the extra space which gets added each time you call this event
SomeString :=StringReplace(SomeString ,', ',', ',[rfReplaceAll,rfIgnoreCase]);
//your desired result
RichEdit.Lines.Strings[RichEdit.Lines.Count-1] := SomeString ;
Remember the BACKSPACE and DEL are working fine. But in case of your code there was an extra space added each time you try and change the contents of RichEdit. Hence giving an impression of the 2 keys not working.
Since you are having problems deleting the space in front of comma I will provide with another solution
Add a Boolean variable to the class isComma: Boolean
.
Later on OnKeyPress event of RichEdit inset this code
isComma := False;
if key = ',' then
isComma := True;
OnChange event code goes here
var
CurPoint: TPoint;
cText: string;
cLine: string;
begin
if isComma then
begin
cLine:=' '; //character to be added after comma, ' ' in here
CurPoint:=RichEdit1.CaretPos;
cText:=RichEdit1.Lines.Strings[CurPoint.y];
//add ' ' where the cursor is i.e. after the comma
cText:=Copy(cText,0,CurPoint.x)+cLine+Copy(cText,CurPoint.x+1,Length(cText));
RichEdit1.Lines.Strings[CurPoint.y]:=cText;
end;
end;