Menu

#2299 Scintilla instances remain inactive until app is deactivated and reactivated

Bug
closed-fixed
nobody
5
2021-12-06
2021-11-25
No

Scintilla 5 on Mac seems to make the assumption that it is the only thing the app will do and it will be instantiated before the app becomes active for the first time, so a new Scintilla instance is inactive by default and will not activate until it gets applicationDidBecomeActive. Scintilla 4 did not have this behaviour.

I guess this works just fine for SciTE, but I think this assumption doesn't hold for other applications and the default state should be active. Otherwise creating any text editor instance in a running and already-active application requires an explicit applicationDidBecomeActive sent to the scintilla nsview. Not doing so results in the Scintilla instance being stuck in the inactive state until you deactivate and reactivate the entire app.

Fix is to change line 419 of ScintillaCocoa.mm

isActive = true;    // was false

Discussion

  • Neil Hodgson

    Neil Hodgson - 2021-11-25

    Shouldn't it check if the application is active? Scintilla views could be created by an inactive application.

     
  • Rowan Daniell

    Rowan Daniell - 2021-11-25

    Yes, it should. That would be a pretty rare use case (to instantiate a new window in the background and not come to the front immediately) but somebody might have it.

    This worked for me in the active case, I don't have a test case for instantiating while inactive. The active property was new in NSApp in Yosemite

    isActive = [NSApp isActive]; // was false; requires 10.10 or later target
    
     
  • Neil Hodgson

    Neil Hodgson - 2021-11-27

    Committed change as [92b29d]. No guard clause as isActive was available much earlier than 10.10 with the first mention on StackExchange in 2009.

     

    Related

    Commit: [92b29d]

  • Neil Hodgson

    Neil Hodgson - 2021-11-29
    • status: open --> open-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2021-12-06
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.