Check if the line is empty
Posted: Mon Jan 11, 2021 3:42 pm
how can I check if there are characters on a specific line? or check if a specific line is empty?
Support forums for TRichView, ScaleRichView, Report Workshop and RVMedia components
https://text-ally.com/forums/
Code: Select all
var
rve: TCustomRichViewEdit;
ItemNo: Integer;
rve := RichViewEdit1.TopLevelEditor;
ItemNo := rve.CurItemNo;
IsCurrentLineEmpty :=
// this is an empty text item
(rve.GetItemStyle(ItemNo) >= 0) and (rve.GetItemText(ItemNo) = '') and
// and it starts a paragraph section
rve.IsFromNewLine(ItemNo) and
// and it is at the end of document, or the next item starts a new paragraph section
((ItemNo + 1 = rve.ItemCount) or (rve.IsFromNewLine(ItemNo + 1));
Code: Select all
var
rve: TCustomRichViewEdit;
ItemNo: Integer;
rve := RichViewEdit1.TopLevelEditor;
ItemNo := rve.CurItemNo;
IsCurrentLineEmpty :=
// this is an empty text item
(rve.GetItemStyle(ItemNo) >= 0) and (rve.GetItemText(ItemNo) = '') and
// and it starts a paragraph section, or follows after a list marker
(rve.IsFromNewLine(ItemNo) or ((ItemNo - 1 >= 0) and (rve.GetItemStyle(ItemNo - 1) = rvsListMarker))) and
// and it is at the end of document, or the next item starts a new paragraph section
((ItemNo + 1 = rve.ItemCount) or (rve.IsFromNewLine(ItemNo + 1));