Moving to the end of the current line. This function used some undocumented methods
Code: Select all
uses CRVFData, RVERVData;
procedure GoToEndOfLine(rve: TCustomRichViewEdit);
var DItemNo, DOffs, ItemNo, Offs: Integer;
RVData: TRVEditRVData;
begin
RVData := TRVEditRVData(rve.TopLevelEditor.RVData);
DItemNo := RVData.CaretDrawItemNo+1;
while (DItemNo<RVData.DrawItems.Count) and not RVData.DrawItems[DItemNo].FromNewLine do
inc(DItemNo);
dec(DItemNo);
DOffs := RVData.GetOffsAfterDrawItem(DItemNo);
RVData.DrawItem2Item(DItemNo, DOffs, ItemNo, Offs);
RVData.SetSelectionBounds(ItemNo, Offs, ItemNo, Offs);
end;
Moving to the end of the current paragraph
Code: Select all
procedure GoToEndOfPara(rve: TCustomRichViewEdit);
var ItemNo, Offs: Integer;
begin
rve := rve.TopLevelEditor;
ItemNo := rve.CurItemNo+1;
while (ItemNo<rve.ItemCount) and not rve.IsParaStart(ItemNo) do
inc(ItemNo);
dec(ItemNo);
Offs := rve.GetOffsAfterItem(ItemNo);
rve.SetSelectionBounds(ItemNo, Offs, ItemNo, Offs);
end;
Moving to the end of the document
Code: Select all
procedure GoToEndOfDoc(rve: TCustomRichViewEdit);
var ItemNo, Offs: Integer;
begin
ItemNo := rve.ItemCount-1;
Offs := rve.GetOffsAfterItem(ItemNo);
rve.SetSelectionBounds(ItemNo, Offs, ItemNo, Offs);
end;