[Lazarus] [Fwd: A few hacky patches (resent)]

Martin Friebe lazarus at mfriebe.de
Fri May 22 01:56:36 CEST 2009


>>
>> laz-synpatch-005.patch
>> This is a gross hack, but it allows clicking *anywhere* on the grey 
>> fold line in the gutter to fold
>> that particular level of routine. I have some procedures that are 
>> very long and it's nice to be able
>> to click on that line from the bottom of the procedure and have it 
>> fold up on me.
Makes me wonder, how it integrates, with the ability to configure which 
mouse button triggers which action

Also the code to do it already exist (Synedit line 6236) for the 
keyboard shortcut:
>       EcFoldCurrent:
>         begin
>           CY := FFoldedLinesView.ExpandedLineForBlockAtLine(CaretY);
>           if CY > 0 then begin
>             FFoldedLinesView.FoldAtTextIndex(CY-1);
>             SetCaretXY(Point(1, CY));
>           end;
>         end;

Lastly, this can be done already via the context menu too (contextmenu 
over the foldline)

=> The idea for such a shortcut is good, need to think about if this is 
done in a good way currently....

-----
>>
>> laz-synpatch-007.patch
>> This is another gross hack, but in a highlighter I've written I use 
>> this to enable me to ensure the
>> remainder of a line is painted in the right background colour. 
>> Synedit calls this "GetLineRemainder"
>> routine (if assigned in the highlighter) to get the colour the 
>> remainder of the line is to be
>> painted after it has finished painting all its tokens. Without this I 
>> was getting odd line
>> remainders when I scrolled often. With this I get perfection every time.
         with fTextDrawer do
           if MarkupInfo = nil

what if markup onfo is assigned, but doesnt change the bg color? (leaves 
it to default )

>>
>> laz-synpatch-008.patch
>> And the final gross hack. I store the folded status of each open file 
>> in my overall project file.
>> The easy way for me to do this is in a sequential comma delimited 
>> list of line numbers that are
>> folded. This routine "DumpFolds" gives me a string which is a comma 
>> delimited list of all the lines
>> that are folded. Then when I reload the project I can simply fold 
>> those lines in reverse order to
>> get precisely the folds I had previously.
Hm, I ll think about it. I had the idea of somekind of checksum, to 
allow detection  of changed text....

Also, just line-number does not work: There can be 2 or more folds 
starting the same line, and vie the context menu you can fold any of them.
>>
>> On another note, recent work by Martin Friebe and Paul Ishenin has 
>> rendered three other gross hacks
>> I've had in my tree irrelevant :)
>>
>> Regards,
>> Brad
>




More information about the Lazarus mailing list