Choose comment text

Started by JJK, December 04, 2008, 11:08:59 AM

Previous topic - Next topic

alex

Hi Stefan,

everything is correct.
glad that it works ;)
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

alex

Checking once more %SelectedLine% (doing email support :) ) found one "problem" with this tag....

The request was to have comments like this:
/**************************************
* First line of text
* Second line of text
**************************************/


I thought, such template:
/**************************************
* %SelectedLine%
**************************************/


on code like this:
First line of text
Second line of text


would produce it. But I got this:
/**************************************
* First line of text
**************************************/
/**************************************
* Second line of text
**************************************/


and this is not what is expected... Or maybe not?
Should logic be changed to duplicate only line with %SeletedLine% text? Or  should it work like now?
What do you think?

Best regards,
Alex.
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]

Stefan

#17
Hi Alex.

i think, this:
/**************************************
* First line of text
**************************************/
/**************************************
* Second line of text
**************************************/


no one expects and wants.
Even more worse if you do this on six lines, f.ex.



I mean, first, %SelectedLine% handles every single selected line on each own, that's why we have that result.

So %SelectedText% would be better capable to do this:

/*******************************
* %SelectedText%
*******************************/

But that works also not complete how it is requested here.



What does the work is an combination:
1.) select the lines and execute this CT  
* %SelectedLine%

2.) reselect all lines and execute this CT  
/*******************************
%SelectedText%
*******************************/



So my first thought was: how about
A) an option like "[ ] Lock Selection after CT executing" as option of the CT setup
B) an option to concatenate several CTs, like every CT has an ID which i can call,
or could we have two or more CTs in one single CT and have an option to execute one after the other?

%%CT:01%%
* %SelectedLine%
%%CT:KeepSelection%%

%%CT:02%%
/*******************************
%SelectedText%
*******************************/



Just BrainStorming  ;D --- maybe i get an idea how you could improve %SelectedLine% .... perhaps like
%%CT:OnlyOnce%%/*******************************
* %SelectedLine%
%%CT:OnlyOnce%%*******************************/


EDIT:
AHH
A> Should logic be changed to duplicate only line with %SeletedLine% text?
I think this goes in the same direction as i have explain above.
While this could work for this very request, it may be contra productive for other uses.
So how about just make an copy of %SelectedLine%  as f.ex. %SelectedLineONLY% so we have both?
Don't know. Should take the days till weekend to think about?
Stefan, HippoEDIT beta tester 
HippoEDIT - the editor programmers wants to code thyself when they are dreaming.        -Don't just edit. HippoEDIT!-

alex

Hi Stefan,

the easiest way I see is to enhance logic for templates with %SelectedLine% to work like this:

template source contains only one line
%Tag%%SelectedLine%%Tag%

on:

111111
222222
333333

will produce:
Tag111111Tag
Tag222222Tag
Tag333333Tag

and template like this (template source contains more then one line, and leading/trailing lines are without tags):

/*************************
%Tag%%SelectedLine%%Tag%
*************************/


produce:
/*************************
Tag111111Tag
Tag222222Tag
Tag333333Tag
*************************/

so I need to do some extra logic on parsing...

But I like your idea about template in template - it is more complex, but probably more flexible and transparent....

The rest of suggestions for me looks complex :) because by design code templates is scripting for poor :) and I would like to keep it simple. Complex stuff should be done with scripting.

From another point, right now I do not want to change code templates too much, because I have planned re-design to be more compatible with TextMate syntax... and also short tags etc.

And there was no real request about this, so maybe I would think more :)
HippoEDIT team
[url="http://www.hippoedit.com/"]http://www.hippoedit.com/[/url]