Author Topic: 'comment/uncomment' problem with '@REM '  (Read 7561 times)

hs2

  • Senior Community Member
  • Posts: 2747
  • Hero Points: 288
'comment/uncomment' problem with '@REM '
« on: August 03, 2007, 01:58:21 pm »
@Sandra: Here is another little challenge ;)
I want to use '@REM ' (exactly like that) as line comment for cmd/bat files.
Problem: The comment (line) setup unintentionally converts it into '@rem ', comment works but 'uncomment' can't handle it.

HS2

Steve Black

  • Community Member
  • Posts: 57
  • Hero Points: 4
Re: 'comment/uncomment' problem with '@REM '
« Reply #1 on: August 03, 2007, 02:49:21 pm »
This is somewhat related to Batch mode comment issues I've reported in http://community.slickedit.com/index.php?topic=1358.0

You can work around it by changing the File Extension comment-line setup to include a space after the comment delimiter.  Comment-line/Uncomment-line will then work.  The space after 'REM' is actually a syntactical requirement, since 'REM' is not a 'real' comment delimiter, but a command.  (I'm refering to DOS/Win/4NT command shell syntax - you could of course be using something else with different rules.)

hs2

  • Senior Community Member
  • Posts: 2747
  • Hero Points: 288
Re: 'comment/uncomment' problem with '@REM '
« Reply #2 on: August 03, 2007, 02:59:44 pm »
Thanks Steve, but there is already a SPACE after @REM and I'm also referring to DOS/Win/4NT command shell syntax.
As I said 'comment' (line) is working except it lowcases '@REM ' to '@rem ' but uncomment (line) fails.
Do I miss sth. else ?

HS2

Sandra

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 754
  • Hero Points: 36
Re: 'comment/uncomment' problem with '@REM '
« Reply #3 on: August 03, 2007, 03:03:44 pm »
What sort of uncomment behavior are you seeing?  Does it throw an error and leave the text, or does the text get moved?  For me, it will uncomment, but if you have a line that has to be shifted to allow space for the comment, the text will end up all the way in column 1 when you uncomment.  Is that what you're seeing (comment mode = at left margin).  Lines which have wide indent margins don't seem to be affected on a single line comment/uncomment.

As far as the lowercase issue, that's happening in setting/restoring the settings.  I'd like to fix that, but I need to poke at it a little more to make sure my fix doesn't break something else.

Steve Black

  • Community Member
  • Posts: 57
  • Hero Points: 4
Re: 'comment/uncomment' problem with '@REM '
« Reply #4 on: August 03, 2007, 03:08:50 pm »
Sorry, I missed the lowercase part.  Gotta read slower and think longer.

Also need to test more: the workaround doesn't work around anyway.  With ':: ' as comment delim, comment-line inserts '::' with no trailing space on an empty line.  And of course, Tools->File Options->Save: Strip trailing spaces option would render it moot anyway.

So just "Ignore that man behind the curtain!"  :-[

hs2

  • Senior Community Member
  • Posts: 2747
  • Hero Points: 288
Re: 'comment/uncomment' problem with '@REM '
« Reply #5 on: August 03, 2007, 03:24:50 pm »
Thanks everybody incl. Lee !
I've fixed my color coding setup (I've added the same '@REM ' delimiter also there and now comment and uncomment are working. (@Sandra: uncomment result was the 'Unrecognized ...'  msg box)
So the only remaining issue is the lowcase.

HS2

hs2

  • Senior Community Member
  • Posts: 2747
  • Hero Points: 288
Re: 'comment/uncomment' problem with '@REM '
« Reply #6 on: August 03, 2007, 04:41:20 pm »
@Sandra: Maybe it's a good thing if the line/box comments are verified that they are covered by the assoc. colorizer setup.
Due to the fact that both things are working closely together but the setup is done at different places a non-matching setup for both leads to the effect I stumbled in and the reason is non-obvious. (I used '@REM ' as line comment but the colorizer line comment was still 'REM' I've done long time ago.)

HS2

Sandra

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 754
  • Hero Points: 36
Re: 'comment/uncomment' problem with '@REM '
« Reply #7 on: August 03, 2007, 08:57:49 pm »
Okay!  I think I have the uppercase to lowercase issue ironed out.  Refresh your hotfix and you should be good to go.  I went ahead and made the change for the box comment characters, too.  Use CAPS to your heart's content.

www.slickedit.com/hotfix -->SlickEdit 2007 (v12x)

As far as checking to make sure the commenting strategy is valid, I think this is a great idea.  I'll file an enhancement ticket for it.  Perhaps if you enter a comment string that is unknown to the lexer, it'll offer to add it for you.  It won't go in 12.0.3, but perhaps in some distant, shining version.

Thanks!

hs2

  • Senior Community Member
  • Posts: 2747
  • Hero Points: 288
Re: 'comment/uncomment' problem with '@REM '
« Reply #8 on: August 03, 2007, 09:14:02 pm »
Thanks a lot Sandra !
That's cool - I also had the idea of auto-adding a line comment to the lexer failing the verification but I've omitted it to mention.
I thought that's too much to ask for and it might be too smart :) But your solution sounds great !

HS2

Edit: Works like a charm !
« Last Edit: August 03, 2007, 09:47:43 pm by hs2 »