Recent

Author Topic: TSynEdit wordwrap  (Read 3238 times)

polpero

  • Full Member
  • ***
  • Posts: 116
TSynEdit wordwrap
« on: March 19, 2017, 04:53:12 pm »
Hi

i've installed David's WordWrapping files from the bugTracker,
recompiled and installed synEdit  successfully...

now loading from file with eowordwrap in options2 checked
   i get a range checking error message
or
  if loaded from stream i get a white display (no text, no gutter numbers...)

***
when  checked (via a menu) at runtime
nothing happens (text doesn't move)


am i forgetting something?
any hint of where/what to look for, would be appreciated...

thanks





polpero

  • Full Member
  • ***
  • Posts: 116
Re: TSynEdit wordwrap
« Reply #1 on: March 20, 2017, 01:31:54 am »
After doing more tests i must admit the
the error seemed to be on my part (mostly)
i had a bad assignment on eoWordWrap
and had not considered the length of the file a was testing...

Everything works as expected except
  • loading a file with wordWrap on sometimes raises rangeCheck error
  • it seems that the process of wordwrapping would be faster
    inside a beginUpdate endUpdate block
    but the code seems to be allergic to it (rangecheck error)
  • Large files are particuliarly long to process...

Thought i'd update the information
not to give any false impressions...

///

Would anyone have an idea about how to
wordwrap to right margin instead of window width?

thanks again
« Last Edit: March 21, 2017, 01:01:16 pm by polpero »

polpero

  • Full Member
  • ***
  • Posts: 116
Re: TSynEdit wordwrap
« Reply #2 on: March 21, 2017, 03:25:34 am »
////////////////////////////////////////
//   WRAP TO RIGHT EDGE

If anyone is interested, wrapping to right edge requires very few modifications to David's patch.
( Find the patch in the BugTracker 30395 http://bugs.freepascal.org/view.php?id=30395 )

In order to wrap to Right edge 2 modifications are needed, both in synedit file:
  • adding a new option: eoREdgeWrap
  • adding a choice between both modes of display

First, eoREdgeWrap must be appended to Options2:

Code: Pascal  [Select][+][-]
  1. File: synedit
  2.  
  3.   TSynEditorOption2 = (
  4.   [..]
  5.     eoWordWrap,                // Truncates long lines into lines that fits onscreen
  6.     eoREdgeWrap                // If previous is true, wraps to Right Edge value
  7.   );
  8.  

The second modification is in TCustomSynEdit.RecalcCharsAndLinesInWin :
Code: Pascal  [Select][+][-]
  1. procedure TCustomSynEdit.RecalcCharsAndLinesInWin(CheckCaret: Boolean);
  2. [..]
  3.   FWrappedLinesView.CharsInWindow:= CharsInWindow;
  4. [..]
  5.  
  6. //This line becomes
  7.  
  8.  
  9.   if eoREdgeWrap in options2 then
  10.      FWrappedLinesView.CharsInWindow:= RightEdge
  11.         else FWrappedLinesView.CharsInWindow:= CharsInWindow;
  12.  
  13.  
 

Done!...

Now checking, from your application, both WrapWords and WrapToRightEdge
you get the REdgeWrap otherwise WrapWords alone Wraps to window width.

If anyone find this useful...


RuedigerD

  • Newbie
  • Posts: 1
Re: TSynEdit wordwrap
« Reply #3 on: February 23, 2020, 12:44:28 pm »
Hi out there!

I'm using lazaraus 2.06 on win10 64bit. Tried to use Davids patch to get wordwrapping back into synedit. Things start to compile fine but something seems to be broken. I get some errors from from syngutterlineoverview.pp: identifier not found emcoverviewgutterscrollto...and some more (see attachment).

Can anybody help me out?

Thanks in advance

Rüdiger

polpero

  • Full Member
  • ***
  • Posts: 116
Re: TSynEdit wordwrap
« Reply #4 on: March 03, 2020, 01:46:32 pm »
Well, i really thought it would be good but experimenting on larger files wasn't so good. So i dropped it all....

Have you tried ATSynEdit?


 

TinyPortal © 2005-2018