Major Incredible Feature Omission !!!

Ideas for new features

Moderators: AmigoJack, helios, bbadmin, Bob Hansen, MudGuard

RoySubs
Posts: 10
Joined: Fri Apr 02, 2004 4:51 pm

Major Incredible Feature Omission !!!

Post by RoySubs »

Hi,

I'm incredulous that this is not in TextPad. I wanted to recommend TextPad for use in the corporate where I work as some were using other editors, but I felt that TextPad is better. However, other editors offer block commenting / uncommenting. i.e you select a block of VBScript code and then hit CTRL+Q or whatever and that puts the ' char at the start of the line. Hitting CTRL+Q again toggles the comments off. Without a feature like this, TextPad is almost completely useless as a VBScript editor (imagine the pain of manually commenting or uncommenting 50 lines of code !). This is really a standard feature of a modern text/script editor. Before someone says, go and do a macro, I've tried loads, they are *all* rubbish. They act in a random way, sometimes putting 2 comments on a line instead of one etc.

Now, TextPad allows me to select 50 lines of code and then press TAB to block tab the 50 lines, but if I press ' then the 50 lines are deleted in place of the '. very very very very annoying. Suggestion : copy the code for the block tab commenting which works perfectly and is very useful for programming, and allow that for block commenting as a toggle switch such as CTRL+Q or something (allow users to define the comment character in the document class and then it's " // " for .js, " ' " for .vbs, etc.) without the rubbish random macros (macros are great, but for this, they don't work well, and for such an important feature that on that alone you just lost hundreds, possibly thousands of sales for the huge investment bank that I work for, I cannot understand this).

By the way, I love TextPad, but the ommision of this basic feature has been making my jaw drop all week ...

Cheers,

Roy.
User avatar
Bob Hansen
Posts: 1517
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

Block Commenting is simple to do:

1. Make a Clipboard Library item to put your block commenting codes around selected text, do not replace selection.

2. Select comments on document, double click on Clib Library item for "Block Comments" and it's done.
Hope this was helpful.............good luck,
Bob
RoySubs
Posts: 10
Joined: Fri Apr 02, 2004 4:51 pm

Post by RoySubs »

Cheers for this Bob, I'm interested in doing this, but not getting it working yet. I can't really see the areas that you mean.

i.e. in a clip library I have :

!TITLE=VB Script Functions
!SORT=Y

!TEXT=Cbool ( )
Cbool(\^)
!
!TEXT=CByte ( )
CByte(\^)
!

for example, so what are the commands for the option you are saying ? Sorry, not really following what I need to do here. Doesn't seem that easy. In another editor that I use (which is imo not as good as TextPad for a lot of stuff), I simply give .vbs extensions a comment char, in this case the ' char, and then I just do CTRL+Q to comment a block and also CTRL+Q to uncomment. This is super-basic functionality, and works like a charm and makes scripting very fast and efficient also. Using the clip library sounds less than easy, and also does not allow for uncommenting unless I'm missing something right ? This is such an important feature for scripting really, without simple fast comment/uncomment (i.e. by way of a shortcut key to get it fast), it's quite laborious. Also, with clip libraries, I use them, so I'd have to switch between clip libararies to just comment a piece of code from what you are saying. I'm probably missing something here as I'm still fairly stunned that such a good editor doesn't have a simple way to do this (and it already *does* do it for TAB's, where I can block TAB and unTAB easily in a block).

All the best,

Roy.
User avatar
CyberSlug
Posts: 120
Joined: Sat Oct 04, 2003 3:41 am

Post by CyberSlug »

See this thread for alternative methods.

Follow the "Updated Versions" link in one of my posts. One of these days I'll get around to finalizing and submitting these tools to the TextPad add-ons....
User avatar
Bob Hansen
Posts: 1517
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

To add "Block Comments" to Clip Library:

1. Right click in the library to be used.
2. Select "Paste New Entry"
3. In the Clip Library Entry window make the following entries:
A. Name of Clipping: Block Comments
B. Remove checkmark from "Replace selection" box.
C. In "Text before cursor....." enter the character(s) for start of blocking. For example enter "/*"
D. In "Text after cursor....." enter the character(s) for end of blocking. For example enter "*/"
E. Click on OK to add to the Clip Library.
4. Right click on Clip Library again, select Close to make an immediate save to the Clip Library. Answer Yes to save the changes.

Now you can reopen the Clip Library and it will be there permanently.

To use the Clip, just highlight the text you want to block for comments. Double click on the "Block Comments" and the start and end block comment characters will be inserted around the selected text.

As an example, if I wanted to make the last paragraph a block of comments, it would end up looking like this:
/*To use the Clip, just highlight the text you want to block for comments. Double click on the "Block Comments" and the start and end block comment characters will be inserted around the selected text.*/
You can modify these guidelines to insert blank lines and other characters, example you could end up with something like this:
/* ==========
To use the Clip, just highlight the text you want to block for comments. Double click on the "Block Comments" and the start and end block comment characters will be inserted around the selected text.
==========*/
In this example I have used "/*" and "*/" for the start/end block characters, but you can use anything you want for your specific language syntax. Have multiple clips, one for each language.

And once added to the Clip Library, you can copy it to other libraries as needed.
Hope this was helpful.............good luck,
Bob
RoySubs
Posts: 10
Joined: Fri Apr 02, 2004 4:51 pm

Post by RoySubs »

That's great Bob, thanks for that and I'll definitely use that when I'm doing JavaScript, but from what I understand of what you have helpfully explained is that this is completely useless for such code as VBScript ? i.e. VBScript requires a ' character at the start of the line, and there is no comment option in a C - like way. Have you found a way to do this on the basis of selecting a bunch of lines and then a way to just toggle comment/uncomment on all the selected lines ?

As I saw someone comment in another thread, this is still a "major oversight", I agree with that comment completely. TextPad is a technical users text editor. Sure it is great for everyone, but in particular, the features like clip libraries etc and colour highlighting are primarily for people who are scripting ... so it's just incredible (to me) that this can be overlooked ... even the clip library, much as appreciate this great info Bob, but it's still a cludge really, in that you can't simply setup the comment highlighting options and then use CTRL+Q and then also use CTRL+Q to uncomment such as in another simpler editor that I use (and am forced to use a lot when I'm doing a lot of re-editing large vbscripts for work as TextPad is simply unsuited to this task when this should be right up there on the list (surely in the top 10 of important fundamental features for a scripting editor I would imagine !)

Cheers,

Roy.
User avatar
Bob Hansen
Posts: 1517
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

I agree with the need, but have no issue with trying to come up with a workaround in the meantime.

Not a lot of time now, but quickly, use a regular expression to insert/remove the ' at the beginning of each line. Make macros for the Search/Replace functions, assign CTL-Q (or any other key combo) and you are set. Will have to use two key combos to toggle, vs. the one key you want, but TextPad will allow you to make them.

Here are the RegEx portions using POSIX.

RegEx to Create Block Comments:
RegEx Search for: (.*)
RegEx Replace with: '\1

RegEx to Remove Block Comments:
RegEx Search for: ^'(.*)
RegEx Replace with: \1

Replace settings:
Conditions: Regular expression is checked.
Scope: Selected text is checked.

Action: Replace all
Hope this was helpful.............good luck,
Bob
zridling
Posts: 55
Joined: Tue Apr 08, 2003 5:33 am
Location: Chicago, US
Contact:

Post by zridling »

Just an added thanks for this Bob, this helped me, too!
ben_josephs
Posts: 2456
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Bob Hansen wrote:RegEx to Create Block Comments:
RegEx Search for: (.*)
RegEx Replace with: '\1

RegEx to Remove Block Comments:
RegEx Search for: ^'(.*)
RegEx Replace with: \1
Simpler:

Code: Select all

RegEx to Create Block Comments:
RegEx Search for:  ^
RegEx Replace with:  '

RegEx to Remove Block Comments:
RegEx Search for:  ^'
RegEx Replace with:  
The first one means "find no characters at the beginning of a line and replace them with a single quote".
The second one means "find a single quote at the beginning of a line and replace it with nothing".
RoySubs
Posts: 10
Joined: Fri Apr 02, 2004 4:51 pm

Post by RoySubs »

Thanks so much for this Ben / Bob ... it's beginning to look like it might be possible to get everything workable for TextPad. *But*, this does all lead to me to what seem to be some ultra-obvious questions :

- TextPad has been around for a while, and I would wager that most users are technical (non-technical users are happy enough with Notepad / Wordpad / Word, they don't really understand the uses of an advanced text editor), so on the basis that it's mostly technical, *HOW* could basic functionality like this ever been overlooked !? TAB/unTAB is there, and virtually the same code would do the comment/uncomment (at least for vbscript and similar languages). It's clear that the TextPad designers could implement this pretty damn quickly if they wanted to.
- Saying that, ok, I totally understand that the designers don't want to *bloat* TextPad, I like that fact, but when I really think about it, there are hundreds of advanced features that a text/script editor *could* have, but what's really important !? When I compare TextPad to SciTE, I see 3 features that TextPad could benefit from that SciTE has :

1. Block commenting properly implemented as a toggle switch (as someone that does a lot of scripting, block commenting is just a little less important than cut and paste and so should have the same level of simplicity in the GUI it seems obvious).
2. brace-matching (when you have the cursor beside a ( or a ), it highlights the matching brace).
3. function / subroutine folding, so that you can fold up a function or for-next or if-else-end if statement in much the same way that you can open and close folders in Explorer. this is very nice for overviewing code ...

Of these 3 ... I would have to say that the usefullness of 2. and 3. fall way way way behind 1. it is just *fundamental* to programming. Sure it's not essential, but it just *saves SO much time* !!! And TextPad is a much better text editor environment. Sure it's just my opinion, but it's about productivity, and I'd rather have high-productivity products like TextPad than flashy gimmicky products (a la Office Wizards that do nothing, look stupid and are anti-productive). TextPad is way up there in the high-productivity department, but there is just this big black spot as a scripting editor, sort of like someone has spent half a million on landscaping a garden but then forgotten to deal with the open sewer that's right in the middle of the garden ! :D it smells bad, and I hate having to go to other editors for such important functionality ! :(

PLEASE GET BUILT-IN FUNDAMENTAL BLOCK-COMMENT/UNCOMMENTING IN THE NEXT VERSION ! :D I PROMISE TO SEND YOU MY SEVERED LEFT FOOT AS A PRESENT IF YOU DO !

(just today, I was revising VBS code in TextPad and it was a nightmare having to do a kind of ' characte / down-arrow juggle on hundreds of lines and a up-arrow / backspace juggle to uncomment sections ... it felt so prehistoric !)

I'm looking forward to implementing these workarounds though. Thanks for the feedback ! :)
User avatar
s_reynisson
Posts: 940
Joined: Tue May 06, 2003 1:59 pm

Post by s_reynisson »

Just to point out:
Poll http://textpad.com/forum/viewtopic.php?t=3997
Original http://www.textpad.com/forum/viewtopic.php?t=3985
I guess since TP is a text editor, finding some function that operates on text in a similar way as a block comment does on a code, would get the attention needed from Helios.
*HOW* could basic functionality like this ever been overlooked !?
Then I open up and see
the person fumbling here is me
a different way to be
User avatar
talleyrand
Posts: 625
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post by talleyrand »

While the start of line macro would work for some languages, it's not applicable to all languages. HTML would have to wrap the begining and end of each line. Modula 2, Objective Caml, Oberon and quite a few languages also would require wrapping each line with (* your comments *). My Fortran (77) is terribly rusty but IIRC, comments were based on column position (6?) so the commenting macro would have to be more intelligent than a simple replace. Column 6 doesn't feel right though, maybe it was 1 and continuation was 6... Damnit, now I have to go dig up a Fortrash book.

At any rate, for the languages I primarily work with, I have my own macros to handle commenting and it's not so complex. A unified commenter based on the syntax rule would be great. And while having you sever your left foot would an interesting feat for this board, I'd rather see Helios focus attention on places where enterprising users/abusers of their editor can't get to (see Jeffy's list).

$.02
Now where did my Fortran stuff go...
I choose to fight with a sack of angry cats.
User avatar
gracefool
Posts: 76
Joined: Thu Jan 29, 2004 7:21 am
Location: Wellington, New Zealand
Contact:

Nice but low priority

Post by gracefool »

talleyrand wrote:At any rate, for the languages I primarily work with, I have my own macros to handle commenting and it's not so complex. A unified commenter based on the syntax rule would be great. And while having you sever your left foot would an interesting feat for this board, I'd rather see Helios focus attention on places where enterprising users/abusers of their editor can't get to (see Jeffy's list).
+1
RoySubs
Posts: 10
Joined: Fri Apr 02, 2004 4:51 pm

Post by RoySubs »

+1 to what ?

- "A unified commenter based on the syntax rule would be great"

or

- "I'd rather see Helios focus attention on places where enterprising users/abusers of their editor can't get to (see Jeffy's list)."

or

- both ...

I should say here, that I completely agree on the above poster. Also, everyone writing different macros is great ... but ... consider this : vb comments have not changed *ever*, c/c++/js comments have not changed *ever*, CMD comments have not changed *ever*, i.e. these are STANDARDs. to further express this FACT, let's consider colour highlighting. this is NOT a standard. if i choose to make my keywords blue but someone else chooses green, these are NOT standard, this is a useful but irrelevant part of programming. but that IS built into the definitions of an extension. NOW, consider this (!!!) : how do you run a macro ? you have to define a comment AND an uncomment shortcut for each !?!?!?

ok, above is some of the reasoning for this. for people that don't program, I'm sure that they don't get it, but to express it in other terms, this is as fundamental to programming as cut/copy/paste is to word processing. it's just a core component of programming. VB/C/CMD/ etc etc etc comments will NEVER change ... so consider, as in the editor SciTE say a SINGLE comment/uncomment toggle is defined, which is CTRL+Q in that editor. ok, now, for each language, the SAME toggle macro is used !!! this is impossible for TextPad with macros and multiple shortcut keys. so, we would have the INCREDIBLE situaiton that I could edit vbscript AND cmd AND js AND ANY OTHER language, but instead of needing to remember X * 2 macro shortcut keys (X languages, 2 shortcuts, one for comment and one for uncomment!!!), I would only need ***1*** toggle switch for a *FUNDAMENTAL PROGRAMMING EDIT OPERATION*. whatever language i'm in, I select a block of text and hit CTRL+Q, and it comments, OR (!), it uncomments if the text is currently commented.

Notes :
- this has no effect on TextPad speed (to refer to Jeffy's great list). impossible to affect speed, that is just a simple fact.
- this is a GENERIC functioanlity that is used in *ALL* programming languages. if you use a single language and define 2 macros then that's fine, mostly I use 1 or 2 languages, but sometimes I need more, and part of the strength of TextPad (I thought)
- again (but I really do think this has been missed, so I want to stress this) comment/uncomment is totally/unequivocably/irrefutably a STANDARD for each given language. Can someone please name me a language that redefines it's commenting every few months ?? It's a standard function so if it's in there with the extension definition that means it has GENERIC usefullness forever along with colour highlighting.

come on , a different macro for every language (sorry !!! of course, I meant *2* different macros for every language, one for comment, and another for uncomment) and having to carry all these macros around ...

Look, I LOVE macros, it's great that TextPad is configurable in this way, and it's great that we can write macros to do this job, but, tell me, is comment/uncomment block commenting NOT a fundamenatal component of working with ANY programming language ??? If a list was to be made of fundamental components, you know that block comment/uncommenting would be in there ... and (I don't know if I already mentioned this !!!) it's a STANDARD for every language !!! vbscript comments will never change from the ' character, CMD will never change from REM / :: etc etc etc. It's a totally fundamental component. Yes, Jefy's list is great, but for this one I think another category should be added to the Jeffy list of block commenting / uncommenting falls under the category :

- would you like an add-on that is completely fundamental to all programming languages and would be very simple to implement in the core application (but complex - in general - to implement for multiple languages - since each languages 2 macros are quite simple, but for X languages you will need X * 2 macros) and completely unaffecting the speed of TextPad operation ? Also for each language you would require different shortcut keys for a function that in programming, is as fundamental as cut/copy/paste is in word processing.

hmm, maybe a bit of a mouthful that category, but I think it has to be to properly express the points about what comment/uncommenting is to programming.

+1 on the previous posters comment though
User avatar
BenjiSmith
Posts: 49
Joined: Fri Jan 16, 2004 9:37 pm
Contact:

Post by BenjiSmith »

RoySubs wrote:instead of needing to remember X * 2 macro shortcut keys (X languages, 2 shortcuts, one for comment and one for uncomment!!!), I would only need ***1*** toggle switch for a *FUNDAMENTAL PROGRAMMING EDIT OPERATION*.
I would probably prefer to have two toggle switches. (not two PER LANGUAGE, mind you, just two total), so that I can choose whether to use a multi-line comment or a bunch of single-line comments for the selected block of text. (For languages with no multi-line comment syntax, the single-line syntax would be used for both toggles. And vice versa.)
Post Reply