You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
notepad.activateFile() doesn't work (sometimes) on "new _" files #105
It is observed that notepad.activateFile() sometimes seems to ignore the request when its argument is an unsaved file, e.g. "new 1", "new 2", etc.
This video (https://imgur.com/CfNdDnP) shows that I have 4 such files open, 1,3,4 and 5, but that "new 1" can't be switched to using notepad.activateFile('new 1'). The video shows that 'new 4' and 'new 5' can be switched to. No problem for 'new 3' either (but that is not in the video).
When I am in a state where notepad.activateFile is not working to switch to new 1 in Python Script, if I switch to NppExec console and use npp_sendmsg NPPM_SWITCHTOFILE 0 "new 1", it switches just fine. So it appears that activateFile isn't always sending the right NPPM_SWITCHTOFILE message , because the message itself is working fine
Over a year of inactivity.
Time to present the obvious workaround, I guess:
defnotepad_activateFile(f):
# note: we can't simply use notepad.activateFile() because of this PS bug: https://github.com/bruderstein/PythonScript/issues/105for (pathname, buffer_id, index, view) innotepad.getFiles():
ifpathname==f:
notepad.activateIndex(view, index)
break
Issue that for PS 3.x it is not working was introduced with
Revision: f27212c104a2a1202f397c2e026abd299152b4d0
Author: Christian Grasser <christian.grasser@live.de>
Date: 28.10.2022 23:21:40
Message:
- correct issues with long filenames as just partially fixed by N++ with https://github.com/notepad-plus-plus/notepad-plus-plus/issues/11106
- added assert checks to testcases for the new methods with bool return values
- removed not implemented declaration
----
Modified: PythonScript/python_tests/tests/NotepadWrapperTestCase.py
Modified: PythonScript/src/NotepadPlusWrapper.cpp
Modified: PythonScript/src/NotepadPlusWrapper.h
because handleFileNameToLongPath() is not working for unsaved files, see
Activity
sasumner commentedon Jan 11, 2019
@chcg Any interest in looking at this one?
alankilborn commentedon Jul 1, 2023
I just encountered this bug while creating a script for this inquiry:
https://community.notepad-plus-plus.org/topic/24647/how-to-save-1000-fills-at-once
When using PS 2.0,
notepad.activateFile('new 1')would not work, but when used withnew 2,new 3, etc. it would work.When trying with PS 3.0.16,
notepad.activateFile()on ANY "new X" file did NOT work.pryrt commentedon Jul 1, 2023
When I am in a state where
notepad.activateFileis not working to switch tonew 1in Python Script, if I switch to NppExec console and usenpp_sendmsg NPPM_SWITCHTOFILE 0 "new 1", it switches just fine. So it appears that activateFile isn't always sending the right NPPM_SWITCHTOFILE message , because the message itself is working finealankilborn commentedon Aug 2, 2024
Over a year of inactivity.
Time to present the obvious workaround, I guess:
chcg commentedon Oct 3, 2024
Issue that for PS 3.x it is not working was introduced with
because handleFileNameToLongPath() is not working for unsaved files, see
PythonScript/PythonScript/src/NotepadPlusWrapper.cpp
Line 444 in 4b3a04f
Addresses issue bruderstein#105 to ensure file activation works relia…
Addresses issue bruderstein#105 to ensure file activation works relia…
Addresses issue #105 to ensure file activation works reliably, even w…