Author Topic: B4 - toggle-comment indent problem in Lua  (Read 4448 times)

PiezonTM

  • Senior Community Member
  • Posts: 140
  • Hero Points: 8
B4 - toggle-comment indent problem in Lua
« on: May 29, 2013, 01:23:52 PM »
If I use the "toggle-comment" in Lua to uncomment an "elseif" (see example below) the two lines unindent by the two characters.  Also on the commenting process using "toggle-comment" in Lua it indents the two spaces.  This is a bit annoying when commenting out section of nested if/else statements (for example) unless you don't mind strange indentation even among comments--which in some cases during debugging is not a problem.

Also, since I write a bunch of C/C++ code as well this is a bit annoying since commenting code in C using toggle-comment does not alter the code formatting (starting column location) for any operation.  Is this difference expected or should these languages operate the same in the with respect to the toggle-comment.

Code: [Select]
        if cmd == 'q' then
            doExit = true
        elseif cmd == 'a' then
            menuListAdapters()
--      elseif cmd == 'b' then
--          menuToggleBlockingMode()
        elseif cmd == 'd' then
            menuListDevices()
        end

Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1299
  • Hero Points: 130
Re: B4 - toggle-comment indent problem in Lua
« Reply #1 on: May 29, 2013, 01:59:52 PM »
It is not supposed to do that.  And I am not able to reproduce that in B4 or any other build from a clean configuration.  You could try running from clean config to test (on the command-line vs -sc C:\tempconfigpath).  What emulation are you running? 

PiezonTM

  • Senior Community Member
  • Posts: 140
  • Hero Points: 8
Re: B4 - toggle-comment indent problem in Lua
« Reply #2 on: May 29, 2013, 02:37:44 PM »
I am running the CUA emulation.  Also I used your suggestion and was also not able to reproduce the problem. 

I also exported ALL options from my original setup/config and imported them into a clean setup that worked and the problem was not reproduced as well.

Strangely enough when I opened my original setup/config I tried to reproduce the problem again and it no longer happens!  This is odd because it was 100% reproducible.  If it reoccurs I'll post again.

Thanks for the time and help.  I'll try to remember the option for a clean config in the future.

rfindley

  • Junior Community Member
  • Posts: 2
  • Hero Points: 1
Re: B4 - toggle-comment indent problem in Lua
« Reply #3 on: May 31, 2013, 06:32:09 AM »
PiezonTM, it's not just you.  I'm seeing this same problem on C/C++ on Beta6.

PiezonTM

  • Senior Community Member
  • Posts: 140
  • Hero Points: 8
Re: B4/B6 - toggle-comment indent problem in Lua
« Reply #4 on: May 31, 2013, 11:18:58 AM »
I have updated to B6 and the problem has come back.  I did some more testing in case it is of some use.

1. I created a clean config and tried to reproduce the problem, I could not.  I then went back to my original config and the problem STILL existed--unlike my previous B4 results.

2. Within my original config I created a new Lua file and the problem did NOT reproduce.

3. Going back to the original file (original config) I STILL have the problem.

Bottom line it seems that it might be related to editing an existing buffer/file.  I have not been able to find a workaround yet.

I have also found a slight variation to my problem.  If I comment both lines below, then just toggle-comment on an highlighted (or not) line I get indenting problems.  I also tested this problem on an existing buffer within a C file and it is a problem.  Not 100% reproducible in my C file, but around 75%.

Lua example:
Start with:
Code: [Select]
--  if something == true then
--      do_it = true   --<<<<< cursor on this line

After just running toggle-comment without highlighting a line I get:
(seems to also be a problem if highlighted)
Code: [Select]
--  if something == true then
do_it = true

NOTE: Sample problem in C, but not as reproducible
NOTE: Not just an "if" statement specific problem.