[SOLVED] Unwanted additional line in the end of TRichMemo. lazarus / 31-LCL ---------------------------------------------------------------------- CM630 · 2024-12-13 15:12 I have added a RichMemo to a form. I have entered two lines in RichMemo1.Lines. But when I run the app there is an empty third line. Can I get rid of it? I tried to set RichMemo1.ReadOnly := True, but it does not help, the line is still there. A sample project is attached. ---------------------------------------------------------------------- cdbc · 2024-12-13 15:32 Hi Maybe:Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i { we don't want that pestering last empty line }RichMemo1.Lines.SkipLastLineBreak:= true;this could work?!? Regards Benny ---------------------------------------------------------------------- dsiders · 2024-12-13 19:28 https://lazarus- ccr.sourceforge.io/docs/rtl/classes/tstrings.skiplastlinebreak.html https://lazarus- ccr.sourceforge.io/docs/rtl/classes/tstrings.trailinglinebreak.html ---------------------------------------------------------------------- Ten_Mile_Hike · 2024-12-13 20:34 The other responses are best, but there is always *Untested* Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Memo1.text:=Leftstring(Memo1.text,Length(memo1.text)-1)  {or -2 if your line is #13#10} ---------------------------------------------------------------------- CM630 · 2024-12-14 07:55 None of these works: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  RichMemo1.Lines.SkipLastLineBreak := True; RichMemo1.Lines.TrailingLineBreak := False; RichMemo1.Lines.Options := RichMemo1.Lines.Options - [soTrailingLineBreak]; I uploaded the snippet with them and attached it. Quote from: Ten_Mile_Hike on December 13, 2024, 09:34:47 pm ... Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Memo1.text:=Leftstring(Memo1.text,Length(memo1.text)-1)  {or -2 if your line is #13#10} ... The last #13#10 is not in the text, but it is displayed, this is the problem. Memo1.text:='1'#13#10'2'; still shows an empty third line. EDIT: I tried again on another PC (still not sure what is different). Memo1.text:='1'#13#10'2'; does not show an empty line in the end. Also I found this https://forum.lazarus.freepascal.org/index.php/topic,28818.15.html, because the issue also occurs in TMemo. Maybe I will use TKMemo, it does not have this issue. ---------------------------------------------------------------------- CM630 · 2025-01-13 07:32 The issue is solved, more info here: https://forum.lazarus.freepascal.org/index.php/topic,69804.msg543027.h tml Shortly, TRichMemo.Lines.Add shall not be used in this case. InsertFontText can be used instead (see https://wiki.freepascal.org/RichMemo/FAQ#Add_text_with_font, I have fixed the example).