Home Download Buy Blog Forum Support

Bugs with auto-indent

Bugs with auto-indent

Postby mity on Sun Aug 26, 2012 9:35 am

In the C syntax highlight mode with auto-indent enabled, I have encountered two strange behaviors, which are bugs probably. I illustrate them below with short code snippets.

(Bug #1) Multi-line (more then 2 lines) C comment followed by preprocessor stuff make auto-indent be still controlled by preceding comment indent. See this code snippet:

Code: Select all
/**
    * The spaces before the asterisks are probably probably the triggers.
    * In my real source there is only space so the asterisk are in a column,
    * but it then breaks the example on this forum).
    */

#include "file1"     // Manually moved cursor to column 1 (ok, expected behaviour)
    #include "file2"    // Incorrect auto-indent does not respect the previous line


This has been already reported here (thread viewtopic.php?f=3&t=8922), but this example is much shorter.


(Bug #2) Bad braces handling when creating block with one or more empty lines. When relying on auto-indent, 1st brace leads to indent one tab to right (correct behavior). Pressing one more enter makes new line. However the ending brace after the empty line(s) then does not result to un-indent, so the result looks like this:

Code: Select all
{

    }  // the brace should be on column 1

(Without the empty line between the braces, the problem does not occur and the braces is correctly un-indented.)


My environment:
- Build: 2217 (64-bit)
- OS: Windows 7 (64-bit)
- user settings:
Code: Select all
{
   "color_scheme": "Packages/Color Scheme - Default/LAZY.tmTheme",
   "auto_complete": false,
   "auto_match_enabled": false,
   "trim_trailing_white_space_on_save": true,
   "translate_tabs_to_spaces": true,
   "smart_indent": false,
   "scroll_past_end": false,
   "drag_text": false,
   "rulers": [80, 120]
}


Hope these can be fixed, as both happen for me quite often due the way I work...

Regards,
Mity
mity
 
Posts: 4
Joined: Sat Aug 25, 2012 5:10 pm

Return to Technical Support

Who is online

Users browsing this forum: Google [Bot] and 20 guests