Menu

#2419 Read properties changed behaviour with if statement

Bug
closed-fixed
nobody
5
2023-12-25
2023-11-30
No

Platform: Windows 7

An if condition before SciTE v5.3.9 ended at a non-indented statement.

Seems patch [40044f] changed the behaviour which I used as reference of where to cout what properties was being read. The if condition can now end at an empty line as I discovered. There was no need AFAIK to change the behaviour, so I view it as an unintentional bug with code improvements.

This used to be ok, now is not ok. The style property is read and set although is not wanted.

theme.dark=0

if theme.dark

    style.*.32=fore:#000000,back:#FFC0C0,$(font.base)

non_indented_statement=0

If the 4th line has a space or tab which is an indented line, then it is ok. The style property will not be read and set.

SciTE v5.3.9 doc excerpt (included header) states:

Importing properties files and conditional logic

When a non-indented statement is found the if clause is finished.

If the new behaviour is to remain, then suggest that the word statement be replaced with line or something better if perferred. If the behaviour is to be changed back, that would be appreciated!

At the moment, this theme file has empty lines which now has issues. Setting theme.dark=0 keeps the dark style settings when light style settings is wanted. I'll have to make changes to the linked theme file if the new behaviour is to remain.

Related

Commit: [40044f]

Discussion

  • Neil Hodgson

    Neil Hodgson - 2023-12-01

    The original GetFullLine discarded initial empty lines but the new version returns them. It seems more extensible to me to return the empty lines then treat them as having no effect in the later ReadLine method.

    --- a/src/PropSetFile.cxx   Tue Nov 28 08:23:12 2023 +1100
    +++ b/src/PropSetFile.cxx   Fri Dec 01 18:04:01 2023 +1100
    @@ -368,6 +368,9 @@
    
     PropSetFile::ReadLineState PropSetFile::ReadLine(const std::string &lineBuffer, ReadLineState rls, const FilePath &directoryForImports,
            const ImportFilter &filter, FilePathSet *imports, size_t depth) {
    
    +   if (lineBuffer.empty()) {
    +       return rls;
    +   }
        if ((rls == ReadLineState::conditionFalse) && (!IsSpaceOrTab(lineBuffer[0])))    // If clause ends with first non-indented line
            rls = ReadLineState::active;
        if (StartsWith(lineBuffer, "module ")) {
    
     
    • Michael Heath

      Michael Heath - 2023-12-01

      I have the cout after } else if (!IsCommentLine(lineBuffer)) { line at bottom of that ReadLine method. I'm using import.include=f4 to reduce properties being imported by recompiled Sc1. The last patch applied prints 4413 lines while unpatched prints 6356 lines so the patch saves going to the end of the method 1943 times, so that is an efficient improvement by returning early with empty lines instead of checking if startswith module, if, match, import and then calling IsCommentLine and the behaviour has changed back to allow empty lines after the if statement.

      Updated local repos and recompiled for main working copy of Sc1 and is working good with current theme file once again that includes empty lines and so has old behaviour back.

      If your patch interests you as a fix, then that makes both of us. Thankyou Neil for looking into this. :)

       
  • Neil Hodgson

    Neil Hodgson - 2023-12-02
    • labels: scite --> scite, properties
    • status: open --> open-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2023-12-02

    Committed fix as [08f048].

     

    Related

    Commit: [08f048]

  • Neil Hodgson

    Neil Hodgson - 2023-12-25
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB