Sublime Forum

Bugs with auto-indent

#1

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:

/**
    * 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 Auto-indent and '#'), 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:

{

    }  // 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:
{
	"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

0 Likes