Board index » delphi » OT (?): GExperts: %BEFORE% macro?
Ralf Kaiser
![]() Delphi Developer |
Ralf Kaiser
![]() Delphi Developer |
OT (?): GExperts: %BEFORE% macro?2003-09-05 02:23:23 PM delphi93 Hello, this might be a little bit off topic: what does the "%BEFORE%" macro in the "Expand macro" expert do?? TIA, Ralf |
Erik Berry
![]() Delphi Developer |
2003-09-06 12:44:09 AM
Re:OT (?): GExperts: %BEFORE% macro?
Ralf Kaiser writes:
Quotethis might be a little bit off topic: after it. I assume you are compiling from the GExperts source code, so see GX_MacroParser.pas for details. Erik |
Ralf Kaiser
![]() Delphi Developer |
2003-09-07 08:15:37 PM
Re:OT (?): GExperts: %BEFORE% macro?
Erik Berry <XXXX@XXXXX.COM>writes:
QuoteRalf Kaiser writes: Another thing that has to with this expert: I have a macro that looks like this: try %SELECTION% finally | end; When i execute this macro and the selection was only in the current line (not multiple lines) then i get the expected result. If i mark two or more lines the i get the following result (let's say the complete line with the text "MARKED TEST" was marked in the editor) MARKED TEXT try MARKED TEXT finally (CURSOR IS HERE) end; Can "%SELECTION%" not be used with more then one line?? Thanks in advance, Ralf -- mailto:XXXX@XXXXX.COM www.emperortools.de |
Erik Berry
![]() Delphi Developer |
2003-09-08 06:49:09 PM
Re:OT (?): GExperts: %BEFORE% macro?
Ralf Kaiser writes:
QuoteWhen i execute this macro and the selection was only in the current line the macro, but it currently does not do this. Have a try with the current GExperts CVS code. Test with the following code where the selection is the two assignment lines including the newline after "20;": procedure TForm1.FormCreate(Sender: TObject); begin i := 10; j := 20; end; The output is this: procedure TForm1.FormCreate(Sender: TObject); begin i := 10; j := 20; try i := 10; j := 20; finally | end; end; In a very literal sense this is the correct output, though I doubt it is what you would prefer in your case, since the assignments are duplicated. If you instead use %CLIPBOARD%, cut the selection, and space over twice on the empty line before executing, you get this which is much closer to what you want: procedure TForm1.FormCreate(Sender: TObject); begin try i := 10; j := 20; finally | end; end; The only remaining issue would be the spacing. In a very literal sense, the spacing is "correct", but obviously it is not how you would want things in your case. The spacing could be fixed though by removing two spaces from the macro itself. QuoteCan "%SELECTION%" not be used with more then one line?? how users use this tool, and I don't think I have a good idea of that yet. You have provided one data point. If you can make a convincing case that your situation would be the general case that most users would expect, it might be something we can change. The same goes for the spacing issue. If someone can come up with a well-defined rule that seems to make all/most of the common cases work as expected, that could be changed as well. A problem is almost inherent in the usage of %SELECTION% - namely that the end of the selection must simultaneously indicate two things (in the default keybinding at least): the extent of the replace string for %SELECTION% and the insertion point for the generated macro text. Often the desired behavior is to not have these two items be the same row/column, so another macro (like CLIPBOARD) would work better, since it decouples the text insert and selection end positions. Erik |
Ralf Kaiser
![]() Delphi Developer |
2003-09-09 02:56:47 PM
Re:OT (?): GExperts: %BEFORE% macro?
"Erik Berry" <XXXX@XXXXX.COM>schrieb im Newsbeitrag
QuoteThis expert is fairly literal with respect to the output it produces. I QuoteHave a try with the current QuoteIn a very literal sense this is the correct output, though I doubt it is QuoteThe only remaining issue would be the spacing. In a very literal sense, Quote>Can "%SELECTION%" not be used with more then one line?? to use. Thanks for your hints. Bye, Ralf |