Menu

#100 Inactive preprocessor code greyed out when pasting even if option turned off

Next_Release
fixed
None
Bug_Report
2018-01-20
2014-11-20
Riot
No

The editor option "Interpret #if, #else, #endif to grey out inactive preprocessor-code" is on by default, but if it is disabled, that disabling is ignored when pasting code from one file to another.

In other words, even if I have the option disabled, when I paste a block of code from file a.cpp to file b.cpp, the inactive code becomes greyed out where it's pasted. Closing and reopening the file returns it to normal.

Discussion

  • Morten MacFly

    Morten MacFly - 2015-02-07
    • Type: --> Undefined
     
  • Alpha

    Alpha - 2015-02-07
    • Type: Undefined --> Bug_Report
     
  • bluehazzard

    bluehazzard - 2017-12-11

    Is this still a valid bug? I can not reproduce this. Can someone give some exact steps?

     
  • Riot

    Riot - 2017-12-12

    I have just tested this further, and the issue seems to be nothing to do with pasting, but actually is when a new file is created in a particular way.

    Steps to reproduce:
    1. Create a new header file, test.h.
    2. Click Edit -> Swap header & source (or F11 shortcut).
    3. The file test.cpp does not exist, so you'll be prompted whether you want to create it. Do so.
    4. Any inactive preprocessor code you enter into this new file will now be greyed out, regardless of your preference setting. It only happens for this new file, and only until you close and reopen it.

    Tested on SVN11217 on 64bit linux.

     
  • bluehazzard

    bluehazzard - 2017-12-13

    ok, i can reproduce and have found the culprit:
    in editormanager.cpp:482

    cbEditor* ed = new cbEditor(m_pNotebook, newFileName);
    

    the new editor is created with the default paramter for the theme, but if we look how a file is opened in editormanager.cpp:390

    ed = new cbEditor(m_pNotebook, fileLdr, fname, m_Theme);
    

    we can see that a theme is passed to the function.

    If i add a theme to the new function in editormanager.cpp:482

    cbEditor* ed = new cbEditor(m_pNotebook, newFileName, m_Theme);
    

    this works as expected

    patch is attached

     
    • Riot

      Riot - 2017-12-13

      Nicely done.

       
  • Teodor Petrov

    Teodor Petrov - 2017-12-14
    • assigned_to: Teodor Petrov
     
  • Teodor Petrov

    Teodor Petrov - 2018-01-20
    • status: open --> fixed
     
  • Teodor Petrov

    Teodor Petrov - 2018-01-20

    Fix in trunk. Thanks for the contribution.

     

Log in to post a comment.