#1394 Applying language to buffer can alter indent size

SciTE (627)
David Misc

The indent.auto part of the SciTEDoc.html page states that "The properties file settings apply to newly opened files but remain constant once the file is open unless changed using the Change Indentation Settings dialog." Unfortunately, some settings may not remain constant if a language is applied to the buffer after the file is open.

When you use the Language menu to apply a language to a buffer containing an already opened file, the indent size will get changed to the tab size if the indent.auto property was set, and the use.tabs & indent.size properties were not set.

This can result in an indent size that is different than the originally determined indent size, if the tab size is different than the original indent size. This will occur even if no changes have been made to the buffer contents since the file was opened.

SciTE does not appear to check the indent.auto property or call DiscoverIndentSettings() when a language is applied to a buffer. Instead it calls SetIndentSettings(), which in this case causes the indent size to be changed to the tab size because the indent.size property is not set.


  • Neil Hodgson

    Neil Hodgson - 2012-08-07

    The explanation in indent.auto was to explain that changing the tabsize (or related setting) in the properties file is not supposed to update loaded files, instead changing the default for future loads.

    Applying a language is a major explicit decision so should be similar in effects to opening a file. For example, if a file without extension is opened and tabs set to defaults, then applying Python should apply Python's tab settings.

  • Neil Hodgson

    Neil Hodgson - 2012-08-07
    • assigned_to: nobody --> nyamatongwe
    • status: open --> open-accepted

Log in to post a comment.