[Lazarus] delphi components into lazarus
Cesar P
cesarpayro at hotmail.com
Fri Oct 10 20:40:41 CEST 2008
Hi John,
can you run SynEdit with console output, or output to a logfile? And put
some debugging in (and rebuild it)?
If yes, try this
1) in components/synedit/SynEditMarkup.pp line 244 currently:
procedure TSynEditMarkup.InvalidateSynLines(FirstLine, LastLine : integer);
begin
if assigned(fInvalidateLinesMethod)
then fInvalidateLinesMethod(FirstLine, LastLine);
end;
make it:
procedure TSynEditMarkup.InvalidateSynLines(FirstLine, LastLine : integer);
begin
debugln(['Markup InvalidateLin first=', FirstLine,' Last=', LastLine]);
if assigned(fInvalidateLinesMethod)
then fInvalidateLinesMethod(FirstLine, LastLine);
end;
and add "LCLProc" to the uses clause.
2) In components/synedit/SynEditMarkupBracket.pp after line 69 in
procedure TSynEditMarkupBracket.FindMatchingBracketPair(PhysCaret : TPoint;
find the "begin" and add at the start of the procedure: (LCLProc should
be in uses already)
debugln('Brackets Invalidate');
3) in components/synedit/SynEdit.pp line 2851 (inside procedure Paint)
uncomment the line:
DebugLn('TCustomSynEdit.Paint LinesInWindow=',dbgs(LinesInWindow),'
nL1=',dbgs(nL1),' nL2=',dbgs(nL2));
Rebuild Lazarus.
Now if you approach or leave a bracket (it will be recognized to the
right and to the left of the caret)
you should get some debug lines like
BracketsInvalidate
Markup InValidate start = xx last= yy
Markup InValidate start = xx last= yy
TCustomSynEdit.Paint LinesInWindow=25 nL1=xx nl2=yy
Possible some of them are repeated more/less often. Do they match the
line number(s) where your brackets are? Can you get the result for 2
brackets on the same line, and 2 brackets on different lines?
Also ensure you do not use code folding => there are a few cases where
code folding may affect the calculation of the correct line number.
Thanks
Martin
John Stoneham wrote:
> Ok, a quick experiment leads me to believe it is indeed a redrawing
> issue. As you suggested, I tried moving another window over the editor
> window. When this happens, the highlighting appears as it should (when
> the cursor is touching a bracket, the other bracket is highlighted;
> when the cursor is away from the bracket, neither are highlighted). As
> soon as the editor window receives focus again, the redrawing doesn't
> work anymore to highlight or de-highlight the brackets.
>
> BTW, the same thing happens if I pageup/pagedown with the cursor next
> to the bracket. When I pageup/pagedown to bring that section back onto
> the screen, the highlighting has repainted correctly. It also repaints
> correctly if I CTRL+UP or CTRL+DOWN to scroll the editor window by one
> line while the cursor remains on the line.
>
> So, it definitely seems like a repaint or redrawing issue.
>
> On Fri, Oct 10, 2008 at 9:00 AM, Martin Friebe <lazarus at mfriebe.de
> <mailto:lazarus at mfriebe.de>> wrote:
>
> Well, I don't have a mac, so I can't test this, but I was involved
> into
> some refactor around the bracket-highlights (a few month back).
>
> one of the major changes was
> http://bugs.freepascal.org/view.php?id=11693 revision 15861
> Did it work before that? Did/does it work in 0.9.24?
>
> A few of the other work items were
> http://bugs.freepascal.org/view.php?id=11732 revision 15845
> http://bugs.freepascal.org/view.php?id=11754 revision 15883 (highlight
> bracket on either side of caret)
>
> Anyway, a few things that may help to nail it down (even so I will not
> be able to do too much, since I have no mac...)
>
> 1) Do determine if it is an issue, with synedit thinking it needs to
> highlight a bracket, or is it an issue with Synedit not redrawing?
>
> Do find out: When the highlight goes wrong:
> a) Bracket is highlighted, but the cursor moved away
> b) Bracket is not highlighted, but the cursor is on the bracket
>
> resize the window, or overlap it with another window => anything that
> should force a redraw => does synedit correct the highlighting?
>
> 2) Fontsize issues (there is a good chance to find it here)
>
> - Try highlighter = "none" or "text" does that look any better?
> - does it make a diff,if the caret is on the opening or closing
> bracket
> (the bracket occurring first on the line, or last?)
> - does it make a diff if the 2 brackets are on the same line, or on 2
> different lines (especially with highlighter none/text ?
>
> Synedit with highlighter, paints the line as a selection of small
> "tokens". It calculates the width of each of them. If the actual
> textdrawer gets a different width => all sort of strange things
> can happen.
> That could explain an operating system dependent issue.
>
>
> Martin
>
>
>
> John Stoneham wrote:
> >
> >
> > On Fri, Oct 10, 2008 at 4:17 AM, Mattias Gärtner
> > <nc-gaertnma at netcologne.de <mailto:nc-gaertnma at netcologne.de>
> <mailto:nc-gaertnma at netcologne.de
> <mailto:nc-gaertnma at netcologne.de>>> wrote:
> >
> > Zitat von John Stoneham <captnjameskirk at gmail.com
> <mailto:captnjameskirk at gmail.com>
> > <mailto:captnjameskirk at gmail.com
> <mailto:captnjameskirk at gmail.com>>>:
> >
> > > I've been using the latest svn (Carbon) for a while now,
> > updating once a day
> > > or so, and matching brackets never seem to highlight properly.
> > This issue
> > > appears on 10.4.11 and 10.5.3 (different builds for Tiger and
> > Leopard).
> > > Usually, they don't highlight at all. When they do highlight,
> > one or both
> > > often get "stuck" with the highlighting on after the cursor
> > moves away.
> >
> > Some weeks ago I saw the same problem. It was the wrong font.
> > Since then it works almost nice, only sometimes the highlighting
> > is not updated.
> >
> >
> > Well, this would be a major improvement over what I see all the
> time.
> > Thing is, I've tried all the fixed width fonts (Andale Mono,
> Courier,
> > Courier New, Monaco), and changing font doesn't have any effect. It
> > still doesn't work properly, ever. Which font are you using that's
> > causing the bracket highlighting to almost work? Actually, it'd be
> > better if you posted all your settings: the color scheme you use,
> > font, font size, whether anti-aliasing is enabled, and your settings
> > for matching brackets (e.g. bold, inverted, etc). Maybe they're some
> > "magic combination" and you've stumbled onto it.
> >
> > Perhaps you could attach your editoroptions.xml file?
> >
> >
> >
> > > Is anyone else noticing this issue? If so, I'll submit a
> bug report.
> >
> > If you have some clues how to reproduce it reliable , yes
> please.
> >
> >
> > It reproduces reliably for me, in that bracket highlighting never
> > works the way it's supposed to. However, it seems to be working
> > somewhat for you. If I can reproduce your settings and see the same
> > behaviour, then I'm sure you could reproduce mine and see what I'm
> > seeing. Then I'd say it's reproducable and I'll file a bug report.
> >
> > --
> > _| ( ) |-| |\|
> >
> ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Lazarus mailing list
> > Lazarus at lazarus.freepascal.org
> <mailto:Lazarus at lazarus.freepascal.org>
> > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
> >
> _______________________________________________
> Lazarus mailing list
> Lazarus at lazarus.freepascal.org <mailto:Lazarus at lazarus.freepascal.org>
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>
>
>
> --
> _| ( ) |-| |\|
> ------------------------------------------------------------------------
>
> _______________________________________________
> Lazarus mailing list
> Lazarus at lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>
More information about the Lazarus
mailing list