Author Topic: Choose comment text  (Read 8434 times)

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2183
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Choose comment text
« Reply #15 on: March 20, 2009, 02:41:44 pm »
Hi Stefan,

everything is correct.
glad that it works ;)

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2183
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Choose comment text
« Reply #16 on: November 05, 2009, 12:27:05 am »
Checking once more %SelectedLine% (doing email support :) ) found one "problem" with this tag....

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

I thought, such template:
Code: [Select]
/**************************************
* %SelectedLine%
**************************************/

on code like this:
Code: [Select]
First line of text
Second line of text

would produce it. But I got this:
Code: [Select]
/**************************************
* 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.

Offline Stefan

  • Administrator
  • Hero Member
  • *****
  • Posts: 775
  • Karma: +6/-0
    • View Profile
Re: Choose comment text
« Reply #17 on: November 05, 2009, 09:33:00 am »
Hi Alex.

i think, this:
Code: [Select]
/**************************************
* 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?
« Last Edit: November 05, 2009, 09:51:36 am by Stefan »

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2183
  • Karma: +37/-3
    • View Profile
    • HippoEDIT
Re: Choose comment text
« Reply #18 on: November 05, 2009, 12:35:09 pm »
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 :)