trichview.com

trichview.support




Re: Erase an entire line


Return to index


Author

Message

Sergey Tkachenko

Posted: 04/29/2004 20:50:18


Well, deleting without adding empty line is slightly more tricky.

You need to make some adjustments in selection:


uses CRVFData, RVMarker;


procedure DeleteLine(rve: TCustomRichViewEdit);

var ItemNo1, Offs1, ItemNo2, Offs2: Integer;

begin

  rve := rve.TopLevelEditor;

  rve.SelectCurrentLine;

  rve.RVData.GetSelectionBoundsEx(ItemNo1, Offs1, ItemNo2, Offs2, False);

  if (ItemNo1>0) and (Offs1<=rve.GetOffsBeforeItem(ItemNo1)) and

    not rve.IsFromNewLine(ItemNo1) and

(rve.GetItemStyle(ItemNo1-1)=rvsListMarker) then begin

    dec(ItemNo1);

    Offs1 := rve.GetOffsBeforeItem(ItemNo1);

  end;

  if (ItemNo1>0) and (Offs1<=rve.GetOffsBeforeItem(ItemNo1)) and

     rve.IsFromNewLine(ItemNo1) then begin

    dec(ItemNo1);

    Offs1 := rve.GetOffsAfterItem(ItemNo1);

    end

  else if (ItemNo2<rve.ItemCount-1) and

(Offs2>=rve.GetOffsAfterItem(ItemNo2)) and

     rve.IsFromNewLine(ItemNo2+1) then begin

    inc(ItemNo2);

    Offs2 := rve.GetOffsBeforeItem(ItemNo2);

  end;

  rve.SetSelectionBounds(ItemNo1, Offs1, ItemNo2, Offs2);

  rve.DeleteSelection;

end;



> the line was extinguished but the lines that are below do not go up to

occupy

> the space of the extinguished line





Powered by ABC Amber Outlook Express Converter