Author Topic: Two bugs: HTML files and commenting, and using "slick-enter" throws error  (Read 1869 times)

Brandon

  • Community Member
  • Posts: 36
  • Hero Points: 5
I reported this about a year ago and was hoping since we are in the beta stages with 22 it might get fixed.   

Basically, the "comment" command will destroy HTML code by misplacing the start/end of comment characters.   It's a little tricky to reproduce so I'll try to post the same instructions.

It has to do with tab settings and HTML formatter settings.

With a fresh config, go to Document/HTML options/Formatting, then Edit the profile and set Indent, Org tab size and tab size to 3.   Also check Indent with tabs.

Create a new html file with the following:

Code: [Select]
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div>
<table>
<tr>
<td></td>
</tr>
</table>
</div>
</body>
</html>

You can maybe try using the beautify command as I'm not sure how the forum post will copy over... hopefully then you will see the tr and td lines indented with two tabs at 3 spaces. Now issue the "comment" command on one or more of these lines.   I am seeing SE corrupt or destroy the beginning and/or end of the code on these lines when commenting.   I'll try posting the results of commenting all lines between the body tags here in a code block...

Code: [Select]
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<!--<div>-->
<!--<table>-->
<!-- <-->
<!-- <td></-->
<!-- </-->
<!--</table>-->
<!--</div>-->
</body>
</html>

I think in other experiments I used 4,3, and 2 space settings and they all corrupted the code too.

As you might imagine, this bug has caught me off guard many times where I've had to go back and repair the "uncommented" code.

Basically it just looks like SE is miscalculating the start/end of the code to insert the <!-- and --> sequences.

Since I work as a web app developer I really hope this one can get fixed...it's a really annoying one.

For the second bug, it's easy to reproduce (and still appears to be there):

  * Go to the last line of this HTML file and issue the command "slick-enter".  With the latest v22B2, I see the error "VSCFGP_BEAUTIFIER_FUNCALL_PARAM_ALIGN not valid".   Maybe this is not supposed to be a valid command for html files, but I tried with other file types and it doesn't happen.  Not a big priority; I think I had a macro file back then that triggered this problem so I just worked around it.   I am just mentioning it again.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4893
  • Hero Points: 398
Please post a file attachment. I tried beautify with the settings you specify and I get 2 tabs with only 2 spaces and the problem doesn't reproduce. I even tried manually adding the extra space and no luck.

Also, what are the beautifier settings when you run the "comment" command. I wasn't sure I needed to change them after creating the sample file.

Brandon

  • Community Member
  • Posts: 36
  • Hero Points: 5
OK let me reset my SE environment to find the right settings to make it happen and I'll post again.

Just to be clear, though, I am using real tabs (not spaces) - so when I said "hopefully you will see the tr and td indented with two tabs at 3 spaces, I actually meant two "real" tabs that were just set to 3 spaces wide.

Brandon

  • Community Member
  • Posts: 36
  • Hero Points: 5
So I just deleted my /config and started over with fresh, and was able to make it happen using the exact steps I described.

1) start with fresh config
2) In Tools/Options go to Languages/Web Authoring Languages/HTML/Formatting.
3) Edit the default profile
4) For indent, set the first three fields to 3, and check Indent with tabs.  Save settings/apply.

5) Now copy that code I posted to a new html file (which did seem to paste fine with tabs intact in my sample).

6) Put the cursor on the <tr> line, hit ESC and issue the "comment" command or use Document/Comment Lines.

The entire <tr> line is destroyed, and looks exactly as I posted before.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4893
  • Hero Points: 398
Reproduced. We will look into this.

Thanks for posting.

Brandon

  • Community Member
  • Posts: 36
  • Hero Points: 5
Thanks!  This one has been a real nuisance for a long time.

SlickEdit Support

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 290
  • Hero Points: 26
Fixed in the forthcoming Beta 3.

Best,
SlickEdit Support

Brandon

  • Community Member
  • Posts: 36
  • Hero Points: 5
Great, look forward to new B3 release.   

Were you able to see this one?  Not a high priority I guess but it does throw an error ....

Quote
Go to the last line of this HTML file and issue the command "slick-enter".  With the latest v22B2, I see the error "VSCFGP_BEAUTIFIER_FUNCALL_PARAM_ALIGN not valid".   Maybe this is not supposed to be a valid command for html files, but I tried with other file types and it doesn't happen.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1124
  • Hero Points: 105
Yeah, slick-enter doesn't expect to be used in a html file.  It's tailored for Slick-C mode, for editing slick-c files.  When it works for other languages, it's because they have the formatter setting it's complaining about.  HTML does not have a setting for function call parameter alignment.

Have you bound the Enter key to slick-enter for HTML mode, or are you calling slick-enter from a macro or script?

If you rebound the Enter key because you didn't like the behavior of the default html-enter for HTML mode, there are other commands you could bind that to that would be more appropriate.  Like 'split-insert-line' for the vanilla behavior you'd get in a text file.

Brandon

  • Community Member
  • Posts: 36
  • Hero Points: 5
I have some older macros that used slick-enter - I don't recall why I used slick-enter specifically but I'm sure they can be reworked to avoid the problem.

It's not a big deal.  I was just reporting it to you guys since a) it does throw an error popup and b) I didn't see it happen in other file modes.

Actually ... it seems intermittent as I have SE open right now with some html files, and it's not happening ...? <shrug>

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1124
  • Hero Points: 105
Yes, what's happening is that when you hit enter, it needs to decide what the indent of the next line is.  Since it's written for SlickC, it's going back through the buffer, looking for SlickC syntax:  is this a function call, a multi-line statement, inside of an array literal, etc... everything it needs to calculate the right indent for the next line.

Interpreting HTML as SlickC is not going to go so well, so it's pretty much a toss up what code path it's going to go down.

For macros, split-insert-line will probably do what you want, unless the macro is depending on language specific indent.