trichview.com

trichview.support




Re: How to join selected text (2 or more paragraphs) in one paragraph and don't lost hyperlink text in them..?


Return to index


Author

Message

Sergey Tkachenko

Posted: 02/17/2005 21:38:50


procedure RemoveLineBreaks(rve: TCustomRichViewEdit);

var i: Integer;

    StartNo, StartOffs, EndNo, EndOffs: Integer;

    Changed: Boolean;


begin

  rve := rve.TopLevelEditor;

  if not rve.SelectionExists then

    exit;

  rve.GetSelectionBounds(StartNo, StartOffs, EndNo, EndOffs, True);

  Changed := False;

  SendMessage(rve.Handle, WM_SETREDRAW, 0, 0);

  for i := EndNo downto StartNo+1 do begin

    if rve.ItemCount<=i then

      continue;

    if rve.IsFromNewLine(i) and (rve.GetItemStyle(i)<>rvsBreak) and

       (rve.GetItemStyle(i)<>rvsTable) then begin

      rve.BeginUndoGroup(rvutMiscTyping);

      rve.SetUndoGroupMode(True);

      Changed := True;

      rve.SetSelectionBounds(i, rve.GetOffsBeforeItem(i), i,

rve.GetOffsBeforeItem(i));

      SendMessage(rve.Handle, WM_KEYDOWN, VK_BACK, 0);

      end

    else if (i>0) and (rve.GetItemStyle(i-1)=rvsListMarker) then begin

      rve.BeginUndoGroup(rvutMiscTyping);

      rve.SetUndoGroupMode(True);

      Changed := True;

      rve.SetSelectionBounds(i, rve.GetOffsBeforeItem(i), i,

rve.GetOffsBeforeItem(i));

      SendMessage(rve.Handle, WM_KEYDOWN, VK_BACK, 0);

      SendMessage(rve.Handle, WM_KEYDOWN, VK_BACK, 0);

    end;

  end;

  if Changed then

    rve.SetUndoGroupMode(False);

  SendMessage(rve.Handle, WM_SETREDRAW, 1, 0);

  rve.Invalidate;

end;


>

> How to join selected text (2 or more paragraphs) in one paragraph and

don't

> lost hyperlink text in them..?





Powered by ABC Amber Outlook Express Converter