Author Topic: Bug in comment-erase 12.0.3  (Read 2985 times)

Ivan N. Zlatev

  • Community Member
  • Posts: 87
  • Hero Points: 5
Bug in comment-erase 12.0.3
« on: September 03, 2007, 09:58:12 am »
There is a bug in comment-erase on 12.0.3 which will result improperly indented code (at least with C#). The cause seems to be the // before the method as follows:

The code:
Code: [Select]
namespace Testing
{

public void Test ()
{
}
}

comment:

Code: [Select]
namespace Testing
{
//
//  public void Test ()
//  {
//  }
}

comment-erase:
Code: [Select]
namespace Testing
{

  public void Test ()
  {
  }
}

Sandra

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 754
  • Hero Points: 35
Re: Bug in comment-erase 12.0.3
« Reply #1 on: September 04, 2007, 03:27:07 pm »
Hey, great catch!  You're right about the problem being concerned with the first line.  Here's how to fix it.

In box.e, line 2350 should be changed from
Code: [Select]
   int leftmostcol = pos('[~ \t]|$', _expand_tabsc(), start, p_rawpos'er');to
Code: [Select]
   int leftmostcol = pos('[~ \t]', _expand_tabsc(), start, p_rawpos'er');Then, line 2361 should be changed from
Code: [Select]
      int col = pos('[~ \t]|$', _expand_tabsc(), start, p_rawpos'er');to
Code: [Select]
      int col = pos('[~ \t]', _expand_tabsc(), start, p_rawpos'er');

I hope those line numbers are right.  If not, you can find the original lines by looking in the function _leftmost_col_in_selection_after_start.  From your command line, type "fp _leftmost_col_in_selection_after_start" and it should take you straight to that function in box.e.  Let me know if that fix causes any problems for you.

Edit:  Had the last set of before/after code lines switched - fixed now.
« Last Edit: September 04, 2007, 04:41:14 pm by Sandra »

hs2

  • Senior Community Member
  • Posts: 2727
  • Hero Points: 281
Re: Bug in comment-erase 12.0.3
« Reply #2 on: September 04, 2007, 03:51:58 pm »
@Sandra: Your fix seems ok - thanks !
I also applied it b/c box.e is one of my favorite modules now getting 1st class maintenance :)
BTW: The second line doesn't need to be changed in v12.03.
HS2

Sandra

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 754
  • Hero Points: 35
Re: Bug in comment-erase 12.0.3
« Reply #3 on: September 04, 2007, 04:40:17 pm »
I think you still need the second line change, though not for the original bug reported in this thread.  If you take the original example and stick a blank line in the middle instead of at the beginning, you'll get similar results after comment-erase.

Original
Code: [Select]
namespace Testing
{
    public void Test ()
    {

    }
}

After comment
Code: [Select]
namespace Testing
{
//  public void Test ()
//  {
//
//  }
}

After comment-erase
Code: [Select]
namespace Testing
{
  public void Test ()
  {

  }
}

hs2

  • Senior Community Member
  • Posts: 2727
  • Hero Points: 281
Re: Bug in comment-erase 12.0.3
« Reply #4 on: September 04, 2007, 05:04:33 pm »
Ok - you fixed your posting so the 'new' 2nd line is really differs ;) HS2
Edit: Hey - that's my 1111. posting - I think I should stop spamming here  ;D
« Last Edit: September 04, 2007, 05:06:19 pm by hs2 »