Sublime Forum

Unrelated nearby tab-only lines keep getting deleted

#1

I use tabs for indent. When editing, sometimes nearby lines with only tabs get converted to blank lines. This happens more often after pressing enter, but sometimes only after typing a character.

I have set “auto_indent = true” and “smart_indent = false”.

So far this has only happened inside a class definition with public and private parts (but in a .txt or .cpp file) - not sure if this is a coincidence.

Here is an example of what happens after I edit something (highlight it to see the empty lines). Previously there were no empty lines in the class.

class AFoo
    {
        public:
            virtual ~AFoo() =0;
        
        

        protected:
            AFoo(int zug);
            
        
        private:
            blah.

    };

And after pressing enter on “blah”, I get:

class AFoo
    {
        public:
            virtual ~AFoo() =0;
        
        

        protected:
            AFoo(int zug);

        
        private:
            blah.
            

    };

Pretty sure this is a bug. I do use trailing spaces plugin with this config:

{
    "trailing_spaces_regexp": "[ ]+",
    "trailing_spaces_highlight_color": "invalid.illegal",
    "trailing_spaces_include_current_line" : false,
    "trailing_spaces_include_empty_lines" : false,
}

The only other packages I use are Package Control, Highlight Whitespace and File Icons.

My user preferences are:

{
    "always_show_minimap_viewport": true,
    "auto_find_in_selection": true,
    "auto_indent": true,
    "auto_match_enabled": false,
    "color_scheme": "Packages/User/xaxazak.tmTheme",
    "detect_indentation": false,
    "drag_text": false,
    "draw_minimap_border": true,
    "draw_white_space": "none",
    "font_face": "Monospace",
    "font_size": 7,
    "hot_exit": false,
    "ignored_packages":
    [
        "Vintage"
    ],
    "shift_tab_unindent": true,
    "smart_indent": false,
    "tab_size": 2,
    "default_line_ending": "unix",
    "auto_complete_commit_on_tab": true,
    "auto_close_tags": false,
}
0 Likes

#2

maybe change this setting:

// Trims white space added by auto_indent when moving the caret off the
// line.
"trim_automatic_white_space": true,
2 Likes

#3

Thanks, that was the problem. Setting to false fixes it.

However, it wasn’t just changing lines when the caret moved off them - it was changing them many lines above and below. Not sure if that is intended behavior.

0 Likes