Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Console window state not restored on startup if console.show() is used #340

Open
alankilborn opened this issue Jun 14, 2024 · 2 comments · May be fixed by #372
Open

Console window state not restored on startup if console.show() is used #340

alankilborn opened this issue Jun 14, 2024 · 2 comments · May be fixed by #372
Labels

Comments

@alankilborn
Copy link

alankilborn commented Jun 14, 2024

#312 introduced persistence of the console window. I think that code has problems.


Try this user startup.py:

try:
    
    startup_already_ran
    print('NOT running startup things a second time')

except:

    startup_already_ran = True
    print('running startup things...')

    console.show()

(note that the try/except wrapper is because of this other bug: #339 )

Exit Notepad++ with the console window showing and restart. At restart the console window will NOT be shown. Removing the console.show() line in the script results in correct persistence behavior of the console window.


Notepad++ Debug Info:

Notepad++ v8.6.8   (64-bit)
Build time : Jun  4 2024 - 00:30:00
Path : C:\NotepadPlusPlus\Misc\_NoBackup\Releases\npp.8.6.8\npp.8.6.8.portable.x64\notepad++.exe
Command Line : -titleAdd="8.6.8 64-bit" -multiInst
Admin mode : OFF
Local Conf mode : ON
Cloud Config : OFF
Periodic Backup : ON
OS Name : Windows 11 Pro (64-bit)
OS Version : 23H2
OS Build : 22631.3737
Current ANSI codepage : 1252
Plugins : 
    mimeTools (3.1)
    NppConverter (4.6)
    NppExport (0.4)
    PythonScript (3.0.18)
@chcg chcg added the Bug label Oct 8, 2024
@chcg
Copy link
Collaborator

chcg commented Oct 8, 2024

Seems at startup console.show() behaves more like toggling. Needs to be further checked why.

@Ekopalypse
Copy link
Contributor

Ekopalypse commented Jan 3, 2025

This is just to document what I think is happening:

  • Npp calls toogleConsole via the menu item
  • PS starts to initialize
  • startup.py is called
  • console.show() is executed
  • The creation of the console begins
  • PS sends PYSCR_SHOWCONSOLE to itself
  • which triggers a g_console->showDialog().
  • which in turn triggers a mp_consoleDlg->doDialog(),
  • followed by a display(true)
  • which then triggers a SendMessage(_hParent, toShow ? NPPM_DMMSHOW : NPPM_DMMHIDE, 0, reinterpret_cast<LPARAM>(_hSelf));
    which means that Npp calls toogleConsole via the menu item.

@Ekopalypse Ekopalypse linked a pull request Jan 6, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants