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 object member function to rename unsaved tab #147
Notepad++ version 7.6.4 (I think) brought the capability to rename an unsaved tab.
For example, a tab with the title "new 2" can be right-clicked upon, "Rename" chosen from the resulting popup menu, and the following box presents:
Entering a value changes the current tab's title to the specified name.
WHAT I'D LIKE: A way to do this programmatically, say with a notepad.rename('My new name') function call.
Perhaps there are dependency problems with supporting this; for instance, does the Notepad++ plugin interface currently permit plugins to rename an unsaved tab?
There also might be logistical problems in uniquely identifying tabs with the same name (yes, Notepad++'s implementation currently allows this) for purposes of, say notepad.getFiles() calls. But, I suppose this is a Notepad++ "problem" (don't allow it), or a user "problem" (don't name two tabs with the same name).
So currently just the MENUCOMMAND.FILE_RENAME would be an option.
My comment to that:
That doesn't fulfill the goal. What that does is pop-up a box and waits for the script user to "fill in the blank", and that's for a file that is going to be actually on disk.
What is wanted is a way to rename an unsaved tab, e.g. new 5, to something else (but still an unsaved tab, not on disk), without any user involvement.
Should pythonscript really rely on internal npp messages?
No, I was just documenting it as a possible means. Since that time, the author of N++ has decided that the internal message itself should be removed, as it is unused (internally).
Are they not called internal because they should not be used by plugins?
Oddly enough, the internal message in question seems to have been create for a plugin's usage.
#define NPPM_SETUNTITLEDNAME (NPPMSG + 115)
// int NPPM_SETUNTITLEDNAME(BufferID id, const wchar_t* newName)
// Rename the tab name for an untitled tab.
// wParam[in]: id - BufferID of the tab. -1 for currently active tab
// lParam[in]: newName - the desired new name of the tab
// Return TRUE upon success; FALSE upon failure
Activity
chcg commentedon Jul 16, 2020
Seems no interface is available for renaming in https://npp-user-manual.org/docs/plugin-communication/#notepad-messages.
Checkin was notepad-plus-plus/notepad-plus-plus@3546268.
So currently just the MENUCOMMAND.FILE_RENAME would be an option.
sasumner commentedon Sep 28, 2020
Request for support in Notepad++ made here: notepad-plus-plus/notepad-plus-plus#8916
alankilborn commentedon Dec 29, 2021
It looks like the "N++ extension needed" part isn't going to be fulfilled (see notepad-plus-plus/notepad-plus-plus#8916 (comment)) so I suppose it is appropriate to close this issue. :-(
alankilborn commentedon Jan 28, 2023
OP said:
@chcg replied:
My comment to that:
That doesn't fulfill the goal. What that does is pop-up a box and waits for the script user to "fill in the blank", and that's for a file that is going to be actually on disk.
What is wanted is a way to rename an unsaved tab, e.g.
new 5, to something else (but still an unsaved tab, not on disk), without any user involvement.alankilborn commentedon May 22, 2024
@chcg
This could be achieved using:
SendMessage(NPPM_INTERNAL_SETFILENAME, intptr_t bufferId, const char * newName);Reopen?
Ekopalypse commentedon May 24, 2024
Should pythonscript really rely on internal npp messages?
Are they not called internal because they should not be used by plugins?
alankilborn commentedon May 24, 2024
No, I was just documenting it as a possible means. Since that time, the author of N++ has decided that the internal message itself should be removed, as it is unused (internally).
Oddly enough, the internal message in question seems to have been create for a plugin's usage.
Ekopalypse commentedon May 24, 2024
Oh, I see, I was late for the party :-)
chcg commentedon Oct 8, 2024
Impl of
needed for this.