Recent

Author Topic: Synedit wordwrap  (Read 3735 times)

Tommi

  • Full Member
  • ***
  • Posts: 219
Synedit wordwrap
« on: November 17, 2022, 11:50:00 pm »
Hi,
is there in synedit any wordwrap option ? I cannot see it but it seems very strange that a so big and complex library has no word wrap.

Thank you

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10786
  • Debugger - SynEdit - and more
    • wiki
Re: Synedit wordwrap
« Reply #1 on: November 18, 2022, 12:40:47 am »
Yes, there is. But it's kind of beta... in progress.

Code: Pascal  [Select][+][-]
  1. uses SynEditWrappedView;
  2. begin
  3.   TLazSynEditLineWrapPlugin.Create(ASynEdit);

Tommi

  • Full Member
  • ***
  • Posts: 219
Re: Synedit wordwrap
« Reply #2 on: November 18, 2022, 01:10:16 pm »
Ok, thank you. And how to disable it after it has been enabled?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10786
  • Debugger - SynEdit - and more
    • wiki
Re: Synedit wordwrap
« Reply #3 on: November 18, 2022, 01:43:09 pm »
That isn't implemented yet....

You may be able to do something like
Code: Pascal  [Select][+][-]
  1. FLineMapView := aSynEdit.TextViewsManager.SynTextViewByClass[TSynEditLineMappingView];
  2. aSynEdit.TextViewsManager.RemoveSynTextView(FLineMapView);
and add it back later...
Mind that is only the visualization... So the rest is still running in the background.

I have not tested this.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10786
  • Debugger - SynEdit - and more
    • wiki
Re: Synedit wordwrap
« Reply #4 on: November 18, 2022, 01:44:48 pm »
Depending on what you need you may want to checkout AtSynEdit.
It has had wrapping for much longer...

ChristianH

  • New Member
  • *
  • Posts: 47
Re: Synedit wordwrap
« Reply #5 on: December 18, 2024, 02:09:44 pm »
The thread is quite old but the issue still exists. To fix this you should add the following code to the TLazSynEditLineWrapPlugin:

Code: Pascal  [Select][+][-]
  1. destructor TLazSynEditLineWrapPlugin.Destroy;
  2. begin
  3.  TSynEdit(Editor).UnRegisterStatusChangedHandler(@DoWidthChanged);
  4.  TSynEdit(Editor).TextViewsManager.RemoveSynTextView(FLineMapView, true);
  5.  TSynEdit(Editor).Invalidate;
  6.  
  7.   inherited;
  8. end;  


I do not know if this is missing on purpose, but I guess nobody tried to enable and disable the wrapper.

Christian

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10786
  • Debugger - SynEdit - and more
    • wiki
Re: Synedit wordwrap
« Reply #6 on: January 24, 2025, 09:54:08 pm »
The thread is quite old but the issue still exists. To fix this you should add the following code to the TLazSynEditLineWrapPlugin:

Thanks, sorry for the delay. Added now. Will merge to fixes-4 asap. (the fix(es) only, not the new feature that were added around it)

Removing the view crashed, when the editor itself was already in destruction. So I added guards for that.


The reason it wasn't there is, that the view may not have been owned by the plugin.

The plugin originally was thought to be able to share that. (see the constructor, there is a search for an existing view).
This will however be removed, it wont be needed any more.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10786
  • Debugger - SynEdit - and more
    • wiki
Re: Synedit wordwrap
« Reply #7 on: January 24, 2025, 10:26:36 pm »
I merged any fixes to the fixes-4 branch. If you are using git (e.g. fpcUpDeluxe), then you can pull them and test them. (Or you can view them online and patch your SynEdit).  RC2 does NOT contain them.

 

TinyPortal © 2005-2018