procedure TEditorForm.WhiteSpaceLeftMargin(whiteSpaceNum: Integer);
{here we call a routine to add n whitespace characters to the
start of each line as a Heath-Robinson quick-fix solution...}
{NOT a good solution to the problem of inserting margin at the left
of text in a RichEdit, as IF A LINE HAS WORD-WRAPPED, then this will
screw things up (and the whitespace WON'T get inserted properly)...}
var
 i, j, k, linesNum, lineLength: Integer;
 tempArray: array[0..(maxLineLen + maxWhiteSpace + 1)] of Char;
 tempLine: String;
begin
 linesNum := Editor.Lines.Count;
 for i := 0 to linesNum do
 begin
 tempLine := Editor.Lines[i];
 lineLength := Length(tempLine);
 if (lineLength <= (maxLineLen - whiteSpaceNum)) then
 begin
 for j := 0 to whiteSpaceNum do
 begin
 tempArray[j] := ' ';
 end;
 k := 1;
 for j := whiteSpaceNum to (lineLength + whiteSpaceNum) do
 begin
 tempArray[j] := tempLine[k];
 Inc(k);
 end;
 tempArray[j + 1] := #0;
 Editor.Lines[i] := String(tempArray);
 end;
 end;
end;